- Timestamp:
- Aug 1, 2022, 12:26:44 PM (3 years ago)
- Location:
- binary-improvements2/SpaceWizards.HttpListener/src/System/Net/WebSockets
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/SpaceWizards.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs
r376 r377 1 1 // Licensed to the .NET Foundation under one or more agreements. 2 2 // The .NET Foundation licenses this file to you under the MIT license. 3 4 // ReSharper disable ConditionIsAlwaysTrueOrFalse 5 #pragma warning disable CS8601 6 #pragma warning disable CS8618 3 7 4 8 using System; -
binary-improvements2/SpaceWizards.HttpListener/src/System/Net/WebSockets/HttpWebSocket.cs
r376 r377 1 1 // Licensed to the .NET Foundation under one or more agreements. 2 2 // The .NET Foundation licenses this file to you under the MIT license. 3 4 // ReSharper disable UnusedMember.Local 5 #pragma warning disable CS0162 6 #pragma warning disable CS8602 3 7 4 8 using System; … … 26 30 27 31 // SHA1 used only for hashing purposes, not for crypto. Check here for FIPS compat. 32 #if UNITY_NETFRAMEWORK 33 SHA1 sha1 = SHA1.Create(); 34 byte[] hash = sha1.ComputeHash(toHash); 35 #else 28 36 byte[] hash = SHA1.HashData(toHash); 37 #endif 29 38 return Convert.ToBase64String(hash); 30 39 } 31 40 41 #if UNITY_NETFRAMEWORK 42 private static readonly char[] protocolsSplitChars = new []{','}; 43 #endif 44 32 45 // return value here signifies if a Sec-WebSocket-Protocol header should be returned by the server. 33 46 internal static bool ProcessWebSocketProtocolHeader(string? clientSecWebSocketProtocol, … … 60 73 // and the server has specified exactly one protocol 61 74 75 #if UNITY_NETFRAMEWORK 76 string[] requestProtocols = clientSecWebSocketProtocol.Split(protocolsSplitChars, StringSplitOptions.RemoveEmptyEntries); 77 #else 62 78 string[] requestProtocols = clientSecWebSocketProtocol.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); 79 #endif 63 80 acceptProtocol = subProtocol; 64 81 … … 68 85 { 69 86 string currentRequestProtocol = requestProtocols[i]; 87 #if UNITY_NETFRAMEWORK 88 currentRequestProtocol = currentRequestProtocol.Trim (); 89 if (currentRequestProtocol.Length == 0) { 90 continue; 91 } 92 #endif 70 93 if (string.Equals(acceptProtocol, currentRequestProtocol, StringComparison.OrdinalIgnoreCase)) 71 94 { -
binary-improvements2/SpaceWizards.HttpListener/src/System/Net/WebSockets/WebSocketValidate.cs
r376 r377 1 1 // Licensed to the .NET Foundation under one or more agreements. 2 2 // The .NET Foundation licenses this file to you under the MIT license. 3 4 // ReSharper disable PartialTypeWithSinglePart 5 // ReSharper disable ConditionIsAlwaysTrueOrFalse 3 6 4 7 using System.Diagnostics;
Note:
See TracChangeset
for help on using the changeset viewer.