aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol/http.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-03 17:01:25 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-03 17:01:25 +0200
commitf4272de5ec77fb57723e2274e4ddc50d73489e1e (patch)
tree2f7ad35411c29c15199f2498bb43571047c0d066 /libmproxy/protocol/http.py
parent1f6d05f89fada5fe360aa79abfa80a3c91ce54da (diff)
downloadmitmproxy-f4272de5ec77fb57723e2274e4ddc50d73489e1e.tar.gz
mitmproxy-f4272de5ec77fb57723e2274e4ddc50d73489e1e.tar.bz2
mitmproxy-f4272de5ec77fb57723e2274e4ddc50d73489e1e.zip
remove ServerConnectionMixin.reconnect
Diffstat (limited to 'libmproxy/protocol/http.py')
-rw-r--r--libmproxy/protocol/http.py25
1 files changed, 7 insertions, 18 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py
index dbf46973..7768b9ad 100644
--- a/libmproxy/protocol/http.py
+++ b/libmproxy/protocol/http.py
@@ -143,10 +143,6 @@ class Http1Layer(_StreamingHttpLayer):
self.ctx.connect()
self.server_protocol = HTTP1Protocol(self.server_conn)
- def reconnect(self):
- self.ctx.reconnect()
- self.server_protocol = HTTP1Protocol(self.server_conn)
-
def set_server(self, *args, **kwargs):
self.ctx.set_server(*args, **kwargs)
self.server_protocol = HTTP1Protocol(self.server_conn)
@@ -202,12 +198,6 @@ class Http2Layer(_HttpLayer):
unhandled_frame_cb=self.handle_unexpected_frame_from_server)
self.server_protocol.perform_connection_preface()
- def reconnect(self):
- self.ctx.reconnect()
- self.server_protocol = HTTP2Protocol(self.server_conn, is_server=False,
- unhandled_frame_cb=self.handle_unexpected_frame_from_server)
- self.server_protocol.perform_connection_preface()
-
def set_server(self, *args, **kwargs):
self.ctx.set_server(*args, **kwargs)
self.server_protocol = HTTP2Protocol(self.server_conn, is_server=False,
@@ -314,14 +304,10 @@ class UpstreamConnectLayer(Layer):
else:
pass # swallow the message
- def reconnect(self):
- self.ctx.reconnect()
- self._send_connect_request()
-
def set_server(self, address, server_tls=None, sni=None, depth=1):
if depth == 1:
if self.ctx.server_conn:
- self.ctx.reconnect()
+ self.ctx.disconnect()
address = Address.wrap(address)
self.connect_request.host = address.host
self.connect_request.port = address.port
@@ -459,7 +445,8 @@ class HttpLayer(Layer):
# > server detects timeout, disconnects
# > read (100-n)% of large request
# > send large request upstream
- self.reconnect()
+ self.disconnect()
+ self.connect()
get_response()
# call the appropriate script hook - this is an opportunity for an
@@ -534,10 +521,12 @@ class HttpLayer(Layer):
"""
# This is a very ugly (untested) workaround to solve a very ugly problem.
if self.server_conn and self.server_conn.tls_established and not ssl:
- self.reconnect()
+ self.disconnect()
+ self.connect()
elif ssl and not hasattr(self, "connected_to") or self.connected_to != address:
if self.server_conn.tls_established:
- self.reconnect()
+ self.disconnect()
+ self.connect()
self.send_request(make_connect_request(address))
tls_layer = TlsLayer(self, False, True)