[mapserver-commits] r12602 - in trunk/mapserver/mapcache: . include
src
svn at osgeo.org
svn at osgeo.org
Thu Sep 29 11:29:10 EDT 2011
Author: tbonfort
Date: 2011-09-29 08:29:10 -0700 (Thu, 29 Sep 2011)
New Revision: 12602
Modified:
trunk/mapserver/mapcache/include/mapcache.h
trunk/mapserver/mapcache/mapcache.xml
trunk/mapserver/mapcache/src/service_wms.c
Log:
limit size of wms getmap requests to 2048 pixels by default (#4036)
Modified: trunk/mapserver/mapcache/include/mapcache.h
===================================================================
--- trunk/mapserver/mapcache/include/mapcache.h 2011-09-29 12:00:55 UTC (rev 12601)
+++ trunk/mapserver/mapcache/include/mapcache.h 2011-09-29 15:29:10 UTC (rev 12602)
@@ -639,6 +639,7 @@
*/
struct mapcache_service_wms {
mapcache_service service;
+ int maxsize;
apr_array_header_t *forwarding_rules;
mapcache_getmap_strategy getmap_strategy;
mapcache_resample_mode resample_mode;
Modified: trunk/mapserver/mapcache/mapcache.xml
===================================================================
--- trunk/mapserver/mapcache/mapcache.xml 2011-09-29 12:00:55 UTC (rev 12601)
+++ trunk/mapserver/mapcache/mapcache.xml 2011-09-29 15:29:10 UTC (rev 12602)
@@ -393,10 +393,11 @@
-->
<hitstats>false</hitstats>
</cache>
-
+ <!--
<cache name="mbtiles" type="mbtiles">
<dbname_template>/Users/tbonfort/Documents/MapBox/tiles/natural-earth-1.mbtiles</dbname_template>
</cache>
+ -->
<!-- format
@@ -712,12 +713,14 @@
<metatile>5 5</metatile>
<metabuffer>30</metabuffer>
</tileset>
+ <!--
<tileset name="natural-earth-1">
<source>osm</source>
<cache>mbtiles</cache>
<format>PNG</format>
<grid>g</grid>
</tileset>
+ -->
<tileset name="osm">
<metadata>
<title>osm mapserver served map of midi-pyrénées</title>
@@ -799,6 +802,7 @@
image format to use when assembling tiles
-->
<format>myjpeg</format>
+ <maxsize>4096</maxsize>
</service>
<service type="wmts" enabled="true"/>
Modified: trunk/mapserver/mapcache/src/service_wms.c
===================================================================
--- trunk/mapserver/mapcache/src/service_wms.c 2011-09-29 12:00:55 UTC (rev 12601)
+++ trunk/mapserver/mapcache/src/service_wms.c 2011-09-29 15:29:10 UTC (rev 12602)
@@ -401,6 +401,12 @@
}
}
+ if(width > wms_service->maxsize || height > wms_service->maxsize) {
+ errcode=400;
+ errmsg = "received wms request with width or height over configured maxsize limit";
+ goto proxies;
+ }
+
if(iswms130) {
srs = apr_table_get(params,"CRS");
if(!srs) {
@@ -879,6 +885,14 @@
return;
}
}
+
+ if ((rule_node = ezxml_child(node,"maxsize")) != NULL) {
+ wms->maxsize = atoi(rule_node->txt);
+ if(wms->maxsize <= 0) {
+ ctx->set_error(ctx,400, "failed to parse wms service maxsize value \"%s\"", rule_node->txt);
+ return;
+ }
+ }
}
mapcache_service* mapcache_service_wms_create(mapcache_context *ctx) {
@@ -888,6 +902,7 @@
return NULL;
}
service->forwarding_rules = apr_array_make(ctx->pool,0,sizeof(mapcache_forwarding_rule*));
+ service->maxsize=2048;
service->service.url_prefix = apr_pstrdup(ctx->pool,"");
service->service.name = apr_pstrdup(ctx->pool,"wms");
service->service.type = MAPCACHE_SERVICE_WMS;
More information about the mapserver-commits
mailing list