Rev 3134: Make HTTP/1.1 the default implementation reveals one more bug. in file:///v/home/vila/src/bzr/bugs/175524/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Dec 24 10:31:28 GMT 2007
At file:///v/home/vila/src/bzr/bugs/175524/
------------------------------------------------------------
revno: 3134
revision-id:v.ladeuil+lp at free.fr-20071224103124-oojmi9jenve9irat
parent: v.ladeuil+lp at free.fr-20071223174827-sepgat9fxmpnax0f
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 175524
timestamp: Mon 2007-12-24 11:31:24 +0100
message:
Make HTTP/1.1 the default implementation reveals one more bug.
* bzrlib/tests/http_server.py:
(TestingHTTPRequestHandler): Make 1.1 the default protocol
version.
(TestingHTTPRequestHandler.send_head): Fix python2.5
implementation bug (specify Content-Length).
modified:
bzrlib/tests/blackbox/test_selftest.py test_selftest.py-20060123024542-01c5f1bbcb596d78
bzrlib/tests/http_server.py httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
-------------- next part --------------
=== modified file 'bzrlib/tests/blackbox/test_selftest.py'
--- a/bzrlib/tests/blackbox/test_selftest.py 2007-09-18 06:31:55 +0000
+++ b/bzrlib/tests/blackbox/test_selftest.py 2007-12-24 10:31:24 +0000
@@ -174,7 +174,7 @@
def test_benchmark_runs_benchmark_tests(self):
"""bzr selftest --benchmark should not run the default test suite."""
# We test this by passing a regression test name to --benchmark, which
- # should result in 0 rests run.
+ # should result in 0 tests run.
old_root = TestCaseWithMemoryTransport.TEST_ROOT
try:
TestCaseWithMemoryTransport.TEST_ROOT = None
=== modified file 'bzrlib/tests/http_server.py'
--- a/bzrlib/tests/http_server.py 2007-12-23 17:48:27 +0000
+++ b/bzrlib/tests/http_server.py 2007-12-24 10:31:24 +0000
@@ -54,6 +54,9 @@
# The Message-like class used to parse the request headers
MessageClass = httplib.HTTPMessage
+ # Default protocol version
+ protocol_version = 'HTTP/1.1'
+
def setup(self):
SimpleHTTPServer.SimpleHTTPRequestHandler.setup(self)
tcs = self.server.test_case_server
@@ -124,6 +127,22 @@
return 0, []
return tail, ranges
+ def send_head(self):
+ """Overrides base implementation to work around a bug in python2.5."""
+ path = self.translate_path(self.path)
+ if os.path.isdir(path) and not self.path.endswith('/'):
+ # redirect browser - doing basically what apache does when
+ # DirectorySlash option is On which is quite common (braindead, but
+ # common)
+ self.send_response(301)
+ self.send_header("Location", self.path + "/")
+ # Indicates that the body is empty for HTTP/1.1 clients
+ self.send_header('Content-Length', '0')
+ self.end_headers()
+ return None
+
+ return SimpleHTTPServer.SimpleHTTPRequestHandler.send_head(self)
+
def send_range_content(self, file, start, length):
file.seek(start)
self.wfile.write(file.read(length))
=== modified file 'bzrlib/tests/test_transport_implementations.py'
--- a/bzrlib/tests/test_transport_implementations.py 2007-12-10 10:41:24 +0000
+++ b/bzrlib/tests/test_transport_implementations.py 2007-12-24 10:31:24 +0000
@@ -215,8 +215,8 @@
except (errors.PathError, errors.RedirectRequested):
# early failure return immediately.
return
- # having got a file, read() must either work (i.e. http reading a dir listing) or
- # fail with ReadError
+ # having got a file, read() must either work (i.e. http reading a dir
+ # listing) or fail with ReadError
try:
a_file.read()
except errors.ReadError:
More information about the bazaar-commits
mailing list