Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(routing/http/client): avoid escaping comma query separator #688

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

lidel
Copy link
Member

@lidel lidel commented Oct 10, 2024

This PR makes delegated routing client make IPIP-484 queries with , instead of %2C.
This is backward-compatible cosmetic fix: routing/http/server works with both , and %2C, so clients that use boxo v0.24 will still work.

Rationale

The comma is in the "sub-delims" set of characters that don't need to be encoded in most parts of a URL, including query parameters. Golang standard library percent-escapes it for consistency, but we prefer human-readable /routing/v1 URLs, and real comma is restored here to ensure human and machine requests hit the same HTTP cache keys.

cc @2color

Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.29%. Comparing base (ceb514c) to head (629baf5).
Report is 1 commits behind head on main.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #688      +/-   ##
==========================================
- Coverage   60.32%   60.29%   -0.03%     
==========================================
  Files         243      243              
  Lines       31004    31005       +1     
==========================================
- Hits        18704    18696       -8     
- Misses      10635    10641       +6     
- Partials     1665     1668       +3     
Files with missing lines Coverage Δ
routing/http/filters/filters.go 82.63% <100.00%> (+0.12%) ⬆️

... and 10 files with indirect coverage changes

The comma is in the "sub-delims" set of characters that don't need to be
encoded in most parts of a URL, including query parameters. Golang
standard library percent-escapes it for consistency, but we prefer
human-readable /routing/v1 URLs, and real comma is restored here to
ensure human and machine requests hit the same HTTP cache keys.
@lidel lidel requested a review from 2color October 10, 2024 20:05
@lidel lidel marked this pull request as ready for review October 10, 2024 20:05
@lidel lidel requested a review from a team as a code owner October 10, 2024 20:05
@lidel lidel changed the title fix(routing/http): avoid escaping comma separator fix(routing/http/client): avoid escaping comma separator Oct 10, 2024
@lidel lidel changed the title fix(routing/http/client): avoid escaping comma separator fix(routing/http/client): avoid escaping comma query separator Oct 10, 2024
Copy link
Member

@2color 2color left a comment

Choose a reason for hiding this comment

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

seems reasonable

@lidel lidel merged commit 30abd55 into main Oct 11, 2024
18 checks passed
@lidel lidel deleted the routing-query-fix branch October 11, 2024 16:20
gammazero pushed a commit that referenced this pull request Oct 22, 2024
@gammazero gammazero mentioned this pull request Oct 22, 2024
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