Mercurial > public > mercurial-scm > hg-stable
diff mercurial/httprepo.py @ 4232:0d51eb296fb9
Merge with crew-stable
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 16 Mar 2007 00:45:18 -0300 |
parents | 9dc64c8414ca fffacca46f09 |
children | bf8319ee3428 |
line wrap: on
line diff
--- a/mercurial/httprepo.py Thu Mar 15 18:57:47 2007 -0500 +++ b/mercurial/httprepo.py Fri Mar 16 00:45:18 2007 -0300 @@ -75,6 +75,14 @@ return userpass + '@' + hostport return hostport +# work around a bug in Python < 2.4.2 +# (it leaves a "\n" at the end of Proxy-authorization headers) +class request(urllib2.Request): + def add_header(self, key, val): + if key.lower() == 'proxy-authorization': + val = val.strip() + return urllib2.Request.add_header(self, key, val) + class httpsendfile(file): def __len__(self): return os.fstat(self.fileno()).st_size @@ -238,7 +246,7 @@ if data: self.ui.debug(_("sending %s bytes\n") % headers.get('content-length', 'X')) - resp = urllib2.urlopen(urllib2.Request(cu, data, headers)) + resp = urllib2.urlopen(request(cu, data, headers)) except urllib2.HTTPError, inst: if inst.code == 401: raise util.Abort(_('authorization failed'))