Rev 5292: Closing the connection is what pycurl was waiting for. in file:///home/vila/src/bzr/experimental/leaking-tests/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Jun 23 17:43:16 BST 2010


At file:///home/vila/src/bzr/experimental/leaking-tests/

------------------------------------------------------------
revno: 5292
revision-id: v.ladeuil+lp at free.fr-20100623164316-yffl9m72oh8jy46a
parent: v.ladeuil+lp at free.fr-20100623160259-9en1egy7vydcu54e
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: http-leaks
timestamp: Wed 2010-06-23 18:43:16 +0200
message:
  Closing the connection is what pycurl was waiting for.
-------------- next part --------------
=== modified file 'bzrlib/tests/http_server.py'
--- a/bzrlib/tests/http_server.py	2010-06-05 09:01:06 +0000
+++ b/bzrlib/tests/http_server.py	2010-06-23 16:43:16 +0000
@@ -78,7 +78,7 @@
     def handle(self):
         SimpleHTTPServer.SimpleHTTPRequestHandler.handle(self)
         # Some client (pycurl, I'm looking at you) are more picky than others
-        # and require that the socket itself is close
+        # and require that the socket itself is closed
         # (SocketServer.StreamRequestHandler only close the two associated
         # 'makefile' objects)
         self.connection.close()

=== modified file 'bzrlib/tests/http_utils.py'
--- a/bzrlib/tests/http_utils.py	2010-06-12 14:56:23 +0000
+++ b/bzrlib/tests/http_utils.py	2010-06-23 16:43:16 +0000
@@ -111,7 +111,7 @@
 
     # These attributes can be overriden or parametrized by daughter clasess if
     # needed, but must exist so that the create_transport_readonly_server()
-    # method (or any method creating an http(s) server can propagate it.
+    # method (or any method creating an http(s) server) can propagate it.
     _protocol_version = None
     _url_protocol = 'http'
 

=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py	2010-06-12 14:56:23 +0000
+++ b/bzrlib/tests/test_http.py	2010-06-23 16:43:16 +0000
@@ -667,6 +667,10 @@
         """Fakes handling a single HTTP request, returns a bad status"""
         ignored = http_server.TestingHTTPRequestHandler.parse_request(self)
         self.wfile.write("Invalid status line\r\n")
+        # If we don't close the connection pycurl will hang. Since this is a
+        # stress test we don't *have* to respect the protocol, but we don't
+        # have to sabotage it too much either.
+        self.close_connection = True
         return False
 
 
@@ -678,19 +682,6 @@
 
     _req_handler_class = InvalidStatusRequestHandler
 
-    def test_http_has(self):
-        # FIXME: that should be fixed now, needs testing -- vila 20100611
-        if self._testing_pycurl() and self._protocol_version == 'HTTP/1.1':
-            raise tests.KnownFailure(
-                'pycurl hangs if the server send back garbage')
-        super(TestInvalidStatusServer, self).test_http_has()
-
-    def test_http_get(self):
-        if self._testing_pycurl() and self._protocol_version == 'HTTP/1.1':
-            raise tests.KnownFailure(
-                'pycurl hangs if the server send back garbage')
-        super(TestInvalidStatusServer, self).test_http_get()
-
 
 class BadProtocolRequestHandler(http_server.TestingHTTPRequestHandler):
     """Whatever request comes in, returns a bad protocol version"""



More information about the bazaar-commits mailing list