Skip to content

fix: canonicalize response header names before lookup - #561

Merged
Mzack9999 merged 2 commits into
projectdiscovery:mainfrom
arpitjain099:fix/response-header-canonical-keys
Nov 26, 2026
Merged

Mzack9999 merged 2 commits into
projectdiscovery:mainfrom
arpitjain099:fix/response-header-canonical-keys

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

Response header names keep their wire case and headerValue is a plain map read, so the gzip check in toHTTPResponse and the redirect lookup in do only match Title case. With a server that answers content-encoding: gzip, DoRawWithOptions returns the 46 byte gzip stream rather than the 21 byte body, and a lowercase location fails with "failed to parse url got empty input" instead of following the 302.

Canonicalizing in fromHeaders covers both, and resp.Header.Get works again. Request writing is untouched; sending raw bytes is the point here. go test -race ./... passes.

@Mzack9999
Mzack9999 merged commit 2f02b3f into projectdiscovery:main Nov 26, 2026
8 checks passed
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.

2 participants