GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `HttpServerCodec`: 1xx interim responses consume the HEAD method queue, misaligning subsequent responses · Issue #17181 · netty/netty

HttpServerCodec: 1xx interim responses consume the HEAD method queue, misaligning subsequent responses #17181

New issue
Copy link
New issue
Copy link
Closed
#17182
Closed
HttpServerCodec: 1xx interim responses consume the HEAD method queue, misaligning subsequent responses#17181
#17182
Copy link
Milestone
4.2.17.Final

Description

@HwangRock
HwangRock
opened on Aug 1, 2026
Issue body actions

Motivation

#12918 stopped 1xx interim responses from consuming a queue entry in HttpClientCodec and HttpContentEncoder. HttpServerCodec shares the same shape but was left out.

isContentAlwaysEmpty(HttpResponse) in HttpServerCodec polls the method queue for every response it encodes:

@Override
protected boolean isContentAlwaysEmpty(HttpResponse msg) {
    methodFlag = pollMethod();
    return methodFlag == METHOD_FLAG_HEAD || super.isContentAlwaysEmpty(msg);
}

isContentAlwaysEmpty(...) is invoked for every HttpResponse on both encoder paths — encodeFullHttpMessage() and encodeInitHttpMessage() in HttpObjectEncoder. An interim response is not the final response to the queued request, so consuming an entry shifts the queue by one. The equivalent guard already exists in isContentAlwaysEmpty(HttpResponse) in HttpClientCodec:

if (statusClass == HttpStatusClass.INFORMATIONAL) {
    // An informational response should be excluded from paired comparison.
    return super.isContentAlwaysEmpty(msg);
}

Two observable failures follow.

A HEAD response carries a body. Send HEAD /a, write a 103 Early Hints, then write the final 200 OK with content. The interim response consumes the HEAD entry, so the final response sees an empty queue, falls back to METHOD_FLAG_OTHER, and the body reaches the wire:

HTTP/1.1 200 OK
content-length: 4

body

Per RFC 9110 section 9.3.2 a HEAD response must not carry content. On a keep-alive connection the peer parses those bytes as the start of the next response, so the connection desynchronises from that point on.

A non-HEAD response loses its body. Pipeline GET /a and HEAD /b, write a 103 for /a, then write /a's final 200 OK with content. pollMethod() returns the HEAD entry belonging to /b, the body is stripped, and Content-Length is left behind:

HTTP/1.1 200 OK
content-length: 6

The peer then waits for six bytes that never arrive.

Sequential request/response traffic recovers on its own, since an empty queue falls back to METHOD_FLAG_OTHER. Corruption needs either a 1xx preceding a HEAD response, or pipelining combined with a 1xx. Both are reachable from first-party handlers: HttpServerExpectContinueHandler and HttpObjectAggregator write 100 Continue through this encoder.

Expected behaviour

A 1xx interim response leaves the method queue untouched, matching HttpClientCodec and HttpContentEncoder.

Netty version: 4.2 (code is shared with 4.1)

I have the guard and tests for both cases and can send a PR if this direction looks right.

Activity

  1. normanmaurer
    added this to the 4.2.17.Final milestone on Aug 3, 2026
  2. normanmaurer
    closed this as completedin #17182on Aug 3, 2026
  3. arnabnandy7
    added a commit that references this issue on Aug 3, 2026

    `HttpServerCodec`: do not consume the method queue for 1xx interim re…

    This issue will close once commit ae41417 is merged into the '4.2' branch.
    ae41417
  4. chrisvest
    added 2 commits that reference this issue on Aug 3, 2026

    Auto-port 5.0: `HttpServerCodec`: do not consume the method queue for…

    This issue will close once commit c6e285e is merged into the '4.2' branch.
    c6e285e

    `HttpServerCodec`: do not consume the method queue for 1xx interim re…

    This issue will close once commit 1b8faad is merged into the '4.2' branch.
    1b8faad
  5. lltopk
    added a commit that references this issue on Oct 24, 2026

    `HttpServerCodec`: do not consume the method queue for 1xx interim re…

    This issue will close once commit 4d97870 is merged into the '4.2' branch.
    4d97870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      • 4.2.17.Final

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.