aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_tcp.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-07-24 11:39:49 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-07-24 11:41:18 +1200
commit91752990d5863526745e5c31cfb4b7459d11047e (patch)
tree5309c036f76f78aac3056ed98935f0f766379994 /test/test_tcp.py
parenteb88cea3c74a253d3a08d010bfd328aa845c6d5b (diff)
downloadmitmproxy-91752990d5863526745e5c31cfb4b7459d11047e.tar.gz
mitmproxy-91752990d5863526745e5c31cfb4b7459d11047e.tar.bz2
mitmproxy-91752990d5863526745e5c31cfb4b7459d11047e.zip
Handle HTTP responses that have a body but no content-length or transfer encoding
We check if the server sent a connection:close header, and read till the socket closes. Closes #2
Diffstat (limited to 'test/test_tcp.py')
-rw-r--r--test/test_tcp.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test_tcp.py b/test/test_tcp.py
index d6235b01..67c56a37 100644
--- a/test/test_tcp.py
+++ b/test/test_tcp.py
@@ -239,3 +239,9 @@ class TestFileLike:
s = cStringIO.StringIO("foobar\nfoobar")
s = tcp.FileLike(s)
assert s.readline(3) == "foo"
+
+ def test_limitless(self):
+ s = cStringIO.StringIO("f"*(50*1024))
+ s = tcp.FileLike(s)
+ ret = s.read(-1)
+ assert len(ret) == 50 * 1024