changeset 14293:9adbb5ef0964

httpclient: import f4c380237fd5 to fix keepalive not working
author Augie Fackler <durin42@gmail.com>
date Wed, 11 May 2011 08:00:48 -0500
parents c97d8485b5fa
children 84256ba2fbf7
files mercurial/httpclient/__init__.py mercurial/httpclient/tests/simple_http_test.py
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httpclient/__init__.py	Wed May 11 11:04:44 2011 +0200
+++ b/mercurial/httpclient/__init__.py	Wed May 11 08:00:48 2011 -0500
@@ -629,9 +629,11 @@
         r = self._current_response
         while r.headers is None:
             r._select()
-        if r.complete() or r.will_close:
+        if r.will_close:
             self.sock = None
             self._current_response = None
+        elif r.complete():
+            self._current_response = None
         else:
             self._current_response_taken = True
         return r
--- a/mercurial/httpclient/tests/simple_http_test.py	Wed May 11 11:04:44 2011 +0200
+++ b/mercurial/httpclient/tests/simple_http_test.py	Wed May 11 08:00:48 2011 -0500
@@ -116,6 +116,9 @@
         self.assertEqual('1234567890', resp.read())
         self.assertEqual(['Value\n Rest of value'],
                          resp.headers.getheaders('multiline'))
+        # Socket should not be closed
+        self.assertEqual(resp.sock.closed, False)
+        self.assertEqual(con.sock.closed, False)
 
     def testSimpleRequest(self):
         con = http.HTTPConnection('1.2.3.4:80')