[Python-checkins] r78426 - in python/branches/py3k: Lib/test/test_urllib2.py Lib/urllib/request.py
senthil.kumaran
python-checkins at python.org
Wed Feb 24 17:53:16 CET 2010
Author: senthil.kumaran
Date: Wed Feb 24 17:53:16 2010
New Revision: 78426
Log:
Merged revisions 78422 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78422 | senthil.kumaran | 2010-02-24 22:15:46 +0530 (Wed, 24 Feb 2010) | 2 lines
Fix for Issue3819 - urllib2 sends Basic auth across redirects
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/test/test_urllib2.py
python/branches/py3k/Lib/urllib/request.py
Modified: python/branches/py3k/Lib/test/test_urllib2.py
==============================================================================
--- python/branches/py3k/Lib/test/test_urllib2.py (original)
+++ python/branches/py3k/Lib/test/test_urllib2.py Wed Feb 24 17:53:16 2010
@@ -1145,7 +1145,8 @@
base64.encodebytes(userpass).strip().decode())
self.assertEqual(http_handler.requests[1].get_header(auth_header),
auth_hdr_value)
-
+ self.assertEqual(http_handler.requests[1].unredirected_hdrs[auth_header],
+ auth_hdr_value)
# if the password manager can't find a password, the handler won't
# handle the HTTP auth error
password_manager.user = password_manager.password = None
Modified: python/branches/py3k/Lib/urllib/request.py
==============================================================================
--- python/branches/py3k/Lib/urllib/request.py (original)
+++ python/branches/py3k/Lib/urllib/request.py Wed Feb 24 17:53:16 2010
@@ -795,7 +795,7 @@
auth = "Basic " + base64.b64encode(raw.encode()).decode("ascii")
if req.headers.get(self.auth_header, None) == auth:
return None
- req.add_header(self.auth_header, auth)
+ req.add_unredirected_header(self.auth_header, auth)
return self.parent.open(req, timeout=req.timeout)
else:
return None
More information about the Python-checkins
mailing list