aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_server.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2013-12-12 04:42:29 +0100
committerMaximilian Hils <git@maximilianhils.com>2013-12-12 04:42:29 +0100
commit39ffe103349439d8e8eef26b81de6e5156e526d9 (patch)
treeccc01bd60d64dfc8e29ce534cb15d9c669a4035e /test/test_server.py
parent4a32a65e0eb1adf354ccb11899158f49d501b5f0 (diff)
downloadmitmproxy-39ffe103349439d8e8eef26b81de6e5156e526d9.tar.gz
mitmproxy-39ffe103349439d8e8eef26b81de6e5156e526d9.tar.bz2
mitmproxy-39ffe103349439d8e8eef26b81de6e5156e526d9.zip
add content-length 0 if we remove header for chunked encoding, fixes #186
Diffstat (limited to 'test/test_server.py')
-rw-r--r--test/test_server.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/test_server.py b/test/test_server.py
index 182b969f..2c94b9df 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -143,7 +143,18 @@ class TestHTTP(tservers.HTTPProxTest, CommonMixin, AppMixin):
req = p.request("get:'http://foo':h':foo'='bar'")
assert req.status_code == 400
-
+ def test_empty_chunked_content(self):
+ """
+ https://github.com/mitmproxy/mitmproxy/issues/186
+ """
+ connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ connection.connect(("127.0.0.1", self.proxy.port))
+ spec = '301:h"Transfer-Encoding"="chunked":r:b"0\\r\\n\\r\\n"'
+ connection.send("GET http://localhost:%d/p/%s HTTP/1.1\r\n"%(self.server.port, spec))
+ connection.send("\r\n");
+ resp = connection.recv(50000)
+ connection.close()
+ assert "content-length" in resp.lower()
class TestHTTPAuth(tservers.HTTPProxTest):
authenticator = http_auth.BasicProxyAuth(http_auth.PassManSingleUser("test", "test"), "realm")