Repository navigation
Conversation
…places the built-in one
Every crawl request built its headers by spreading records
({ "User-Agent": ua, Accept, ...customHeaders }). A custom header whose name
differed only in case (user-agent, accept) became a second key, and
new Headers(record) appended both, sending a combined value. mergeHeaderRecords
(utils/headers) merges case-insensitively, later wins, and is used by the page
fetch (standard and document fetcher), robots, sitemaps, llms, markdown,
well-known, rsl, agent-access, the asset checks, the script fetcher and the
cloaking probe. The CLI's -H parse and its merge over [crawler] headers are
case-insensitive too.
Fixes squirrelscan/repo#3346.
Signed-off-by: Nik Cubrilovic <[email protected]>
- the cloaking probe's Googlebot fetch keeps its agent over a custom one, and the markdown probe its Accept (each is what the probe tests) - Range (the size check's byte window) and the sitemap Accept-Encoding (only codings the reader decodes) are laid after the custom headers - soft-404 merges a custom-header record before building Headers, so x-a and X-A in one TOML table go out once - tests: CLI -H over [crawler] headers across casings, the agent-access identities, a real-server cloaking agent check, the Accept check that could not match; docs scoped to requests that carry the custom headers Refs squirrelscan/repo#3346. Signed-off-by: Nik Cubrilovic <[email protected]>
…g fix in the changelog Refs squirrelscan/repo#3346. Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
marked this pull request as ready for review
October 25, 2026 22:48
|
Review of #1130 (case-insensitive header merging). I read the diff, including the new I found nothing that should block the merge. The helper is small and correct. A later record wins, the winner keeps its spelling, and
Before merging, run the secret-scan and |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every crawl request built its headers by spreading records, e.g.
{ "User-Agent": ua, Accept, ...customHeaders }. When a custom header's name differed from a built-in one only in case (-H "user-agent: x",acceptin[crawler] headers), the record held both keys, andnew Headers(record)appended them: the request sent a combined value such assquirrel/..., x.Changes
mergeHeaderRecords(@squirrelscan/utils/headers) merges records case-insensitively; a later record wins and keeps its spelling.User-Agentmade both cloaking fetches send it, so agent-based cloaking could not show);Accept;Range;Accept-Encoding.-Hparsing and its merge over[crawler] headersare case-insensitive.Tests
merge-header-records.test.tscustom-header-case-3346.test.ts, a real crawl. Pages, robots, sitemap and root probes send the custom agent alone; agent access keeps its identities.custom-header-case-3346.test.ts. Stylesheet, script and image requests send the custom agent alone; the cloaking Googlebot fetch keeps Googlebot. Both run against real servers.parseHeadersandmergeOptionsToConfigacross casings.Each test fails on main.
Not in this PR
The start-URL redirect probe and the cache
Varykey still use[crawler] user_agentrather than a custom agent. That is squirrelscan/repo#3351, which waits for the seed-resolution PR that rewrites that probe. The redirect probe sends no custom headers by design (#1395).Gates
format:checkmake validateIndependent review, then a delta review: 1 blocking and 1 medium, both fixed; the two lows (docs exceptions, CHANGELOG cloaking line) are fixed as well.
Docs:
configuration/crawler.mdx(headers). Skill: no change needed (the precedence is now what the docs always said).Fixes squirrelscan/repo#3346.