Skip to content

Commit

Permalink
fix: More debugging code removal
Browse files Browse the repository at this point in the history
  • Loading branch information
Frooxius committed Jul 20, 2024
1 parent 8dda1ab commit 772e040
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions System.Net.WebSockets.Client.Managed/ManagedWebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,6 @@ private static void WriteRandomMask(byte[] buffer, int offset)
/// <param name="payloadBuffer">The buffer into which payload data should be written.</param>
/// <param name="cancellationToken">The CancellationToken used to cancel the websocket.</param>
/// <returns>Information about the received message.</returns>
bool _dumpNext = false;
private async Task<WebSocketReceiveResult> ReceiveAsyncPrivate(ArraySegment<byte> payloadBuffer, CancellationToken cancellationToken)
{
// This is a long method. While splitting it up into pieces would arguably help with readability, doing so would
Expand Down Expand Up @@ -728,7 +727,7 @@ private async Task<WebSocketReceiveResult> ReceiveAsyncPrivate(ArraySegment<byte
header.PayloadLength -= bytesToCopy;

// If this a text message, validate that it contains valid UTF8.
if (_dumpNext || (header.Opcode == MessageOpcode.Text &&
if ((header.Opcode == MessageOpcode.Text &&
!TryValidateUtf8(new ArraySegment<byte>(payloadBuffer.Array, payloadBuffer.Offset, bytesToCopy), header.Fin && header.PayloadLength == 0, _utf8TextState)))
{
await CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus.InvalidPayloadData, WebSocketError.Faulted, cancellationToken).ConfigureAwait(false);
Expand Down

0 comments on commit 772e040

Please sign in to comment.