[Twisted-Python] ReverseProxy does not forward GET URL parameters

Lance Kurisaki lkurisaki at ambiron.net
Wed Jun 4 11:46:32 MDT 2003


The ReverseProxy does not forward GET parameters in a URL. For example,
if the client GETs "/script?arg1=a&arg2=b", the destination server sees
only "GET /script".

The following patch fixes that.
					Lance



Index: twisted/web/proxy.py
===================================================================
RCS file: /cvs/Twisted/twisted/web/proxy.py,v
retrieving revision 1.14
diff -u -r1.14 proxy.py
--- twisted/web/proxy.py        3 Jun 2003 04:45:35 -0000       1.14
+++ twisted/web/proxy.py        4 Jun 2003 17:37:20 -0000
@@ -179,7 +179,12 @@
     def render(self, request):
         request.received_headers['host'] = self.host
         request.content.seek(0, 0)
-        clientFactory = ProxyClientFactory(request.method, self.path,
+
+       path = self.path
+       x = request.uri.split("?")
+       if len(x) == 2: path += "?" + x[1]
+
+        clientFactory = ProxyClientFactory(request.method, path,
                                      request.clientproto,
                                      request.getAllHeaders(),
                                      request.content.read(),




More information about the Twisted-Python mailing list