[mapserver-commits] r12278 - in trunk/mapserver/mapcache: . include
src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:13:19 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:13:19 -0700 (Fri, 26 Aug 2011)
New Revision: 12278
Modified:
trunk/mapserver/mapcache/geocache.xml
trunk/mapserver/mapcache/include/geocache.h
trunk/mapserver/mapcache/src/source_wms.c
Log:
initialize pathinfo
thomas.bonfort | 2011-01-21 10:43:27 +0100 (Fri, 21 Jan 2011)
Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:13:14 UTC (rev 12277)
+++ trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:13:19 UTC (rev 12278)
@@ -241,13 +241,46 @@
<FORMAT>image/png</FORMAT>
<LAYERS>basic</LAYERS>
</wmsparams>
+
+ <!-- http
+
+ custom http parameters that will be used when making WMS requests
+ -->
+ <http>
+
+ <!-- headers
+
+ http headers added to request. make sure you know what you are
+ doing when adding a header here, as they take precedence over any
+ default headers curl will be adding to the request.
+ typical headers that can be added here are User-Agent and Referer.
+
+ when adding a <key>value</key> element here, the request to the
+ wms source will contain the
+
+ key: value\r\n
+
+ HTTP header.
+ -->
+ <!--
+ <headers>
+ <User-Agent>mod-geocache/r175</User-Agent>
+ <Referer>http://www.mysite.com?param=2&par=4</Referer>
+ </headers>
+ -->
+
+ <!-- TODO other http parameters
+ * PROXY
+ * AUTH
+ -->
+ </http>
</source>
<source name="osm" type="wms">
<url>http://localhost/cgi-bin/mapserv?</url>
<wmsparams>
<FORMAT>image/png</FORMAT>
<LAYERS>default</LAYERS>
- <MAP>/Users/tbonfort/dev/mapserver-utils/osm-mapserver.map</MAP>
+ <MAP>/home/tbonfort/dev/mapserver-utils/osm-mapserver.map</MAP>
</wmsparams>
</source>
<source name="nexrad" type="wms">
Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:13:14 UTC (rev 12277)
+++ trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:13:19 UTC (rev 12278)
@@ -47,7 +47,7 @@
#define GEOCACHE_FILE_LOCKED 6
#define GEOCACHE_VERSION "0.3-dev"
-#define GEOCACHE_USERAGENT "geocache/"GEOCACHE_VERSION
+#define GEOCACHE_USERAGENT "mod-geocache/"GEOCACHE_VERSION
@@ -231,6 +231,7 @@
char *url; /**< the base WMS url */
apr_table_t *wms_default_params; /**< default WMS parameters (SERVICE,REQUEST,STYLES,VERSION) */
apr_table_t *wms_params; /**< WMS parameters specified in configuration */
+ apr_table_t *http_headers;
};
#ifdef USE_GDAL
Modified: trunk/mapserver/mapcache/src/source_wms.c
===================================================================
--- trunk/mapserver/mapcache/src/source_wms.c 2011-08-26 11:13:14 UTC (rev 12277)
+++ trunk/mapserver/mapcache/src/source_wms.c 2011-08-26 11:13:19 UTC (rev 12278)
@@ -44,7 +44,7 @@
}
tile->tile.data = geocache_buffer_create(30000,ctx->pool);
- geocache_http_request_url_with_params(ctx,wms->url,params,NULL,tile->tile.data);
+ geocache_http_request_url_with_params(ctx,wms->url,params,wms->http_headers,tile->tile.data);
GC_CHECK_ERROR(ctx);
if(!geocache_imageio_is_valid_format(ctx,tile->tile.data)) {
@@ -71,6 +71,16 @@
apr_table_set(src->wms_params, cur_node->name, cur_node->txt);
}
}
+ if ((cur_node = ezxml_child(node,"http")) != NULL) {
+ ezxml_t http_node;
+ if((http_node = ezxml_child(cur_node,"headers")) != NULL) {
+ ezxml_t header_node;
+ for(header_node = http_node->child; header_node; header_node = header_node->sibling) {
+ apr_table_set(src->http_headers, header_node->name, header_node->txt);
+ }
+ }
+ /* TODO: parse <proxy> and <auth> elements */
+ }
}
/**
@@ -101,6 +111,7 @@
source->source.configuration_parse = _geocache_source_wms_configuration_parse;
source->wms_default_params = apr_table_make(ctx->pool,4);;
source->wms_params = apr_table_make(ctx->pool,4);
+ source->http_headers = apr_table_make(ctx->pool,1);
apr_table_add(source->wms_default_params,"VERSION","1.1.1");
apr_table_add(source->wms_default_params,"REQUEST","GetMap");
apr_table_add(source->wms_default_params,"SERVICE","WMS");
More information about the mapserver-commits
mailing list