##// END OF EJS Templates
http: backout 181108726ea5, which breaks on Python 2.4
Augie Fackler -
r20174:af02783d default
parent child Browse files
Show More
@@ -8,7 +8,6 b''
8 # GNU General Public License version 2 or any later version.
8 # GNU General Public License version 2 or any later version.
9
9
10 import urllib, urllib2, httplib, os, socket, cStringIO
10 import urllib, urllib2, httplib, os, socket, cStringIO
11 import base64
12 from i18n import _
11 from i18n import _
13 import keepalive, util, sslutil
12 import keepalive, util, sslutil
14 import httpconnection as httpconnectionmod
13 import httpconnection as httpconnectionmod
@@ -419,22 +418,9 b' class httpdigestauthhandler(urllib2.HTTP'
419
418
420 class httpbasicauthhandler(urllib2.HTTPBasicAuthHandler):
419 class httpbasicauthhandler(urllib2.HTTPBasicAuthHandler):
421 def __init__(self, *args, **kwargs):
420 def __init__(self, *args, **kwargs):
422 self.auth = None
423 urllib2.HTTPBasicAuthHandler.__init__(self, *args, **kwargs)
421 urllib2.HTTPBasicAuthHandler.__init__(self, *args, **kwargs)
424 self.retried_req = None
422 self.retried_req = None
425
423
426 def http_request(self, request):
427 if self.auth:
428 request.add_unredirected_header(self.auth_header, self.auth)
429
430 return request
431
432 def https_request(self, request):
433 if self.auth:
434 request.add_unredirected_header(self.auth_header, self.auth)
435
436 return request
437
438 def reset_retry_count(self):
424 def reset_retry_count(self):
439 # Python 2.6.5 will call this on 401 or 407 errors and thus loop
425 # Python 2.6.5 will call this on 401 or 407 errors and thus loop
440 # forever. We disable reset_retry_count completely and reset in
426 # forever. We disable reset_retry_count completely and reset in
@@ -449,19 +435,6 b' class httpbasicauthhandler(urllib2.HTTPB'
449 return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed(
435 return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed(
450 self, auth_header, host, req, headers)
436 self, auth_header, host, req, headers)
451
437
452 def retry_http_basic_auth(self, host, req, realm):
453 user, pw = self.passwd.find_user_password(realm, host)
454 if pw is not None:
455 raw = "%s:%s" % (user, pw)
456 auth = 'Basic %s' % base64.b64encode(raw).strip()
457 if req.headers.get(self.auth_header, None) == auth:
458 return None
459 self.auth = auth
460 req.add_unredirected_header(self.auth_header, auth)
461 return self.parent.open(req, timeout=req.timeout)
462 else:
463 return None
464
465 handlerfuncs = []
438 handlerfuncs = []
466
439
467 def opener(ui, authinfo=None):
440 def opener(ui, authinfo=None):
General Comments 0
You need to be logged in to leave comments. Login now