]> granicus.if.org Git - python/commitdiff
Merged revisions 78422 via svnmerge from
authorSenthil Kumaran <orsenthil@gmail.com>
Wed, 24 Feb 2010 16:49:45 +0000 (16:49 +0000)
committerSenthil Kumaran <orsenthil@gmail.com>
Wed, 24 Feb 2010 16:49:45 +0000 (16:49 +0000)
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
........

Lib/test/test_urllib2.py
Lib/urllib2.py

index 485d5e98516b39fcbf1e7a2432e0a1cb314d430e..c911c9d2c074274248402882bfe470d9b4e527c6 100644 (file)
@@ -1134,7 +1134,8 @@ class HandlerTests(unittest.TestCase):
         auth_hdr_value = 'Basic '+base64.encodestring(userpass).strip()
         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
index b7f2cf46e15d36b17d5849f132865e217c8134fd..b416913f49292c274a52009295dc6eced82758a9 100644 (file)
@@ -839,7 +839,7 @@ class AbstractBasicAuthHandler:
             auth = 'Basic %s' % base64.b64encode(raw).strip()
             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