summaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2011-10-11 14:05:21 -0700
committerShawn O. Pearce <sop@google.com>2011-10-11 14:06:11 -0700
commitdf5ee52050a5b8ea4e0bb69c007dac556c18ec03 (patch)
tree760f85dcd1039e3ba6110d39cc041c664730e7cb /main.py
parentfab96c68e3acfb5403ffe65577563f3cb39e2530 (diff)
downloadgit-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-xmain.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.py b/main.py
index 22e6fa42..fda81038 100755
--- a/main.py
+++ b/main.py
@@ -276,10 +276,17 @@ class _UserAgentHandler(urllib2.BaseHandler):
276class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler): 276class _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
285def init_http(): 292def init_http():