aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-02-01 15:25:51 +0100
committerGitHub <noreply@github.com>2017-02-01 15:25:51 +0100
commit212d9f1b9848fe347ef5924c2e7431180c550cb6 (patch)
tree80028cb6d7b632ea850ac46fa4a6c20e1bbfc012 /test
parentcf991ba4e25c59343084b5782f499fbada323f64 (diff)
parent9e3f06b7f27da778c730bbf912e3f1709ed9f058 (diff)
downloadmitmproxy-212d9f1b9848fe347ef5924c2e7431180c550cb6.tar.gz
mitmproxy-212d9f1b9848fe347ef5924c2e7431180c550cb6.tar.bz2
mitmproxy-212d9f1b9848fe347ef5924c2e7431180c550cb6.zip
Merge pull request #1948 from amm0nite/fix_dns_spoofing_example
Fix for dns_spoofing.py example
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: