aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/master.py
Commit message (Collapse)AuthorAgeFilesLines
* bump dependenciesThomas Kriechbaumer2018-12-021-2/+3
|
* fix shutdown on WindowsMaximilian Hils2018-05-281-1/+9
| | | | This fixes #3133.
* Remove the tick eventAldo Cortesi2018-05-021-11/+3
| | | | Mitmproxy: the tickless wonder.
* Redesign keepservingAldo Cortesi2018-05-021-4/+1
| | | | | | | | - Instead of listening for a pseudo-event, we periodically check whether client replay, server replay or file reading is active. - Adjust server replay not to use tick. - Adjust readfile to expose a command to check whether reading is in progress.
* client replay: move all client replay-related code into addonAldo Cortesi2018-04-271-57/+0
|
* asyncio: shift script reloading out of the tick eventAldo Cortesi2018-04-231-9/+5
| | | | | | | The tick event is a nasty compromise, left over from when we didn't have an event loop. This is the first patch in a series that explores moving our built-in addons to managing coroutines on the eventloop directly for periodic tasks.
* asyncio: fix exit behavior for consoleAldo Cortesi2018-04-171-4/+28
| | | | | | | | | - Add a master.run_loop function. This encapsulates our run behaviour so that it can be used by implementations that need to manage their own run loop (like urwid). - Shift crash exit message to the common core. I'm not convinced we really need this, but if we want it it should be centralised. - Clean up an extra exception that can be thrown by asyncio itself on "dirty" termination after a mitmproxy crash.
* asyncio: clarify shutdown semanticsAldo Cortesi2018-04-161-5/+13
| | | | | This patch clarifies proxy shutdown, and specifies that the master.shutdown() method is thread-save.
* Improve benchmarkingAldo Cortesi2018-04-161-4/+8
| | | | | | | | | - The benchmark addon now manages setting up and tearing down the backend and traffic processes itself. - Use wrk instead of hey. I get more consistent results with this tool, and hey shows a strange tail-latency bump that seems artificial. - Make termination behaviour simpler. The bencmark revealed a bug where .done events were not called if the proxy was shut down by an addon.
* fix Python 3.6 variable type annotations #3053oscure762018-04-141-1/+1
|
* asyncio: ditch the handler contextAldo Cortesi2018-04-071-17/+4
| | | | | | | There are a few reasons for this. First, logs are now async, and can be called at any time. Second, the event loop is thread local, so there can only ever be one master per thread. These two things together completely obviate the need for a handler context.
* asyncio: remove master.add_log, in favor of a persistent log.Log instanceAldo Cortesi2018-04-071-7/+2
|
* asyncio: move log mechanism onto the event loopAldo Cortesi2018-04-071-1/+0
| | | | | | Logs are now asynchronous, with a log entry pushed onto the event loop for handling. To support this, the test mechanism grows an await_log method that waits for a log entry to appear.
* asyncio simplify: we don't need a queue for proxy->main loop commsAldo Cortesi2018-04-071-16/+3
| | | | Instead, we just schedule coroutines directly onto the core loop.
* asyncio: remove last vestiage of channel input from masterAldo Cortesi2018-04-071-5/+0
|
* asyncio: cleanup and lintAldo Cortesi2018-04-021-2/+3
| | | | Also fix a racy websocket test.
* asyncio: test cleanupAldo Cortesi2018-04-021-0/+8
| | | | | | Also silence asyncio logs. We sometimes end up with messages on the queue that need to be ignored when the proxy shuts down, and asyncio complains loudly about this.
* asyncio: shift console over to asyncio eventloopAldo Cortesi2018-04-021-1/+2
|
* asyncio: make http2 tests passAldo Cortesi2018-04-021-7/+10
|
* asyncio: fix channel interface and testsAldo Cortesi2018-04-011-4/+8
| | | | | We now need to synthesize a tick event when changing addons in tests, because tick is asynchronously called on the event loop.
* asyncio: fix client replayAldo Cortesi2018-04-011-7/+1
|
* asyncio: start a test loop for unit testsAldo Cortesi2018-04-011-3/+0
| | | | | Also move signal handling out of master. These only work in the main thread, and properly belong in main.py.
* asyncio: clean up event loop acquisitionAldo Cortesi2018-04-011-17/+11
| | | | | | | We now acquire the event loop through asyncio.get_event_loop, avoiding having to pass the loop explicity in a bunch of places. This function does not return the currently running loop from within coroutines in versions of Python prior to 3.6.
* asyncio: brutally rip out our old queue mechanismAldo Cortesi2018-04-011-24/+37
|
* Fix #2688Miroslav2018-01-071-1/+1
|
* add doc stringThomas Kriechbaumer2017-12-181-0/+5
|
* fix #2640Thomas Kriechbaumer2017-12-181-5/+20
|
* mitmproxy.types -> mitmproxy.coretypesAldo Cortesi2017-12-171-1/+1
| | | | | | | | | | The types name is valuable, and we have a better use for it in collecting and exposing types for options and commands. The coretypes module should probably be split up anyway - it contains a threading base class, a few container objects, and the defintion of our serialization protocol. I was tempted to rename it to "uncagegorized" for the sake of honesty.
* disentangle ProxyServer and Master classes.Maximilian Hils2017-07-301-12/+24
| | | | | | The proxy server should ultimately be an addon itself and not be passed to the Master constructor. This commit already removes the server in the majority of instances, and also replaces a large number of ProxyConfig usages with the Options class..
* request replay testUjjwal Verma2017-06-261-1/+1
|
* Fixes #2197Ujjwal Verma2017-06-191-0/+5
|
* Increase test coverageUjjwal Verma2017-05-311-4/+4
|
* commands: view.order.options, view.marked.toggle, view.createAldo Cortesi2017-04-301-20/+0
| | | | | | And use these commands to remove the last hard-coded keybindings from flow list. This means the flow list is now 100% command-driven, which is very exciting.
* Basic outline of the command subsystemAldo Cortesi2017-04-271-0/+2
| | | | | - Add a command manager - Sketch out the type system with a few simple supported types
* Move options into ctxAldo Cortesi2017-04-261-0/+2
| | | | | | | Many addons currently save options on configure(), either as individual options or sometimes by saving the entire options object. The current options should simply be available on the ctx object, simplifying state management for addons considerably.
* Revamp how addons workAldo Cortesi2017-04-251-1/+1
| | | | | | | | | | | | | | | | | | | - Addons now nest, which means that addons can manage addons. This has a number of salutary effects - the scripts addon no longer has to poke into the global addons list, we no longer have to replace/remove/boot-outof parent addons when we load scripts, and this paves the way for making our top-level tools into addons themselves. - All addon calls are now wrapped in a safe execution environment where exceptions are caught, and output to stdout/stderr are intercepted and turned into logs. - We no longer support script arguments in sys.argv - creating an option properly is the only way to pass arguments. This means that all scripts are always directly controllable from interctive tooling, and that arguments are type-checked. For now, I've disabled testing of the har dump example - it needs to be moved to the new argument handling, and become a class addon. I'll address that in a separate patch.
* Rip out master handler mechanismAldo Cortesi2017-03-161-97/+2
| | | | | All events are now handled by addons, and we no longer support any events on master.
* Merge pull request #2152 from cortesi/readfileAldo Cortesi2017-03-161-35/+3
|\ | | | | Extract flow reading into addons
| * Clean up addonmanager interfaceAldo Cortesi2017-03-161-5/+3
| | | | | | | | | | Clarify the plethora of invocation methods we've sprouted, correct some usages in the codebase.
| * Extract flow reading into addonsAldo Cortesi2017-03-151-30/+0
| | | | | | | | | | | | | | | | This patch moves the final pieces of master functionality into addons. - Add a ReadFile addon to read from file - Add a separate ReadStdin addon to read from stdin, only used by mitmdump - Remove all methods that know about io and serialization from master.Master
* | add Request.makeMaximilian Hils2017-03-151-17/+7
|/
* Move running() in to .tick() method to make sure it's called consistentlyAldo Cortesi2017-03-141-4/+4
|
* Enable custom options for addonsAldo Cortesi2017-03-141-0/+4
| | | | | | | | - Add an options parameter to the start() event. This is to be used by addons on startup to add custom options. - Add a running() event that is called once the proxy is up and running. - With the new paradigm we can't log during master __init__, so add a tiny termstatus addon to print proxy status to terminal once we're running.
* Unify mode specificationAldo Cortesi2017-03-061-1/+1
| | | | | | | | | | | | We now have: --mode regular (the default) --mode transparent --mode socks5 --mode reverse:SPEC --mode upstream:SPEC Where SPEC is a host specification.
* nuke tcp.Address and add proper IPv6 supportThomas Kriechbaumer2017-02-241-2/+2
|
* eventsequence: coverage++Thomas Kriechbaumer2017-02-091-3/+3
|
* mitmdump: fix reading from stdinMaximilian Hils2017-01-101-2/+5
|
* Merge branch 'mitmweb-eventlog'Maximilian Hils2016-11-231-3/+7
|\
| * mitmweb: 100% app test coverage, numerous fixesMaximilian Hils2016-11-231-3/+7
| |
* | add WebSocket flows and messagesThomas Kriechbaumer2016-11-231-0/+16
|/