#1684

fix(proxy): preserve whitespace in replayed request bodies

Opensamirhvbrwants to merge intofrom

Fixes #1681.

The proxy replay parser strips the captured body before applying request modifications. A replay that changes only a header can therefore change the payload as well. For example, b" value \r\n" becomes b"value".

Preserve the text after the HTTP header separator. The existing replay logic still handles explicit replacement bodies and recomputes Content-Length from the serialized payload.

The regression drives both the host and sandbox replay entry points with Caido's get/create/send calls stubbed. Ten cases fail on unchanged 06015506 and eight controls pass. After the fix, all 42 proxy and Caido tests pass. Ruff format/lint and diff checks pass on Python 3.12.14 with the frozen dependency set. The tests use synthetic requests. Live Caido and Docker integration remain unverified.

Activity

2
greptile-apps[bot]1d ago

Confidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Preserves leading and trailing whitespace in captured text bodies when requests are replayed.

  • Request replays keep whitespace in captured bodies.

No actionable issues found. Tests were inspected but not run during this review.

Reviews (1) · Last reviewed commit: "fix(proxy): preserve whitespace in repla..." · Reviewed by Greptile