aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/proxy/protocol/http2.py6
-rw-r--r--setup.py4
-rw-r--r--test/mitmproxy/proxy/protocol/test_http2.py14
3 files changed, 16 insertions, 8 deletions
diff --git a/mitmproxy/proxy/protocol/http2.py b/mitmproxy/proxy/protocol/http2.py
index a6e8a4dd..c1812b3d 100644
--- a/mitmproxy/proxy/protocol/http2.py
+++ b/mitmproxy/proxy/protocol/http2.py
@@ -188,7 +188,7 @@ class Http2Layer(base.Layer):
self.streams[eid].kill()
self.connections[source_conn].safe_reset_stream(
event.stream_id,
- h2.errors.REFUSED_STREAM
+ h2.errors.ErrorCodes.REFUSED_STREAM
)
self.log("HTTP body too large. Limit is {}.".format(bsl), "info")
else:
@@ -207,7 +207,7 @@ class Http2Layer(base.Layer):
def _handle_stream_reset(self, eid, event, is_server, other_conn):
self.streams[eid].kill()
- if eid in self.streams and event.error_code == h2.errors.CANCEL:
+ if eid in self.streams and event.error_code == h2.errors.ErrorCodes.CANCEL:
if is_server:
other_stream_id = self.streams[eid].client_stream_id
else:
@@ -228,7 +228,7 @@ class Http2Layer(base.Layer):
event.last_stream_id,
event.additional_data), "info")
- if event.error_code != h2.errors.NO_ERROR:
+ if event.error_code != h2.errors.ErrorCodes.NO_ERROR:
# Something terrible has happened - kill everything!
self.connections[self.client_conn].close_connection(
error_code=event.error_code,
diff --git a/setup.py b/setup.py
index aa5f9445..a758a31b 100644
--- a/setup.py
+++ b/setup.py
@@ -66,9 +66,9 @@ setup(
"construct>=2.8, <2.9",
"cryptography>=1.3, <1.9",
"cssutils>=1.0.1, <1.1",
- "h2>=2.6.1, <3",
+ "h2>=3.0, <4",
"html2text>=2016.1.8, <=2016.9.19",
- "hyperframe>=4.0.2, <6",
+ "hyperframe>=5.0, <6",
"jsbeautifier>=1.6.3, <1.7",
"kaitaistruct>=0.6, <0.7",
"passlib>=1.6.5, <1.8",
diff --git a/test/mitmproxy/proxy/protocol/test_http2.py b/test/mitmproxy/proxy/protocol/test_http2.py
index 1f695cc5..23027c24 100644
--- a/test/mitmproxy/proxy/protocol/test_http2.py
+++ b/test/mitmproxy/proxy/protocol/test_http2.py
@@ -36,7 +36,11 @@ class _Http2ServerBase(net_tservers.ServerTestBase):
class handler(mitmproxy.net.tcp.BaseHandler):
def handle(self):
- h2_conn = h2.connection.H2Connection(client_side=False, header_encoding=False)
+ config = h2.config.H2Configuration(
+ client_side=False,
+ validate_outbound_headers=False,
+ validate_inbound_headers=False)
+ h2_conn = h2.connection.H2Connection(config)
preamble = self.rfile.read(24)
h2_conn.initiate_connection()
@@ -138,7 +142,11 @@ class _Http2TestBase:
client.convert_to_ssl(alpn_protos=[b'h2'])
- h2_conn = h2.connection.H2Connection(client_side=True, header_encoding=False)
+ config = h2.config.H2Configuration(
+ client_side=True,
+ validate_outbound_headers=False,
+ validate_inbound_headers=False)
+ h2_conn = h2.connection.H2Connection(config)
h2_conn.initiate_connection()
client.wfile.write(h2_conn.data_to_send())
client.wfile.flush()
@@ -756,7 +764,7 @@ class TestMaxConcurrentStreams(_Http2Test):
@classmethod
def setup_class(cls):
_Http2TestBase.setup_class()
- _Http2ServerBase.setup_class(h2_server_settings={h2.settings.MAX_CONCURRENT_STREAMS: 2})
+ _Http2ServerBase.setup_class(h2_server_settings={h2.settings.SettingCodes.MAX_CONCURRENT_STREAMS: 2})
@classmethod
def handle_server_event(cls, event, h2_conn, rfile, wfile):