Summary
Found while reviewing #196; deliberately left out of that PR because the previous aggregator also wrote 100 Continue through the same codec. This is not a regression from streaming.
Verified against repository commit aee97f895640f6a38d0b829472feb9d9fe0ff530 and the Netty 4.2.12.Final sources jar. The shared version catalog still selects that affected release.
HttpServerCodec queues one method per decoded request, but removes one method for every encoded response, including informational responses:
method = queue.poll();
return HttpMethod.HEAD.equals(method) || super.isContentAlwaysEmpty(msg);
An interim response must leave the request's entry available for its final response. The unconditional poll instead lets that final response use the next request's method, or null when the queue is empty.
Impact
For the POST/HEAD failure, HEAD must be decoded before the encoder starts the final POST response:
POST headers with Expect: 100-continue methods = [POST]
100 Continue encoded methods = []
POST body followed by HEAD decoded methods = [HEAD]
POST's final 200 encoded polls HEAD; suppresses POST body
HttpPipeliningHandler preserves dispatch and response order, but cannot prevent this: the codec records HEAD before the gate holds that request pending.
- With a chunked POST response, the body and terminating chunk disappear while
Transfer-Encoding: chunked remains.
- With a buffered POST response, the body disappears while the declared
Content-Length remains.
- If the next decoded request is CONNECT, a successful POST response can incorrectly lose
Transfer-Encoding while retaining chunk framing.
These are response-framing failures on a keep-alive connection. A client can wait for missing bytes, consume the next response as body data, or reject its status line as an invalid chunk size. Exploitability as request smuggling has not been established.
The shift is not necessarily permanent: sequential traffic recovers when the final response polls an empty queue before the next request is decoded. The underlying defect also affects other 1xx statuses, and an interim response to HEAD can remove the method needed to suppress its final response's body.
Fix notes
Recommended resolution: update the shared Netty version from 4.2.12.Final to 4.2.17.Final, the first fixed release in the 4.2 line. Update gradle/libs.versions.toml so transport, codec, handler and native transport dependencies move together.
Upstream netty/netty#17182 adds the INFORMATIONAL guard before polling the request-method queue. The fix is included in Netty 4.2.17.Final, released on 2026-08-04. It delegates informational responses to the base encoder, preserving its special handling of 101; protocol upgrade removes the codec and its remaining queue.
Use the released upstream fix rather than a local workaround, because it repairs the queue where Netty owns it and covers both buffered and streamed encoding. Reflection-based queue repair, a custom codec and informational-response bypass handlers are outside this task.
Validation required before closing:
- POST bodies reach the wire after
100 Continue even when HEAD or CONNECT is already decoded; chunked framing and declared content lengths remain correct.
- The final HEAD response has no body, sequential keep-alive traffic remains correct, and informational responses remain observable on the wire.
- Regression tests exercise the real
HttpServerCodec; they fail on 4.2.12.Final and pass on the selected fixed version.
- Verify resolved Netty versions in core, starter and the Netty example, including dependency-management overrides; all Netty modules use the selected version.
- Run
./gradlew build and the published-consumer smoke gate described in docs/publishing.md; both CI platform cells pass before merge.
Pointers
gradle/libs.versions.toml:6 — shared Netty version to update.
netty-loom-spring-core/build.gradle.kts:9-18 — Netty dependencies using the shared version, including native classifier variants.
netty-loom-spring-boot-starter/src/main/java/io/github/azholdaspaev/nettyloomspring/autoconfigure/NettyLoomAutoConfiguration.java:123-138 — codec precedes the pipelining gate and body-limit handler.
netty-loom-spring-core/src/main/java/io/github/azholdaspaev/nettyloomspring/core/handler/HttpRequestBodyLimitHandler.java:84-89 — writes the full 100 Continue response.
netty-loom-spring-core/src/test/java/io/github/azholdaspaev/nettyloomspring/core/handler/HttpRequestBodyLimitHandlerTest.java:198-199 — existing fixture omits the codec and cannot detect this defect.
- Affected Netty encoder and fixed encoder.
TDD entry point
HttpRequestBodyLimitHandlerTest#shouldPreservePostBodyAfterContinueBeforePipelinedHead
Before upgrading, add a failing wire-level test using an EmbeddedChannel with the real codec, pipelining gate and body-limit handler. Send POST headers with Expect: 100-continue, assert the encoded invitation, then send the body and HEAD together before writing the final POST response. Assert the POST body and chunk terminator reach the wire, and the final HEAD response has no body.
Cover both a streamed chunked response and a buffered response with Content-Length, plus the CONNECT framing case and sequential traffic. Apply the version update only after establishing the failing test. Reverting the version to 4.2.12.Final must reproduce the missing POST body.