classification
Title: urllib2 - Basic,Digest Proxy Auth Handlers failure will give 401 code instead of 407
Type: Stage: test needed
Components: Versions: Python 3.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: orsenthil, terry.reedy
Priority: normal Keywords:

Created on 2010-08-19 17:59 by orsenthil, last changed 2010-08-20 18:53 by terry.reedy.

Messages (2)
msg114386 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-08-19 17:59
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.
msg114442 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-20 18:53
In 3.x, http_error_auth_reqed is a method of urllib.request.AbstractBasicAuthHandler
(20.5.8. AbstractBasicAuthHandler Objects in 3.1 lib manual)
History
Date User Action Args
2010-08-20 18:53:07terry.reedysetnosy: + terry.reedy

messages: + msg114442
stage: test needed
2010-08-19 18:01:30orsenthilsettitle: urllib2 - Basic,Digest Auth Handlers Retry will give 401 code instead of 407 -> urllib2 - Basic,Digest Proxy Auth Handlers failure will give 401 code instead of 407
2010-08-19 17:59:10orsenthilcreate