aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2016-05-21 20:17:59 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2016-05-21 20:17:59 +0200
commit6965c93be6221f5905dcb1b290fea73c9fe652de (patch)
tree80ae5d150c47aa70aefd748e2ecd881880215f50
parentf7ce8e219e6f64133ba9f3c56669ace350c2d521 (diff)
downloadmitmproxy-6965c93be6221f5905dcb1b290fea73c9fe652de.tar.gz
mitmproxy-6965c93be6221f5905dcb1b290fea73c9fe652de.tar.bz2
mitmproxy-6965c93be6221f5905dcb1b290fea73c9fe652de.zip
implement transparent Priority updates
-rw-r--r--mitmproxy/protocol/http2.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/mitmproxy/protocol/http2.py b/mitmproxy/protocol/http2.py
index 81bf5db9..3c4b59e9 100644
--- a/mitmproxy/protocol/http2.py
+++ b/mitmproxy/protocol/http2.py
@@ -9,6 +9,7 @@ import six
from h2.connection import H2Connection
from h2.exceptions import StreamClosedError
from h2 import events
+from hyperframe.frame import PriorityFrame
from netlib.tcp import ssl_read_select
from netlib.exceptions import HttpException
@@ -185,6 +186,17 @@ class Http2Layer(Layer):
self.streams[event.pushed_stream_id].timestamp_end = time.time()
self.streams[event.pushed_stream_id].request_data_finished.set()
self.streams[event.pushed_stream_id].start()
+ elif isinstance(event, events.PriorityUpdated):
+ stream_id = event.stream_id
+ if stream_id in self.streams.keys() and self.streams[stream_id].server_stream_id:
+ stream_id = self.streams[stream_id].server_stream_id
+
+ depends_on = event.depends_on
+ if depends_on in self.streams.keys() and self.streams[depends_on].server_stream_id:
+ depends_on = self.streams[depends_on].server_stream_id
+
+ frame = PriorityFrame(stream_id, depends_on, event.weight, event.exclusive)
+ self.server_conn.send(frame.serialize())
elif isinstance(event, events.TrailersReceived):
raise NotImplementedError()