comparison mercurial/url.py @ 41708:d20f1594ff4a

url: always access req._tunnel_host The getattr() was there to handle Python versions before 2.6, which lacked this attribute. We /might/ be able to further delete some code here. However, the behavior here is extremely hard to follow because large parts of this code duplicate code from the Python standard library and it is difficult to understand what is actually needed. Differential Revision: https://phab.mercurial-scm.org/D5950
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 12 Feb 2019 12:13:56 -0800
parents 349c8879becd
children 4028897dfa05
comparison
equal deleted inserted replaced
41707:140b542b0e59 41708:d20f1594ff4a
177 self.close() 177 self.close()
178 self.proxyres = None 178 self.proxyres = None
179 return proxyres 179 return proxyres
180 return keepalive.HTTPConnection.getresponse(self) 180 return keepalive.HTTPConnection.getresponse(self)
181 181
182 # general transaction handler to support different ways to handle 182 # Large parts of this function have their origin from before Python 2.6
183 # HTTPS proxying before and after Python 2.6.3. 183 # and could potentially be removed.
184 def _generic_start_transaction(handler, h, req): 184 def _generic_start_transaction(handler, h, req):
185 tunnel_host = getattr(req, '_tunnel_host', None) 185 tunnel_host = req._tunnel_host
186 if tunnel_host: 186 if tunnel_host:
187 if tunnel_host[:7] not in ['http://', 'https:/']: 187 if tunnel_host[:7] not in ['http://', 'https:/']:
188 tunnel_host = 'https://' + tunnel_host 188 tunnel_host = 'https://' + tunnel_host
189 new_tunnel = True 189 new_tunnel = True
190 else: 190 else: