[Osaas-commits] r46 - in trunk: . server/osaas server/test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Nov 20 21:25:08 CET 2008


Author: bh
Date: 2008-11-20 21:25:08 +0100 (Thu, 20 Nov 2008)
New Revision: 46

Modified:
   trunk/ChangeLog
   trunk/server/osaas/formparser.py
   trunk/server/osaas/recordfilter.py
   trunk/server/test/test_osasserver.py
Log:
Cope with WMS clients that omit the SERVICE field of GetMap
requests

* server/osaas/formparser.py (request_fields): Make the SERVICE
field optional

* server/osaas/recordfilter.py (default_filter): Do not check the
SERVICE field.  Some WMS clients do not send it and REQUEST ==
"GetMap" is unique enough, as GetMap is only used in WMS.

* server/test/test_osasserver.py
(OSAASDBServerTests.test_post_without_service_field): New test for
the requests without SERVICE field.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-11-20 19:54:24 UTC (rev 45)
+++ trunk/ChangeLog	2008-11-20 20:25:08 UTC (rev 46)
@@ -1,5 +1,21 @@
 2008-11-20  Bernhard Herzog  <bh at intevation.de>
 
+	Cope with WMS clients that omit the SERVICE field of GetMap
+	requests
+
+	* server/osaas/formparser.py (request_fields): Make the SERVICE
+	field optional
+
+	* server/osaas/recordfilter.py (default_filter): Do not check the
+	SERVICE field.  Some WMS clients do not send it and REQUEST ==
+	"GetMap" is unique enough, as GetMap is only used in WMS.
+
+	* server/test/test_osasserver.py
+	(OSAASDBServerTests.test_post_without_service_field): New test for
+	the requests without SERVICE field.
+
+2008-11-20  Bernhard Herzog  <bh at intevation.de>
+
 	* server/osaas/formparser.py (Record.set_fields): Set missing
 	optional fields to None in the record.
 

Modified: trunk/server/osaas/formparser.py
===================================================================
--- trunk/server/osaas/formparser.py	2008-11-20 19:54:24 UTC (rev 45)
+++ trunk/server/osaas/formparser.py	2008-11-20 20:25:08 UTC (rev 46)
@@ -84,7 +84,7 @@
     Field("HEIGHT", required=True),
     Field("BBOX", required=True),
     Field("LAYERS", required=True),
-    Field("SERVICE", required=True),
+    Field("SERVICE"),
     Field("FORMAT"),
     Field("TRANSPARENT"),
     Field("EXCEPTIONS"),

Modified: trunk/server/osaas/recordfilter.py
===================================================================
--- trunk/server/osaas/recordfilter.py	2008-11-20 19:54:24 UTC (rev 45)
+++ trunk/server/osaas/recordfilter.py	2008-11-20 20:25:08 UTC (rev 46)
@@ -8,4 +8,4 @@
 """Filter for requests"""
 
 def default_filter(record):
-    return record.SERVICE == "WMS" and record.REQUEST == "GetMap"
+    return record.REQUEST == "GetMap"

Modified: trunk/server/test/test_osasserver.py
===================================================================
--- trunk/server/test/test_osasserver.py	2008-11-20 19:54:24 UTC (rev 45)
+++ trunk/server/test/test_osasserver.py	2008-11-20 20:25:08 UTC (rev 46)
@@ -220,6 +220,52 @@
                               SRS="EPSG:4326",
                               SERVICE="WMS")
 
+    def test_post_without_service_field(self):
+        self.send_formdata_request("&".join([
+            "user=karl", "responsetime=2007-06-01T12:14:16Z",
+            "wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
+            "wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
+            "requeststring=VERSION=1.1.1%26REQUEST=GetCapabilities"]))
+        self.send_formdata_request("&".join([
+            "user=karl", "responsetime=2007-06-01T12:14:17Z",
+            "wmsidextern=example.com%2Fcgi-bin%2Ffridawms",
+            "wmsidintern=localhost%2Fcgi-bin%2Fmyfrida",
+            "requeststring=VERSION=1.1.1%26REQUEST=GetMap"
+            "%26FORMAT=image%2Fpng%26TRANSPARENT=TRUE"
+            "%26WIDTH=460%26HEIGHT=348"
+            "%26EXCEPTIONS=application%2Fvnd.ogc.se_xml"
+            "%26BGCOLOR=0xffffff%26BBOX=0.0,0.0,460.0,348.0"
+            "%26LAYERS=gewaesser%26STYLES=%26SRS=EPSG:4326"]))
+        self.dbrequest_event.wait(1)
+        self.assertEquals(len(self.dbrequests), 1)
+        self.check_attributes(self.dbrequests[0],
+                              user="karl",
+                              responsetime=datetime.datetime(2007, 6, 1,
+                                                             12, 14, 17),
+                              wmsidextern="example.com/cgi-bin/fridawms",
+                              wmsidintern="localhost/cgi-bin/myfrida",
+                              requeststring=("VERSION=1.1.1&REQUEST=GetMap"
+                                             "&FORMAT=image/png"
+                                             "&TRANSPARENT=TRUE"
+                                             "&WIDTH=460&HEIGHT=348"
+                                      "&EXCEPTIONS=application/vnd.ogc.se_xml"
+                                             "&BGCOLOR=0xffffff"
+                                             "&BBOX=0.0,0.0,460.0,348.0"
+                                             "&LAYERS=gewaesser&STYLES="
+                                             "&SRS=EPSG:4326"),
+                              VERSION="1.1.1",
+                              REQUEST="GetMap",
+                              FORMAT="image/png",
+                              TRANSPARENT="TRUE",
+                              WIDTH="460",
+                              HEIGHT="348",
+                              EXCEPTIONS="application/vnd.ogc.se_xml",
+                              BGCOLOR="0xffffff",
+                              BBOX="0.0,0.0,460.0,348.0",
+                              LAYERS="gewaesser",
+                              STYLES="",
+                              SRS="EPSG:4326")
+
     def test_post_with_content_with_missing_fields(self):
         # the formdata is missing the "responsetime" field
         formdata = "&".join([



More information about the Osaas-commits mailing list