[PATCH] httpclient: Import f4c380237fd5 to fix keepalive not working

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Wed May 11 08:07:44 CDT 2011


On Wed, May 11, 2011 at 3:02 PM, Augie Fackler <durin42 at gmail.com> wrote:
> # HG changeset patch
> # User Augie Fackler <durin42 at gmail.com>
> # Date 1305118848 18000
> # Node ID b2d9568cc3292668bfad9bde1119bfa638059e36
> # Parent  34ec9b313638b8930cec1dc77149893b5b892895
> httpclient: Import f4c380237fd5 to fix keepalive not working.
>
> diff --git a/mercurial/httpclient/__init__.py b/mercurial/httpclient/__init__.py
> --- a/mercurial/httpclient/__init__.py
> +++ b/mercurial/httpclient/__init__.py
> @@ -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
> diff --git a/mercurial/httpclient/tests/simple_http_test.py b/mercurial/httpclient/tests/simple_http_test.py
> --- a/mercurial/httpclient/tests/simple_http_test.py
> +++ b/mercurial/httpclient/tests/simple_http_test.py
> @@ -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')
>

Works for me.
-parren


More information about the Mercurial-devel mailing list