mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
fix #1620
This commit is contained in:
parent
a0ad0b06a0
commit
f11b289c39
@ -2,6 +2,7 @@ import time
|
|||||||
import copy
|
import copy
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from mitmproxy import controller # noqa
|
||||||
from mitmproxy import stateobject
|
from mitmproxy import stateobject
|
||||||
from mitmproxy import connections
|
from mitmproxy import connections
|
||||||
from mitmproxy import version
|
from mitmproxy import version
|
||||||
@ -80,7 +81,7 @@ class Flow(stateobject.StateObject):
|
|||||||
self.error = None # type: Optional[Error]
|
self.error = None # type: Optional[Error]
|
||||||
self.intercepted = False # type: bool
|
self.intercepted = False # type: bool
|
||||||
self._backup = None # type: Optional[Flow]
|
self._backup = None # type: Optional[Flow]
|
||||||
self.reply = None
|
self.reply = None # type: Optional[controller.Reply]
|
||||||
self.marked = False # type: bool
|
self.marked = False # type: bool
|
||||||
|
|
||||||
_stateobject_attributes = dict(
|
_stateobject_attributes = dict(
|
||||||
|
@ -659,11 +659,10 @@ class ConsoleMaster(master.Master):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def process_flow(self, f):
|
def process_flow(self, f):
|
||||||
should_intercept = any(
|
should_intercept = (
|
||||||
[
|
self.state.intercept and flowfilter.match(self.state.intercept, f)
|
||||||
self.state.intercept and flowfilter.match(self.state.intercept, f) and not f.request.is_replay,
|
and not f.request.is_replay
|
||||||
f.intercepted,
|
and f.reply.state == "handled"
|
||||||
]
|
|
||||||
)
|
)
|
||||||
if should_intercept:
|
if should_intercept:
|
||||||
f.intercept(self)
|
f.intercept(self)
|
||||||
|
@ -9,6 +9,7 @@ from typing import Optional
|
|||||||
from mitmproxy import addons
|
from mitmproxy import addons
|
||||||
from mitmproxy import controller
|
from mitmproxy import controller
|
||||||
from mitmproxy import exceptions
|
from mitmproxy import exceptions
|
||||||
|
from mitmproxy import flowfilter
|
||||||
from mitmproxy.addons import state
|
from mitmproxy.addons import state
|
||||||
from mitmproxy import options
|
from mitmproxy import options
|
||||||
from mitmproxy import master
|
from mitmproxy import master
|
||||||
@ -179,8 +180,12 @@ class WebMaster(master.Master):
|
|||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
def _process_flow(self, f):
|
def _process_flow(self, f):
|
||||||
if self.state.intercept and self.state.intercept(
|
should_intercept = (
|
||||||
f) and not f.request.is_replay:
|
self.state.intercept and flowfilter.match(self.state.intercept, f)
|
||||||
|
and not f.request.is_replay
|
||||||
|
and f.reply.state == "handled"
|
||||||
|
)
|
||||||
|
if should_intercept:
|
||||||
f.intercept(self)
|
f.intercept(self)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user