mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Merge branch 'fix_windows_bugs' into fix_invalid_tcp_close
This commit is contained in:
commit
643602c066
@ -235,6 +235,7 @@ class TCPClient:
|
|||||||
try:
|
try:
|
||||||
if self.ssl_established:
|
if self.ssl_established:
|
||||||
self.connection.shutdown()
|
self.connection.shutdown()
|
||||||
|
self.connection.sock_shutdown(socket.SHUT_WR)
|
||||||
else:
|
else:
|
||||||
self.connection.shutdown(socket.SHUT_WR)
|
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.
|
#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:
|
if request_client_cert:
|
||||||
def ver(*args):
|
def ver(*args):
|
||||||
self.clientcert = certutils.SSLCert(args[1])
|
self.clientcert = certutils.SSLCert(args[1])
|
||||||
|
# err 20 = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
|
||||||
|
#return True
|
||||||
ctx.set_verify(SSL.VERIFY_PEER, ver)
|
ctx.set_verify(SSL.VERIFY_PEER, ver)
|
||||||
self.connection = SSL.Connection(ctx, self.connection)
|
self.connection = SSL.Connection(ctx, self.connection)
|
||||||
self.ssl_established = True
|
self.ssl_established = True
|
||||||
@ -338,6 +341,7 @@ class BaseHandler:
|
|||||||
try:
|
try:
|
||||||
if self.ssl_established:
|
if self.ssl_established:
|
||||||
self.connection.shutdown()
|
self.connection.shutdown()
|
||||||
|
self.connection.sock_shutdown(socket.SHUT_WR)
|
||||||
else:
|
else:
|
||||||
self.connection.shutdown(socket.SHUT_WR)
|
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.
|
#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.
|
||||||
|
@ -52,7 +52,7 @@ class TServer(tcp.TCPServer):
|
|||||||
self.last_handler = h
|
self.last_handler = h
|
||||||
if self.ssl:
|
if self.ssl:
|
||||||
cert = certutils.SSLCert.from_pem(
|
cert = certutils.SSLCert.from_pem(
|
||||||
file(self.ssl["cert"], "r").read()
|
file(self.ssl["cert"], "rb").read()
|
||||||
)
|
)
|
||||||
if self.ssl["v3_only"]:
|
if self.ssl["v3_only"]:
|
||||||
method = tcp.SSLv3_METHOD
|
method = tcp.SSLv3_METHOD
|
||||||
|
2
setup.py
2
setup.py
@ -65,7 +65,7 @@ def findPackages(path, dataExclude=[]):
|
|||||||
return packages, package_data
|
return packages, package_data
|
||||||
|
|
||||||
|
|
||||||
long_description = file("README").read()
|
long_description = file("README","rb").read()
|
||||||
packages, package_data = findPackages("netlib")
|
packages, package_data = findPackages("netlib")
|
||||||
setup(
|
setup(
|
||||||
name = "netlib",
|
name = "netlib",
|
||||||
|
@ -17,7 +17,7 @@ class TestPassManHtpasswd:
|
|||||||
tutils.raises("invalid htpasswd", http_auth.PassManHtpasswd, s)
|
tutils.raises("invalid htpasswd", http_auth.PassManHtpasswd, s)
|
||||||
|
|
||||||
def test_simple(self):
|
def test_simple(self):
|
||||||
f = open(tutils.test_data.path("data/htpasswd"))
|
f = open(tutils.test_data.path("data/htpasswd"),"rb")
|
||||||
pm = http_auth.PassManHtpasswd(f)
|
pm = http_auth.PassManHtpasswd(f)
|
||||||
|
|
||||||
vals = ("basic", "test", "test")
|
vals = ("basic", "test", "test")
|
||||||
|
Loading…
Reference in New Issue
Block a user