[同步]1. 同步主库到2024年8月8日 14ced0fb4d1858efc4db0e2221ef3ccbb3e60f0b

14ced0f - never allow unmasked client websocket package
This commit is contained in:
Blank 2024-10-21 16:16:45 +08:00
parent 9bd4a5ba0d
commit bb220daeca
1 changed files with 13 additions and 5 deletions

View File

@ -1,8 +1,5 @@
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Buffers;
using System.Collections.Specialized;
using System.IO;
using System.Text;
using GameFrameX.SuperSocket.ProtoBase;
@ -18,6 +15,17 @@ namespace GameFrameX.SuperSocket.WebSocket
private static readonly ReadOnlyMemory<byte> _headerTerminator = new byte[] { (byte)'\r', (byte)'\n', (byte)'\r', (byte)'\n' };
private readonly bool _requireMask = true;
public WebSocketPipelineFilter()
{
}
public WebSocketPipelineFilter(bool requireMask)
{
_requireMask = requireMask;
}
public IPackageDecoder<WebSocketPackage> Decoder { get; set; }
public IPipelineFilter<WebSocketPackage> NextFilter { get; internal set; }
@ -33,7 +41,7 @@ namespace GameFrameX.SuperSocket.WebSocket
var package = ParseHandshake(ref pack);
NextFilter = new WebSocketDataPipelineFilter(package.HttpHeader);
NextFilter = new WebSocketDataPipelineFilter(package.HttpHeader, _requireMask);
return package;
}