xmlrpclib hangs execution
itkovian
itkovian at gmail.com
Mon Jun 18 06:23:48 EDT 2007
I think a better fix than the one I posted below is using the
HTTPConnection library, as opposed to the HTTP library from httplib.
A patch can be found below:
--- /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)
More information about the Python-list
mailing list