[PATCH stable] httpclient (experimental): use blocking socket for ssl wrapping (issue3268)
Mads Kiilerich
mads at kiilerich.com
Fri May 18 14:50:51 CDT 2012
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1337370545 -7200
# Branch stable
# Node ID a24a034227e6d23985b406e6a006bb751967963a
# Parent c20efe04cd7a265dc3b0f28ac56a88f5d9af8859
httpclient (experimental): use blocking socket for ssl wrapping (issue3268)
httpclient use non-blocking sockets, but ssl.wrap_socket apparently requires
blocking sockets ... but apparently only when the socket has been used before,
for example for proxy CONNECT.
The failing connection could be seen with
$ tests/tinyproxy.py &
$ hg id --config ui.usehttp2=1 --config http_proxy.host=localhost:8000 https://bitbucket.org/mirror/mercurial
diff --git a/mercurial/httpclient/__init__.py b/mercurial/httpclient/__init__.py
--- a/mercurial/httpclient/__init__.py
+++ b/mercurial/httpclient/__init__.py
@@ -407,6 +407,7 @@
if self.ssl:
logger.debug('wrapping socket for ssl with options %r',
self.ssl_opts)
+ sock.setblocking(1)
sock = socketutil.wrap_socket(sock, **self.ssl_opts)
if self._ssl_validator:
self._ssl_validator(sock)
More information about the Mercurial-devel
mailing list