aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2016-09-03 16:56:21 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2016-09-03 16:56:21 +0200
commit3da9e37d9eb346f8e9cf4ab1b3be15abc1051f57 (patch)
treea8d389eac26a375aa581a4372ac21a7da573fb39
parentd895d6caf0dde49c71df2193621238532a66c29c (diff)
downloadmitmproxy-3da9e37d9eb346f8e9cf4ab1b3be15abc1051f57.tar.gz
mitmproxy-3da9e37d9eb346f8e9cf4ab1b3be15abc1051f57.tar.bz2
mitmproxy-3da9e37d9eb346f8e9cf4ab1b3be15abc1051f57.zip
http2: improve connection lost
-rw-r--r--mitmproxy/protocol/http2.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/mitmproxy/protocol/http2.py b/mitmproxy/protocol/http2.py
index 881dbf83..1595fb61 100644
--- a/mitmproxy/protocol/http2.py
+++ b/mitmproxy/protocol/http2.py
@@ -440,7 +440,7 @@ class Http2SingleStreamLayer(http._HttpTransmissionLayer, basethread.BaseThread)
def raise_zombie(self, pre_command=None):
connection_closed = self.h2_connection.state_machine.state == h2.connection.ConnectionState.CLOSED
- if self.zombie is not None or connection_closed:
+ if self.zombie is not None or not hasattr(self.server_conn, 'h2') or connection_closed:
if pre_command is not None:
pre_command()
raise exceptions.Http2ZombieException("Connection already dead")
@@ -527,6 +527,7 @@ class Http2SingleStreamLayer(http._HttpTransmissionLayer, basethread.BaseThread)
except Exception as e: # pragma: no cover
raise e
finally:
+ self.raise_zombie()
self.server_conn.h2.lock.release()
if not self.no_body: