if the `:authority` header is not found, we can try to guess it from
variable `flow.request.pretty_host` as .pop() accepts a fallback
parameter
This commit is contained in:
Yoann L 2019-10-25 10:38:35 +02:00
parent eb7ed1dc40
commit ad120c380a

View File

@ -203,7 +203,7 @@ class ClientPlayback:
# https://github.com/mitmproxy/mitmproxy/issues/2197 # https://github.com/mitmproxy/mitmproxy/issues/2197
if hf.request.http_version == "HTTP/2.0": if hf.request.http_version == "HTTP/2.0":
hf.request.http_version = "HTTP/1.1" hf.request.http_version = "HTTP/1.1"
host = hf.request.headers.pop(":authority") host = hf.request.headers.pop(":authority", hf.request.pretty_host)
hf.request.headers.insert(0, "host", host) hf.request.headers.insert(0, "host", host)
self.q.put(hf) self.q.put(hf)
ctx.master.addons.trigger("update", lst) ctx.master.addons.trigger("update", lst)