1 === modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
2 --- bzrlib/transport/http/_urllib2_wrappers.py 2010-05-08 05:56:28 +0000
3 +++ bzrlib/transport/http/_urllib2_wrappers.py 2010-09-15 02:43:44 +0000
8 +class addinfourl(urllib2.addinfourl):
9 + '''Replacement addinfourl class compatible with python-2.7's xmlrpclib
11 + In python-2.7, xmlrpclib expects that the response object that it receives
12 + has a getheader method. httplib.HTTPResponse provides this but
13 + urllib2.addinfourl does not. Add the necessary functions here, ported to
14 + use the internal data structures of addinfourl.
17 + def getheader(self, name, default=None):
18 + if self.headers is None:
19 + raise httplib.ResponseNotReady()
20 + return self.headers.getheader(name, default)
22 + def getheaders(self):
23 + if self.headers is None:
24 + raise httplib.ResponseNotReady()
25 + return self.headers.items()
28 class _ReportingFileSocket(object):
30 def __init__(self, filesock, report_activity=None):
34 fp = socket._fileobject(r, bufsize=65536)
35 - resp = urllib2.addinfourl(fp, r.msg, req.get_full_url())
36 + resp = addinfourl(fp, r.msg, req.get_full_url())
39 resp.version = r.version