Skip to content

fix: Support half-close on native transport hijacked streams - #133

Merged
HofmeisterAn merged 2 commits into
mainfrom
bugfix/native-half-close
Oct 31, 2026
Merged

HofmeisterAn merged 2 commits into
mainfrom
bugfix/native-half-close

Conversation

@HofmeisterAn

Copy link
Copy Markdown
Collaborator

CloseWrite on a hijacked stream (attach, exec) of the native transport closed the whole stream instead of only its write side, so reading the output after closing stdin failed with "Stream does not support reading".

Because the upgraded stream from SocketsHttpHandler doesn't expose its socket, DockerClient now begins a HijackScope, a new public type in Docker.DotNet.Handler.Abstractions, around hijack requests.

The native transport now connects through its own connect callbacks for Unix sockets and TCP, and their stream records the socket the hijack request is written to, so CloseWrite shuts down only that socket's send side, as the legacy transports do.

Recording starts only once a connection is fully set up, so writes from a TLS handshake that runs on behalf of a request sent over another connection are ignored.

If a user replaces the connect callback or plaintext stream filter through ConfigureHandler, CloseWrite keeps its previous behavior.

@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Oct 31, 2026
@HofmeisterAn
HofmeisterAn force-pushed the bugfix/native-half-close branch from 1112807 to e098351 Compare October 31, 2026 17:27
@HofmeisterAn HofmeisterAn added the bug Something isn't working label Oct 31, 2026
@HofmeisterAn
HofmeisterAn merged commit a88c521 into main Oct 31, 2026
18 checks passed
@HofmeisterAn
HofmeisterAn deleted the bugfix/native-half-close branch October 31, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant