Rev 2546: Fix 121889 by working around urllib2 bug. in file:///v/home/vila/src/bugs/121889/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sun Jun 24 16:16:43 BST 2007
At file:///v/home/vila/src/bugs/121889/
------------------------------------------------------------
revno: 2546
revision-id: v.ladeuil+lp at free.fr-20070624151640-5tg62jb5g9tqvybd
parent: pqm at pqm.ubuntu.com-20070622160825-17gv0lorkzbr3x76
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 121889
timestamp: Sun 2007-06-24 17:16:40 +0200
message:
Fix 121889 by working around urllib2 bug.
* tests/HTTPTestUtil.py:
(DigestAuthRequestHandler.send_header_auth_reqed): python-2.4.1
fail to decode the header without the quotes. The RFC do not
require them, python >= 2.4.4 handles them gracefully. Not a big
deal.
* tests/test_http.py:
(TestAuth.setUp): Add a comment in hope I will not running around
shouting: "Who takes my traces ? Gimme my traces !" when running
the only tests who capture their own traces without showing them.
* transport/http/_urllib2_wrappers.py (BasicAuthHandler,
DigestAuthHandler): Not directly related to the bug, bug good to
fix anyway, the digest auth should be preferred to the basic
one. To do so, the digest handler should be tried before the basic
one.
* builtins.py:
(cmd_selftest.run): Fix typo. Note to reviewers: No, it's not
related to the bug. No there are no tests for that. No I don't
intend to write some :) But I'll understand if you veto that
because you want to take care of it :D
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/HTTPTestUtil.py HTTPTestUtil.py-20050914180604-247d3aafb7a43343
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2007-06-19 14:49:06 +0000
+++ b/bzrlib/builtins.py 2007-06-24 15:16:40 +0000
@@ -2472,9 +2472,9 @@
clean_selftest_output()
return 0
if keep_output:
- trace.warning("notice: selftest --keep-output "
- "is no longer supported; "
- "test output is always removed")
+ warning("notice: selftest --keep-output "
+ "is no longer supported; "
+ "test output is always removed")
if numbered_dirs is None and sys.platform == 'win32':
numbered_dirs = True
=== modified file 'bzrlib/tests/HTTPTestUtil.py'
--- a/bzrlib/tests/HTTPTestUtil.py 2007-05-06 06:59:57 +0000
+++ b/bzrlib/tests/HTTPTestUtil.py 2007-06-24 15:16:40 +0000
@@ -393,7 +393,8 @@
def send_header_auth_reqed(self):
tcs = self.server.test_case_server
header = 'Digest realm="%s", ' % tcs.auth_realm
- header += 'nonce="%s", algorithm=%s, qop=auth' % (tcs.auth_nonce, 'MD5')
+ header += 'nonce="%s", algorithm="%s", qop="auth"' % (tcs.auth_nonce,
+ 'MD5')
self.send_header(tcs.auth_header_sent,header)
=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py 2007-05-06 06:59:57 +0000
+++ b/bzrlib/tests/test_http.py 2007-06-24 15:16:40 +0000
@@ -1176,6 +1176,10 @@
self.build_tree_contents([('a', 'contents of a\n'),
('b', 'contents of b\n'),])
self.old_factory = ui.ui_factory
+ # The following has the unfortunate side-effect of hiding any ouput
+ # during the tests (including pdb prompts). Feel free to comment them
+ # for debugging purposes but leave them in place, there are needed to
+ # run the tests without any console
self.old_stdout = sys.stdout
sys.stdout = StringIOWrapper()
self.addCleanup(self.restoreUIFactory)
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py 2007-04-22 16:32:04 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py 2007-06-24 15:16:40 +0000
@@ -916,6 +916,8 @@
class BasicAuthHandler(AbstractAuthHandler):
"""A custom basic authentication handler."""
+ handler_order = 500
+
auth_regexp = re.compile('realm="([^"]*)"', re.I)
def build_auth_header(self, auth, request):
@@ -972,6 +974,9 @@
class DigestAuthHandler(AbstractAuthHandler):
"""A custom digest authentication handler."""
+ # Before basic as digest is a bit more secure
+ handler_order = 490
+
def auth_params_reusable(self, auth):
# If the auth scheme is known, it means a previous
# authentication was successful, all information is
More information about the bazaar-commits
mailing list