Rev 2956: Fix #158972 don't use timeout for HttpServer in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Sat Nov 3 01:53:33 GMT 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2956
revision-id: pqm at pqm.ubuntu.com-20071103015330-pt1tec7wyxwwcey8
parent: pqm at pqm.ubuntu.com-20071031141102-b5664t8izotfnc6h
parent: v.ladeuil+lp at free.fr-20071102090358-urw3ymbkp19n9qgv
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2007-11-03 01:53:30 +0000
message:
Fix #158972 don't use timeout for HttpServer
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/HttpServer.py httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
------------------------------------------------------------
revno: 2955.1.1
merged: v.ladeuil+lp at free.fr-20071102090358-urw3ymbkp19n9qgv
parent: pqm at pqm.ubuntu.com-20071031141102-b5664t8izotfnc6h
parent: v.ladeuil+lp at free.fr-20071031143746-7jrk0tmczzzp9aoz
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Fri 2007-11-02 10:03:58 +0100
message:
Fix #158972 don't use timeout for HttpServer
------------------------------------------------------------
revno: 2953.2.2
merged: v.ladeuil+lp at free.fr-20071031143746-7jrk0tmczzzp9aoz
parent: v.ladeuil+lp at free.fr-20071031124242-zh1ub5bq2fqo9bzu
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 158972
timestamp: Wed 2007-10-31 15:37:46 +0100
message:
Fix #158972 don't use timeout for HttpServer
------------------------------------------------------------
revno: 2953.2.1
merged: v.ladeuil+lp at free.fr-20071031124242-zh1ub5bq2fqo9bzu
parent: pqm at pqm.ubuntu.com-20071031104053-fj7i7m8037qjgce4
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 158972
timestamp: Wed 2007-10-31 13:42:42 +0100
message:
Fix #158972 by not using timeout for HttpServer.
* bzrlib/tests/HttpServer.py:
(TestingHTTPRequestHandler._handle_one_request): Deleted.
(TestingHTTPServer.server_close): Shuwdown the socket before
closing it.
(HttpServer._http_start): No more timeout.
=== modified file 'NEWS'
--- a/NEWS 2007-10-31 09:46:42 +0000
+++ b/NEWS 2007-10-31 14:37:46 +0000
@@ -127,6 +127,9 @@
display a user friendly message instead of a traceback.
(Ian Clatworthy, #115601)
+ * Do no use timeout in HttpServer anymore.
+ (Vincent Ladeuil, #158972).
+
* Make sure to use ``O_BINARY`` when opening files to check their
sha1sum. (Alexander Belchenko, John Arbash Meinel, #153493)
=== modified file 'bzrlib/tests/HttpServer.py'
--- a/bzrlib/tests/HttpServer.py 2007-09-20 11:05:51 +0000
+++ b/bzrlib/tests/HttpServer.py 2007-10-31 12:42:42 +0000
@@ -64,7 +64,7 @@
connection early to avoid polluting the test results.
"""
try:
- self._handle_one_request()
+ SimpleHTTPRequestHandler.handle_one_request(self)
except socket.error, e:
if (len(e.args) > 0
and e.args[0] in (errno.EPIPE, errno.ECONNRESET,
@@ -74,43 +74,6 @@
else:
raise
- def _handle_one_request(self):
- """
- Request handling as defined in the base class.
-
- You normally don't need to override this method; see the class
- __doc__ string for information on how to handle specific HTTP
- commands such as GET and POST.
-
- On some platforms, notably OS X, a lot of EAGAIN (resource temporary
- unavailable) occur. We retry silently at most 10 times.
- """
- for i in xrange(1,11): # Don't try more than 10 times
- try:
- self.raw_requestline = self.rfile.readline()
- except socket.error, e:
- if e.args[0] in (errno.EAGAIN, errno.EWOULDBLOCK):
- # omitted for now because some tests look at the log of
- # the server and expect to see no errors. see recent
- # email thread. -- mbp 20051021.
- ## self.log_message('EAGAIN (%d) while reading from raw_requestline' % i)
- time.sleep(0.01)
- continue
- raise
- else:
- break
- if not self.raw_requestline:
- self.close_connection = 1
- return
- if not self.parse_request(): # An error code has been sent, just exit
- return
- mname = 'do_' + self.command
- if getattr(self, mname, None) is None:
- self.send_error(501, "Unsupported method (%r)" % self.command)
- return
- method = getattr(self, mname)
- method()
-
_range_regexp = re.compile(r'^(?P<start>\d+)-(?P<end>\d+)$')
_tail_regexp = re.compile(r'^-(?P<tail>\d+)$')
@@ -311,6 +274,15 @@
# the tests cases.
self.test_case_server = test_case_server
+ def server_close(self):
+ """Called to clean-up the server.
+
+ Since the server may be in a blocking read, we shutdown the socket
+ before closing it.
+ """
+ self.socket.shutdown(socket.SHUT_RDWR)
+ BaseHTTPServer.HTTPServer.server_close(self)
+
class HttpServer(Server):
"""A test server for http transports.
@@ -346,7 +318,6 @@
self._http_base_url = '%s://%s:%s/' % (self._url_protocol,
self.host,
self.port)
- httpd.socket.settimeout(0.1)
self._http_starting.release()
while self._http_running:
More information about the bazaar-commits
mailing list