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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 26 17:44:55 CET 2008


Author: bh
Date: 2008-11-26 17:44:54 +0100 (Wed, 26 Nov 2008)
New Revision: 179

Modified:
   trunk/ChangeLog
   trunk/inteproxy/proxycore.py
   trunk/test/test_inteproxy.py
Log:
* inteproxy/proxycore.py
(InteProxyHTTPRequestHandler.open_http_connection): Strip
Proxy-Authenticate headers from the response.  They must not be
sent to the InteProxy client

* test/test_inteproxy.py
(AuthenticatingProxyRequestHandler.handle_proxy_request): Send a
Proxy-Authenticate header when authentication fails
(TestInteProxyWithExtraProxyWithIncorrectAuthentication.test):
Also test whether the Proxy-Authenticate header was removed by
InteProxy


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-11-26 16:23:36 UTC (rev 178)
+++ trunk/ChangeLog	2008-11-26 16:44:54 UTC (rev 179)
@@ -1,6 +1,20 @@
 2008-11-26  Bernhard Herzog  <bh at intevation.de>
 
 	* inteproxy/proxycore.py
+	(InteProxyHTTPRequestHandler.open_http_connection): Strip
+	Proxy-Authenticate headers from the response.  They must not be
+	sent to the InteProxy client
+
+	* test/test_inteproxy.py
+	(AuthenticatingProxyRequestHandler.handle_proxy_request): Send a
+	Proxy-Authenticate header when authentication fails
+	(TestInteProxyWithExtraProxyWithIncorrectAuthentication.test):
+	Also test whether the Proxy-Authenticate header was removed by
+	InteProxy
+
+2008-11-26  Bernhard Herzog  <bh at intevation.de>
+
+	* inteproxy/proxycore.py
 	(InteProxyHTTPRequestHandler.open_http_connection): Add some
 	comments
 

Modified: trunk/inteproxy/proxycore.py
===================================================================
--- trunk/inteproxy/proxycore.py	2008-11-26 16:23:36 UTC (rev 178)
+++ trunk/inteproxy/proxycore.py	2008-11-26 16:44:54 UTC (rev 179)
@@ -196,6 +196,10 @@
                            response_message.status, response_message.reason)
             response_message.status = 502
             response_message.reason = "Upstream proxy requires authentication"
+
+        for header in ["Proxy-Authenticate"]:
+            del response_message.headers[header]
+
         return response_message
 
 

Modified: trunk/test/test_inteproxy.py
===================================================================
--- trunk/test/test_inteproxy.py	2008-11-26 16:23:36 UTC (rev 178)
+++ trunk/test/test_inteproxy.py	2008-11-26 16:44:54 UTC (rev 179)
@@ -234,7 +234,16 @@
             # we should send a Proxy-Authenticate too, but it doesn't
             # matter for this test because InteProxy doesn't look at the
             # header yet.
-            self.send_error(407)
+            self.send_response(407, "Proxy Authentication Required")
+            self.send_header("Proxy-Authenticate",
+                             'Basic realm="inteproxytest"')
+            self.send_header("Content-Type", "text/html")
+            self.send_header('Connection', 'close')
+            self.end_headers()
+            self.wfile.write("<html><body>"
+                             "Proxy requires authentication"
+                             "</body><html>")
+
         else:
             InteProxyHTTPRequestHandler.handle_proxy_request(self)
 
@@ -285,3 +294,6 @@
         # send a 502 (Bad Gateway) instead to indicate a server
         # configuration problem
         self.assertEquals(response.status, 502)
+
+        # there must not be a Proxy-Authenticate header either
+        self.failIf("Proxy-Authenticate" in response.msg, None)



More information about the Inteproxy-commits mailing list