469,609 Members | 1,652 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Problem with RE in AbstractBasicAuthHandler

Hi,

I was trying to use the HTTPBasicAuthHandler with an MS web server
requiring authentication (basic) but without success. I digged a bit
in the urllib2 module (python 2.3.4) and it turned out to be a problem
with the regular expression matching in the
AbstractBasicAuthHandler.http_error_auth_reqed() function. The
rx.match() cannot be used since it always matches from the beginning
of the string and the reply from my server had 2 more words in front
(Negotiate, NTLM, Basic realm="...").

The patch below fixes this by replacing match() with search():

================================================== ================
--- urllib2.py-orig 2004-07-20 16:10:28.000000000 +0100
+++ urllib2.py 2004-07-20 16:29:34.000000000 +0100
@@ -631,7 +631,7 @@
# XXX could be multiple headers
authreq = headers.get(authreq, None)
if authreq:
- mo = AbstractBasicAuthHandler.rx.match(authreq)
+ mo = AbstractBasicAuthHandler.rx.search(authreq)
if mo:
scheme, realm = mo.groups()
if scheme.lower() == 'basic':
================================================== ================

Thanks,

Catalin
Jul 18 '05 #1
0 872

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by bmiras | last post: by
reply views Thread by Bruce Davis | last post: by
11 posts views Thread by Kostatus | last post: by
117 posts views Thread by Peter Olcott | last post: by
28 posts views Thread by Jon Davis | last post: by
6 posts views Thread by Ammar | last post: by
2 posts views Thread by Mike Collins | last post: by
reply views Thread by Solution2021 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.