Mercurial > public > mercurial-scm > hg
comparison mercurial/url.py @ 29599:e3dc96834126
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 05 Jun 2016 12:29:08 +0900 |
parents | 486de14eb394 |
children | 6fd751fa58d3 |
comparison
equal
deleted
inserted
replaced
29598:a67398726747 | 29599:e3dc96834126 |
---|---|
182 raise socket.error(msg) | 182 raise socket.error(msg) |
183 | 183 |
184 class httpconnection(keepalive.HTTPConnection): | 184 class httpconnection(keepalive.HTTPConnection): |
185 # must be able to send big bundle as stream. | 185 # must be able to send big bundle as stream. |
186 send = _gen_sendfile(keepalive.HTTPConnection.send) | 186 send = _gen_sendfile(keepalive.HTTPConnection.send) |
187 | |
188 def connect(self): | |
189 if has_https and self.realhostport: # use CONNECT proxy | |
190 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
191 self.sock.connect((self.host, self.port)) | |
192 if _generic_proxytunnel(self): | |
193 # we do not support client X.509 certificates | |
194 self.sock = sslutil.wrapsocket(self.sock, None, None, None, | |
195 serverhostname=self.host) | |
196 else: | |
197 keepalive.HTTPConnection.connect(self) | |
198 | 187 |
199 def getresponse(self): | 188 def getresponse(self): |
200 proxyres = getattr(self, 'proxyres', None) | 189 proxyres = getattr(self, 'proxyres', None) |
201 if proxyres: | 190 if proxyres: |
202 if proxyres.will_close: | 191 if proxyres.will_close: |