diff --git a/mitmproxy/master.py b/mitmproxy/master.py index a23be0a75..c2d2b6a01 100644 --- a/mitmproxy/master.py +++ b/mitmproxy/master.py @@ -202,13 +202,7 @@ class Master: host = f.request.headers.pop(":authority") f.request.headers.insert(0, "host", host) - rt = http_replay.RequestReplayThread( - self.options, - f, - asyncio.get_event_loop(), - self.event_queue, - self.should_exit - ) + rt = http_replay.RequestReplayThread(self.options, f, self.server.channel) rt.start() # pragma: no cover if block: rt.join() diff --git a/mitmproxy/proxy/protocol/http_replay.py b/mitmproxy/proxy/protocol/http_replay.py index 8682f50e6..b2cca2b11 100644 --- a/mitmproxy/proxy/protocol/http_replay.py +++ b/mitmproxy/proxy/protocol/http_replay.py @@ -1,8 +1,3 @@ -import asyncio -import queue -import threading -import typing - from mitmproxy import log from mitmproxy import controller from mitmproxy import exceptions @@ -26,21 +21,12 @@ class RequestReplayThread(basethread.BaseThread): self, opts: options.Options, f: http.HTTPFlow, - loop: asyncio.AbstractEventLoop, - event_queue: typing.Optional[queue.Queue], - should_exit: threading.Event + channel: controller.Channel, ) -> None: - """ - event_queue can be a queue or None, if no scripthooks should be - processed. - """ self.options = opts self.f = f f.live = True - if event_queue: - self.channel = controller.Channel(loop, event_queue) - else: - self.channel = None + self.channel = channel super().__init__( "RequestReplay (%s)" % f.request.url )