diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-06-23 17:00:55 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-06-23 17:00:55 +1200 |
commit | b04d0743419d35486e53ca755967072055d84466 (patch) | |
tree | da198268469d26fe135ec0a82937e66ef5b4706f /libmproxy/proxy.py | |
parent | 0d9e0eac9a683dff2732685d4661ce4e94e273c7 (diff) | |
download | mitmproxy-b04d0743419d35486e53ca755967072055d84466.tar.gz mitmproxy-b04d0743419d35486e53ca755967072055d84466.tar.bz2 mitmproxy-b04d0743419d35486e53ca755967072055d84466.zip |
Repair a problem that sometimes caused SSL connections to peg the CPU.
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r-- | libmproxy/proxy.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 3f81096d..77498842 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -472,7 +472,10 @@ class FileLike: def read(self, length): result = '' while len(result) < length: - data = self.o.read(length) + try: + data = self.o.read(length) + except AttributeError: + break if not data: break result += data @@ -596,7 +599,7 @@ class ProxyHandler(SocketServer.StreamRequestHandler): return self.send_response(response) except IOError: - pass + cc.close = True except ProxyError, e: err = Error(request, e.msg) 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' '<body>\n%s\n</body>\n</html>' % (code, response, body)) self.wfile.flush() - except IOError: + except: pass |