FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: apply server_replay_extra policy even after replay map is exhausted by waterWang · Pull Request #8365 · mitmproxy/mitmproxy · GitHub

fix: apply server_replay_extra policy even after replay map is exhausted - #8365

Open
waterWang wants to merge 3 commits into
mitmproxy:mainfrom
waterWang:fix/server-replay-extra-after-exhaustion
Open

fix: apply server_replay_extra policy even after replay map is exhausted#8365
waterWang wants to merge 3 commits into
mitmproxy:mainfrom
waterWang:fix/server-replay-extra-after-exhaustion

Conversation

Copy link
Copy Markdown

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 bypasses server_replay_extra because the extra-request policy is gated behind if self.flowmap:.

This contradicts the option's documented contract: server_replay_extra controls requests during replay for which no replayable response was found. It also makes numeric policies such as 404 stop applying silently after the last saved response is consumed.

Changes

  • mitmproxy/addons/serverplayback.py: Move the server_replay_extra handling (kill, return synthetic status code) outside the if 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: Add test_server_playback_extra_after_exhaustion — loads one flow, consumes it, then verifies that the configured server_replay_extra policy (204, 400, 404, 500) is still applied to the next request.

Closes #8363

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(server-replay): apply the extra-request policy after replay exhaustion

1 participant


Back | FazBrowse Home | New Git URL