Skip to content

Commit e74f586

Browse files
no idea what happened
1 parent 291da25 commit e74f586

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Infinity.WebSockets/WebSocketClientConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class WebSocketClientConnection : WebSocketConnection
2424
protected override NetworkStream Stream => stream!;
2525
protected override bool MaskOutgoingFrames => true;
2626

27-
protected override bool ValidateIncomingMask() => false;
27+
protected override bool ValidateIncomingMask(bool masked) => !masked;
2828
public override int MaxPayloadSize { get; set; } = Configuration.MaxBufferSize;
2929

3030
public WebSocketClientConnection(ILogger? _logger = null) { logger = _logger; }

Infinity.WebSockets/WebSocketConnection.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public abstract class WebSocketConnection : NetworkConnection
2323
protected abstract bool MaskOutgoingFrames { get; }
2424
public abstract int MaxPayloadSize { get; set; }
2525

26+
protected abstract bool ValidateIncomingMask(bool masked);
27+
2628
public override async Task<SendErrors> Send(MessageWriter writer)
2729
{
2830
if (state != ConnectionState.Connected || Stream == null || closeSent)
@@ -130,8 +132,6 @@ private async Task SendPing()
130132
}
131133
}
132134

133-
protected abstract bool ValidateIncomingMask();
134-
135135
protected async Task ReceiveLoop()
136136
{
137137
if (Stream == null) return;
@@ -168,7 +168,7 @@ protected async Task ReceiveLoop()
168168

169169

170170
// Validate masking
171-
if (!ValidateIncomingMask())
171+
if (!ValidateIncomingMask(masked))
172172
{
173173
var cw = MessageWriter.Get();
174174
cw.Write((byte)(1002 >> 8));

Infinity.WebSockets/WebSocketServerConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class WebSocketServerConnection : WebSocketConnection
1313
protected override NetworkStream Stream => stream;
1414
protected override bool MaskOutgoingFrames => false;
1515

16-
protected override bool ValidateIncomingMask() => true;
16+
protected override bool ValidateIncomingMask(bool masked) => masked;
1717
public override int MaxPayloadSize { get; set; } = 64 * 1024 * 1024; // default 64MB
1818

1919
// additional handshake metadata exposed for consumers

0 commit comments

Comments
 (0)