mirror of
https://github.com/apple/swift-nio.git
synced 2026-05-20 20:30:36 +00:00
61053a00bb
`NIOTypedHTTPClientUpgradeHandler.handlerAdded` will write upgrade request if the channel is already active ### Motivation: This has been added to make it easier to implement a websocket client that supports proxies. If the upgrade handler is added after the proxy connect has been processed previously nothing would happen. ### Modifications: - Added new function `NIOTypedHTTPClientUpgradeHandler.writeUpgradeRequest()` function. Call this from `channelActive` and also from `handlerAdded` if the channel is already active. - Added test `testUpgradeHappensAfterHandlerAdded` ### Result: NIOTypedHTTPClientUpgradeHandler now also works if it is added to a channel after the channel is active --------- Co-authored-by: Cory Benfield <lukasa@apple.com>