aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2016-07-05 20:59:02 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2016-07-05 21:02:19 +0200
commit50fdb015538a38544f22c5154dcb742eb942fa48 (patch)
tree00c33050c94351c9230bb2a13b403152c59aca1a
parent1adcd6ad6bbf9ff3cd3a48ec4c9afe04c5b9fd6c (diff)
downloadmitmproxy-50fdb015538a38544f22c5154dcb742eb942fa48.tar.gz
mitmproxy-50fdb015538a38544f22c5154dcb742eb942fa48.tar.bz2
mitmproxy-50fdb015538a38544f22c5154dcb742eb942fa48.zip
prevent early priority changes
-rw-r--r--mitmproxy/protocol/http2.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/mitmproxy/protocol/http2.py b/mitmproxy/protocol/http2.py
index 28d6a890..19c7c604 100644
--- a/mitmproxy/protocol/http2.py
+++ b/mitmproxy/protocol/http2.py
@@ -206,10 +206,15 @@ class Http2Layer(base.Layer):
self.streams[event.pushed_stream_id].request_data_finished.set()
self.streams[event.pushed_stream_id].start()
elif isinstance(event, events.PriorityUpdated):
- if self.streams[eid].handled_priority_event is event:
- # This event was already handled during stream creation
- # HeadersFrame + Priority information as RequestReceived
- return True
+ if eid in self.streams:
+ if self.streams[eid].handled_priority_event is event:
+ # This event was already handled during stream creation
+ # HeadersFrame + Priority information as RequestReceived
+ return True
+ if eid in self.streams:
+ self.streams[eid].priority_weight = event.weight
+ self.streams[eid].priority_depends_on = event.depends_on
+ self.streams[eid].priority_exclusive = event.exclusive
stream_id = event.stream_id
if stream_id in self.streams.keys() and self.streams[stream_id].server_stream_id:
@@ -219,10 +224,6 @@ class Http2Layer(base.Layer):
if depends_on in self.streams.keys() and self.streams[depends_on].server_stream_id:
depends_on = self.streams[depends_on].server_stream_id
- self.streams[eid].priority_weight = event.weight
- self.streams[eid].priority_depends_on = event.depends_on
- self.streams[eid].priority_exclusive = event.exclusive
-
with self.server_conn.h2.lock:
self.server_conn.h2.prioritize(
stream_id,