| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
This fixes #3133.
|
|
|
|
| |
Mitmproxy: the tickless wonder.
|
|
|
|
|
|
|
|
| |
- 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.
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
| |
This patch clarifies proxy shutdown, and specifies that the master.shutdown()
method is thread-save.
|
|
|
|
|
|
|
|
|
| |
- 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.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Instead, we just schedule coroutines directly onto the core loop.
|
| |
|
|
|
|
| |
Also fix a racy websocket test.
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
| |
We now need to synthesize a tick event when changing addons in tests, because
tick is asynchronously called on the event loop.
|
| |
|
|
|
|
|
| |
Also move signal handling out of master. These only work in the main thread,
and properly belong in main.py.
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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..
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
- Add a command manager
- Sketch out the type system with a few simple supported types
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
| |
All events are now handled by addons, and we no longer support any events on
master.
|
|\
| |
| | |
Extract flow reading into addons
|
| |
| |
| |
| |
| | |
Clarify the plethora of invocation methods we've sprouted, correct some usages
in the codebase.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now have:
--mode regular (the default)
--mode transparent
--mode socks5
--mode reverse:SPEC
--mode upstream:SPEC
Where SPEC is a host specification.
|
| |
|
| |
|
| |
|
|\ |
|
| | |
|
|/ |
|