Skip to content

Add a ChunkedWriteHandler when a socket is upgraded to SSL - #6332

Open
doxlik wants to merge 1 commit into
eclipse-vertx:masterfrom
doxlik:fix-sendfile-in-tls-upgraded-socket
Open

Add a ChunkedWriteHandler when a socket is upgraded to SSL#6332
doxlik wants to merge 1 commit into
eclipse-vertx:masterfrom
doxlik:fix-sendfile-in-tls-upgraded-socket

Conversation

@doxlik

@doxlik doxlik commented Aug 25, 2026

Copy link
Copy Markdown

The ChunkedWriteHandler is installed once when the pipeline is created and only when the channel is encrypted at that point, whereas supportsFileRegion() is evaluated at write time against the live pipeline. A socket upgraded with upgradeToSsl() therefore stops using the file region transfer without gaining the handler that consumes the chunked file NetSocket#sendFile writes: the ChunkedNioFile reaches the tail of the pipeline and Netty rejects it with an UnsupportedMessageTypeException, the future fails and the peer receives no data.

Install the handler when the upgrade completes, unless the pipeline already has one. It is
inserted before the connection handler, so that the chunks it produces are written through the
SSL handler and encrypted. This is the position the pipeline gives it when the channel is
created encrypted.

Closes #6331

The ChunkedWriteHandler is installed once when the pipeline is created and
only when the channel is encrypted at that point, whereas supportsFileRegion()
is evaluated at write time against the live pipeline. A socket upgraded with
upgradeToSsl() therefore stops using the file region transfer without gaining
the handler that consumes the chunked file NetSocket#sendFile writes: the
ChunkedNioFile reaches the tail of the pipeline and Netty rejects it with an
UnsupportedMessageTypeException, the future fails and the peer receives no
data.

Install the handler when the upgrade completes, unless the pipeline already
has one. It is added before the connection handler so that the chunks are
written to the SSL handler and encrypted, which is where the pipeline places
it when the channel is created encrypted.

Signed-off-by: doxlik <doxlikx@gmail.com>
@doxlik

doxlik commented Aug 25, 2026

Copy link
Copy Markdown
Author

@vietj please have a look once you have time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChunkedWriteHandler is not added to the pipeline on a runtime TLS upgrade

1 participant