Skip to content

fix: canonicalize response header names before lookup - #561

Open
arpitjain099 wants to merge 1 commit into
projectdiscovery:mainfrom
arpitjain099:fix/response-header-canonical-keys
Open

arpitjain099 wants to merge 1 commit into
projectdiscovery:mainfrom
arpitjain099:fix/response-header-canonical-keys

Conversation

@arpitjain099

Copy link
Copy Markdown

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.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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