Skip to content

Treat only & as the urlencoded field separator#290

Merged
Kludex merged 1 commit into
mainfrom
whatwg-urlencoded-separator
May 31, 2026
Merged

Treat only & as the urlencoded field separator#290
Kludex merged 1 commit into
mainfrom
whatwg-urlencoded-separator

Conversation

@Kludex
Copy link
Copy Markdown
Owner

@Kludex Kludex commented May 31, 2026

QuerystringParser treated both & and ; as field separators, falling back to a ; scan whenever no & was found. This aligns it with the WHATWG URL standard, under which application/x-www-form-urlencoded bodies are delimited by & only.

; is now ordinary field data. This matches every common encoder - urllib.parse, browser URLSearchParams, httpx, requests, and Rust's serde_urlencoded/reqwest all emit &-separated bodies and none produce ;-separated forms - so no conformant client is affected.

Collapsing the two-step find("&") -> find(";") lookup into a single & search also makes parsing linear in the body length rather than quadratic for ;-heavy inputs, and the search is now bounded by the truncated length so max_size is respected within a chunk.

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.

Per the WHATWG URL standard, application/x-www-form-urlencoded bodies
delimit fields with `&` only. `;` is now ordinary data, matching
urllib.parse, browsers, httpx, requests, and reqwest.
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 31, 2026

Merging this PR will not alter performance

✅ 5 untouched benchmarks


Comparing whatwg-urlencoded-separator (47381e2) with main (1e6ff97)

Open in CodSpeed

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@Kludex Kludex merged commit d69df35 into main May 31, 2026
15 checks passed
@Kludex Kludex deleted the whatwg-urlencoded-separator branch May 31, 2026 12:22
@Kludex Kludex mentioned this pull request May 31, 2026
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