Skip to content

Commit

Permalink
Browser connections fail with "A server must not mask any frames that…
Browse files Browse the repository at this point in the history
… it sends to the client" #213
  • Loading branch information
chronoxor committed Aug 12, 2022
1 parent 9013228 commit e2f8d14
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion source/NetCoreServer/NetCoreServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>6.4.0.0</Version>
<Version>6.5.0.0</Version>
<Authors>Ivan Shynkarenka</Authors>
<Copyright>Copyright (c) 2019-2022 Ivan Shynkarenka</Copyright>
<RepositoryUrl>https://github.com/chronoxor/NetCoreServer</RepositoryUrl>
Expand Down
20 changes: 10 additions & 10 deletions source/NetCoreServer/WsSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public long SendText(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_TEXT, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_TEXT, false, buffer);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -40,7 +40,7 @@ public bool SendTextAsync(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_TEXT, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_TEXT, false, buffer);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -58,7 +58,7 @@ public long SendBinary(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_BINARY, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_BINARY, false, buffer);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -71,7 +71,7 @@ public bool SendBinaryAsync(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_BINARY, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_BINARY, false, buffer);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -89,7 +89,7 @@ public long SendClose(int status, ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_CLOSE, true, buffer, status);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_CLOSE, false, buffer, status);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -102,7 +102,7 @@ public bool SendCloseAsync(int status, ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_CLOSE, true, buffer, status);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_CLOSE, false, buffer, status);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -120,7 +120,7 @@ public long SendPing(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PING, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PING, false, buffer);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -133,7 +133,7 @@ public bool SendPingAsync(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PING, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PING, false, buffer);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -151,7 +151,7 @@ public long SendPong(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PONG, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PONG, false, buffer);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -164,7 +164,7 @@ public bool SendPongAsync(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PONG, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PONG, false, buffer);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand Down
20 changes: 10 additions & 10 deletions source/NetCoreServer/WssSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public long SendText(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_TEXT, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_TEXT, false, buffer);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -40,7 +40,7 @@ public bool SendTextAsync(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_TEXT, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_TEXT, false, buffer);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -58,7 +58,7 @@ public long SendBinary(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_BINARY, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_BINARY, false, buffer);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -71,7 +71,7 @@ public bool SendBinaryAsync(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_BINARY, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_BINARY, false, buffer);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -89,7 +89,7 @@ public long SendClose(int status, ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_CLOSE, true, buffer, status);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_CLOSE, false, buffer, status);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -102,7 +102,7 @@ public bool SendCloseAsync(int status, ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_CLOSE, true, buffer, status);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_CLOSE, false, buffer, status);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -120,7 +120,7 @@ public long SendPing(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PING, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PING, false, buffer);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -133,7 +133,7 @@ public bool SendPingAsync(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PING, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PING, false, buffer);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -151,7 +151,7 @@ public long SendPong(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PONG, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PONG, false, buffer);
return base.Send(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand All @@ -164,7 +164,7 @@ public bool SendPongAsync(ReadOnlySpan<byte> buffer)
{
lock (WebSocket.WsSendLock)
{
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PONG, true, buffer);
WebSocket.PrepareSendFrame(WebSocket.WS_FIN | WebSocket.WS_PONG, false, buffer);
return base.SendAsync(WebSocket.WsSendBuffer.AsSpan());
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit e2f8d14

Please sign in to comment.