* WIP: Added option to suppress the sending of 502 Bad Gateway responses if the server is not responding
* Revert "WIP: Added option to suppress the sending of 502 Bad Gateway responses if the server is not responding"
This reverts commit 21b74f38b7ddeb63c5070cb4ca4928d3c37d12fe.
* Added addon which suppresses the bad gateway error messages sent by mitmproxy
* fix type annotation
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
This commit replaces our WSGI implementation with a new ASGI one,
which then uses `asgiref`'s compatibility mode to still support WSGI applications.
The ASGI implementation is a bit bare-bone, but good enough for our purposes.
The major changes are:
- We now support ASGI apps.
- Instead of taking connections out of mitmproxy's normal processing,
we now just set flow.response and let things continue as usual.
This allows users to see responses in mitmproxy, use the response hook
to modify app responses, etc. Also important for us,
this makes the new implementation work for shenanigans like sans-io.
This allow's trailers without the initial Trailer header announcement. In HTTP/2 the stream ends with any frame containing END_SREAM. In the case of trailers, it is a final HEADERS frame after all the DATA frames. Therefore we do not need to explicitly check for the trailer announcement header, but can simply wait until the response message / stream has ended.
- restructure examples (fix#4031)
- remove example dependencies from setup.py,
we do not need special dependencies for our supported addons.
- unify how we generate docs from code
- improve example docs
the HAR file spec (http://www.softwareishard.com/blog/har-12-spec/#timings) states that timings that do not apply for a certain requests should be set to -1, this example may set -1000 as a timings value for certain requests.
This ends up producing invalid HAR files in many cases.
My proposed fix is to assign -1 into the dic and only multiply by 1000 for other values