aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http2/protocol.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-15 17:31:08 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-16 15:00:28 +0200
commitabb37a3ef52ab9a0f68dc46e4a8ca165e365139b (patch)
treeff569a1321eb3cef327d9e5f5843840a577eaeb1 /netlib/http2/protocol.py
parent20c136e070cee0e93e870bf32199cb36b1b85275 (diff)
downloadmitmproxy-abb37a3ef52ab9a0f68dc46e4a8ca165e365139b.tar.gz
mitmproxy-abb37a3ef52ab9a0f68dc46e4a8ca165e365139b.tar.bz2
mitmproxy-abb37a3ef52ab9a0f68dc46e4a8ca165e365139b.zip
http2: improve test suite
Diffstat (limited to 'netlib/http2/protocol.py')
-rw-r--r--netlib/http2/protocol.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/netlib/http2/protocol.py b/netlib/http2/protocol.py
index a77edd9b..8191090c 100644
--- a/netlib/http2/protocol.py
+++ b/netlib/http2/protocol.py
@@ -55,7 +55,7 @@ class HTTP2Protocol(object):
if isinstance(frm, frame.SettingsFrame):
break
- def _read_settings_ack(self, hide=False):
+ def _read_settings_ack(self, hide=False): # pragma no cover
while True:
frm = self.read_frame(hide)
if isinstance(frm, frame.SettingsFrame):
@@ -99,12 +99,12 @@ class HTTP2Protocol(object):
raw_bytes = frm.to_bytes()
self.tcp_handler.wfile.write(raw_bytes)
self.tcp_handler.wfile.flush()
- if not hide and self.dump_frames:
+ if not hide and self.dump_frames: # pragma no cover
print(frm.human_readable(">>"))
def read_frame(self, hide=False):
frm = frame.Frame.from_file(self.tcp_handler.rfile, self)
- if not hide and self.dump_frames:
+ if not hide and self.dump_frames: # pragma no cover
print(frm.human_readable("<<"))
if isinstance(frm, frame.SettingsFrame) and not frm.flags & frame.Frame.FLAG_ACK:
self._apply_settings(frm.settings, hide)
@@ -123,7 +123,9 @@ class HTTP2Protocol(object):
state=self,
flags=frame.Frame.FLAG_ACK),
hide)
- # self._read_settings_ack(hide)
+
+ # be liberal in what we expect from the other end
+ # to be more strict use: self._read_settings_ack(hide)
def _create_headers(self, headers, stream_id, end_stream=True):
# TODO: implement max frame size checks and sending in chunks
@@ -140,7 +142,7 @@ class HTTP2Protocol(object):
stream_id=stream_id,
header_block_fragment=header_block_fragment)
- if self.dump_frames:
+ if self.dump_frames: # pragma no cover
print(frm.human_readable(">>"))
return [frm.to_bytes()]
@@ -158,7 +160,7 @@ class HTTP2Protocol(object):
stream_id=stream_id,
payload=body)
- if self.dump_frames:
+ if self.dump_frames: # pragma no cover
print(frm.human_readable(">>"))
return [frm.to_bytes()]
@@ -225,8 +227,6 @@ class HTTP2Protocol(object):
if headers is None:
headers = []
- body='foobar'
-
headers = [(b':status', bytes(str(code)))] + headers
if not stream_id: