[ python-Bugs-1613573 ] xmlrpclib ServerProxy uses old httplib interface

SourceForge.net noreply at sourceforge.net
Fri Jun 15 16:05:40 CEST 2007


Bugs item #1613573, was opened at 2006-12-12 00:17
Message generated for change (Comment added) made by itkovian
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1613573&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Matt Brown (mattgbrown)
Assigned to: Nobody/Anonymous (nobody)
Summary: xmlrpclib ServerProxy uses old httplib interface

Initial Comment:
The ServerProxy class of the xmlrpclib module uses the old style HTTP / HTTPS classes of the httplib module rather than the newer HTTPConnection and HTTPConnection classes.

The practical result of this is that xmlrpc connections are not able to make use of HTTP/1.1 functionality. 

Please update the xmlrpclib module to use the newer API provided by httplib so that the advanced functionality of HTTP/1.1 is available.

----------------------------------------------------------------------

Comment By: Itkovian (itkovian)
Date: 2007-06-15 16:05

Message:
Logged In: YES 
user_id=1818513
Originator: NO

I think the only changes required are these:

--- /sw/lib/python2.5/xmlrpclib.py      2006-11-29 02:46:38.000000000
+0100
+++ xmlrpclib.py        2007-06-15 16:03:17.000000000 +0200
@@ -1182,23 +1182,13 @@
         self.send_user_agent(h)
         self.send_content(h, request_body)
 
-        errcode, errmsg, headers = h.getreply()
+        response = h.getresponse()
+        
+        if response.status != 200:
+          raise ProtocolError(host + handler, response.status,
response.reason, response.msg.headers)
 
-        if errcode != 200:
-            raise ProtocolError(
-                host + handler,
-                errcode, errmsg,
-                headers
-                )
-
-        self.verbose = verbose
-
-        try:
-            sock = h._conn.sock
-        except AttributeError:
-            sock = None
-
-        return self._parse_response(h.getfile(), sock)
+        payload = response.read()
+        return payload
 
     ##
     # Create parser.
@@ -1250,7 +1240,7 @@
         # create a HTTP connection object from a host descriptor
         import httplib
         host, extra_headers, x509 = self.get_host_info(host)
-        return httplib.HTTP(host)
+        return httplib.HTTPConnection(host)


----------------------------------------------------------------------

Comment By: A.M. Kuchling (akuchling)
Date: 2006-12-12 21:58

Message:
Logged In: YES 
user_id=11375
Originator: NO

Can you provide a patch to make this change?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1613573&group_id=5470


More information about the Python-bugs-list mailing list