aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/master.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2018-04-27 16:34:56 +1200
committerAldo Cortesi <aldo@nullcube.com>2018-04-27 16:34:56 +1200
commit28d53d5a245cbac19896bac30a41435024b17b78 (patch)
treee129000ed82aff80a2f322ea5861a436e2a7feaf /mitmproxy/master.py
parentbc3ace6082dd07edf4d44c834da78fa1b6a719d0 (diff)
downloadmitmproxy-28d53d5a245cbac19896bac30a41435024b17b78.tar.gz
mitmproxy-28d53d5a245cbac19896bac30a41435024b17b78.tar.bz2
mitmproxy-28d53d5a245cbac19896bac30a41435024b17b78.zip
client replay: move all client replay-related code into addon
Diffstat (limited to 'mitmproxy/master.py')
-rw-r--r--mitmproxy/master.py57
1 files changed, 0 insertions, 57 deletions
diff --git a/mitmproxy/master.py b/mitmproxy/master.py
index 8eb01600..7f81d185 100644
--- a/mitmproxy/master.py
+++ b/mitmproxy/master.py
@@ -8,13 +8,11 @@ from mitmproxy import addonmanager
from mitmproxy import options
from mitmproxy import controller
from mitmproxy import eventsequence
-from mitmproxy import exceptions
from mitmproxy import command
from mitmproxy import http
from mitmproxy import websocket
from mitmproxy import log
from mitmproxy.net import server_spec
-from mitmproxy.proxy.protocol import http_replay
from mitmproxy.coretypes import basethread
from . import ctx as mitmproxy_ctx
@@ -164,58 +162,3 @@ class Master:
f.reply = controller.DummyReply()
for e, o in eventsequence.iterate(f):
await self.addons.handle_lifecycle(e, o)
-
- def replay_request(
- self,
- f: http.HTTPFlow,
- block: bool=False
- ) -> http_replay.RequestReplayThread:
- """
- Replay a HTTP request to receive a new response from the server.
-
- Args:
- f: The flow to replay.
- block: If True, this function will wait for the replay to finish.
- This causes a deadlock if activated in the main thread.
-
- Returns:
- The thread object doing the replay.
-
- Raises:
- exceptions.ReplayException, if the flow is in a state
- where it is ineligible for replay.
- """
-
- if f.live:
- raise exceptions.ReplayException(
- "Can't replay live flow."
- )
- if f.intercepted:
- raise exceptions.ReplayException(
- "Can't replay intercepted flow."
- )
- if not f.request:
- raise exceptions.ReplayException(
- "Can't replay flow with missing request."
- )
- if f.request.raw_content is None:
- raise exceptions.ReplayException(
- "Can't replay flow with missing content."
- )
-
- f.backup()
- f.request.is_replay = True
-
- f.response = None
- f.error = None
-
- if f.request.http_version == "HTTP/2.0": # https://github.com/mitmproxy/mitmproxy/issues/2197
- f.request.http_version = "HTTP/1.1"
- host = f.request.headers.pop(":authority")
- f.request.headers.insert(0, "host", host)
-
- rt = http_replay.RequestReplayThread(self.options, f, self.channel)
- rt.start() # pragma: no cover
- if block:
- rt.join()
- return rt