Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nonstandard close statuses in ManagedWebSocket #83713

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ public static IEnumerable<object[]> CloseStatus_Valid_TestData()
{
yield return new object[] { WebSocketCloseStatus.EndpointUnavailable, "", WebSocketCloseStatus.EndpointUnavailable };
yield return new object[] { WebSocketCloseStatus.MandatoryExtension, "StatusDescription", WebSocketCloseStatus.MandatoryExtension };
yield return new object[] { WebSocketCloseStatus.ServiceRestart, "ServiceRestart", WebSocketCloseStatus.ServiceRestart };
yield return new object[] { WebSocketCloseStatus.TryAgainLater, "TryAgainLater", WebSocketCloseStatus.TryAgainLater };
yield return new object[] { WebSocketCloseStatus.BadGateway, "BadGateway", WebSocketCloseStatus.BadGateway };
}

[ConditionalTheory(nameof(IsNotWindows7AndIsWindowsImplementation))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/22015", TestPlatforms.AnyUnix)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,9 @@ private static bool IsValidCloseStatus(WebSocketCloseStatus closeStatus)
case WebSocketCloseStatus.NormalClosure:
case WebSocketCloseStatus.PolicyViolation:
case WebSocketCloseStatus.ProtocolError:
case WebSocketCloseStatus.ServiceRestart:
case WebSocketCloseStatus.TryAgainLater:
case WebSocketCloseStatus.BadGateway:
return true;

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public enum WebSocketCloseStatus
PolicyViolation = 1008,
MessageTooBig = 1009,
MandatoryExtension = 1010,
InternalServerError = 1011
InternalServerError = 1011,
ServiceRestart = 1012, // indicates that the server / service is restarting.
TryAgainLater = 1013, // indicates that a temporary server condition forced blocking the client's request.
BadGateway = 1014 // indicates that the server acting as gateway received an invalid response
// TLSHandshakeFailed = 1015, // 1015 is reserved and should never be used by user

// 0 - 999 Status codes in the range 0-999 are not used.
Expand Down