Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors
ProxyHandler.read_request
and its submethods to remove duplicate code and clearly separate request processing. As this is pretty much the core of mitmproxy, I'd love to have a second opinion on it. The github diff is pretty much useless, reading the new proxy.py lines 337-450 gives a better picture of the changes (old proxy.py here). If there are no objections, please merge.By the way, this restructuring unfolded a few caveats, namely processing absolute-form request targets in reverse proxy or transparent mode. mitmproxy fails to do that correctly at the moment. In other words, this breaks a
client -> transparent mitmproxy -> other proxy -> destination
setup. However, that is a separate issue not introduced by these changes.Cheers,
Max