[Twisted-Python] Anomaly found between twisted XML-RPC client and twisted server (Bug?)

Andrew Bennetts andrew-twisted at puzzling.org
Fri May 23 00:40:13 EDT 2003


On Fri, May 23, 2003 at 12:19:26PM +0800, Wari Wahab wrote:
> 
> If the request is wrong, shouldn't twisted.web complain about it at a 
> point earlier than the XMLRPC resource? If it lets the request thru, why 
> does request.content becomes empty. Or, shouldn't the XMLRPC client adds 
> a '/' at least when there is no URI (URL?) in the request?

That's for taking the time to investigate this!

Does this patch to the Proxy class fix the problem?

Index: twisted/web/xmlrpc.py
===================================================================
RCS file: /cvs/Twisted/twisted/web/xmlrpc.py,v
retrieving revision 1.22
diff -u -r1.22 xmlrpc.py
--- twisted/web/xmlrpc.py       12 May 2003 20:16:49 -0000      1.22
+++ twisted/web/xmlrpc.py       23 May 2003 04:37:04 -0000
@@ -225,6 +225,8 @@
     def __init__(self, url):
         parts = urlparse.urlparse(url)
         self.url = urlparse.urlunparse(('', '')+parts[2:])
+        if not self.url:
+            self.url = '/'
         if ':' in parts[1]:
             self.host, self.port = parts[1].split(':')
             self.port = int(self.port)

(I haven't actually read the code very carefully; perhaps there's a better
way to call urlunparse or something, but this looks like it'll fix the
symptom)

-Andrew.





More information about the Twisted-Python mailing list