From b44c3ac6e0f54413a067294bbcb0fe019fade3f3 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Thu, 14 Jan 2016 19:05:15 +0100 Subject: propagate GoAway to the other side --- libmproxy/protocol/http.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libmproxy') 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(): -- cgit v1.2.3