##// END OF EJS Templates
Work around a urllib2 bug in Python < 2.4.2...
Alexis S. L. Carvalho -
r4226:fffacca4 default
parent child Browse files
Show More
@@ -76,6 +76,14 b' def netlocunsplit(host, port, user=None,'
76 76 return userpass + '@' + hostport
77 77 return hostport
78 78
79 # work around a bug in Python < 2.4.2
80 # (it leaves a "\n" at the end of Proxy-authorization headers)
81 class request(urllib2.Request):
82 def add_header(self, key, val):
83 if key.lower() == 'proxy-authorization':
84 val = val.strip()
85 return urllib2.Request.add_header(self, key, val)
86
79 87 class httpsendfile(file):
80 88 def __len__(self):
81 89 return os.fstat(self.fileno()).st_size
@@ -239,7 +247,7 b' class httprepository(remoterepository):'
239 247 if data:
240 248 self.ui.debug(_("sending %s bytes\n") %
241 249 headers.get('content-length', 'X'))
242 resp = urllib2.urlopen(urllib2.Request(cu, data, headers))
250 resp = urllib2.urlopen(request(cu, data, headers))
243 251 except urllib2.HTTPError, inst:
244 252 if inst.code == 401:
245 253 raise util.Abort(_('authorization failed'))
General Comments 0
You need to be logged in to leave comments. Login now