[issue9643] urllib2 - Basic, Digest Auth Handlers Retry will give 401 code instead of 407

Senthil Kumaran report at bugs.python.org
Thu Aug 19 19:59:12 CEST 2010


New submission from Senthil Kumaran <orsenthil at gmail.com>:

The retry logic and code used by ProxyBasicAuthHandler and ProxyDigestAuthHandler are same as normal authentication handlers. While this reuse is good, there is a problem that, on authentication failure, the HTTPError code is hardcoded to 401, whereas for Proxy cases it should have been 407.

The problematic line is this:


    def http_error_auth_reqed(self, auth_header, host, req, headers):
            ...
            raise HTTPError(req.full_url, 401, "digest auth failed",
                            headers, None)

can be changed by:
- Passing the errcode as arg.
- Or getting it from headers.

----------
assignee: orsenthil
messages: 114386
nosy: orsenthil
priority: normal
severity: normal
status: open
title: urllib2 - Basic,Digest Auth Handlers Retry will give 401 code instead of 407
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9643>
_______________________________________


More information about the Python-bugs-list mailing list