aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-07-24 22:30:15 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-07-24 22:30:15 +1200
commite9de11f0e35b6f311c87b8f56ef01de2af2aeb2c (patch)
treefd4940e6efabb279eddeb0fbde633bd96f2419d4
parent11896d21182d3afe14d7fa7a5c6ecc64d7fb636c (diff)
downloadmitmproxy-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.py17
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()