You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have run into the issue with latest Apache HttpClient5 5.4.1 / Apache HttpCore5 5.3.1 as a client (Reactor Netty as the HTTP server with HTTP/1.1 and H2C protocols) that now tries HTTP/1.1 TLS Upgrade (RFC-2817) by default, see please [1] for context. The HttpServerRequest::receiveContent() never emits any value nor completes since no next / completion callbacks are called.
if (isFullHttpRequest) {
FullHttpRequest request = (FullHttpRequest) msg;
if (request.content().readableBytes() > 0) {
super.onInboundNext(ctx, msg);
}
else {
request.release();
}
if (isHttp2()) {
//force auto read to enable more accurate close selection now inbound is done
channel().config().setAutoRead(true);
onInboundComplete();
}
}
In case of upgrade flow (which happens only for GET/OPTIONS/HEAD), the channel pipeline involves HttpObjectAggregator and emits the FullHttpRequest instance (precisely, HttpObjectAggregator.AggregatedFullHttpRequest) with empty content, which deviates from non-upgrade flow that emits DefaultHttpRequest, followed by last content. As the result, onInboundNext is not called, and because the upgrade did not switch protocols and stayed on HTTP/1.1, onInboundComplete is also not called.
reta
changed the title
`HttpServerRequest::receiveContent() never emits any value nor completes when HTTP/1.1 TLS Upgrade (RFC-2817) kicks in
HttpServerRequest::receiveContent() never emits any value nor completes when HTTP/1.1 TLS Upgrade (RFC-2817) kicks in
Dec 9, 2024
We have run into the issue with latest Apache HttpClient5 5.4.1 / Apache HttpCore5 5.3.1 as a client (Reactor Netty as the HTTP server with HTTP/1.1 and H2C protocols) that now tries HTTP/1.1 TLS Upgrade (RFC-2817) by default, see please [1] for context. The
HttpServerRequest::receiveContent()
never emits any value nor completes since no next / completion callbacks are called.I have traced this problem to
HttpServerOperations
, specifically to this block of code https://github.com/reactor/reactor-netty/blob/main/reactor-netty-http/src/main/java/reactor/netty/http/server/HttpServerOperations.java#L812:In case of upgrade flow (which happens only for GET/OPTIONS/HEAD), the channel pipeline involves
HttpObjectAggregator
and emits theFullHttpRequest
instance (precisely,HttpObjectAggregator.AggregatedFullHttpRequest
) with empty content, which deviates from non-upgrade flow that emitsDefaultHttpRequest
, followed by last content. As the result,onInboundNext
is not called, and because the upgrade did not switch protocols and stayed on HTTP/1.1,onInboundComplete
is also not called.[1] https://github.com/apache/httpcomponents-client/pull/542/files
Expected Behavior
The
HttpServerRequest::receiveContent()
should complete with empty result.Actual Behavior
The
HttpServerRequest::receiveContent()
hangs.Steps to Reproduce
I have published a full reproducer here [2], it is very small but has pom.xml + client + server (easier to start with).
[2] https://github.com/reta/httpclient5-upgrade-reproducer
Possible Solution
I assume that calling
onInboundComplete()
would be the right thing to do here, since there is no content and inbound request is processed.Your Environment
netty
, ...): Apache HttpClient5 5.4.1, Apache HttpCore5 5.3.1java -version
): 11 / 17 / 21uname -a
): anyThe text was updated successfully, but these errors were encountered: