Repository navigation
Conversation
2 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
When server replay is configured without
server_replay_reuse(the default), consuming the final replayable response empties the replay map. Every later request then bypassesserver_replay_extrabecause the extra-request policy is gated behindif self.flowmap:.This contradicts the option's documented contract:
server_replay_extracontrols requests during replay for which no replayable response was found. It also makes numeric policies such as404stop applying silently after the last saved response is consumed.Changes
mitmproxy/addons/serverplayback.py: Move theserver_replay_extrahandling (kill, return synthetic status code) outside theif self.flowmap:guard. After a matched replay flow is served, the function returns early. If no match is found (or the flowmap is empty), the configured extra-request policy is applied.Tests
test/mitmproxy/addons/test_serverplayback.py: Addtest_server_playback_extra_after_exhaustion— loads one flow, consumes it, then verifies that the configuredserver_replay_extrapolicy (204, 400, 404, 500) is still applied to the next request.Closes #8363