[Inteproxy-commits] r18 - trunk

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 30 16:55:52 CET 2007


Author: bh
Date: 2007-01-30 16:55:52 +0100 (Tue, 30 Jan 2007)
New Revision: 18

Modified:
   trunk/ChangeLog
   trunk/InteProxy.py
Log:
* InteProxy.py (InteProxyHTTPRequestHandler.handle_proxy_request):
Read the client request body before the new https request for the
actual server is created.  This will make it easier to deal with
cases wehre the body has to be modified.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-01-30 15:20:10 UTC (rev 17)
+++ trunk/ChangeLog	2007-01-30 15:55:52 UTC (rev 18)
@@ -1,5 +1,12 @@
 2007-01-30  Bernhard Herzog  <bh at intevation.de>
 
+	* InteProxy.py (InteProxyHTTPRequestHandler.handle_proxy_request):
+	Read the client request body before the new https request for the
+	actual server is created.  This will make it easier to deal with
+	cases wehre the body has to be modified.
+
+2007-01-30  Bernhard Herzog  <bh at intevation.de>
+
 	Add a --debug-level option.
 
 	* InteProxy.py (InteProxyHTTPRequestHandler.debug_level): New

Modified: trunk/InteProxy.py
===================================================================
--- trunk/InteProxy.py	2007-01-30 15:20:10 UTC (rev 17)
+++ trunk/InteProxy.py	2007-01-30 15:55:52 UTC (rev 18)
@@ -128,6 +128,17 @@
         remote_url = "https://%s%s" % (netloc, url)
         self.log_debug("Converted url: %r", remote_url)
 
+        # If any data is associated with the request read it
+        length = int(self.headers.getheader("Content-Length", "0"))
+        if length:
+            # FIXME: check whether length bytes were read
+            data = self.rfile.read(length)
+            self.log_debug("body of client request (%d bytes):\n%r",
+                           length, data)
+        else:
+            self.log_debug("client request has no body")
+            data = None
+
         request = urllib2.Request(remote_url)
         for header, value in self.headers.items():
             if header.lower() == "host":
@@ -155,17 +166,6 @@
             else:
                 request.add_header(header, value)
 
-        # If any data is associated with the request pass it through
-        length = int(self.headers.getheader("Content-Length", "0"))
-        if length:
-            # FIXME: check whether length bytes were read
-            data = self.rfile.read(length)
-            self.log_debug("body of client request (%d bytes):\n%r",
-                           length, data)
-        else:
-            self.log_debug("client request has no body")
-            data = None
-
         if data is not None:
             request.add_data(data)
 



More information about the Inteproxy-commits mailing list