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
{{ message }}
Repository navigation
Expose WebSocketMessageFlags in ClientWebSocket #77783
In #31088 compression support in WebSocket was introduced. There was added WebSocketMessageFlags.DisableCompression flag which is needed to turn off compression i.e. when sending data containing secrets -- it helps to avoid CRIME/BREACH attacks.
However, this flag was added only in WebSocket and not in ClientWebSocket which is supposed to manage messages. We need to expose DisableCompression flag in SendAsync methods as well as it is done for EndOfMessage flag.
I've not quite followed the proposal. ClientWebSocket derives from WebSocket, inheriting all the APIs added there, and its implementation wraps ManagedWebSocket that implements the compression. What is the specific API that would be added to ClientWebSocket?
Thanks. This isn't about missing API, then, it's a bug. ClientWebSocket should be overriding public virtual ValueTask SendAsync(ReadOnlyMemory<byte> buffer, WebSocketMessageType messageType, WebSocketMessageFlags messageFlags, CancellationToken cancellationToken = default) to forward it to the wrapped ManagedWebSocket's corresponding overload.
Activity
stephentoub commentedon Nov 2, 2022
I've not quite followed the proposal. ClientWebSocket derives from WebSocket, inheriting all the APIs added there, and its implementation wraps ManagedWebSocket that implements the compression. What is the specific API that would be added to ClientWebSocket?
greenEkatherine commentedon Nov 3, 2022
@stephentoub we should add
SendAsyncmethod that handlesDisableCompressionflag. Currently we handle onlyEndOfMessageflag in both ClientWebSocketruntime/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs
Lines 145 to 149 in 64b3ee4
runtime/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/WebSocket.cs
Lines 56 to 64 in 64b3ee4
stephentoub commentedon Nov 3, 2022
Thanks. This isn't about missing API, then, it's a bug. ClientWebSocket should be overriding
public virtual ValueTask SendAsync(ReadOnlyMemory<byte> buffer, WebSocketMessageType messageType, WebSocketMessageFlags messageFlags, CancellationToken cancellationToken = default)to forward it to the wrapped ManagedWebSocket's corresponding overload.MihaZupan commentedon Nov 3, 2022
Triage: We should fix this in 8.0, looks like we're missing test coverage as well.
CarnaViire commentedon Dec 12, 2022
Reopening for backport
karelz commentedon Jan 6, 2023
Fixed in 8.0 (main) in PR #79412, and in 7.0.3 in PR #79547, and in 6.0.14 in PR #79549.