changeset 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 af776c3d5c3e
children 4be9ecc982e1
files mercurial/url.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/url.py	Tue Mar 21 15:44:38 2023 +0000
+++ b/mercurial/url.py	Tue Mar 21 15:27:03 2023 +0100
@@ -327,7 +327,9 @@
             self.cert_file = cert_file
 
         def connect(self):
-            self.sock = socket.create_connection((self.host, self.port))
+            self.sock = socket.create_connection(
+                (self.host, self.port), self.timeout
+            )
 
             host = self.host
             realhostport = self.realhostport  # pytype: disable=attribute-error