diff options
author | Shawn O. Pearce <sop@google.com> | 2011-10-11 14:05:21 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2011-10-11 14:06:11 -0700 |
commit | df5ee52050a5b8ea4e0bb69c007dac556c18ec03 (patch) | |
tree | 760f85dcd1039e3ba6110d39cc041c664730e7cb /main.py | |
parent | fab96c68e3acfb5403ffe65577563f3cb39e2530 (diff) | |
download | git-repo-df5ee52050a5b8ea4e0bb69c007dac556c18ec03.tar.gz |
Fix Python 2.4 support
Change-Id: I89521ae52fa564f0d849cc51e71fee65b3c47bab
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -276,10 +276,17 @@ class _UserAgentHandler(urllib2.BaseHandler): | |||
276 | class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler): | 276 | class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler): |
277 | def http_error_auth_reqed(self, authreq, host, req, headers): | 277 | def http_error_auth_reqed(self, authreq, host, req, headers): |
278 | try: | 278 | try: |
279 | old_add_header = req.add_header | ||
280 | def _add_header(name, val): | ||
281 | val = val.replace('\n', '') | ||
282 | old_add_header(name, val) | ||
283 | req.add_header = _add_header | ||
279 | return urllib2.AbstractBasicAuthHandler.http_error_auth_reqed( | 284 | return urllib2.AbstractBasicAuthHandler.http_error_auth_reqed( |
280 | self, authreq, host, req, headers) | 285 | self, authreq, host, req, headers) |
281 | except: | 286 | except: |
282 | self.reset_retry_count() | 287 | reset = getattr(self, 'reset_retry_count', None) |
288 | if reset is not None: | ||
289 | reset() | ||
283 | raise | 290 | raise |
284 | 291 | ||
285 | def init_http(): | 292 | def init_http(): |