changeset 40031:f2dffa1359c6

url: have httpsconnection inherit from our custom HTTPConnection This will ensure that any customizations we perform to HTTPConnection will be available to httpsconnection. Differential Revision: https://phab.mercurial-scm.org/D4855
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 01 Oct 2018 12:06:36 -0700
parents 62160d3077cd
children dc82ad1b7f77
files mercurial/keepalive.py mercurial/url.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/keepalive.py	Wed Oct 03 09:43:01 2018 -0700
+++ b/mercurial/keepalive.py	Mon Oct 01 12:06:36 2018 -0700
@@ -615,6 +615,10 @@
     return safegetresponse
 
 class HTTPConnection(httplib.HTTPConnection):
+    # url.httpsconnection inherits from this. So when adding/removing
+    # attributes, be sure to audit httpsconnection() for unintended
+    # consequences.
+
     # use the modified response class
     response_class = HTTPResponse
     send = safesend
--- a/mercurial/url.py	Wed Oct 03 09:43:01 2018 -0700
+++ b/mercurial/url.py	Mon Oct 01 12:06:36 2018 -0700
@@ -339,7 +339,7 @@
         return logginghttpconnection(createconnection, *args, **kwargs)
 
 if has_https:
-    class httpsconnection(httplib.HTTPConnection):
+    class httpsconnection(keepalive.HTTPConnection):
         response_class = keepalive.HTTPResponse
         default_port = httplib.HTTPS_PORT
         # must be able to send big bundle as stream.
@@ -348,7 +348,7 @@
 
         def __init__(self, host, port=None, key_file=None, cert_file=None,
                      *args, **kwargs):
-            httplib.HTTPConnection.__init__(self, host, port, *args, **kwargs)
+            keepalive.HTTPConnection.__init__(self, host, port, *args, **kwargs)
             self.key_file = key_file
             self.cert_file = cert_file