Merge lp:~jelmer/bzr/missing-get-revdelta into lp:~bzr/bzr/trunk-old

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jelmer/bzr/missing-get-revdelta
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: None lines
To merge this branch: bzr merge lp:~jelmer/bzr/missing-get-revdelta
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

The attached patch allows AuthHandlers in the HTTP code to indicate that
they do not require a username.

This means it's possible to use GSSAPI authentication without a username in
the URL.

Cheers,

 Jelmer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- bzrlib/transport/http/_urllib2_wrappers.py 2009-02-17 14:46:26 +0000
+++ bzrlib/transport/http/_urllib2_wrappers.py 2009-02-18 16:23:31 +0000
@@ -987,6 +987,7 @@
987 # classes:987 # classes:
988 # - auth_required_header: the header received from the server988 # - auth_required_header: the header received from the server
989 # - auth_header: the header sent in the request989 # - auth_header: the header sent in the request
990 # - requires_username: whether the auth mechanism requires a username
990991
991 def __init__(self):992 def __init__(self):
992 # We want to know when we enter into an try/fail cycle of993 # We want to know when we enter into an try/fail cycle of
@@ -1034,7 +1035,7 @@
1034 # We already tried that, give up1035 # We already tried that, give up
1035 return None1036 return None
10361037
1037 if auth.get('user', None) is None:1038 if self.requires_username and auth.get('user', None) is None:
1038 # Without a known user, we can't authenticate1039 # Without a known user, we can't authenticate
1039 return None1040 return None
10401041
@@ -1158,6 +1159,8 @@
11581159
1159 handler_order = 4801160 handler_order = 480
11601161
1162 requires_username = False
1163
1161 def auth_match(self, header, auth):1164 def auth_match(self, header, auth):
1162 scheme = header.lower()1165 scheme = header.lower()
1163 if scheme != 'negotiate':1166 if scheme != 'negotiate':
@@ -1203,6 +1206,8 @@
12031206
1204 auth_regexp = re.compile('realm="([^"]*)"', re.I)1207 auth_regexp = re.compile('realm="([^"]*)"', re.I)
12051208
1209 requires_username = True
1210
1206 def build_auth_header(self, auth, request):1211 def build_auth_header(self, auth, request):
1207 raw = '%s:%s' % (auth['user'], auth['password'])1212 raw = '%s:%s' % (auth['user'], auth['password'])
1208 auth_header = 'Basic ' + raw.encode('base64').strip()1213 auth_header = 'Basic ' + raw.encode('base64').strip()
@@ -1260,6 +1265,8 @@
1260 # Before basic as digest is a bit more secure1265 # Before basic as digest is a bit more secure
1261 handler_order = 4901266 handler_order = 490
12621267
1268 requires_username = True
1269
1263 def auth_params_reusable(self, auth):1270 def auth_params_reusable(self, auth):
1264 # If the auth scheme is known, it means a previous1271 # If the auth scheme is known, it means a previous
1265 # authentication was successful, all information is1272 # authentication was successful, all information is