##// END OF EJS Templates
url: always use str for proxy configuration...
Gregory Szorc -
r41859:4028897d default
parent child Browse files
Show More
@@ -131,9 +131,11 b' class proxyhandler(urlreq.proxyhandler):'
131 131 else:
132 132 self.no_list = no_list
133 133
134 proxyurl = bytes(proxy)
135 proxies = {'http': proxyurl, 'https': proxyurl}
136 ui.debug('proxying through %s\n' % util.hidepassword(proxyurl))
134 # Keys and values need to be str because the standard library
135 # expects them to be.
136 proxyurl = str(proxy)
137 proxies = {r'http': proxyurl, r'https': proxyurl}
138 ui.debug('proxying through %s\n' % util.hidepassword(bytes(proxy)))
137 139 else:
138 140 proxies = {}
139 141
@@ -141,7 +143,7 b' class proxyhandler(urlreq.proxyhandler):'
141 143 self.ui = ui
142 144
143 145 def proxy_open(self, req, proxy, type_):
144 host = urllibcompat.gethost(req).split(':')[0]
146 host = pycompat.bytesurl(urllibcompat.gethost(req)).split(':')[0]
145 147 for e in self.no_list:
146 148 if host == e:
147 149 return None
@@ -184,15 +186,15 b' class httpconnection(keepalive.HTTPConne'
184 186 def _generic_start_transaction(handler, h, req):
185 187 tunnel_host = req._tunnel_host
186 188 if tunnel_host:
187 if tunnel_host[:7] not in ['http://', 'https:/']:
188 tunnel_host = 'https://' + tunnel_host
189 if tunnel_host[:7] not in [r'http://', r'https:/']:
190 tunnel_host = r'https://' + tunnel_host
189 191 new_tunnel = True
190 192 else:
191 193 tunnel_host = urllibcompat.getselector(req)
192 194 new_tunnel = False
193 195
194 196 if new_tunnel or tunnel_host == urllibcompat.getfullurl(req): # has proxy
195 u = util.url(tunnel_host)
197 u = util.url(pycompat.bytesurl(tunnel_host))
196 198 if new_tunnel or u.scheme == 'https': # only use CONNECT for HTTPS
197 199 h.realhostport = ':'.join([u.host, (u.port or '443')])
198 200 h.headers = req.headers.copy()
@@ -205,7 +207,7 b' def _generic_start_transaction(handler, '
205 207 def _generic_proxytunnel(self):
206 208 proxyheaders = dict(
207 209 [(x, self.headers[x]) for x in self.headers
208 if x.lower().startswith('proxy-')])
210 if x.lower().startswith(r'proxy-')])
209 211 self.send('CONNECT %s HTTP/1.0\r\n' % self.realhostport)
210 212 for header in proxyheaders.iteritems():
211 213 self.send('%s: %s\r\n' % header)
General Comments 0
You need to be logged in to leave comments. Login now