aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2020-04-09 08:37:57 +0200
committerGitHub <noreply@github.com>2020-04-09 08:37:57 +0200
commit0d9e517c064ca3992fac83c3a1ec6e4284221e72 (patch)
treec1472652ee95cf8c41b91d544e89f3b0d64c0323 /mitmproxy
parent4d6886a0f4ebbf6bc66b74fa548ff724ba2ad660 (diff)
parentb5e3f736c0c6654c3ef0d1f280a4eacdb5ca91de (diff)
downloadmitmproxy-0d9e517c064ca3992fac83c3a1ec6e4284221e72.tar.gz
mitmproxy-0d9e517c064ca3992fac83c3a1ec6e4284221e72.tar.bz2
mitmproxy-0d9e517c064ca3992fac83c3a1ec6e4284221e72.zip
Merge pull request #3767 from mitmproxy/fix-ci
re-add missing CI steps and fix linting
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")