Patchwork [1,of,2] keepalive: pass the correct arguments to HTTPResponse

login
register
mail settings
Submitter via Mercurial-devel
Date June 2, 2017, 11:03 p.m.
Message ID <80511f08c101eae26b77.1496444627@dragonair.svl.corp.google.com>
Download mbox | patch
Permalink /patch/21141/
State Accepted
Headers show

Comments

via Mercurial-devel - June 2, 2017, 11:03 p.m.
# HG changeset patch
# User Kyle Lippincott <spectral@google.com>
# Date 1496366600 25200
#      Thu Jun 01 18:23:20 2017 -0700
# Node ID 80511f08c101eae26b774a9759da271807e4bf0b
# Parent  5d44d7d4076e5a96001b0f88c730fa7ea24a9e02
keepalive: pass the correct arguments to HTTPResponse

python2.7's httplib.HTTPResponse takes the arguments in the following order:
    sock, debuglevel, strict, method, buffering

This was previously passing them in as positional and skipped strict, so we set
strict=method.  I'm explicitly setting strict=True now to preserve the previous
behavior that has been there since this file was created.
Yuya Nishihara - June 4, 2017, 1:09 p.m.
On Fri, 02 Jun 2017 16:03:47 -0700, Kyle Lippincott via Mercurial-devel wrote:
> # HG changeset patch
> # User Kyle Lippincott <spectral@google.com>
> # Date 1496366600 25200
> #      Thu Jun 01 18:23:20 2017 -0700
> # Node ID 80511f08c101eae26b774a9759da271807e4bf0b
> # Parent  5d44d7d4076e5a96001b0f88c730fa7ea24a9e02
> keepalive: pass the correct arguments to HTTPResponse

Looks good. Queued, thanks.

Patch

diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -353,7 +353,8 @@ 
 
 
     def __init__(self, sock, debuglevel=0, strict=0, method=None):
-        httplib.HTTPResponse.__init__(self, sock, debuglevel, method)
+        httplib.HTTPResponse.__init__(self, sock, debuglevel=debuglevel,
+                                      strict=True, method=method)
         self.fileno = sock.fileno
         self.code = None
         self._rbuf = ''