aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_flow.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-03-17 17:31:35 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-03-17 17:37:54 +1300
commit0e993bec6f7fa77e73a08053f4558ff1fc36d022 (patch)
treea9f0763cf510028c3cd73128dfd0a48991bfedc3 /test/test_flow.py
parent790ad468e4352419ef519401680f99ee3beb148d (diff)
downloadmitmproxy-0e993bec6f7fa77e73a08053f4558ff1fc36d022.tar.gz
mitmproxy-0e993bec6f7fa77e73a08053f4558ff1fc36d022.tar.bz2
mitmproxy-0e993bec6f7fa77e73a08053f4558ff1fc36d022.zip
Add the --host option, which uses the value in the Host header for dispaly URLs.
- Can be toggled with "o" then "h" in mitmproxy - Useful for transparent mode
Diffstat (limited to 'test/test_flow.py')
-rw-r--r--test/test_flow.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/test_flow.py b/test/test_flow.py
index c1ae1a9f..fce4e98a 100644
--- a/test/test_flow.py
+++ b/test/test_flow.py
@@ -497,7 +497,7 @@ class TestSerialize:
fm = flow.FlowMaster(None, s)
fm.load_flows(r)
assert len(s._flow_list) == 6
-
+
def test_filter(self):
sio = StringIO()
fl = filt.parse("~c 200")
@@ -783,6 +783,17 @@ class TestRequest:
r.content = flow.CONTENT_MISSING
assert not r._assemble()
+ def test_get_url(self):
+ h = flow.ODictCaseless()
+ h["test"] = ["test"]
+ c = flow.ClientConnect(("addr", 2222))
+ r = flow.Request(c, (1, 1), "host", 22, "https", "GET", "/", h, "content")
+ assert r.get_url() == "https://host:22/"
+ assert r.get_url(hostheader=True) == "https://host:22/"
+ r.headers["Host"] = ["foo.com"]
+ assert r.get_url() == "https://host:22/"
+ assert r.get_url(hostheader=True) == "https://foo.com:22/"
+
def test_path_components(self):
h = flow.ODictCaseless()
c = flow.ClientConnect(("addr", 2222))