Open
Description
Expected behavior
When a client is attempting to upgrade an HTTPS connection to a WebSocket connection and the TLS connection fails the returned error should indicate the TLS connection failed.
Actual behavior
The error returned is ChannelError.inappropriateOperationForState
which is not very informative
Steps to reproduce
This issue is actually common to any ChannelHandler placed in front of the Upgrade ChannelHandler. So the following method provides an easier replication.
- Using the websocket server and client examples
- Write a channel handler that fires an error as soon as
channelRead
is called and closes the channel. - Add it before the upgrade channel handler in the client.
- Run and watch the
ChannelError.inappropriateOperationForState
get returned and not the error returned by the above channel handler.
SwiftNIO version/commit hash
2.81.0
System & version information
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0