diff options
| author | Henrik Nordstrom <henrik@henriknordstrom.net> | 2011-01-11 18:04:15 +0100 | 
|---|---|---|
| committer | Henrik Nordstrom <henrik@henriknordstrom.net> | 2011-02-10 02:59:51 +0100 | 
| commit | 061cea89da96bc2ee71d9d2f065ae920aeccb311 (patch) | |
| tree | 35a0b0f81013c6fc2beba71cfdcc24fd342f8c24 /libmproxy/console.py | |
| parent | d11dd742d8593087959b6f1e0d9cc1f956dee03e (diff) | |
| download | mitmproxy-061cea89da96bc2ee71d9d2f065ae920aeccb311.tar.gz mitmproxy-061cea89da96bc2ee71d9d2f065ae920aeccb311.tar.bz2 mitmproxy-061cea89da96bc2ee71d9d2f065ae920aeccb311.zip | |
Import cache store control into console controller
Diffstat (limited to 'libmproxy/console.py')
| -rw-r--r-- | libmproxy/console.py | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/libmproxy/console.py b/libmproxy/console.py index 1f19671a..9bf032e6 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -19,6 +19,7 @@ import cStringIO  import urwid.curses_display  import urwid  import controller, utils, filt, proxy, flow +import recorder  class Stop(Exception): pass @@ -707,6 +708,7 @@ class ConsoleState(flow.State):          flow.State.__init__(self)          self.focus = None          self.beep = None +        self.store = None          self.view_body_mode = VIEW_BODY_RAW          self.view_flow_mode = VIEW_FLOW_REQUEST @@ -727,6 +729,8 @@ class ConsoleState(flow.State):          return flow.State.add_request(self, req)      def add_response(self, resp): +        if self.store is not None: +            self.store.save_response(resp)          f = flow.State.add_response(self, resp)          if self.focus is None:              self.set_focus(0) @@ -737,6 +741,9 @@ class ConsoleState(flow.State):          self.set_focus(self.focus)          return ret +    def start_recording(self, recorder): +        self.store = recorder +      def get_focus(self):          if not self.view or self.focus is None:              return None, None @@ -815,6 +822,9 @@ class ConsoleMaster(controller.Master):          self.stickycookie = None          self.stickyhosts = {} +        if options.cache is not None: +            self.state.start_recording(recorder.Recorder(options)) +      def spawn_external_viewer(self, data, contenttype):          if contenttype:              ext = mimetypes.guess_extension(contenttype) or "" | 
