aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/net
diff options
context:
space:
mode:
authorSuraj Tripathi <suraj.t97@gmail.com>2017-11-27 23:31:32 +0530
committerThomas Kriechbaumer <Kriechi@users.noreply.github.com>2017-11-27 19:01:32 +0100
commit5067438ec178643ac6ffe9ce518f502bc680dc99 (patch)
tree2cded8c78920e6077d917913447d37722f55af61 /test/mitmproxy/net
parent46901d1d55cb5bad86e17e093b85ade8111315aa (diff)
downloadmitmproxy-5067438ec178643ac6ffe9ce518f502bc680dc99.tar.gz
mitmproxy-5067438ec178643ac6ffe9ce518f502bc680dc99.tar.bz2
mitmproxy-5067438ec178643ac6ffe9ce518f502bc680dc99.zip
Bug in expected_http_body_size fix (#2642)
fixes #2618
Diffstat (limited to 'test/mitmproxy/net')
-rw-r--r--test/mitmproxy/net/http/http1/test_read.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/mitmproxy/net/http/http1/test_read.py b/test/mitmproxy/net/http/http1/test_read.py
index b3589c92..4084c360 100644
--- a/test/mitmproxy/net/http/http1/test_read.py
+++ b/test/mitmproxy/net/http/http1/test_read.py
@@ -194,6 +194,17 @@ def test_expected_http_body_size():
treq(headers=Headers(content_length="42"))
) == 42
+ # more than 1 content-length headers with same value
+ assert expected_http_body_size(
+ treq(headers=Headers([(b'content-length', b'42'), (b'content-length', b'42')]))
+ ) == 42
+
+ # more than 1 content-length headers with conflicting value
+ with pytest.raises(exceptions.HttpSyntaxException):
+ expected_http_body_size(
+ treq(headers=Headers([(b'content-length', b'42'), (b'content-length', b'45')]))
+ )
+
# no length
assert expected_http_body_size(
treq(headers=Headers())