aboutsummaryrefslogtreecommitdiffstats
path: root/netlib
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-08-20 20:36:51 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-08-20 20:36:51 +0200
commit53f2582313ce5e8d1c875bea8b3f1a270db35b5b (patch)
treebc3cf46f2a91cca227a82aee4f4f54c4dfcbace1 /netlib
parent16f697f68a7f94375bd1435f5eec6e00911b7019 (diff)
downloadmitmproxy-53f2582313ce5e8d1c875bea8b3f1a270db35b5b.tar.gz
mitmproxy-53f2582313ce5e8d1c875bea8b3f1a270db35b5b.tar.bz2
mitmproxy-53f2582313ce5e8d1c875bea8b3f1a270db35b5b.zip
http2: fix unhandled settings frame
Diffstat (limited to 'netlib')
-rw-r--r--netlib/http/http2/protocol.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/netlib/http/http2/protocol.py b/netlib/http/http2/protocol.py
index cf46a130..66ce19c8 100644
--- a/netlib/http/http2/protocol.py
+++ b/netlib/http/http2/protocol.py
@@ -239,7 +239,8 @@ class HTTP2Protocol(semantics.ProtocolMixin):
self.tcp_handler.wfile.write(self.CLIENT_CONNECTION_PREFACE)
self.send_frame(frame.SettingsFrame(state=self), hide=True)
- self._receive_settings(hide=True)
+ self._receive_settings(hide=True) # server announces own settings
+ self._receive_settings(hide=True) # server acks my settings
def send_frame(self, frm, hide=False):
raw_bytes = frm.to_bytes()
@@ -279,16 +280,6 @@ class HTTP2Protocol(semantics.ProtocolMixin):
else:
self._handle_unexpected_frame(frm)
- def _read_settings_ack(self, hide=False): # pragma no cover
- while True:
- frm = self.read_frame(hide)
- if isinstance(frm, frame.SettingsFrame):
- assert frm.flags & frame.Frame.FLAG_ACK
- assert len(frm.settings) == 0
- break
- else:
- self._handle_unexpected_frame(frm)
-
def _next_stream_id(self):
if self.current_stream_id is None:
if self.is_server:
@@ -313,9 +304,6 @@ class HTTP2Protocol(semantics.ProtocolMixin):
flags=frame.Frame.FLAG_ACK)
self.send_frame(frm, hide)
- # be liberal in what we expect from the other end
- # to be more strict use: self._read_settings_ack(hide)
-
def _update_flow_control_window(self, stream_id, increment):
frm = frame.WindowUpdateFrame(stream_id=0, window_size_increment=increment)
self.send_frame(frm)