mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
asyncio: fix client replay
This commit is contained in:
parent
54170ee657
commit
b6d943cfa3
@ -202,13 +202,7 @@ class Master:
|
|||||||
host = f.request.headers.pop(":authority")
|
host = f.request.headers.pop(":authority")
|
||||||
f.request.headers.insert(0, "host", host)
|
f.request.headers.insert(0, "host", host)
|
||||||
|
|
||||||
rt = http_replay.RequestReplayThread(
|
rt = http_replay.RequestReplayThread(self.options, f, self.server.channel)
|
||||||
self.options,
|
|
||||||
f,
|
|
||||||
asyncio.get_event_loop(),
|
|
||||||
self.event_queue,
|
|
||||||
self.should_exit
|
|
||||||
)
|
|
||||||
rt.start() # pragma: no cover
|
rt.start() # pragma: no cover
|
||||||
if block:
|
if block:
|
||||||
rt.join()
|
rt.join()
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
import asyncio
|
|
||||||
import queue
|
|
||||||
import threading
|
|
||||||
import typing
|
|
||||||
|
|
||||||
from mitmproxy import log
|
from mitmproxy import log
|
||||||
from mitmproxy import controller
|
from mitmproxy import controller
|
||||||
from mitmproxy import exceptions
|
from mitmproxy import exceptions
|
||||||
@ -26,21 +21,12 @@ class RequestReplayThread(basethread.BaseThread):
|
|||||||
self,
|
self,
|
||||||
opts: options.Options,
|
opts: options.Options,
|
||||||
f: http.HTTPFlow,
|
f: http.HTTPFlow,
|
||||||
loop: asyncio.AbstractEventLoop,
|
channel: controller.Channel,
|
||||||
event_queue: typing.Optional[queue.Queue],
|
|
||||||
should_exit: threading.Event
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
|
||||||
event_queue can be a queue or None, if no scripthooks should be
|
|
||||||
processed.
|
|
||||||
"""
|
|
||||||
self.options = opts
|
self.options = opts
|
||||||
self.f = f
|
self.f = f
|
||||||
f.live = True
|
f.live = True
|
||||||
if event_queue:
|
self.channel = channel
|
||||||
self.channel = controller.Channel(loop, event_queue)
|
|
||||||
else:
|
|
||||||
self.channel = None
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
"RequestReplay (%s)" % f.request.url
|
"RequestReplay (%s)" % f.request.url
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user