aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2016-01-14 19:05:15 +0100
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2016-02-04 09:52:01 +0100
commitb44c3ac6e0f54413a067294bbcb0fe019fade3f3 (patch)
tree9d50e3dd83851a60101a09f2d8ab6d67fc4ab30d /libmproxy
parente9eed5e4c206e507665f5a4ff92654e969f4dd89 (diff)
downloadmitmproxy-b44c3ac6e0f54413a067294bbcb0fe019fade3f3.tar.gz
mitmproxy-b44c3ac6e0f54413a067294bbcb0fe019fade3f3.tar.bz2
mitmproxy-b44c3ac6e0f54413a067294bbcb0fe019fade3f3.zip
propagate GoAway to the other side
Diffstat (limited to 'libmproxy')
-rw-r--r--libmproxy/protocol/http.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py
index fc045e0d..8315aed0 100644
--- a/libmproxy/protocol/http.py
+++ b/libmproxy/protocol/http.py
@@ -135,6 +135,11 @@ class SafeH2Connection(H2Connection):
self.conn = conn
self.lock = threading.RLock()
+ def safe_close_connection(self, error_code):
+ with self.lock:
+ self.close_connection(error_code)
+ self.conn.send(self.data_to_send())
+
def safe_increment_flow_control(self, stream_id, length):
with self.lock:
self.increment_flow_control_window(length)
@@ -263,6 +268,9 @@ class Http2Layer(Layer):
source_conn.h2.safe_acknowledge_settings(event)
new_settings = dict([(id, cs.new_value) for (id, cs) in event.changed_settings.iteritems()])
other_conn.h2.safe_update_settings(new_settings)
+ elif isinstance(event, ConnectionTerminated):
+ other_conn.h2.safe_close_connection(event.error_code)
+ return
# TODO: cleanup resources once we are sure nobody needs them
# for stream_id in self.streams.keys():