← Back to Pull requests

http-netty: don't send a payload body or trailers in responses to HEAD #3693

Closed
unknown closed this pull request without merging on Nov 05, 2026 18:14 UTC
View on GitHub
unknown unknown commented on Oct 21, 2026 16:20 UTC
Author

Motivation

A server must not send a payload body or trailers in a response to a HEAD request (RFC 7231, section 4.3.2), but a handler that reuses its GET logic for HEAD returns them anyway. HTTP/1.1 already discards them. HTTP/2 had no such check and wrote a DATA frame with the body followed by a trailers HEADERS frame. Strict clients such as curl treat that as a protocol error and close the whole connection with GOAWAY, not just the one stream.

Modifications

  • Drop the payload and trailers of responses to HEAD requests before they are written, for both HTTP/1.1 and HTTP/2. Other methods are unaffected.

  • Apply this to HEAD only, not to every response that can't have a body (1xx, 204, 304, 2xx to CONNECT), because some of those, such as a CONNECT tunnel or a WebSocket upgrade, legitimately carry data.

  • Consume the dropped body instead of cancelling it, because cancelling can tear down the connection or stream when the body is tied to the request. A HEAD handler that streams an infinite body therefore still keeps its HTTP/2 stream open, as it did before.
  • Result

    A handler that returns a body or trailers for a HEAD request no longer breaks HTTP/2 connections: the client gets the response headers followed by an empty DATA frame with END_STREAM. Packet captures of such a handler before and after the change show the leaked DATA and trailers frames gone and HTTP/1.1 output unchanged.

    Behavior change: services whose handlers return a payload body or trailers for a HEAD request over HTTP/2 now have them dropped instead of sent. Headers, including any Content-Length the handler sets, are unchanged, so no action is needed.

    Diff: 211 lines (+158 / -53) across 2 files Reviewer: idelpivnitskiy Review duration: 21713m
    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 · 211 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 #3693"
    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.7% (MEDIUM) · Higher = larger blast radius
    59.7%
    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.6% · Safe to merge
    23.6%