File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff 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 ; }
Original file line number Diff line number Diff 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 ) ) ;
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments