[Inteproxy-commits] r156 - in trunk: . inteproxy test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jun 27 11:52:20 CEST 2008


Author: bh
Date: 2008-06-27 11:52:20 +0200 (Fri, 27 Jun 2008)
New Revision: 156

Modified:
   trunk/ChangeLog
   trunk/inteproxy/transcoder.py
   trunk/test/test_inteproxy.py
Log:
* inteproxy/transcoder.py (TranscoderMap.rewrite_urls): Also
rewrite remote HTTPS-URLs

* test/test_inteproxy.py
(TestInteProxyURLRewriting.test_httpproxy_url_rewriting_https_urls):
New test for rewriting HTTPS URLs.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-06-23 08:20:12 UTC (rev 155)
+++ trunk/ChangeLog	2008-06-27 09:52:20 UTC (rev 156)
@@ -1,3 +1,12 @@
+2008-06-27  Bernhard Herzog  <bh at intevation.de>
+
+	* inteproxy/transcoder.py (TranscoderMap.rewrite_urls): Also
+	rewrite remote HTTPS-URLs
+
+	* test/test_inteproxy.py
+	(TestInteProxyURLRewriting.test_httpproxy_url_rewriting_https_urls):
+	New test for rewriting HTTPS URLs.
+
 2008-06-23  Stephan Holl <stephan.holl at intevation.de>
 
 	* website/index.htm4, website/index-de.htm4: updated with new
@@ -7,7 +16,7 @@
 
 	* packaging/Windows/inteproxy-installer.nsi: Add non-administrator
 	warning for uninstallation. Set correct 'all users' folder for
-	uninstall.	  
+	uninstall.
 
 2008-06-20  Stephan Holl <stephan.holl at intevation.de>
 

Modified: trunk/inteproxy/transcoder.py
===================================================================
--- trunk/inteproxy/transcoder.py	2008-06-23 08:20:12 UTC (rev 155)
+++ trunk/inteproxy/transcoder.py	2008-06-27 09:52:20 UTC (rev 156)
@@ -269,9 +269,9 @@
             if not host:
                 log_debug("rewrite_urls: ignoring host %r", host)
                 continue
-            remote_url = "http://%s%s" % (host, path)
             local_url = "%s%s%s" % (prefix, host, path)
-            pairs[remote_url] = local_url
+            for protocol in ["http", "https"]:
+                pairs["%s://%s%s" % (protocol, host, path)] = local_url
         regex = re.compile("(" + "|".join([re.escape(url)
                                            for url in pairs.keys()])
                            + ")")

Modified: trunk/test/test_inteproxy.py
===================================================================
--- trunk/test/test_inteproxy.py	2008-06-23 08:20:12 UTC (rev 155)
+++ trunk/test/test_inteproxy.py	2008-06-27 09:52:20 UTC (rev 156)
@@ -119,6 +119,10 @@
          "An URL that may be rewritten: http://example.com/a/wms\n"
          "and one that may not: http://example.com/foo\n"
          "and one that may: http://example.com/another/wms\n"),
+        ("/rewrite-03", [("Content-Type", "text/plain")],
+         "An URL that may be rewritten: https://example.com/a/wms\n"
+         "and one that may not: http://example.com/foo\n"
+         "and one that may: http://example.com/another/wms\n"),
         ]
 
 
@@ -161,6 +165,23 @@
                           % (self.server.server_port,
                              self.server.server_port))
 
+    def test_httpproxy_url_rewriting_https_urls(self):
+        http = httplib.HTTPConnection("localhost", self.server.server_port)
+        http.request("GET",
+                     "http://localhost:%d/localhost:%d/rewrite-03"
+                     % (self.server.server_port,
+                        self.remote_server.server_port))
+        response = http.getresponse()
+        self.assertEquals(response.status, 200)
+        data = response.read()
+        self.assertEquals(data,
+                          "An URL that may be rewritten:"
+                          " http://localhost:%d/example.com/a/wms\n"
+                          "and one that may not: http://example.com/foo\n"
+                          "and one that may:"
+                          " http://localhost:%d/example.com/another/wms\n"
+                          % (self.server.server_port,
+                             self.server.server_port))
 
 
 class TestInteProxyWithExtraProxy(ServerTest):



More information about the Inteproxy-commits mailing list