Skip to content

Preserve raw response bytes in ResponseChain - #760

Merged
Mzack9999 merged 4 commits into
projectdiscovery:mainfrom
volksec:agent/preserve-raw-response-bytes
Oct 25, 2026
Merged

Mzack9999 merged 4 commits into
projectdiscovery:mainfrom
volksec:agent/preserve-raw-response-bytes

Conversation

@volksec

@volksec volksec commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #804

Summary

  • add an opt-in NewResponseChainWithRaw constructor
  • preserve response bytes before content decoding and charset normalization
  • expose safe raw-body and raw-full-response accessors
  • keep the existing NewResponseChain allocation and behavior unchanged

Motivation

This is the dependency-level support needed by projectdiscovery/nuclei#7387. Nuclei currently receives only the normalized body from ResponseChain, so it cannot expose an encoded response payload alongside the existing decoded body.

The opt-in constructor keeps the additional pooled buffer out of callers that do not need raw bytes. Both raw and decoded reads remain bounded by the configured maximum body size.

Validation

  • go test ./http
  • go vet ./http
  • regression test confirms a gzip response remains decoded through BodyString() while RawBodyBytes() preserves the original gzip stream

Signed-off-by: Luan Nutels - VolkSec <luan.nutels@owasp.org>
@dwisiswant0 dwisiswant0 added the Status: On Hold Similar to blocked, but is assigned to someone label Oct 1, 2026
@Mzack9999
Mzack9999 merged commit a61b288 into projectdiscovery:main Oct 25, 2026
7 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: On Hold Similar to blocked, but is assigned to someone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResponseChain cannot keep the raw body

3 participants