aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2020-04-08 22:11:52 +0200
committerMaximilian Hils <git@maximilianhils.com>2020-04-09 08:25:22 +0200
commitb5e3f736c0c6654c3ef0d1f280a4eacdb5ca91de (patch)
treec1472652ee95cf8c41b91d544e89f3b0d64c0323 /mitmproxy
parent7dda557add07de21cc701cebc60410579ed4b811 (diff)
downloadmitmproxy-b5e3f736c0c6654c3ef0d1f280a4eacdb5ca91de.tar.gz
mitmproxy-b5e3f736c0c6654c3ef0d1f280a4eacdb5ca91de.tar.bz2
mitmproxy-b5e3f736c0c6654c3ef0d1f280a4eacdb5ca91de.zip
minor improvements, tests++
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/addons/command_history.py6
-rw-r--r--mitmproxy/net/http/http1/read.py3
2 files changed, 5 insertions, 4 deletions
diff --git a/mitmproxy/addons/command_history.py b/mitmproxy/addons/command_history.py
index 2c1bf887..d5aaa928 100644
--- a/mitmproxy/addons/command_history.py
+++ b/mitmproxy/addons/command_history.py
@@ -27,7 +27,7 @@ class CommandHistory:
def running(self):
# FIXME: We have a weird bug where the contract for configure is not followed and it is never called with
# confdir or command_history as updated.
- self.configure("command_history")
+ self.configure("command_history") # pragma: no cover
def configure(self, updated):
if "command_history" in updated or "confdir" in updated:
@@ -36,9 +36,9 @@ class CommandHistory:
self.set_filter('')
def done(self):
- if ctx.options.command_history and len(self.history) > self.VACUUM_SIZE:
+ if ctx.options.command_history and len(self.history) >= self.VACUUM_SIZE:
# vacuum history so that it doesn't grow indefinitely.
- history_str = "\n".join(self.history[-self.VACUUM_SIZE / 2:]) + "\n"
+ history_str = "\n".join(self.history[-self.VACUUM_SIZE // 2:]) + "\n"
self.history_file.write_text(history_str)
@command.command("commands.history.add")
diff --git a/mitmproxy/net/http/http1/read.py b/mitmproxy/net/http/http1/read.py
index 0fc03f1b..a9585d7d 100644
--- a/mitmproxy/net/http/http1/read.py
+++ b/mitmproxy/net/http/http1/read.py
@@ -331,7 +331,8 @@ def _read_headers(rfile):
while True:
line = rfile.readline()
if not line or line == b"\r\n" or line == b"\n":
- break
+ # we do have coverage of this, but coverage.py does not detect it.
+ break # pragma: no cover
if line[0] in b" \t":
if not ret:
raise exceptions.HttpSyntaxException("Invalid headers")