aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http2/frame.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-15 15:31:58 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-16 15:00:28 +0200
commit1c124421e34d310c6e0577f20b595413d639a5c3 (patch)
tree342fb7c688eea62902921ad1591193b375f04cf2 /netlib/http2/frame.py
parentd0a9d3cdda6d1f784a23ea4bd9efd3134e292628 (diff)
downloadmitmproxy-1c124421e34d310c6e0577f20b595413d639a5c3.tar.gz
mitmproxy-1c124421e34d310c6e0577f20b595413d639a5c3.tar.bz2
mitmproxy-1c124421e34d310c6e0577f20b595413d639a5c3.zip
http2: fix header_block_fragments and length
Diffstat (limited to 'netlib/http2/frame.py')
-rw-r--r--netlib/http2/frame.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/netlib/http2/frame.py b/netlib/http2/frame.py
index 3e285cba..98ced904 100644
--- a/netlib/http2/frame.py
+++ b/netlib/http2/frame.py
@@ -114,6 +114,8 @@ class Frame(object):
raise NotImplementedError()
def human_readable(self, direction="-"):
+ self.length = len(self.payload_bytes())
+
return "\n".join([
"%s: %s | length: %d | flags: %#x | stream_id: %d" % (direction, self.__class__.__name__, self.length, self.flags, self.stream_id),
self.payload_human_readable(),
@@ -456,7 +458,10 @@ class PushPromiseFrame(Frame):
s.append("padding: %d" % self.pad_length)
s.append("promised stream: %#x" % self.promised_stream)
- s.append("header_block_fragment: %s" % str(self.header_block_fragment))
+ s.append(
+ "header_block_fragment: %s" %
+ self.header_block_fragment.encode('hex'))
+
return "\n".join(s)
@@ -600,7 +605,11 @@ class ContinuationFrame(Frame):
return self.header_block_fragment
def payload_human_readable(self):
- return "header_block_fragment: %s" % str(self.header_block_fragment)
+ s = []
+ s.append(
+ "header_block_fragment: %s" %
+ self.header_block_fragment.encode('hex'))
+ return "\n".join(s)
_FRAME_CLASSES = [
DataFrame,