aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_examples.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index 3930e8df..e32323a6 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -103,6 +103,28 @@ class TestScripts(mastertest.MasterTest):
m.request(f)
assert f.response.content == b"Hello World"
+ def test_dns_spoofing(self):
+ m, sc = tscript("complex/dns_spoofing.py")
+ original_host = "example.com"
+
+ host_header = Headers(host=original_host)
+ f = tflow.tflow(req=tutils.treq(headers=host_header, port=80))
+
+ m.requestheaders(f)
+
+ # Rewrite by reverse proxy mode
+ f.request.scheme = "https"
+ f.request.host = "mitmproxy.org"
+ f.request.port = 443
+
+ m.request(f)
+
+ assert f.request.scheme == "http"
+ assert f.request.host == original_host
+ assert f.request.port == 80
+
+ assert f.request.headers["Host"] == original_host
+
class TestHARDump: