Mercurial > public > mercurial-scm > hg
comparison mercurial/url.py @ 50318:3bb7c56e8fe6 stable
url: don't ignore timeout for https connections
For http, we use the stdlib's HTTPConnection.connect which passes the
timeout down to socket.create_connection; for https, we override the
connect method but weren't handling the timeout, so connections could
hang for hours even with http.timeout set to low values.
author | Julien Cristau <jcristau@mozilla.com> |
---|---|
date | Tue, 21 Mar 2023 15:27:03 +0100 |
parents | 9f3edb305261 |
children | ecaf00089461 |
comparison
equal
deleted
inserted
replaced
50317:af776c3d5c3e | 50318:3bb7c56e8fe6 |
---|---|
325 keepalive.HTTPConnection.__init__(self, host, port, *args, **kwargs) | 325 keepalive.HTTPConnection.__init__(self, host, port, *args, **kwargs) |
326 self.key_file = key_file | 326 self.key_file = key_file |
327 self.cert_file = cert_file | 327 self.cert_file = cert_file |
328 | 328 |
329 def connect(self): | 329 def connect(self): |
330 self.sock = socket.create_connection((self.host, self.port)) | 330 self.sock = socket.create_connection( |
331 (self.host, self.port), self.timeout | |
332 ) | |
331 | 333 |
332 host = self.host | 334 host = self.host |
333 realhostport = self.realhostport # pytype: disable=attribute-error | 335 realhostport = self.realhostport # pytype: disable=attribute-error |
334 if realhostport: # use CONNECT proxy | 336 if realhostport: # use CONNECT proxy |
335 _generic_proxytunnel(self) | 337 _generic_proxytunnel(self) |