Issue 979407: urllib2 digest auth totally broken (original) (raw)

Created on 2004-06-25 01:16 by aaronsw, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg60522 - (view) Author: Aaron Swartz (aaronsw) Date: 2004-06-25 01:16
The urllib2 digest auth handler is totally broken. 1. It looks for an "Authorization" header instead of "WWW- Authenticate" (Authorization is the header you send back). 2. It thinks passwords in the URL are port names. 3. Even if you get around all that, it just doesn't work. It seems to encrypt the thing wrongly and get itself into an infinite loop sending the wrong answer back again and again, being rejected each time.
msg60523 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-02-20 21:00
Logged In: YES user_id=849994 For discussion about number 2 above, see #944396.
msg182136 - (view) Author: Michele OrrĂ¹ (maker) * Date: 2013-02-15 09:47
Isn't this issue fixed and tested on Lib/test/test_urllib2.py:1304?
msg182154 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-02-15 17:52
let me check that.
msg192438 - (view) Author: Senko Rasic (senko) * Date: 2013-07-06 13:13
Checked with 3.4.0 alpha, works fine. Apart from the tests mentioned, I used the following script to check digest auth: from urllib import request url = 'http://httpbin.org/digest-auth/auth/user/passwd' req = request.Request(url) password_manager = request.HTTPPasswordMgrWithDefaultRealm() password_manager.add_password(None, url, 'user', 'passwd') auth_manager = request.HTTPDigestAuthHandler(password_manager) opener = request.build_opener(auth_manager) request.install_opener(opener) handler = request.urlopen(req) assert handler.getcode() == 200
msg192564 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-07 14:40
The bug has been fixed a while ago. Python 2.7 as well as Python 3.x have tests to verify digest auth. Farewell Aaron...
History
Date User Action Args
2022-04-11 14:56:05 admin set github: 40447
2013-07-07 14:40:51 christian.heimes set status: open -> closednosy: + christian.heimesmessages: + resolution: fixedstage: test needed -> resolved
2013-07-07 14:38:40 vstinner set nosy: + vstinner
2013-07-06 13:13:46 senko set nosy: + senkomessages: +
2013-02-15 17:52:54 orsenthil set messages: +
2013-02-15 09:47:00 maker set nosy: + makermessages: +
2010-08-19 15:30:47 asandvig set nosy: + asandvig
2010-08-19 14:58:58 BreamoreBoy set versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6
2009-04-22 17:22:05 ajaksu2 set keywords: + easy
2009-02-13 02:05:09 ajaksu2 set nosy: + jjlee
2009-02-12 17:42:24 ajaksu2 set versions: + Python 2.6nosy: + orsenthildependencies: + urllib2 doesn't handle username/password in urlcomponents: + Library (Lib), - Nonetype: behaviorstage: test needed
2004-06-25 01:16:37 aaronsw create