Revert "minor fixes"

This reverts commit f94219e737.
This commit is contained in:
Maximilian Hils 2016-09-26 18:07:04 -07:00
parent f94219e737
commit ebccc103d8

View File

@ -348,9 +348,12 @@ class HttpLayer(base.Layer):
elif self.mode == "upstream":
pass
else:
# Don't set .host directly, that would update the host header.
flow.request.data.host = self.__initial_server_conn.address.host
flow.request.data.port = self.__initial_server_conn.address.port
# Setting request.host also updates the host header, which we want to preserve
host_header = flow.request.headers.get("host", None)
flow.request.host = self.__initial_server_conn.address.host
flow.request.port = self.__initial_server_conn.address.port
if host_header:
flow.request.headers["host"] = host_header
flow.request.scheme = "https" if self.__initial_server_tls else "http"
request_reply = self.channel.ask("request", flow)
@ -377,10 +380,10 @@ class HttpLayer(base.Layer):
raise exceptions.HttpProtocolException("Cannot change scheme in upstream proxy mode.")
"""
# This is a very ugly (untested) workaround to solve a very ugly problem.
if self.server_conn and self.server_conn.tls_established and not tls:
if self.server_conn and self.server_conn.tls_established and not ssl:
self.disconnect()
self.connect()
elif tls and not hasattr(self, "connected_to") or self.connected_to != address:
elif ssl and not hasattr(self, "connected_to") or self.connected_to != address:
if self.server_conn.tls_established:
self.disconnect()
self.connect()