← Back to Pull requests

http-api: don't read a leading `//` in a request-target as an authority #3741

Closed
unknown closed this pull request without merging on Nov 16, 2026 23:45 UTC
View on GitHub
unknown unknown commented on Nov 16, 2026 22:36 UTC
Author

Reported by @sudosuraj

Motivation

HttpRequestMetaData parses a request-target as an RFC 3986 URI-reference, so //a/b is read as authority a and 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 from Host or :authority. As a result, host(), effectiveHostAndPort(), and values built from them can disagree with Host, a client fills in a missing Host header from the path, and path() drops the first segment.

Modifications

  • A request-target without a scheme parses a leading // 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.

  • Path setters can't turn a path into an authority: rawPath and path keep a / after an empty authority, and appendPathSegments checks the joined path, not just its first segment. A path that starts with // is rejected only when the target has a scheme.

  • A server reinterprets these targets instead of rejecting them with 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() returns null, path() and rawPath() return the whole path (for example //a/b), and effectiveHostAndPort() comes from Host. A client no longer takes Host or :authority from such a target, and uses its configured host instead. Routes and filters that match on the path see the full path.

    Diff: 209 lines (+156 / -53) across 2 files Reviewer: idelpivnitskiy Review duration: 69m
    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
    0.60
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 59.6% (MEDIUM) · Higher = larger blast radius
    59.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.5% · Safe to merge
    23.5%