Show More
@@ -542,11 +542,25 b' if has_https:' | |||
|
542 | 542 | conn.ui = self.ui |
|
543 | 543 | return conn |
|
544 | 544 | |
|
545 | # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if | |
|
546 | # it doesn't know about the auth type requested. This can happen if | |
|
547 | # somebody is using BasicAuth and types a bad password. | |
|
548 | 545 | class httpdigestauthhandler(urllib2.HTTPDigestAuthHandler): |
|
546 | def __init__(self, *args, **kwargs): | |
|
547 | urllib2.HTTPDigestAuthHandler.__init__(self, *args, **kwargs) | |
|
548 | self.retried_req = None | |
|
549 | ||
|
550 | def reset_retry_count(self): | |
|
551 | # Python 2.6.5 will call this on 401 or 407 errors and thus loop | |
|
552 | # forever. We disable reset_retry_count completely and reset in | |
|
553 | # http_error_auth_reqed instead. | |
|
554 | pass | |
|
555 | ||
|
549 | 556 | def http_error_auth_reqed(self, auth_header, host, req, headers): |
|
557 | # Reset the retry counter once for each request. | |
|
558 | if req is not self.retried_req: | |
|
559 | self.retried_req = req | |
|
560 | self.retried = 0 | |
|
561 | # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if | |
|
562 | # it doesn't know about the auth type requested. This can happen if | |
|
563 | # somebody is using BasicAuth and types a bad password. | |
|
550 | 564 | try: |
|
551 | 565 | return urllib2.HTTPDigestAuthHandler.http_error_auth_reqed( |
|
552 | 566 | self, auth_header, host, req, headers) |
@@ -556,13 +570,6 b' class httpdigestauthhandler(urllib2.HTTP' | |||
|
556 | 570 | return |
|
557 | 571 | raise |
|
558 | 572 | |
|
559 | # Python 2.6.5 will keep resetting the retry count on redirects, for | |
|
560 | # example when the server returns 401 on failing auth (like google code | |
|
561 | # currently does). We stop the endless recursion by not resetting the | |
|
562 | # count. | |
|
563 | def reset_retry_count(self): | |
|
564 | pass | |
|
565 | ||
|
566 | 573 | def getauthinfo(path): |
|
567 | 574 | scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) |
|
568 | 575 | if not urlpath: |
General Comments 0
You need to be logged in to leave comments.
Login now