diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-09-27 16:07:22 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-09-28 11:06:39 -0700 |
commit | e0cd33b5863cebb78c38873e32540ee4c495ec15 (patch) | |
tree | dcb6d2903f081f7607bdf65a4157545903bb5fc5 | |
parent | 070aa27cf5f88d2036c88c110e00421c427c0c9b (diff) | |
download | mitmproxy-e0cd33b5863cebb78c38873e32540ee4c495ec15.tar.gz mitmproxy-e0cd33b5863cebb78c38873e32540ee4c495ec15.tar.bz2 mitmproxy-e0cd33b5863cebb78c38873e32540ee4c495ec15.zip |
fix host header modification, refs #1571
-rw-r--r-- | mitmproxy/protocol/http.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mitmproxy/protocol/http.py b/mitmproxy/protocol/http.py index e1487943..d3e3c80f 100644 --- a/mitmproxy/protocol/http.py +++ b/mitmproxy/protocol/http.py @@ -185,8 +185,11 @@ class HttpLayer(base.Layer): return # update host header in reverse proxy mode - if self.mode == "reverse": - flow.request.headers["Host"] = self.config.upstream_server.address.host + if self.config.options.mode == "reverse": + if six.PY2: + flow.request.headers["Host"] = self.config.upstream_server.address.host.encode() + else: + flow.request.headers["Host"] = self.config.upstream_server.address.host # set upstream auth if self.mode == "upstream" and self.config.upstream_auth is not None: |