[Patches] [ python-Patches-812285 ] More precise realm parsing in AbstractBasicAuthHandler
SourceForge.net
noreply at sourceforge.net
Wed Mar 7 08:39:29 CET 2007
Patches item #812285, was opened at 2003-09-25 08:47
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=812285&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Federico Di Carlo (federicodc)
Assigned to: Nobody/Anonymous (nobody)
Summary: More precise realm parsing in AbstractBasicAuthHandler
Initial Comment:
AbstractBasicAuthHandler class parses headers to search
for a scheme and its realm.
"rx" is the compiled regular expression that is used to
match these items. But it doesn't work on multiple
auth-schemes (as stated in urllib2.py source code).
Since I HAD to work around this issue (we have NTLM
authentication first in our proxy) I managed a bit the
regular expression (rx) and its groups.
The auth-request I had to face is:
< NTLM, Basic realm="something" >, so I created a RE
with named groups to find exactly the type of request
that has a "realm" after the scheme, and that can
contain commas, in this way:
< ([ \t]+|(.*,)+)*(?P<scheme>[^ \t]+)[
\t]+realm="(?P<realm>[^"]*)"' >
Matching groups "scheme" and "realm" will contain right
values as parsed.
This will NOT fix issue with multiple realm-based
requests (it will return only last one), but seems to
handle well requests like the one specified.
Diff attached for Python 2.3
Hope this helps,
Federico Di Carlo
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2007-03-07 07:39
Message:
Logged In: YES
user_id=849994
Originator: NO
Thanks for the patch, committed a similar one as rev. 54195, 54196 (2.5).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=812285&group_id=5470
More information about the Patches
mailing list