Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ProcessWebSocketProtocolHeader()

static bool System.Net.WebSockets.HttpWebSocket.ProcessWebSocketProtocolHeader ( string clientSecWebSocketProtocol,
string subProtocol,
out string acceptProtocol )
inlinestaticpackage

Definition at line 27 of file HttpWebSocket.cs.

28 {
29 acceptProtocol = string.Empty;
30 if (string.IsNullOrEmpty(clientSecWebSocketProtocol))
31 {
32 if (subProtocol != null)
33 {
34 throw new WebSocketException(WebSocketError.UnsupportedProtocol, System.SR.Format(System.SR.net_WebSockets_ClientAcceptingNoProtocols, subProtocol));
35 }
36 return false;
37 }
38 if (subProtocol == null)
39 {
40 return true;
41 }
42 string[] array = clientSecWebSocketProtocol.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
44 foreach (string b in array)
45 {
46 if (string.Equals(acceptProtocol, b, StringComparison.OrdinalIgnoreCase))
47 {
48 return true;
49 }
50 }
52 }
static string net_WebSockets_AcceptUnsupportedProtocol
Definition SR.cs:128
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_WebSockets_ClientAcceptingNoProtocols
Definition SR.cs:126
Definition SR.cs:7

References System.array, System.Net.Equals, System.SR.Format(), System.SR.net_WebSockets_AcceptUnsupportedProtocol, and System.SR.net_WebSockets_ClientAcceptingNoProtocols.

Referenced by System.Net.WebSockets.HttpWebSocket.AcceptWebSocketAsyncCore().