[Python-checkins] r54195 - python/trunk/Lib/urllib2.py

georg.brandl python-checkins at python.org
Wed Mar 7 08:39:08 CET 2007


Author: georg.brandl
Date: Wed Mar  7 08:39:06 2007
New Revision: 54195

Modified:
   python/trunk/Lib/urllib2.py
Log:
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.


Modified: python/trunk/Lib/urllib2.py
==============================================================================
--- python/trunk/Lib/urllib2.py	(original)
+++ python/trunk/Lib/urllib2.py	Wed Mar  7 08:39:06 2007
@@ -767,11 +767,10 @@
 
 class AbstractBasicAuthHandler:
 
-    rx = re.compile('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', re.I)
+    # XXX this allows for multiple auth-schemes, but will stupidly pick
+    # the last one with a realm specified.
 
-    # XXX there can actually be multiple auth-schemes in a
-    # www-authenticate header.  should probably be a lot more careful
-    # in parsing them to extract multiple alternatives
+    rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', re.I)
 
     # XXX could pre-emptively send auth info already accepted (RFC 2617,
     # end of section 2, and section 1.2 immediately after "credentials"


More information about the Python-checkins mailing list