diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-27 16:15:22 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-27 16:15:22 +1200 |
commit | 9588da4ab4afd00acf6b09c862f8b4d6a079570a (patch) | |
tree | d1c84baa823e7c033e31dfb56658f610ee2d4460 | |
parent | 8f148b6b14e4fbf1dfa78111b624c131c9cd983d (diff) | |
download | mitmproxy-9588da4ab4afd00acf6b09c862f8b4d6a079570a.tar.gz mitmproxy-9588da4ab4afd00acf6b09c862f8b4d6a079570a.tar.bz2 mitmproxy-9588da4ab4afd00acf6b09c862f8b4d6a079570a.zip |
Catch errors that may happen on interpreter shutdown.
-rw-r--r-- | libpathod/pathod.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py index a09d3594..2d3264f8 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -1,4 +1,4 @@ -import urllib, threading, re, logging +import urllib, threading, re, logging, socket, sys from netlib import tcp, http, odict, wsgi import version, app, rparse @@ -27,7 +27,10 @@ class PathodHandler(tcp.BaseHandler): self.finish() while not self.finished: - line = self.rfile.readline() + try: + line = self.rfile.readline() + except socket.error: + return None if line == "\r\n" or line == "\n": # Possible leftover from previous message line = self.rfile.readline() if line == "": |