This commit is contained in:
Maximilian Hils 2015-10-03 14:48:42 +02:00
parent c6811bd0e8
commit 26631621ee
1 changed files with 5 additions and 0 deletions

View File

@ -382,6 +382,7 @@ class HttpLayer(Layer):
def get_request_from_client(self):
request = self.read_request()
if request.headers.get("expect", "").lower() == "100-continue":
# TODO: We may have to use send_response_headers for HTTP2 here.
self.send_response(expect_continue_response)
request.headers.pop("expect")
request.body = b"".join(self.read_request_body(request))
@ -491,8 +492,12 @@ class HttpLayer(Layer):
if flow.request.form_in == "authority":
flow.request.scheme = "http" # pseudo value
else:
# 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.__original_server_conn.address.host
flow.request.port = self.__original_server_conn.address.port
if host_header:
flow.request.headers["host"] = host_header
# TODO: This does not really work if we change the first request and --no-upstream-cert is enabled
flow.request.scheme = "https" if self.__original_server_conn.tls_established else "http"