Skip to content

Commit c6d3cfa

Browse files
committed
Fix of WebSocket close status frame
1 parent a9de497 commit c6d3cfa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/NetCoreServer/WebSocket.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ public bool PerformServerUpgrade(HttpRequest request, HttpResponse response)
257257
/// <param name="status">WebSocket status (default is 0)</param>
258258
public void PrepareSendFrame(byte opcode, bool mask, ReadOnlySpan<byte> buffer, int status = 0)
259259
{
260-
bool storeWSCloseStatus = (opcode & WS_CLOSE) == WS_CLOSE;
261-
long size = storeWSCloseStatus ? (buffer.Length + 2) : buffer.Length;
260+
bool storeStatus = (opcode & WS_CLOSE) == WS_CLOSE;
261+
long size = storeStatus ? (buffer.Length + 2) : buffer.Length;
262262

263263
// Clear the previous WebSocket send buffer
264264
WsSendBuffer.Clear();
@@ -298,7 +298,7 @@ public void PrepareSendFrame(byte opcode, bool mask, ReadOnlySpan<byte> buffer,
298298
// RFC 6455: If there is a body, the first two bytes of the body MUST
299299
// be a 2-byte unsigned integer (in network byte order) representing
300300
// a status code with value code.
301-
if (storeWSCloseStatus)
301+
if (storeStatus)
302302
{
303303
index += 2;
304304
WsSendBuffer.Data[offset + 0] = (byte)(((status >> 8) & 0xFF) ^ WsSendMask[0]);

0 commit comments

Comments
 (0)