This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: xmlrpclib ServerProxy uses old httplib interface
Type: Stage:
Components: Library (Lib) Versions: Python 2.6, Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: akuchling, gpolo, itkovian, mattgbrown, techtonik, vstinner
Priority: normal Keywords: patch

Created on 2006-12-11 23:17 by mattgbrown, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue1613573_xmlrpc_uses_deprecated_api.patch techtonik, 2008-07-01 13:30 patch against trunk
Messages (12)
msg30788 - (view) Author: Matt Brown (mattgbrown) Date: 2006-12-11 23:17
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.
msg30789 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-12-12 20:58
Can you provide a patch to make this change?
msg30790 - (view) Author: Itkovian (itkovian) Date: 2007-06-15 14:05
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)
msg64329 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-03-22 15:02
There is another patch regarding the use of HTTP/1.1 for xmlrpclib at
http://bugs.python.org/issue1767370. The other issue could be update
with some comments from this issue and then this issue could be closed,
I believe.
msg69043 - (view) Author: anatoly techtonik (techtonik) Date: 2008-07-01 13:30
* use newer 2.0 public interface of httplib for connection handling

Attached patch is for trunk/
Tested for Python 2.5
issue1767370 is a separate issue that can be fixed later
msg92601 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009-09-14 10:48
I consider this issue as a duplicate of #6267 which is already fixed (commited).
Reopen the issue if I'm wrong ;-)

See also #2076 and #1767370 (other duplicates).
msg92689 - (view) Author: anatoly techtonik (techtonik) Date: 2009-09-16 15:33
Yep, the patch at #6267 is an extension of this one except for the last 
chunk where I also check if sockets are ssl-enabled. I am not sure why 
it was needed. It also may have been already fixed somewhere else. As 
this bug doesn't have any tests attached it may be considered closed for 
now.

Would be nice to see these fixes in Python 2.6 though as it is the 
default version that seems to go in Ubuntu 9.10

+        import socket
+        if not socket._have_ssl:
             raise NotImplementedError(
                 "your version of httplib doesn't support HTTPS"
                 )
msg92695 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009-09-16 16:02
@techtonik: I don't think that testing socket._have_ssl is better than testing
for HTTPSConnection. socket._have_ssl might be True, whereas
HTTPSConnection is missing for a random reason. xmlrpclib uses
HTTPSConnection, not directly the socket library. HTTPSConnection may be
implemented using something else than socket / ssl.
msg92698 - (view) Author: anatoly techtonik (techtonik) Date: 2009-09-16 16:24
There should be a better way to do this check, because HTTPConnection 
method may exists, but HTTPConnection may be impossible, because of 
other reasons.

And I still would like to see this fix in Python 2.6 - too bad it hadn't 
enough attention before 2.6.

Flags like +wanted-2.6 like in FireFox bugzilla could really help to 
see/discuss critical parts to be included for everybody before it's too 
late. Should we stop development and dedicate a month or two on 
improving the process? =)
msg92702 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009-09-16 17:13
@techtonik: You wrote "HTTPConnection" twice. I don't really understand your
request. Do you think that the issue is fixed in Python trunk or not? If not,
please open a new issue since this issue is closed.

techtonik> And I still would like to see this fix in Python 2.6
techtonik> - too bad it hadn't enough attention before 2.6.

Python is developed by people working on Python in their free time. IMHO,
voting for an ticket is useless. If you want to see your fix faster in the
subversion, follow some rules:
 - explain correctly the issue
 - write a test
 - write a patch
 - explain your solution
 - fix your patches if needed after each patch review

You posted your patch the 1st July 2008, and the 2.6 final version was released
the 1st october 2008. It was a little bit too late for the 2.6 (because of the
beta/RC releases), but it may be included in next 2.6.x release if it's easy to
backport it. I also think that not enough people are interested by XML-RPC +
HTTPS.
msg92748 - (view) Author: anatoly techtonik (techtonik) Date: 2009-09-17 09:17
This bug may be fixed. Unfortunately I do not possess original setup 
anymore. The primary issue is still issue648658 and that affects bzr + 
launchpad integration, XML-RPC access to bugzilla and probably more.
msg92749 - (view) Author: anatoly techtonik (techtonik) Date: 2009-09-17 09:20
And I want to add that I am glad that is finally fixed, so I really 
appreciate the work people done in this direction in their free time.
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44330
2009-09-17 09:20:04techtoniksetmessages: + msg92749
2009-09-17 09:17:54techtoniksetmessages: + msg92748
2009-09-16 17:13:01vstinnersetmessages: + msg92702
2009-09-16 17:10:25vstinnersetmessages: - msg92701
2009-09-16 17:09:58vstinnersetmessages: + msg92701
2009-09-16 16:24:12techtoniksetmessages: + msg92698
2009-09-16 16:02:12vstinnersetmessages: + msg92695
2009-09-16 15:33:37techtoniksetmessages: + msg92689
2009-09-14 10:49:01vstinnersetstatus: open -> closed
resolution: duplicate
2009-09-14 10:48:20vstinnersetnosy: + vstinner
messages: + msg92601
2008-07-01 13:30:44techtoniksetfiles: + issue1613573_xmlrpc_uses_deprecated_api.patch
keywords: + patch
messages: + msg69043
nosy: + techtonik
versions: + Python 2.6
2008-03-22 15:02:53gpolosetnosy: + gpolo
messages: + msg64329
2006-12-11 23:17:38mattgbrowncreate