diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-10-05 17:45:42 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-10-05 17:45:48 -0700 |
commit | b422ba5328a4fe4773ec62f057a8be70f35e89cf (patch) | |
tree | 10ccfd57869a5ae00837fda17a03522b62012916 /mitmproxy/contrib | |
parent | 8e7ec6117afe528f521fb8d691f27b87141d878b (diff) | |
download | mitmproxy-b422ba5328a4fe4773ec62f057a8be70f35e89cf.tar.gz mitmproxy-b422ba5328a4fe4773ec62f057a8be70f35e89cf.tar.bz2 mitmproxy-b422ba5328a4fe4773ec62f057a8be70f35e89cf.zip |
simplify eof detection
Diffstat (limited to 'mitmproxy/contrib')
-rw-r--r-- | mitmproxy/contrib/tnetstring.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mitmproxy/contrib/tnetstring.py b/mitmproxy/contrib/tnetstring.py index 86236caa..6c498c75 100644 --- a/mitmproxy/contrib/tnetstring.py +++ b/mitmproxy/contrib/tnetstring.py @@ -172,6 +172,8 @@ def load(file_handle): # Read the length prefix one char at a time. # Note that the netstring spec explicitly forbids padding zeros. c = file_handle.read(1) + if c == b"": # we want to detect this special case. + raise ValueError("not a tnetstring: empty file") data_length = b"" while c.isdigit(): data_length += c |