mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
Merge pull request #2473 from mengbiping/postpone-connection
Respect response to CONNECT created in http_connect function in upstream mode
This commit is contained in:
commit
874d0aa253
@ -217,16 +217,19 @@ 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 the user specifies a response in the http_connect hook, we do not connect upstream here.
|
||||||
f.request.host,
|
# https://github.com/mitmproxy/mitmproxy/pull/2473
|
||||||
f.request.port,
|
if not f.response:
|
||||||
f.request.scheme
|
self.establish_server_connection(
|
||||||
)
|
f.request.host,
|
||||||
self.send_request(f.request)
|
f.request.port,
|
||||||
f.response = self.read_response_headers()
|
f.request.scheme
|
||||||
f.response.data.content = b"".join(
|
)
|
||||||
self.read_response_body(f.request, f.response)
|
self.send_request(f.request)
|
||||||
)
|
f.response = self.read_response_headers()
|
||||||
|
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