diff options
| author | Maximilian Hils <git@maximilianhils.com> | 2016-10-25 21:56:13 -0700 | 
|---|---|---|
| committer | Maximilian Hils <git@maximilianhils.com> | 2016-10-25 21:56:13 -0700 | 
| commit | f11b289c39e1b13439a048f433cb108c640ccddb (patch) | |
| tree | 4e6624b1b288faa322b85b098b2220994e5a1e37 | |
| parent | a0ad0b06a00a017c6277e8183d955ad2d46a5ce5 (diff) | |
| download | mitmproxy-f11b289c39e1b13439a048f433cb108c640ccddb.tar.gz mitmproxy-f11b289c39e1b13439a048f433cb108c640ccddb.tar.bz2 mitmproxy-f11b289c39e1b13439a048f433cb108c640ccddb.zip | |
fix #1620
| -rw-r--r-- | mitmproxy/flow.py | 3 | ||||
| -rw-r--r-- | mitmproxy/tools/console/master.py | 9 | ||||
| -rw-r--r-- | mitmproxy/tools/web/master.py | 9 | 
3 files changed, 13 insertions, 8 deletions
| diff --git a/mitmproxy/flow.py b/mitmproxy/flow.py index a23abf5f..ff7a2b4a 100644 --- a/mitmproxy/flow.py +++ b/mitmproxy/flow.py @@ -2,6 +2,7 @@ import time  import copy  import uuid +from mitmproxy import controller  # noqa  from mitmproxy import stateobject  from mitmproxy import connections  from mitmproxy import version @@ -80,7 +81,7 @@ class Flow(stateobject.StateObject):          self.error = None  # type: Optional[Error]          self.intercepted = False  # type: bool          self._backup = None  # type: Optional[Flow] -        self.reply = None +        self.reply = None  # type: Optional[controller.Reply]          self.marked = False  # type: bool      _stateobject_attributes = dict( diff --git a/mitmproxy/tools/console/master.py b/mitmproxy/tools/console/master.py index c128e42b..1f48f350 100644 --- a/mitmproxy/tools/console/master.py +++ b/mitmproxy/tools/console/master.py @@ -659,11 +659,10 @@ class ConsoleMaster(master.Master):              )      def process_flow(self, f): -        should_intercept = any( -            [ -                self.state.intercept and flowfilter.match(self.state.intercept, f) and not f.request.is_replay, -                f.intercepted, -            ] +        should_intercept = ( +            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) diff --git a/mitmproxy/tools/web/master.py b/mitmproxy/tools/web/master.py index 75842422..e95daf44 100644 --- a/mitmproxy/tools/web/master.py +++ b/mitmproxy/tools/web/master.py @@ -9,6 +9,7 @@ from typing import Optional  from mitmproxy import addons  from mitmproxy import controller  from mitmproxy import exceptions +from mitmproxy import flowfilter  from mitmproxy.addons import state  from mitmproxy import options  from mitmproxy import master @@ -179,8 +180,12 @@ class WebMaster(master.Master):              self.shutdown()      def _process_flow(self, f): -        if self.state.intercept and self.state.intercept( -                f) and not f.request.is_replay: +        should_intercept = ( +            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)          return f | 
