diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-25 11:34:10 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-25 11:34:10 +1200 |
commit | 47f862ae278c61df9bd1b62ec291a954fc0707ea (patch) | |
tree | 4e71694bc88ce48fc6fa08071ae0a3b6d19cc096 /netlib/tcp.py | |
parent | f3237503a77258d37b67c5716ac178cbfd7ffe1b (diff) | |
download | mitmproxy-47f862ae278c61df9bd1b62ec291a954fc0707ea.tar.gz mitmproxy-47f862ae278c61df9bd1b62ec291a954fc0707ea.tar.bz2 mitmproxy-47f862ae278c61df9bd1b62ec291a954fc0707ea.zip |
Add a finished flag to BaseHandler, and catch an extra OpenSSL exception.
Diffstat (limited to 'netlib/tcp.py')
-rw-r--r-- | netlib/tcp.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py index 25e83e07..91b0c742 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -20,7 +20,7 @@ class FileLike: while len(result) < length: try: data = self.o.read(length) - except SSL.ZeroReturnError: + except (SSL.ZeroReturnError, SSL.SysCallError): break if not data: break @@ -86,6 +86,7 @@ class BaseHandler: self.client_address = client_address self.server = server + self.finished = False def convert_to_ssl(self, cert, key): ctx = SSL.Context(SSL.SSLv23_METHOD) @@ -97,6 +98,7 @@ class BaseHandler: self.wfile = FileLike(self.connection) def finish(self): + self.finished = True try: if not getattr(self.wfile, "closed", False): self.wfile.flush() |