http-api: don't read a leading `//` in a request-target as an authority #3741
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.60) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.60 · 209 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.320
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.060
Real PR Conversation Timeline
1 comments
"Review active on #3741"
general
weight: 0.35
idelpivnitskiy
Reported by @sudosuraj
Motivation
HttpRequestMetaDataparses a request-target as an RFC 3986 URI-reference, so//a/bis read as authorityaand path/b. RFC 9112 section 3.2 and RFC 9113 section 8.3.1 define it as the origin-form path//a/b, with the authority taken fromHostor:authority. As a result,host(),effectiveHostAndPort(), and values built from them can disagree withHost, a client fills in a missingHostheader from the path, andpath()drops the first segment.Modifications
//as part of the path, for requests a server receives and requests a client sends. Absolute-form targets still supply the authority, as RFC 9112 section 3.2.2 requires.rawPathandpathkeep a/after an empty authority, andappendPathSegmentschecks the joined path, not just its first segment. A path that starts with//is rejected only when the target has a scheme.400, so clients that accidentally double the leading slash are still served.Result
A request-target that starts with
//no longer supplies an authority, and its path keeps the first segment.Behavior change: for a request-target that starts with
//,host()returnsnull,path()andrawPath()return the whole path (for example//a/b), andeffectiveHostAndPort()comes fromHost. A client no longer takesHostor:authorityfrom such a target, and uses its configured host instead. Routes and filters that match on the path see the full path.