Show More
@@ -8,7 +8,6 b'' | |||
|
8 | 8 | # GNU General Public License version 2 or any later version. |
|
9 | 9 | |
|
10 | 10 | import urllib, urllib2, httplib, os, socket, cStringIO |
|
11 | import base64 | |
|
12 | 11 | from i18n import _ |
|
13 | 12 | import keepalive, util, sslutil |
|
14 | 13 | import httpconnection as httpconnectionmod |
@@ -419,22 +418,9 b' class httpdigestauthhandler(urllib2.HTTP' | |||
|
419 | 418 | |
|
420 | 419 | class httpbasicauthhandler(urllib2.HTTPBasicAuthHandler): |
|
421 | 420 | def __init__(self, *args, **kwargs): |
|
422 | self.auth = None | |
|
423 | 421 | urllib2.HTTPBasicAuthHandler.__init__(self, *args, **kwargs) |
|
424 | 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 | 424 | def reset_retry_count(self): |
|
439 | 425 | # Python 2.6.5 will call this on 401 or 407 errors and thus loop |
|
440 | 426 | # forever. We disable reset_retry_count completely and reset in |
@@ -449,19 +435,6 b' class httpbasicauthhandler(urllib2.HTTPB' | |||
|
449 | 435 | return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed( |
|
450 | 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 | 438 | handlerfuncs = [] |
|
466 | 439 | |
|
467 | 440 | def opener(ui, authinfo=None): |
General Comments 0
You need to be logged in to leave comments.
Login now