diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-24 22:30:15 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-24 22:30:15 +1200 |
commit | e9de11f0e35b6f311c87b8f56ef01de2af2aeb2c (patch) | |
tree | fd4940e6efabb279eddeb0fbde633bd96f2419d4 | |
parent | 11896d21182d3afe14d7fa7a5c6ecc64d7fb636c (diff) | |
download | mitmproxy-e9de11f0e35b6f311c87b8f56ef01de2af2aeb2c.tar.gz mitmproxy-e9de11f0e35b6f311c87b8f56ef01de2af2aeb2c.tar.bz2 mitmproxy-e9de11f0e35b6f311c87b8f56ef01de2af2aeb2c.zip |
Don't add stuff to our internal log buffer if noapi is on.
-rw-r--r-- | libpathod/pathod.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py index 0ab7e915..8ee7f9ae 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -206,14 +206,15 @@ class Pathod(tcp.TCPServer): h.finish() def add_log(self, d): - lock = threading.Lock() - with lock: - d["id"] = self.logid - self.log.insert(0, d) - if len(self.log) > self.LOGBUF: - self.log.pop() - self.logid += 1 - return d["id"] + if not self.noapi: + lock = threading.Lock() + with lock: + d["id"] = self.logid + self.log.insert(0, d) + if len(self.log) > self.LOGBUF: + self.log.pop() + self.logid += 1 + return d["id"] def clear_log(self): lock = threading.Lock() |