aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/tcp.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-12-08 10:15:43 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-12-08 10:15:43 +1300
commited74b628569348d3d71cfe6e6a5f29b5289ee82c (patch)
tree0d23809113380fbcf78531a41fb913af134e6c12 /netlib/tcp.py
parentbed2aed9db346f37b858c8f7f069f65e9f59d0e9 (diff)
parent5aad09ab816b2343ca686d45e6c5d2b8ba07b10b (diff)
downloadmitmproxy-ed74b628569348d3d71cfe6e6a5f29b5289ee82c.tar.gz
mitmproxy-ed74b628569348d3d71cfe6e6a5f29b5289ee82c.tar.bz2
mitmproxy-ed74b628569348d3d71cfe6e6a5f29b5289ee82c.zip
Merge branch 'fix_invalid_tcp_close'
Diffstat (limited to 'netlib/tcp.py')
-rw-r--r--netlib/tcp.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py
index bee1f75b..c632ec67 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -235,6 +235,7 @@ class TCPClient:
try:
if self.ssl_established:
self.connection.shutdown()
+ self.connection.sock_shutdown(socket.SHUT_WR)
else:
self.connection.shutdown(socket.SHUT_WR)
#Section 4.2.2.13 of RFC 1122 tells us that a close() with any pending readable data could lead to an immediate RST being sent.
@@ -302,6 +303,8 @@ class BaseHandler:
if request_client_cert:
def ver(*args):
self.clientcert = certutils.SSLCert(args[1])
+ # Return true to prevent cert verification error
+ return True
ctx.set_verify(SSL.VERIFY_PEER, ver)
self.connection = SSL.Connection(ctx, self.connection)
self.ssl_established = True
@@ -338,6 +341,7 @@ class BaseHandler:
try:
if self.ssl_established:
self.connection.shutdown()
+ self.connection.sock_shutdown(socket.SHUT_WR)
else:
self.connection.shutdown(socket.SHUT_WR)
#Section 4.2.2.13 of RFC 1122 tells us that a close() with any pending readable data could lead to an immediate RST being sent.