url: drop support for proxying HTTP (not HTTPS) over CONNECT tunneling
authorYuya Nishihara <yuya@tcha.org>
Sun, 05 Jun 2016 12:29:08 +0900
changeset 29599 e3dc96834126
parent 29598 a67398726747
child 29600 7a157639b8f2
url: drop support for proxying HTTP (not HTTPS) over CONNECT tunneling It's been broken since cca59ef27e60, which made ui argument mandatory. I've tried several combinations of HTTP/HTTPS proxying on old/new Python versions, but I couldn't figure out how to reach this code path. Also, wrapping HTTP connection by SSLSocket seems wrong. My understanding is that self.realhostport is set by _generic_start_transaction() if HTTPS connection is tunneled. This patch removes proxy tunneling from httpconnection.connect() assuming that it was dead code from the beginning. Note that HTTPS over tunneling should be handled by httpsconnection class.
mercurial/url.py
--- a/mercurial/url.py	Sat May 21 18:16:39 2016 +0900
+++ b/mercurial/url.py	Sun Jun 05 12:29:08 2016 +0900
@@ -185,17 +185,6 @@
     # must be able to send big bundle as stream.
     send = _gen_sendfile(keepalive.HTTPConnection.send)
 
-    def connect(self):
-        if has_https and self.realhostport: # use CONNECT proxy
-            self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-            self.sock.connect((self.host, self.port))
-            if _generic_proxytunnel(self):
-                # we do not support client X.509 certificates
-                self.sock = sslutil.wrapsocket(self.sock, None, None, None,
-                                               serverhostname=self.host)
-        else:
-            keepalive.HTTPConnection.connect(self)
-
     def getresponse(self):
         proxyres = getattr(self, 'proxyres', None)
         if proxyres: