diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-03-04 11:42:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-04 11:42:44 +0100 |
commit | 78fd5a9dadbf16cebe46243ef706069b857ff3d9 (patch) | |
tree | 56f57e0cf785cebddf0fde1683ca19f7cdcc741b /examples/complex/dns_spoofing.py | |
parent | bae4cdf8d5cc434938c74a041f762075513dd8e4 (diff) | |
parent | 50ebdf3081d4cf3b16532c4a8bdea6bfa94cbbba (diff) | |
download | mitmproxy-78fd5a9dadbf16cebe46243ef706069b857ff3d9.tar.gz mitmproxy-78fd5a9dadbf16cebe46243ef706069b857ff3d9.tar.bz2 mitmproxy-78fd5a9dadbf16cebe46243ef706069b857ff3d9.zip |
Merge pull request #2053 from krsoninikhil/on-issues
Adds --keep-host-header option (#2039)
Diffstat (limited to 'examples/complex/dns_spoofing.py')
-rw-r--r-- | examples/complex/dns_spoofing.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/examples/complex/dns_spoofing.py b/examples/complex/dns_spoofing.py index acda303d..2fd6b699 100644 --- a/examples/complex/dns_spoofing.py +++ b/examples/complex/dns_spoofing.py @@ -13,6 +13,8 @@ Usage: -s dns_spoofing.py # Used as the target location if neither SNI nor host header are present. -R http://example.com/ + # To avoid auto rewriting of host header by the reverse proxy target. + --keep-host-header mitmdump -p 80 -R http://localhost:443/ @@ -29,13 +31,6 @@ parse_host_header = re.compile(r"^(?P<host>[^:]+|\[.+\])(?::(?P<port>\d+))?$") class Rerouter: - def requestheaders(self, flow): - """ - The original host header is retrieved early - before flow.request is replaced by mitmproxy new outgoing request - """ - flow.metadata["original_host"] = flow.request.host_header - def request(self, flow): if flow.client_conn.ssl_established: flow.request.scheme = "https" @@ -46,7 +41,7 @@ class Rerouter: sni = None port = 80 - host_header = flow.metadata["original_host"] + host_header = flow.request.host_header m = parse_host_header.match(host_header) if m: host_header = m.group("host").strip("[]") |