[mapserver-commits] r12492 - in trunk/mapserver/mapcache: . include
src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:31:56 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:31:56 -0700 (Fri, 26 Aug 2011)
New Revision: 12492
Modified:
trunk/mapserver/mapcache/geocache.xml
trunk/mapserver/mapcache/include/geocache.h
trunk/mapserver/mapcache/src/http.c
Log:
Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:31:52 UTC (rev 12491)
+++ trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:31:56 UTC (rev 12492)
@@ -505,6 +505,9 @@
* PROXY
* AUTH
-->
+
+ <!-- timeout in seconds before bailing out from a request -->
+ <connection_timeout>30</connection_timeout>
</http>
</source>
<source name="osm" type="wms">
Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:31:52 UTC (rev 12491)
+++ trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:31:56 UTC (rev 12492)
@@ -290,6 +290,7 @@
struct geocache_http {
char *url; /**< the base url to request */
apr_table_t *headers; /**< additional headers to add to the http request, eg, Referer */
+ int connection_timeout;
/* TODO: authentication */
};
Modified: trunk/mapserver/mapcache/src/http.c
===================================================================
--- trunk/mapserver/mapcache/src/http.c 2011-08-26 11:31:52 UTC (rev 12491)
+++ trunk/mapserver/mapcache/src/http.c 2011-08-26 11:31:56 UTC (rev 12492)
@@ -84,7 +84,7 @@
curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, error_msg);
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
- curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
+ curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, req->connection_timeout);
curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
@@ -284,6 +284,19 @@
ctx->set_error(ctx,400,"got an <http> object with no <url>");
return NULL;
}
+
+ if ((http_node = ezxml_child(node,"connection_timeout")) != NULL) {
+ char *endptr;
+ req->connection_timeout = (int)strtol(http_node->txt,&endptr,10);
+ if(*endptr != 0 || req->connection_timeout<1) {
+ ctx->set_error(ctx,400,"invalid <http> <connection_limit> \"%s\" (positive integer expected)",
+ http_node->txt);
+ return NULL;
+ }
+ } else {
+ req->connection_timeout = 30;
+ }
+
req->headers = apr_table_make(ctx->pool,1);
if((http_node = ezxml_child(node,"headers")) != NULL) {
ezxml_t header_node;
More information about the mapserver-commits
mailing list