aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-11-03 16:45:36 +0100
committerMaximilian Hils <git@maximilianhils.com>2017-11-03 16:45:36 +0100
commitc7d8b7d6a720246785e632f00b6854e9b30a2778 (patch)
treed3ceb4901ae03eb96fbbd5fa0dd9dee40d59f45d
parentb32dff7520b67f6f6a93627363d91d4f30cad956 (diff)
downloadmitmproxy-c7d8b7d6a720246785e632f00b6854e9b30a2778.tar.gz
mitmproxy-c7d8b7d6a720246785e632f00b6854e9b30a2778.tar.bz2
mitmproxy-c7d8b7d6a720246785e632f00b6854e9b30a2778.zip
fix #2617
-rw-r--r--mitmproxy/proxy/protocol/http.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mitmproxy/proxy/protocol/http.py b/mitmproxy/proxy/protocol/http.py
index a366861d..57ac0f16 100644
--- a/mitmproxy/proxy/protocol/http.py
+++ b/mitmproxy/proxy/protocol/http.py
@@ -165,7 +165,7 @@ class HttpLayer(base.Layer):
def __init__(self, ctx, mode):
super().__init__(ctx)
self.mode = mode
- self.__initial_server_conn = None
+ self.__initial_server_address = None # type: tuple
"Contains the original destination in transparent mode, which needs to be restored"
"if an inline script modified the target server for a single http request"
# We cannot rely on server_conn.tls_established,
@@ -177,7 +177,7 @@ class HttpLayer(base.Layer):
def __call__(self):
if self.mode == HTTPMode.transparent:
self.__initial_server_tls = self.server_tls
- self.__initial_server_conn = self.server_conn
+ self.__initial_server_address = self.server_conn.address
while True:
flow = http.HTTPFlow(
self.client_conn,
@@ -313,8 +313,8 @@ class HttpLayer(base.Layer):
# Setting request.host also updates the host header, which we want
# to preserve
host_header = f.request.host_header
- f.request.host = self.__initial_server_conn.address[0]
- f.request.port = self.__initial_server_conn.address[1]
+ f.request.host = self.__initial_server_address[0]
+ f.request.port = self.__initial_server_address[1]
f.request.host_header = host_header # set again as .host overwrites this.
f.request.scheme = "https" if self.__initial_server_tls else "http"
self.channel.ask("request", f)