[Differential] [Request, 5 lines] D72: httpclient: honor the timeout when setting up the connection
simpkins (Adam Simpkins)
phabricator at mercurial-scm.org
Thu Jul 13 04:13:04 UTC 2017
simpkins created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Previously HTTPConnection._connect() called socket.create_connection() without
specifying a timeout. This could cause the code to hang forever trying to
establish a connection, even if a timeout parameter was specified when
creating the HTTPConnection object.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D72
AFFECTED FILES
mercurial/httpclient/__init__.py
CHANGE DETAILS
Index: mercurial/httpclient/__init__.py
===================================================================
--- mercurial/httpclient/__init__.py
+++ mercurial/httpclient/__init__.py
@@ -517,7 +517,7 @@
logger.info('Connecting to http proxy %s:%s',
self._proxy_host, self._proxy_port)
sock = socket.create_connection((self._proxy_host,
- self._proxy_port))
+ self._proxy_port), self.timeout)
if self.ssl:
data = self._buildheaders(b'CONNECT', b'%s:%d' % (self.host,
self.port),
@@ -549,7 +549,8 @@
logger.info('CONNECT (for SSL) to %s:%s via proxy succeeded.',
self.host, self.port)
else:
- sock = socket.create_connection((self.host, self.port))
+ sock = socket.create_connection((self.host, self.port),
+ self.timeout)
if self.ssl:
# This is the default, but in the case of proxied SSL
# requests the proxy logic above will have cleared
EMAIL PREFERENCES
https://phab.mercurial-scm.org/settings/panel/emailpreferences/
To: simpkins, #hg-reviewers
Cc: mercurial-devel, indygreg
More information about the Mercurial-devel
mailing list