mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
Repair a problem that sometimes caused SSL connections to peg the CPU.
This commit is contained in:
parent
0d9e0eac9a
commit
b04d074341
@ -472,7 +472,10 @@ class FileLike:
|
|||||||
def read(self, length):
|
def read(self, length):
|
||||||
result = ''
|
result = ''
|
||||||
while len(result) < length:
|
while len(result) < length:
|
||||||
|
try:
|
||||||
data = self.o.read(length)
|
data = self.o.read(length)
|
||||||
|
except AttributeError:
|
||||||
|
break
|
||||||
if not data:
|
if not data:
|
||||||
break
|
break
|
||||||
result += data
|
result += data
|
||||||
@ -596,7 +599,7 @@ class ProxyHandler(SocketServer.StreamRequestHandler):
|
|||||||
return
|
return
|
||||||
self.send_response(response)
|
self.send_response(response)
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
cc.close = True
|
||||||
except ProxyError, e:
|
except ProxyError, e:
|
||||||
err = Error(request, e.msg)
|
err = Error(request, e.msg)
|
||||||
err.send(self.mqueue)
|
err.send(self.mqueue)
|
||||||
@ -714,7 +717,7 @@ class ProxyHandler(SocketServer.StreamRequestHandler):
|
|||||||
self.wfile.write('<html><head>\n<title>%d %s</title>\n</head>\n'
|
self.wfile.write('<html><head>\n<title>%d %s</title>\n</head>\n'
|
||||||
'<body>\n%s\n</body>\n</html>' % (code, response, body))
|
'<body>\n%s\n</body>\n</html>' % (code, response, body))
|
||||||
self.wfile.flush()
|
self.wfile.flush()
|
||||||
except IOError:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user