mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 14:58:38 +00:00
close existing server_conn before replacing it
This commit is contained in:
parent
0bd3d0ff4c
commit
e82ed55516
@ -569,7 +569,9 @@ class TCPClient(_Connection):
|
||||
# Make sure to close the real socket, not the SSL proxy.
|
||||
# OpenSSL is really good at screwing up, i.e. when trying to recv from a failed connection,
|
||||
# it tries to renegotiate...
|
||||
if isinstance(self.connection, SSL.Connection):
|
||||
if not self.connection:
|
||||
return
|
||||
elif isinstance(self.connection, SSL.Connection):
|
||||
close_socket(self.connection._socket)
|
||||
else:
|
||||
close_socket(self.connection)
|
||||
|
@ -83,7 +83,11 @@ class RequestReplayThread(basethread.BaseThread):
|
||||
|
||||
server.wfile.write(http1.assemble_request(r))
|
||||
server.wfile.flush()
|
||||
|
||||
if self.f.server_conn:
|
||||
self.f.server_conn.close()
|
||||
self.f.server_conn = server
|
||||
|
||||
self.f.response = http.HTTPResponse.wrap(
|
||||
http1.read_response(
|
||||
server.rfile,
|
||||
|
Loading…
Reference in New Issue
Block a user