aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_server.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-06-10 13:17:18 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-06-10 13:17:18 +1200
commit52779d9db98dff042a0b2b5dca97440b520367df (patch)
treeecaed5067234758e7da28f7e21e908c7a948aa51 /test/test_server.py
parent55ddf853cd8cac13bb6021ef92d21af85cb9b2f1 (diff)
downloadmitmproxy-52779d9db98dff042a0b2b5dca97440b520367df.tar.gz
mitmproxy-52779d9db98dff042a0b2b5dca97440b520367df.tar.bz2
mitmproxy-52779d9db98dff042a0b2b5dca97440b520367df.zip
Refactoring of proxy.py
- Correctly pass HTTP request version on to upstream servers - Adjust tests not to hang due to a pathod response with no content-length
Diffstat (limited to 'test/test_server.py')
-rw-r--r--test/test_server.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/test_server.py b/test/test_server.py
index e6f055cc..d0e5d652 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -3,9 +3,17 @@ import time
import libpathod.test, requests
import tutils
+"""
+ Note that the choice of response code in these tests matters more than you
+ might think. libcurl treats a 304 response code differently from, say, a
+ 200 response code - it will correctly terminate a 304 response with no
+ content-length header, whereas it will block forever waiting for content
+ for a 200 response.
+"""
+
class Sanity(tutils.ProxTest):
def test_http(self):
- assert self.pathod("205").status_code == 205
+ assert self.pathod("304").status_code == 304
assert self.log()
@@ -23,10 +31,10 @@ class TestReverse(Sanity):
class TestProxy(tutils.ProxTest):
def test_http(self):
- f = self.pathod("205")
- assert f.status_code == 205
+ f = self.pathod("304")
+ assert f.status_code == 304
l = self.log()
assert l[0].address
assert "host" in l[1].headers
- assert l[2].code == 205
+ assert l[2].code == 304