Show More
@@ -222,13 +222,16 b' def _generic_start_transaction(handler, ' | |||
|
222 | 222 | h.headers = None |
|
223 | 223 | |
|
224 | 224 | |
|
225 | def _generic_proxytunnel(self): | |
|
225 | def _generic_proxytunnel(self: "httpsconnection"): | |
|
226 | headers = self.headers # pytype: disable=attribute-error | |
|
226 | 227 | proxyheaders = { |
|
227 |
pycompat.bytestr(x): pycompat.bytestr( |
|
|
228 |
for x in |
|
|
228 | pycompat.bytestr(x): pycompat.bytestr(headers[x]) | |
|
229 | for x in headers | |
|
229 | 230 | if x.lower().startswith('proxy-') |
|
230 | 231 | } |
|
231 | self.send(b'CONNECT %s HTTP/1.0\r\n' % self.realhostport) | |
|
232 | realhostport = self.realhostport # pytype: disable=attribute-error | |
|
233 | self.send(b'CONNECT %s HTTP/1.0\r\n' % realhostport) | |
|
234 | ||
|
232 | 235 | for header in proxyheaders.items(): |
|
233 | 236 | self.send(b'%s: %s\r\n' % header) |
|
234 | 237 | self.send(b'\r\n') |
@@ -237,10 +240,14 b' def _generic_proxytunnel(self):' | |||
|
237 | 240 | # httplib.HTTPConnection as there are no adequate places to |
|
238 | 241 | # override functions to provide the needed functionality. |
|
239 | 242 | |
|
243 | # pytype: disable=attribute-error | |
|
240 | 244 | res = self.response_class(self.sock, method=self._method) |
|
245 | # pytype: enable=attribute-error | |
|
241 | 246 | |
|
242 | 247 | while True: |
|
248 | # pytype: disable=attribute-error | |
|
243 | 249 | version, status, reason = res._read_status() |
|
250 | # pytype: enable=attribute-error | |
|
244 | 251 | if status != httplib.CONTINUE: |
|
245 | 252 | break |
|
246 | 253 | # skip lines that are all whitespace |
@@ -323,14 +330,15 b' if has_https:' | |||
|
323 | 330 | self.sock = socket.create_connection((self.host, self.port)) |
|
324 | 331 | |
|
325 | 332 | host = self.host |
|
326 | if self.realhostport: # use CONNECT proxy | |
|
333 | realhostport = self.realhostport # pytype: disable=attribute-error | |
|
334 | if realhostport: # use CONNECT proxy | |
|
327 | 335 | _generic_proxytunnel(self) |
|
328 |
host = |
|
|
336 | host = realhostport.rsplit(b':', 1)[0] | |
|
329 | 337 | self.sock = sslutil.wrapsocket( |
|
330 | 338 | self.sock, |
|
331 | 339 | self.key_file, |
|
332 | 340 | self.cert_file, |
|
333 | ui=self.ui, | |
|
341 | ui=self.ui, # pytype: disable=attribute-error | |
|
334 | 342 | serverhostname=host, |
|
335 | 343 | ) |
|
336 | 344 | sslutil.validatesocket(self.sock) |
General Comments 0
You need to be logged in to leave comments.
Login now