diff options
-rw-r--r-- | netlib/h2/frame.py | 41 | ||||
-rw-r--r-- | setup.py | 3 | ||||
-rw-r--r-- | test/h2/test_frames.py | 169 |
3 files changed, 167 insertions, 46 deletions
diff --git a/netlib/h2/frame.py b/netlib/h2/frame.py index ed6af200..179634b0 100644 --- a/netlib/h2/frame.py +++ b/netlib/h2/frame.py @@ -1,4 +1,6 @@ import struct +import io +from hpack.hpack import Encoder, Decoder from .. import utils from functools import reduce @@ -71,6 +73,7 @@ class Frame(object): def __eq__(self, other): return self.to_bytes() == other.to_bytes() + class DataFrame(Frame): TYPE = 0x0 VALID_FLAGS = [Frame.FLAG_END_STREAM, Frame.FLAG_PADDED] @@ -110,14 +113,18 @@ class DataFrame(Frame): def payload_human_readable(self): return "payload: %s" % str(self.payload) + class HeadersFrame(Frame): TYPE = 0x1 VALID_FLAGS = [Frame.FLAG_END_STREAM, Frame.FLAG_END_HEADERS, Frame.FLAG_PADDED, Frame.FLAG_PRIORITY] - def __init__(self, length=0, flags=Frame.FLAG_NO_FLAGS, stream_id=0x0, header_block_fragment=b'', - pad_length=0, exclusive=False, stream_dependency=0x0, weight=0): + def __init__(self, length=0, flags=Frame.FLAG_NO_FLAGS, stream_id=0x0, headers=None, pad_length=0, exclusive=False, stream_dependency=0x0, weight=0): super(HeadersFrame, self).__init__(length, flags, stream_id) - self.header_block_fragment = header_block_fragment + + if headers is None: + headers = [] + + self.headers = headers self.pad_length = pad_length self.exclusive = exclusive self.stream_dependency = stream_dependency @@ -129,15 +136,18 @@ class HeadersFrame(Frame): if f.flags & self.FLAG_PADDED: f.pad_length = struct.unpack('!B', payload[0])[0] - f.header_block_fragment = payload[1:-f.pad_length] + header_block_fragment = payload[1:-f.pad_length] else: - f.header_block_fragment = payload[0:] + header_block_fragment = payload[0:] if f.flags & self.FLAG_PRIORITY: - f.stream_dependency, f.weight = struct.unpack('!LB', f.header_block_fragment[:5]) + f.stream_dependency, f.weight = struct.unpack('!LB', header_block_fragment[:5]) f.exclusive = bool(f.stream_dependency >> 31) f.stream_dependency &= 0x7FFFFFFF - f.header_block_fragment = f.header_block_fragment[5:] + header_block_fragment = header_block_fragment[5:] + + for header, value in Decoder().decode(header_block_fragment): + f.headers.append((header, value)) return f @@ -152,7 +162,7 @@ class HeadersFrame(Frame): if self.flags & self.FLAG_PRIORITY: b += struct.pack('!LB', (int(self.exclusive) << 31) | self.stream_dependency, self.weight) - b += bytes(self.header_block_fragment) + b += Encoder().encode(self.headers) if self.flags & self.FLAG_PADDED: b += b'\0' * self.pad_length @@ -170,9 +180,15 @@ class HeadersFrame(Frame): if self.flags & self.FLAG_PADDED: s.append("padding: %d" % self.pad_length) - s.append("header_block_fragment: %s" % str(self.header_block_fragment)) + if not self.headers: + s.append("headers: None") + else: + for header, value in self.headers: + s.append("%s: %s" % (header, value)) + return "\n".join(s) + class PriorityFrame(Frame): TYPE = 0x2 VALID_FLAGS = [] @@ -209,6 +225,7 @@ class PriorityFrame(Frame): s.append("weight: %d" % self.weight) return "\n".join(s) + class RstStreamFrame(Frame): TYPE = 0x3 VALID_FLAGS = [] @@ -232,6 +249,7 @@ class RstStreamFrame(Frame): def payload_human_readable(self): return "error code: %#x" % self.error_code + class SettingsFrame(Frame): TYPE = 0x4 VALID_FLAGS = [Frame.FLAG_ACK] @@ -284,6 +302,7 @@ class SettingsFrame(Frame): else: return "\n".join(s) + class PushPromiseFrame(Frame): TYPE = 0x5 VALID_FLAGS = [Frame.FLAG_END_HEADERS, Frame.FLAG_PADDED] @@ -338,6 +357,7 @@ class PushPromiseFrame(Frame): s.append("header_block_fragment: %s" % str(self.header_block_fragment)) return "\n".join(s) + class PingFrame(Frame): TYPE = 0x6 VALID_FLAGS = [Frame.FLAG_ACK] @@ -363,6 +383,7 @@ class PingFrame(Frame): def payload_human_readable(self): return "opaque data: %s" % str(self.payload) + class GoAwayFrame(Frame): TYPE = 0x7 VALID_FLAGS = [] @@ -398,6 +419,7 @@ class GoAwayFrame(Frame): s.append("debug data: %s" % str(self.data)) return "\n".join(s) + class WindowUpdateFrame(Frame): TYPE = 0x8 VALID_FLAGS = [] @@ -424,6 +446,7 @@ class WindowUpdateFrame(Frame): def payload_human_readable(self): return "window size increment: %#x" % self.window_size_increment + class ContinuationFrame(Frame): TYPE = 0x9 VALID_FLAGS = [Frame.FLAG_END_HEADERS] @@ -42,7 +42,8 @@ setup( "pyasn1>=0.1.7", "pyOpenSSL>=0.15.1", "cryptography>=0.9", - "passlib>=1.6.2" + "passlib>=1.6.2", + "hpack>=1.0.1" ], extras_require={ 'dev': [ diff --git a/test/h2/test_frames.py b/test/h2/test_frames.py index eb6e2a60..eb470dd4 100644 --- a/test/h2/test_frames.py +++ b/test/h2/test_frames.py @@ -5,17 +5,21 @@ from nose.tools import assert_equal # TODO test stream association if valid or not + def test_invalid_flags(): tutils.raises(ValueError, DataFrame, ContinuationFrame.FLAG_END_HEADERS, 0x1234567, 'foobar') + def test_frame_equality(): a = DataFrame(6, Frame.FLAG_END_STREAM, 0x1234567, 'foobar') b = DataFrame(6, Frame.FLAG_END_STREAM, 0x1234567, 'foobar') assert_equal(a, b) + def test_too_large_frames(): DataFrame(6, Frame.FLAG_END_STREAM, 0x1234567) + def test_data_frame_to_bytes(): f = DataFrame(6, Frame.FLAG_END_STREAM, 0x1234567, 'foobar') assert_equal(f.to_bytes().encode('hex'), '000006000101234567666f6f626172') @@ -26,6 +30,7 @@ def test_data_frame_to_bytes(): f = DataFrame(6, Frame.FLAG_NO_FLAGS, 0x0, 'foobar') tutils.raises(ValueError, f.to_bytes) + def test_data_frame_from_bytes(): f = Frame.from_bytes('000006000101234567666f6f626172'.decode('hex')) assert isinstance(f, DataFrame) @@ -43,85 +48,139 @@ def test_data_frame_from_bytes(): assert_equal(f.stream_id, 0x1234567) assert_equal(f.payload, 'foobar') + def test_data_frame_human_readable(): f = DataFrame(11, Frame.FLAG_END_STREAM | Frame.FLAG_PADDED, 0x1234567, 'foobar', pad_length=3) assert f.human_readable() -def test_headers_frame_to_bytes(): - f = HeadersFrame(6, Frame.FLAG_NO_FLAGS, 0x1234567, 'foobar') - assert_equal(f.to_bytes().encode('hex'), '000006010001234567666f6f626172') - f = HeadersFrame(10, HeadersFrame.FLAG_PADDED, 0x1234567, 'foobar', pad_length=3) - assert_equal(f.to_bytes().encode('hex'), '00000a01080123456703666f6f626172000000') - - f = HeadersFrame(10, HeadersFrame.FLAG_PRIORITY, 0x1234567, 'foobar', exclusive=True, stream_dependency=0x7654321, weight=42) - assert_equal(f.to_bytes().encode('hex'), '00000b012001234567876543212a666f6f626172') - - f = HeadersFrame(14, HeadersFrame.FLAG_PADDED | HeadersFrame.FLAG_PRIORITY, 0x1234567, - 'foobar', pad_length=3, exclusive=True, stream_dependency=0x7654321, weight=42) - assert_equal(f.to_bytes().encode('hex'), '00000f01280123456703876543212a666f6f626172000000') - - f = HeadersFrame(14, HeadersFrame.FLAG_PADDED | HeadersFrame.FLAG_PRIORITY, 0x1234567, 'foobar', - pad_length=3, exclusive=False, stream_dependency=0x7654321, weight=42) - assert_equal(f.to_bytes().encode('hex'), '00000f01280123456703076543212a666f6f626172000000') +def test_headers_frame_to_bytes(): + f = HeadersFrame( + 6, + Frame.FLAG_NO_FLAGS, + 0x1234567, + headers=[('host', 'foo.bar')]) + assert_equal(f.to_bytes().encode('hex'), '000007010001234567668594e75e31d9') + + f = HeadersFrame( + 10, + HeadersFrame.FLAG_PADDED, + 0x1234567, + headers=[('host', 'foo.bar')], + pad_length=3) + assert_equal(f.to_bytes().encode('hex'), '00000b01080123456703668594e75e31d9000000') + + f = HeadersFrame( + 10, + HeadersFrame.FLAG_PRIORITY, + 0x1234567, + headers=[('host', 'foo.bar')], + exclusive=True, + stream_dependency=0x7654321, + weight=42) + assert_equal(f.to_bytes().encode('hex'), '00000c012001234567876543212a668594e75e31d9') + + f = HeadersFrame( + 14, + HeadersFrame.FLAG_PADDED | HeadersFrame.FLAG_PRIORITY, + 0x1234567, + headers=[('host', 'foo.bar')], + pad_length=3, + exclusive=True, + stream_dependency=0x7654321, + weight=42) + assert_equal(f.to_bytes().encode('hex'), '00001001280123456703876543212a668594e75e31d9000000') + + f = HeadersFrame( + 14, + HeadersFrame.FLAG_PADDED | HeadersFrame.FLAG_PRIORITY, + 0x1234567, + headers=[('host', 'foo.bar')], + pad_length=3, + exclusive=False, + stream_dependency=0x7654321, + weight=42) + assert_equal(f.to_bytes().encode('hex'), '00001001280123456703076543212a668594e75e31d9000000') f = HeadersFrame(6, Frame.FLAG_NO_FLAGS, 0x0, 'foobar') tutils.raises(ValueError, f.to_bytes) + def test_headers_frame_from_bytes(): - f = Frame.from_bytes('000006010001234567666f6f626172'.decode('hex')) + f = Frame.from_bytes('000007010001234567668594e75e31d9'.decode('hex')) assert isinstance(f, HeadersFrame) - assert_equal(f.length, 6) + assert_equal(f.length, 7) assert_equal(f.TYPE, HeadersFrame.TYPE) assert_equal(f.flags, Frame.FLAG_NO_FLAGS) assert_equal(f.stream_id, 0x1234567) - assert_equal(f.header_block_fragment, 'foobar') + assert_equal(f.headers, [('host', 'foo.bar')]) - f = Frame.from_bytes('00000a01080123456703666f6f626172000000'.decode('hex')) + f = Frame.from_bytes('00000b01080123456703668594e75e31d9000000'.decode('hex')) assert isinstance(f, HeadersFrame) - assert_equal(f.length, 10) + assert_equal(f.length, 11) assert_equal(f.TYPE, HeadersFrame.TYPE) assert_equal(f.flags, HeadersFrame.FLAG_PADDED) assert_equal(f.stream_id, 0x1234567) - assert_equal(f.header_block_fragment, 'foobar') + assert_equal(f.headers, [('host', 'foo.bar')]) - f = Frame.from_bytes('00000b012001234567876543212a666f6f626172'.decode('hex')) + f = Frame.from_bytes('00000c012001234567876543212a668594e75e31d9'.decode('hex')) assert isinstance(f, HeadersFrame) - assert_equal(f.length, 11) + assert_equal(f.length, 12) assert_equal(f.TYPE, HeadersFrame.TYPE) assert_equal(f.flags, HeadersFrame.FLAG_PRIORITY) assert_equal(f.stream_id, 0x1234567) - assert_equal(f.header_block_fragment, 'foobar') + assert_equal(f.headers, [('host', 'foo.bar')]) assert_equal(f.exclusive, True) assert_equal(f.stream_dependency, 0x7654321) assert_equal(f.weight, 42) - f = Frame.from_bytes('00000f01280123456703876543212a666f6f626172000000'.decode('hex')) + f = Frame.from_bytes('00001001280123456703876543212a668594e75e31d9000000'.decode('hex')) assert isinstance(f, HeadersFrame) - assert_equal(f.length, 15) + assert_equal(f.length, 16) assert_equal(f.TYPE, HeadersFrame.TYPE) assert_equal(f.flags, HeadersFrame.FLAG_PADDED | HeadersFrame.FLAG_PRIORITY) assert_equal(f.stream_id, 0x1234567) - assert_equal(f.header_block_fragment, 'foobar') + assert_equal(f.headers, [('host', 'foo.bar')]) assert_equal(f.exclusive, True) assert_equal(f.stream_dependency, 0x7654321) assert_equal(f.weight, 42) - f = Frame.from_bytes('00000f01280123456703076543212a666f6f626172000000'.decode('hex')) + f = Frame.from_bytes('00001001280123456703076543212a668594e75e31d9000000'.decode('hex')) assert isinstance(f, HeadersFrame) - assert_equal(f.length, 15) + assert_equal(f.length, 16) assert_equal(f.TYPE, HeadersFrame.TYPE) assert_equal(f.flags, HeadersFrame.FLAG_PADDED | HeadersFrame.FLAG_PRIORITY) assert_equal(f.stream_id, 0x1234567) - assert_equal(f.header_block_fragment, 'foobar') + assert_equal(f.headers, [('host', 'foo.bar')]) assert_equal(f.exclusive, False) assert_equal(f.stream_dependency, 0x7654321) assert_equal(f.weight, 42) + def test_headers_frame_human_readable(): - f = HeadersFrame(14, HeadersFrame.FLAG_PADDED | HeadersFrame.FLAG_PRIORITY, 0x1234567, 'foobar', pad_length=3, exclusive=False, stream_dependency=0x7654321, weight=42) + f = HeadersFrame( + 7, + HeadersFrame.FLAG_PADDED | HeadersFrame.FLAG_PRIORITY, + 0x1234567, + headers=[], + pad_length=3, + exclusive=False, + stream_dependency=0x7654321, + weight=42) + assert f.human_readable() + + f = HeadersFrame( + 14, + HeadersFrame.FLAG_PADDED | HeadersFrame.FLAG_PRIORITY, + 0x1234567, + headers=[('host', 'foo.bar')], + pad_length=3, + exclusive=False, + stream_dependency=0x7654321, + weight=42) assert f.human_readable() + def test_priority_frame_to_bytes(): f = PriorityFrame(5, Frame.FLAG_NO_FLAGS, 0x1234567, exclusive=True, stream_dependency=0x7654321, weight=42) assert_equal(f.to_bytes().encode('hex'), '000005020001234567876543212a') @@ -135,6 +194,7 @@ def test_priority_frame_to_bytes(): f = PriorityFrame(5, Frame.FLAG_NO_FLAGS, 0x1234567, stream_dependency=0x0) tutils.raises(ValueError, f.to_bytes) + def test_priority_frame_from_bytes(): f = Frame.from_bytes('000005020001234567876543212a'.decode('hex')) assert isinstance(f, PriorityFrame) @@ -156,10 +216,12 @@ def test_priority_frame_from_bytes(): assert_equal(f.stream_dependency, 0x7654321) assert_equal(f.weight, 21) + def test_priority_frame_human_readable(): f = PriorityFrame(5, Frame.FLAG_NO_FLAGS, 0x1234567, exclusive=False, stream_dependency=0x7654321, weight=21) assert f.human_readable() + def test_rst_stream_frame_to_bytes(): f = RstStreamFrame(4, Frame.FLAG_NO_FLAGS, 0x1234567, error_code=0x7654321) assert_equal(f.to_bytes().encode('hex'), '00000403000123456707654321') @@ -167,6 +229,7 @@ def test_rst_stream_frame_to_bytes(): f = RstStreamFrame(4, Frame.FLAG_NO_FLAGS, 0x0) tutils.raises(ValueError, f.to_bytes) + def test_rst_stream_frame_from_bytes(): f = Frame.from_bytes('00000403000123456707654321'.decode('hex')) assert isinstance(f, RstStreamFrame) @@ -176,10 +239,12 @@ def test_rst_stream_frame_from_bytes(): assert_equal(f.stream_id, 0x1234567) assert_equal(f.error_code, 0x07654321) + def test_rst_stream_frame_human_readable(): f = RstStreamFrame(4, Frame.FLAG_NO_FLAGS, 0x1234567, error_code=0x7654321) assert f.human_readable() + def test_settings_frame_to_bytes(): f = SettingsFrame(0, Frame.FLAG_NO_FLAGS, 0x0) assert_equal(f.to_bytes().encode('hex'), '000000040000000000') @@ -187,16 +252,26 @@ def test_settings_frame_to_bytes(): f = SettingsFrame(0, SettingsFrame.FLAG_ACK, 0x0) assert_equal(f.to_bytes().encode('hex'), '000000040100000000') - f = SettingsFrame(6, SettingsFrame.FLAG_ACK, 0x0, settings={SettingsFrame.SETTINGS.SETTINGS_ENABLE_PUSH: 1}) + f = SettingsFrame( + 6, + SettingsFrame.FLAG_ACK, 0x0, + settings={ + SettingsFrame.SETTINGS.SETTINGS_ENABLE_PUSH: 1}) assert_equal(f.to_bytes().encode('hex'), '000006040100000000000200000001') - f = SettingsFrame(12, Frame.FLAG_NO_FLAGS, 0x0, settings={ - SettingsFrame.SETTINGS.SETTINGS_ENABLE_PUSH: 1, SettingsFrame.SETTINGS.SETTINGS_MAX_CONCURRENT_STREAMS: 0x12345678}) + f = SettingsFrame( + 12, + Frame.FLAG_NO_FLAGS, + 0x0, + settings={ + SettingsFrame.SETTINGS.SETTINGS_ENABLE_PUSH: 1, + SettingsFrame.SETTINGS.SETTINGS_MAX_CONCURRENT_STREAMS: 0x12345678}) assert_equal(f.to_bytes().encode('hex'), '00000c040000000000000200000001000312345678') f = SettingsFrame(0, Frame.FLAG_NO_FLAGS, 0x1234567) tutils.raises(ValueError, f.to_bytes) + def test_settings_frame_from_bytes(): f = Frame.from_bytes('000000040000000000'.decode('hex')) assert isinstance(f, SettingsFrame) @@ -231,13 +306,21 @@ def test_settings_frame_from_bytes(): assert_equal(f.settings[SettingsFrame.SETTINGS.SETTINGS_ENABLE_PUSH], 1) assert_equal(f.settings[SettingsFrame.SETTINGS.SETTINGS_MAX_CONCURRENT_STREAMS], 0x12345678) + def test_settings_frame_human_readable(): f = SettingsFrame(12, Frame.FLAG_NO_FLAGS, 0x0, settings={}) assert f.human_readable() - f = SettingsFrame(12, Frame.FLAG_NO_FLAGS, 0x0, settings={SettingsFrame.SETTINGS.SETTINGS_ENABLE_PUSH: 1, SettingsFrame.SETTINGS.SETTINGS_MAX_CONCURRENT_STREAMS: 0x12345678}) + f = SettingsFrame( + 12, + Frame.FLAG_NO_FLAGS, + 0x0, + settings={ + SettingsFrame.SETTINGS.SETTINGS_ENABLE_PUSH: 1, + SettingsFrame.SETTINGS.SETTINGS_MAX_CONCURRENT_STREAMS: 0x12345678}) assert f.human_readable() + def test_push_promise_frame_to_bytes(): f = PushPromiseFrame(10, Frame.FLAG_NO_FLAGS, 0x1234567, 0x7654321, 'foobar') assert_equal(f.to_bytes().encode('hex'), '00000a05000123456707654321666f6f626172') @@ -251,6 +334,7 @@ def test_push_promise_frame_to_bytes(): f = PushPromiseFrame(4, Frame.FLAG_NO_FLAGS, 0x1234567, 0x0) tutils.raises(ValueError, f.to_bytes) + def test_push_promise_frame_from_bytes(): f = Frame.from_bytes('00000a05000123456707654321666f6f626172'.decode('hex')) assert isinstance(f, PushPromiseFrame) @@ -268,10 +352,12 @@ def test_push_promise_frame_from_bytes(): assert_equal(f.stream_id, 0x1234567) assert_equal(f.header_block_fragment, 'foobar') + def test_push_promise_frame_human_readable(): f = PushPromiseFrame(14, HeadersFrame.FLAG_PADDED, 0x1234567, 0x7654321, 'foobar', pad_length=3) assert f.human_readable() + def test_ping_frame_to_bytes(): f = PingFrame(8, PingFrame.FLAG_ACK, 0x0, payload=b'foobar') assert_equal(f.to_bytes().encode('hex'), '000008060100000000666f6f6261720000') @@ -282,6 +368,7 @@ def test_ping_frame_to_bytes(): f = PingFrame(8, Frame.FLAG_NO_FLAGS, 0x1234567) tutils.raises(ValueError, f.to_bytes) + def test_ping_frame_from_bytes(): f = Frame.from_bytes('000008060100000000666f6f6261720000'.decode('hex')) assert isinstance(f, PingFrame) @@ -299,10 +386,12 @@ def test_ping_frame_from_bytes(): assert_equal(f.stream_id, 0x0) assert_equal(f.payload, b'foobarde') + def test_ping_frame_human_readable(): f = PingFrame(8, PingFrame.FLAG_ACK, 0x0, payload=b'foobar') assert f.human_readable() + def test_goaway_frame_to_bytes(): f = GoAwayFrame(8, Frame.FLAG_NO_FLAGS, 0x0, last_stream=0x1234567, error_code=0x87654321, data=b'') assert_equal(f.to_bytes().encode('hex'), '0000080700000000000123456787654321') @@ -313,6 +402,7 @@ def test_goaway_frame_to_bytes(): f = GoAwayFrame(8, Frame.FLAG_NO_FLAGS, 0x1234567, last_stream=0x1234567, error_code=0x87654321) tutils.raises(ValueError, f.to_bytes) + def test_goaway_frame_from_bytes(): f = Frame.from_bytes('0000080700000000000123456787654321'.decode('hex')) assert isinstance(f, GoAwayFrame) @@ -334,10 +424,12 @@ def test_goaway_frame_from_bytes(): assert_equal(f.error_code, 0x87654321) assert_equal(f.data, b'foobar') + def test_go_away_frame_human_readable(): f = GoAwayFrame(14, Frame.FLAG_NO_FLAGS, 0x0, last_stream=0x1234567, error_code=0x87654321, data=b'foobar') assert f.human_readable() + def test_window_update_frame_to_bytes(): f = WindowUpdateFrame(4, Frame.FLAG_NO_FLAGS, 0x0, window_size_increment=0x1234567) assert_equal(f.to_bytes().encode('hex'), '00000408000000000001234567') @@ -351,6 +443,7 @@ def test_window_update_frame_to_bytes(): f = WindowUpdateFrame(4, Frame.FLAG_NO_FLAGS, 0x0, window_size_increment=0) tutils.raises(ValueError, f.to_bytes) + def test_window_update_frame_from_bytes(): f = Frame.from_bytes('00000408000000000001234567'.decode('hex')) assert isinstance(f, WindowUpdateFrame) @@ -360,10 +453,12 @@ def test_window_update_frame_from_bytes(): assert_equal(f.stream_id, 0x0) assert_equal(f.window_size_increment, 0x1234567) + def test_window_update_frame_human_readable(): f = WindowUpdateFrame(4, Frame.FLAG_NO_FLAGS, 0x1234567, window_size_increment=0x7654321) assert f.human_readable() + def test_continuation_frame_to_bytes(): f = ContinuationFrame(6, ContinuationFrame.FLAG_END_HEADERS, 0x1234567, 'foobar') assert_equal(f.to_bytes().encode('hex'), '000006090401234567666f6f626172') @@ -371,6 +466,7 @@ def test_continuation_frame_to_bytes(): f = ContinuationFrame(6, ContinuationFrame.FLAG_END_HEADERS, 0x0, 'foobar') tutils.raises(ValueError, f.to_bytes) + def test_continuation_frame_from_bytes(): f = Frame.from_bytes('000006090401234567666f6f626172'.decode('hex')) assert isinstance(f, ContinuationFrame) @@ -380,6 +476,7 @@ def test_continuation_frame_from_bytes(): assert_equal(f.stream_id, 0x1234567) assert_equal(f.header_block_fragment, 'foobar') + def test_continuation_frame_human_readable(): f = ContinuationFrame(6, ContinuationFrame.FLAG_END_HEADERS, 0x1234567, 'foobar') assert f.human_readable() |