mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-01-24 10:32:15 +08:00
60fa35ae28
* fix bzr * update udev to 165 * update gobject-introspection to 0.10.0
41 lines
1.4 KiB
Diff
41 lines
1.4 KiB
Diff
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
|
|
--- bzrlib/transport/http/_urllib2_wrappers.py 2010-05-08 05:56:28 +0000
|
|
+++ bzrlib/transport/http/_urllib2_wrappers.py 2010-09-15 02:43:44 +0000
|
|
@@ -75,6 +75,26 @@
|
|
)
|
|
|
|
|
|
+class addinfourl(urllib2.addinfourl):
|
|
+ '''Replacement addinfourl class compatible with python-2.7's xmlrpclib
|
|
+
|
|
+ In python-2.7, xmlrpclib expects that the response object that it receives
|
|
+ has a getheader method. httplib.HTTPResponse provides this but
|
|
+ urllib2.addinfourl does not. Add the necessary functions here, ported to
|
|
+ use the internal data structures of addinfourl.
|
|
+ '''
|
|
+
|
|
+ def getheader(self, name, default=None):
|
|
+ if self.headers is None:
|
|
+ raise httplib.ResponseNotReady()
|
|
+ return self.headers.getheader(name, default)
|
|
+
|
|
+ def getheaders(self):
|
|
+ if self.headers is None:
|
|
+ raise httplib.ResponseNotReady()
|
|
+ return self.headers.items()
|
|
+
|
|
+
|
|
class _ReportingFileSocket(object):
|
|
|
|
def __init__(self, filesock, report_activity=None):
|
|
@@ -656,7 +676,7 @@
|
|
r = response
|
|
r.recv = r.read
|
|
fp = socket._fileobject(r, bufsize=65536)
|
|
- resp = urllib2.addinfourl(fp, r.msg, req.get_full_url())
|
|
+ resp = addinfourl(fp, r.msg, req.get_full_url())
|
|
resp.code = r.status
|
|
resp.msg = r.reason
|
|
resp.version = r.version
|
|
|