Issue #12541: Be lenient with quotes around Realm field of HTTP Basic Authentation in urllib2.

G: changed Misc/NEWS
This commit is contained in:
Senthil Kumaran 2012-05-15 22:30:25 +08:00
parent 539f239e88
commit 34f3fcc269
3 changed files with 19 additions and 1 deletions

View file

@ -794,7 +794,7 @@ class AbstractBasicAuthHandler:
# allow for double- and single-quoted realm values
# (single quotes are a violation of the RFC, but appear in the wild)
rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
'realm=(["\'])(.*?)\\2', re.I)
'realm=(["\']?)([^"\']*)\\2', re.I)
# XXX could pre-emptively send auth info already accepted (RFC 2617,
# end of section 2, and section 1.2 immediately after "credentials"