Skip to content

Preserve raw response bytes in ResponseChain - #760

Open
volksec wants to merge 1 commit into
projectdiscovery:mainfrom
volksec:agent/preserve-raw-response-bytes
Open

Preserve raw response bytes in ResponseChain#760
volksec wants to merge 1 commit into
projectdiscovery:mainfrom
volksec:agent/preserve-raw-response-bytes

Conversation

@volksec

@volksec volksec commented Jul 30, 2026

Copy link
Copy Markdown

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>
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.

1 participant