aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol2/http_proxy.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-08-18 15:59:44 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-08-18 15:59:44 +0200
commitab1549e0eff98588211346aada44549311f04938 (patch)
treed5fa78c1d639d5f63f60b637821496c05ec1da18 /libmproxy/protocol2/http_proxy.py
parent96de7ad562da9b5110059988b851c66b51874510 (diff)
downloadmitmproxy-ab1549e0eff98588211346aada44549311f04938.tar.gz
mitmproxy-ab1549e0eff98588211346aada44549311f04938.tar.bz2
mitmproxy-ab1549e0eff98588211346aada44549311f04938.zip
yield -> callbacks
Diffstat (limited to 'libmproxy/protocol2/http_proxy.py')
-rw-r--r--libmproxy/protocol2/http_proxy.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/libmproxy/protocol2/http_proxy.py b/libmproxy/protocol2/http_proxy.py
index 652aa473..c24af6cf 100644
--- a/libmproxy/protocol2/http_proxy.py
+++ b/libmproxy/protocol2/http_proxy.py
@@ -7,11 +7,11 @@ from .http import Http1Layer
class HttpProxy(Layer, ServerConnectionMixin):
def __call__(self):
layer = Http1Layer(self, "regular")
- for message in layer():
- if not self._handle_server_message(message):
- yield message
- if self.server_conn:
- self._disconnect()
+ try:
+ layer()
+ finally:
+ if self.server_conn:
+ self._disconnect()
class HttpUpstreamProxy(Layer, ServerConnectionMixin):
def __init__(self, ctx, server_address):
@@ -19,8 +19,8 @@ class HttpUpstreamProxy(Layer, ServerConnectionMixin):
def __call__(self):
layer = Http1Layer(self, "upstream")
- for message in layer():
- if not self._handle_server_message(message):
- yield message
- if self.server_conn:
- self._disconnect()
+ try:
+ layer()
+ finally:
+ if self.server_conn:
+ self._disconnect() \ No newline at end of file