aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-08-30 01:21:58 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-08-30 01:21:58 +0200
commitdd7f50d64bef38fa67b4cace91913d03691dde26 (patch)
treec183aa1f286ec191a094713d1f697f2fa54ab385 /libmproxy/protocol
parent100ea27c30d89b895a02a1b128edc5472ab84b3e (diff)
downloadmitmproxy-dd7f50d64bef38fa67b4cace91913d03691dde26.tar.gz
mitmproxy-dd7f50d64bef38fa67b4cace91913d03691dde26.tar.bz2
mitmproxy-dd7f50d64bef38fa67b4cace91913d03691dde26.zip
restructure code, remove cruft
Diffstat (limited to 'libmproxy/protocol')
-rw-r--r--libmproxy/protocol/http.py83
1 files changed, 1 insertions, 82 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py
index 56d7d57f..a30437d1 100644
--- a/libmproxy/protocol/http.py
+++ b/libmproxy/protocol/http.py
@@ -695,85 +695,4 @@ class HTTPHandler(ProtocolHandler):
else:
raise http.HttpAuthenticationError(
self.c.config.authenticator.auth_challenge_headers())
- return request.headers
-
-
-class RequestReplayThread(threading.Thread):
- name = "RequestReplayThread"
-
- def __init__(self, config, flow, masterq, should_exit):
- """
- masterqueue can be a queue or None, if no scripthooks should be
- processed.
- """
- self.config, self.flow = config, flow
- if masterq:
- self.channel = controller.Channel(masterq, should_exit)
- else:
- self.channel = None
- super(RequestReplayThread, self).__init__()
-
- def run(self):
- r = self.flow.request
- form_out_backup = r.form_out
- try:
- self.flow.response = None
-
- # If we have a channel, run script hooks.
- if self.channel:
- request_reply = self.channel.ask("request", self.flow)
- if request_reply is None or request_reply == KILL:
- raise KillSignal()
- elif isinstance(request_reply, HTTPResponse):
- self.flow.response = request_reply
-
- if not self.flow.response:
- # In all modes, we directly connect to the server displayed
- if self.config.mode == "upstream":
- # FIXME
- server_address = self.config.mode.get_upstream_server(
- self.flow.client_conn
- )[2:]
- server = ServerConnection(server_address)
- server.connect()
- if r.scheme == "https":
- send_connect_request(server, r.host, r.port)
- server.establish_ssl(
- self.config.clientcerts,
- sni=self.flow.server_conn.sni
- )
- r.form_out = "relative"
- else:
- r.form_out = "absolute"
- else:
- server_address = (r.host, r.port)
- server = ServerConnection(server_address)
- server.connect()
- if r.scheme == "https":
- server.establish_ssl(
- self.config.clientcerts,
- sni=self.flow.server_conn.sni
- )
- r.form_out = "relative"
-
- server.send(self.flow.server_conn.protocol.assemble(r))
- self.flow.server_conn = server
- self.flow.response = HTTPResponse.from_protocol(
- self.flow.server_conn.protocol,
- r.method,
- body_size_limit=self.config.body_size_limit,
- )
- if self.channel:
- response_reply = self.channel.ask("response", self.flow)
- if response_reply is None or response_reply == KILL:
- raise KillSignal()
- except (proxy.ProxyError, http.HttpError, tcp.NetLibError) as v:
- self.flow.error = Error(repr(v))
- if self.channel:
- self.channel.ask("error", self.flow)
- except KillSignal:
- # KillSignal should only be raised if there's a channel in the
- # first place.
- self.channel.tell("log", proxy.Log("Connection killed", "info"))
- finally:
- r.form_out = form_out_backup
+ return request.headers \ No newline at end of file