From 05de3b759fe75e2f6839d8e855c304239f97eec1 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sun, 5 Jun 2016 12:53:41 +0200 Subject: http2: remove forbidden headers E.g.: send_error_reponse sets a connection header --- mitmproxy/protocol/http2.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mitmproxy/protocol/http2.py b/mitmproxy/protocol/http2.py index 19c7c604..9515eef9 100644 --- a/mitmproxy/protocol/http2.py +++ b/mitmproxy/protocol/http2.py @@ -478,6 +478,9 @@ class Http2SingleStreamLayer(http._HttpTransmissionLayer, basethread.BaseThread) def send_response_headers(self, response): headers = response.headers.copy() headers.insert(0, ":status", str(response.status_code)) + for forbidden_header in h2.utilities.CONNECTION_HEADERS: + if forbidden_header in headers: + del headers[forbidden_header] with self.client_conn.h2.lock: self.client_conn.h2.safe_send_headers( self.is_zombie, -- cgit v1.2.3