mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Catch an amazingly subtle SSL connection corruption bug.
Closing a set of pseudo-file descriptors in the wrong order caused junk data to be written to the SSL stream. An apparent bug in OpenSSL then lets this corrupt the _next_ SSL connection.
This commit is contained in:
parent
ed64b0e796
commit
eb88cea3c7
@ -209,9 +209,9 @@ class BaseHandler:
|
|||||||
try:
|
try:
|
||||||
if not getattr(self.wfile, "closed", False):
|
if not getattr(self.wfile, "closed", False):
|
||||||
self.wfile.flush()
|
self.wfile.flush()
|
||||||
|
self.close()
|
||||||
self.wfile.close()
|
self.wfile.close()
|
||||||
self.rfile.close()
|
self.rfile.close()
|
||||||
self.close()
|
|
||||||
except socket.error:
|
except socket.error:
|
||||||
# Remote has disconnected
|
# Remote has disconnected
|
||||||
pass
|
pass
|
||||||
@ -245,10 +245,10 @@ class BaseHandler:
|
|||||||
self.connection.shutdown()
|
self.connection.shutdown()
|
||||||
else:
|
else:
|
||||||
self.connection.shutdown(socket.SHUT_RDWR)
|
self.connection.shutdown(socket.SHUT_RDWR)
|
||||||
self.connection.close()
|
except (socket.error, SSL.Error), v:
|
||||||
except (socket.error, SSL.Error):
|
|
||||||
# Socket probably already closed
|
# Socket probably already closed
|
||||||
pass
|
pass
|
||||||
|
self.connection.close()
|
||||||
|
|
||||||
|
|
||||||
class TCPServer:
|
class TCPServer:
|
||||||
|
Loading…
Reference in New Issue
Block a user