#1681

[BUG] Proxy replay strips body whitespace during header-only edits

Opensamirhvbropened 1d ago

Describe the bug

repeat_request rewrites the body of a recorded request when the only requested change is a header. parse_raw_request strips whitespace from the body after splitting the raw HTTP message. The same change occurs when replaying without modifications.

To Reproduce

On main at 06015506625a78b981ae0b34be40239fc1b389be, replay a recorded POST whose body is b" value \r\n", supplying a header-only modification. Capture the request submitted to Caido. An offline reproduction with Caido's read/send boundary stubbed produces b"value". A whitespace-only body becomes empty, and the final CRLF of a multipart body is removed.

Expected behavior

Header-only replay preserves the original body exactly. An explicit body replacement still uses the requested replacement.

Environment

Python 3.12, macOS, current main, synthetic HTTP requests, no LLM or live target.

This matters when isolating one variable in a replay, including signed and whitespace-sensitive bodies. The proposed change preserves the body after the HTTP header separator and keeps the existing framing and replacement logic.

Activity

0

No activity yet.