mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Allow http_connect to create a response for CONNECT request so that connection to server be postponed in upstream mode.
This commit is contained in:
parent
d409a6c09a
commit
1004460ba6
@ -217,16 +217,17 @@ class HttpLayer(base.Layer):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def handle_upstream_connect(self, f):
|
def handle_upstream_connect(self, f):
|
||||||
self.establish_server_connection(
|
if not f.response:
|
||||||
f.request.host,
|
self.establish_server_connection(
|
||||||
f.request.port,
|
f.request.host,
|
||||||
f.request.scheme
|
f.request.port,
|
||||||
)
|
f.request.scheme
|
||||||
self.send_request(f.request)
|
)
|
||||||
f.response = self.read_response_headers()
|
self.send_request(f.request)
|
||||||
f.response.data.content = b"".join(
|
f.response = self.read_response_headers()
|
||||||
self.read_response_body(f.request, f.response)
|
f.response.data.content = b"".join(
|
||||||
)
|
self.read_response_body(f.request, f.response)
|
||||||
|
)
|
||||||
self.send_response(f.response)
|
self.send_response(f.response)
|
||||||
if is_ok(f.response.status_code):
|
if is_ok(f.response.status_code):
|
||||||
layer = UpstreamConnectLayer(self, f.request)
|
layer = UpstreamConnectLayer(self, f.request)
|
||||||
|
Loading…
Reference in New Issue
Block a user