Rev 4051: merge jelmer patches in file:///net/bigmamac/Volumes/home/vila/src/bzr/bugs/256612-http-auth/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Feb 25 18:58:51 GMT 2009
At file:///net/bigmamac/Volumes/home/vila/src/bzr/bugs/256612-http-auth/
------------------------------------------------------------
revno: 4051
revision-id: v.ladeuil+lp at free.fr-20090225185843-mns85a9v5zqr60ef
parent: pqm at pqm.ubuntu.com-20090225171156-l63eiz2bz51ialsg
parent: jelmer at samba.org-20090218165011-dp0uuk76echk0dta
parent: jelmer at samba.org-20090218162331-hjjc7us2hd6hbfl0
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 256612-http-auth
timestamp: Wed 2009-02-25 19:58:43 +0100
message:
merge jelmer patches
modified:
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
------------------------------------------------------------
revno: 4017.6.1
revision-id: jelmer at samba.org-20090218165011-dp0uuk76echk0dta
parent: pqm at pqm.ubuntu.com-20090218132708-okubrahz9exvae9r
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: bzr.dev
timestamp: Wed 2009-02-18 17:50:11 +0100
message:
Cope with the WWW-Authenticate header containing only a single word in
Digest/Basic authentication.
modified:
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
------------------------------------------------------------
revno: 4017.5.1
revision-id: jelmer at samba.org-20090218162331-hjjc7us2hd6hbfl0
parent: pqm at pqm.ubuntu.com-20090218132708-okubrahz9exvae9r
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: bzr.dev
timestamp: Wed 2009-02-18 17:23:31 +0100
message:
Allow HTTP authentication handlers (such as the NegotiateAuthHandler) to
do authentication without a username.
modified:
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
-------------- next part --------------
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py 2009-02-23 16:15:00 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py 2009-02-25 18:58:43 +0000
@@ -987,6 +987,7 @@
# classes:
# - auth_required_header: the header received from the server
# - auth_header: the header sent in the request
+ # - requires_username: whether the auth mechanism requires a username
def __init__(self):
# We want to know when we enter into an try/fail cycle of
@@ -1034,7 +1035,7 @@
# We already tried that, give up
return None
- if auth.get('user', None) is None:
+ if self.requires_username and auth.get('user', None) is None:
# Without a known user, we can't authenticate
return None
@@ -1158,6 +1159,8 @@
handler_order = 480
+ requires_username = False
+
def auth_match(self, header, auth):
scheme = header.lower()
if scheme != 'negotiate':
@@ -1203,13 +1206,18 @@
auth_regexp = re.compile('realm="([^"]*)"', re.I)
+ requires_username = True
+
def build_auth_header(self, auth, request):
raw = '%s:%s' % (auth['user'], auth['password'])
auth_header = 'Basic ' + raw.encode('base64').strip()
return auth_header
def auth_match(self, header, auth):
- scheme, raw_auth = header.split(None, 1)
+ try:
+ scheme, raw_auth = header.split(None, 1)
+ except ValueError:
+ return False
scheme = scheme.lower()
if scheme != 'basic':
return False
@@ -1260,6 +1268,8 @@
# Before basic as digest is a bit more secure
handler_order = 490
+ requires_username = True
+
def auth_params_reusable(self, auth):
# If the auth scheme is known, it means a previous
# authentication was successful, all information is
@@ -1267,7 +1277,10 @@
return auth.get('scheme', None) == 'digest'
def auth_match(self, header, auth):
- scheme, raw_auth = header.split(None, 1)
+ try:
+ scheme, raw_auth = header.split(None, 1)
+ except ValueError:
+ return False
scheme = scheme.lower()
if scheme != 'digest':
return False
More information about the bazaar-commits
mailing list