Skip to content

Allow repeated User-Agent headers to merge instead of raising duplicate-header errors#104

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/allow-multiple-user-agents
Draft

Allow repeated User-Agent headers to merge instead of raising duplicate-header errors#104
Copilot wants to merge 2 commits into
mainfrom
copilot/allow-multiple-user-agents

Conversation

Copy link
Copy Markdown

Copilot AI commented May 23, 2026

Some clients (notably crawlers) send multiple User-Agent header lines. Protocol::HTTP::Headers previously treated user-agent as singleton, causing DuplicateHeaderError and dropped requests when duplicates were present.

  • Policy change

    • Updated Headers::POLICY to treat user-agent as Header::Split (mergeable) rather than false (singleton).
    • Duplicate User-Agent lines now coalesce into a single logical header value instead of failing request parsing.
  • Spec coverage

    • Added a focused headers spec asserting duplicate user-agent values are merged and serialized consistently with existing split-header behavior.
headers = Protocol::HTTP::Headers.new
headers.merge!([
  ["user-agent", "foobar/2000"],
  ["user-agent", "foobar/2001"],
])

headers["user-agent"]      # => ["foobar/2000", "foobar/2001"]
headers["user-agent"].to_s # => "foobar/2000,foobar/2001"

Copilot AI linked an issue May 23, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix issue with multiple User-Agent headers in Falcon Allow repeated User-Agent headers to merge instead of raising duplicate-header errors May 23, 2026
Copilot AI requested a review from ioquatix May 23, 2026 02:00
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.

Allow Multiple User Agents Headers

2 participants