We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8d21aa2 commit 33e2642Copy full SHA for 33e2642
1 file changed
Lib/urllib2.py
@@ -856,8 +856,16 @@ class AbstractBasicAuthHandler:
856
857
# allow for double- and single-quoted realm values
858
# (single quotes are a violation of the RFC, but appear in the wild)
859
- rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
860
- 'realm=(["\']?)([^"\']*)\\2', re.I)
+
+ rx = re.compile('(?:^|,)' # start of the string or ','
861
+ '[ \t]*' # optional whitespaces
862
+ '([^ \t]+)' # scheme like "Basic"
863
+ '[ \t]+' # mandatory whitespaces
864
+ # realm=xxx
865
+ # realm='xxx'
866
+ # realm="xxx"
867
+ 'realm=(["\']?)([^"\']*)\\2',
868
+ re.I)
869
870
# XXX could pre-emptively send auth info already accepted (RFC 2617,
871
# end of section 2, and section 1.2 immediately after "credentials"
0 commit comments