New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
urllib2's AbstractBasicAuthHandler is limited to 6 requests #53848
Comments
It seems that commit r81636 broke urllib2's AbstractBasicAuthHandler because the "retried" attribute isn't reset on success. Therefore it's limited to 6 requests. The attached patch should fix this problem. |
The patch is fine. |
Fixed in r84207(release27-maint). |
Fixed in py3k (r84210) and release31-maint(r84211). I discovered a new problem while fixing this. It will be taken care in bpo-9643. |
Grr. Why wasn't this fix backported to the release maintenance branch before 2.6.6 was released? I've just had an application break as a result of upgrading from 2.6.5 to 2.6.6. Oh well, too late now. :-( </grumble> |
Ouch. My mistake. Had not realize then, that code that actually broke things was merged in 2.6.x and it had to be fixed too. :( |
Ah well, it turned out to be fairly easy to work around, at least. :-) Just in case any other urllib2 users have to deal with this in 2.6.6 (and also manage to find their way to this bug report :-): it's easy to monkeypatch your way around the problem. E.g.: import sys
import urllib2
if sys.version_info[:2] == (2, 6) and sys.version_info[2] >= 6:
def fixed_http_error_401(self, req, fp, code, msg, headers):
url = req.get_full_url()
response = self.http_error_auth_reqed('www-authenticate',
url, req, headers)
self.retried = 0
return response
urllib2.HTTPBasicAuthHandler.http_error_401 = fixed_http_error_401 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: