Repository navigation
Fix ada::url host_end one byte short of its documented position - #1244
Merged
Merged
Conversation
anonrig
approved these changes
Sep 1, 2026
Member
|
thank you |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1244 +/- ##
=======================================
Coverage 63.27% 63.27%
=======================================
Files 39 39
Lines 7705 7705
Branches 3514 3514
=======================================
Hits 4875 4875
Misses 752 752
Partials 2078 2078 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
ada::url::get_components().host_endis one byte short of the position theurl_componentsdocumentation diagram describes (one past the host) in both branches ofurl-inl.h: the no-credentials branch subtracts one, and the credentials branch omits the '@' byte thathost_startsits on.ada::url_aggregatorreports the documented position on the same inputs, so the two implementations of the one contract disagree, and slicinghrefby[host_start, host_end)fromada::urltruncates the host:The computation was internally self-correcting -
running_indexadded the missing byte back - which is why every other offset agrees between the two implementations and only the exposedhost_endis wrong. The existing test slices byget_hostname().size()and never readshost_end, which is how it survived. This change fixes both branches, updatesrunning_indexaccordingly (it is now already one past the host), and pins[host_start, host_end)to the hostname inurl_components.cpp, which runs over the full WPTurltestdatacorpus. The new assertion fails before the fix and passes after; the full suite (353 tests) is green with the change.Per AI_USAGE_POLICY.md: this defect was found by an automated analysis loop built on Claude; the fix and test were reviewed by me before filing, I am accountable for them, and I am happy to answer questions during review. clang-format 22 has been applied to the touched files.