Commit graph

2576 commits

Author SHA1 Message Date
Maximilian Hils
3a2b02b420 don't error on connection errors when streaming, fix #5383 2022-06-28 15:53:39 +02:00
Maximilian Hils
87d3d1cb88 pyinstaller: move hooks into package 2022-06-28 14:18:40 +02:00
Denis
82f18f6afb
fix huge (>65kb) http2 responses corrupted (#5430)
* [#5428] fix huge (>65kb) http2 responses corrupted

* [#5428] add tests for huge (>65kb) http2 responses

* add changelog for #5428

* style fix

Co-authored-by: dhabensky <dhabensky@yandex-team.ru>
2022-06-28 11:52:55 +02:00
Maximilian Hils
8c151c66a4
add asyncio_utils.set_current_task_debug_info (#5392) 2022-06-03 15:20:25 +02:00
Jixun Wu
f02d28ecae
Fix a bug where an excess empty chunk has been sent for chunked HEAD request (#5374)
* fix: don't generate empty chunk for head request (#5372)

* docs: update changlog

* chore: assert for optional self.request.
2022-05-26 13:08:34 +02:00
Manuel Meitinger
8fce7c7fa3
Support specifying the local address for outgoing connections. (#5366)
* allow sockname to specify local-addr

* set local_addr via command line

* minor fix for reconfig

* minor rewording

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2022-05-23 14:54:25 +00:00
rinsuki
400eb3a285
Fix handling of multiple Cookie headers when proxying HTTP/2 to HTTP/1 (#5342)
* Fix handling of multiple Cookie headers when proxying HTTP/2 to HTTP/1

fix #5337

* Add Tests about converts multiple Cookie headers to HTTP/1 from HTTP/2

* Adjust order

* minor code style nits

* Update CHANGELOG.md

* Update _http1.py

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
2022-05-12 19:04:36 +00:00
Maximilian Hils
e9176deae9 tlsconfig: add IP address verification test 2022-05-11 16:44:02 +02:00
Maximilian Hils
7afabfe3f7 share SSL.Context for all server connections
This should cause not functional differences, but increase performance.
2022-05-11 16:16:16 +02:00
Maximilian Hils
b3abf5dc9f
don't crash for HTTP/2 informational responses (#5332) 2022-05-08 14:21:00 +02:00
Robert Xiao
c296132d61
Properly encode hostname for upstream requests. (#5325)
* Tests for the fix to #5316

* Encode host part of authority using idna in upstream proxy.

Fixes #5316.
2022-05-06 13:02:49 +02:00
Robert Xiao
c562865880
Fix CommandError when loading a new contentview (#5324)
* Console tests: don't mess with the mouse

* Fix CommandError when adding a custom view after startup.

Previously, hot-reloading a script with a custom view after at least one flow
was viewed could throw "CommandError: Not viewing a flow" due to show() being
called while the flow view window was not visible.

Additionally, this patch also refreshes the FlowView when a custom view is
removed.

Fixes #5319.

* Test for the fix to #5319.

* Update CHANGELOG to fix #5319
2022-05-06 07:06:17 +02:00
Maximilian Hils
46f01ad958
fix compatibility with OpenSSL 3 (#5311) 2022-05-01 20:24:32 +00:00
Maximilian Hils
1ef2a350ae formally deprecate HTTPFlow.mode
This was non-functioning already anyways, time to deprecate it properly.
2022-04-28 19:36:34 +02:00
Maximilian Hils
b3587b52b2 make it black! 2022-04-28 19:11:10 +02:00
Maximilian Hils
fdde9ba3b3 use Python 3.9+ typing 2022-04-26 13:53:23 +02:00
Maximilian Hils
b31ad66225 autoflake --in-place **/*.py 2022-04-26 13:52:46 +02:00
Maximilian Hils
e83ec8390a pyupgrade --py39-plus **/*.py 2022-04-26 13:51:11 +02:00
Maximilian Hils
2959750124
Merge pull request #5292 from mitmproxy/memoryleak
Fix Memory Leaks
2022-04-25 12:52:43 +02:00
Maximilian Hils
e88d5764c3 make asyncio_utils.create_task infallible 2022-04-25 11:28:50 +02:00
Maximilian Hils
c8d8e303a8 lint 2022-04-25 11:28:50 +02:00
Maximilian Hils
035b3bf37d drop HTTP streams that are completed, fix #4456 2022-04-25 11:28:50 +02:00
Maximilian Hils
56eea20f63 tutils: add BytesMatching placeholder 2022-04-25 11:28:50 +02:00
Maximilian Hils
0600e8b4bc debug signals: stay alive by default 2022-04-25 11:28:50 +02:00
Maximilian Hils
330243f2ab dns: improve web display, coverage++ 2022-04-24 23:09:11 +02:00
Maximilian Hils
f6554924ee fix nits 2022-04-24 22:14:10 +02:00
Maximilian Hils
f253a65a46 console: test that flow detail views don't crash 2022-04-24 19:06:43 +02:00
Manuel Meitinger
ebaacfd850 [dns] additional intercept test 2022-04-24 15:25:07 +02:00
Manuel Meitinger
bda488d871 [dns] flowfilter url test 2022-04-24 15:09:06 +02:00
Manuel Meitinger
4229c7c85c [dns] offline tests for proxyserver 2022-04-24 14:56:55 +02:00
Manuel Meitinger
dd61b21ce3 [dns] offline dns_resolve tests at 100% coverage 2022-04-24 14:28:11 +02:00
Manuel Meitinger
0553b73d36 [dns] 100% coverage 2022-04-23 23:31:41 +02:00
Manuel Meitinger
99bcfb7f55 [dns] move resolve code into addon 2022-04-23 22:45:51 +02:00
Manuel Meitinger
c821d02e09 [dns] update layer tests and bugfix 2022-04-23 21:57:22 +02:00
Maximilian Hils
51b640b600 skip internet tests, fix nits 2022-04-23 19:03:25 +02:00
Maximilian Hils
9c33870ac8 move DNS resolution into own addon, simple -> regular 2022-04-23 18:49:16 +02:00
Maximilian Hils
0407d9697b proxy modes: use mitmproxy terminology
We consistently use "reverse proxy" and not "forward proxy",
so we should do the same for DNS. Also removed "custom" mode.
If users want such things, the correct approach is to specify a reverse
proxy and set `.response` in the request hook (similar to how it works for HTTP)
2022-04-23 17:05:30 +02:00
Maximilian Hils
2bc43fc10d self-connect: don't resolve
resolving domains here would leak DNS requests if the user aborts,
we don't want that. It's very much a heuristic only anyways.
2022-04-23 16:50:55 +02:00
Maximilian Hils
74f0965a0b Connection.protocol -> Connection.transport_protocol
This is less ambiguous. Also use a string literal to simplify things.
2022-04-23 16:42:11 +02:00
Maximilian Hils
c17e3a16ec dumper: improve dns query display 2022-04-23 16:12:28 +02:00
Maximilian Hils
5c9ab2e774 str -> to_str
`str` is a bit of a footgun because it overrides the builtin `str()` if imported directly.
2022-04-23 13:34:04 +02:00
Manuel Meitinger
976b1a5f27
Merge branch 'mitmproxy:main' into dns 2022-04-22 22:18:14 +02:00
EndUser509
35703b0b6b
HTTP/2 keepalive (#5144)
* Example addon for saving streamed data including a small bug fix to make it work.

* Revert "Example addon for saving streamed data including a small bug fix to make it work."

This reverts commit 02ab78def9a52eaca1a89d0757cd9475ce250eaa.

* Add https_ping_threshold option to enable keep-alive for HTTP/2 server connections by sending PING frames if the conection is idle longer than the threshold.

* Fixed test

* Fix test

* Adding pragma

* Moved timer logic to _http2.py

* Small code improvement

* Update mitmproxy/options.py

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Update mitmproxy/options.py

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Update mitmproxy/proxy/commands.py

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Update mitmproxy/proxy/commands.py

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Update mitmproxy/proxy/layers/http/_http2.py

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Sending Wakup back to right client

* Update mitmproxy/proxy/server.py

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Update mitmproxy/proxy/server.py

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Update mitmproxy/proxy/server.py

Co-authored-by: Maximilian Hils <github@maximilianhils.com>

* Incorporated suggested changes
Fixed almost all tests

* make `Wakeup` a `CommandCompleted` event.

This allows us to use it with `reply()` in tests,
which makes sure that the correct instance is reused.
 # Please enter the commit message for your changes. Lines starting

* nits

`typing.Set` for Python 3.8 compatibility and a few minor stylistic changes.

* nits nits

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2022-04-22 13:59:55 +02:00
Manuel Meitinger
5b69087a19 [dns] coverage response codes 2022-04-11 01:42:46 +02:00
Manuel Meitinger
9a55989b25 [dns] refactored enums 2022-04-11 01:38:19 +02:00
Manuel Meitinger
16e04d1c49 [dns] use random test ports 2022-04-10 23:05:29 +02:00
Manuel Meitinger
f2c17a7198 [dns] alternate DNS test port 2022-04-10 18:09:49 +02:00
Manuel Meitinger
383dd67a61 [dns] set DNS test port > 1024 2022-04-10 17:57:39 +02:00
Manuel Meitinger
ec1f736171 [dns] proxyserver tests 2022-04-10 17:49:19 +02:00
Manuel Meitinger
563f041ba6 [dns] generalize self-connect test 2022-04-10 11:16:13 +02:00