From 5858c0a64a72e933c27e32ce054ab45f43c5736b Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Wed, 2 Nov 2016 15:57:25 -0700 Subject: [PATCH] fix #85 by making HandshakeHelpers internal and tidying doc comments we don't need to share it with anything in the current implementation --- .../Internal/HandshakeHelpers.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.AspNetCore.WebSockets/Internal/HandshakeHelpers.cs b/src/Microsoft.AspNetCore.WebSockets/Internal/HandshakeHelpers.cs index 019f84a08c..a4bb0721ab 100644 --- a/src/Microsoft.AspNetCore.WebSockets/Internal/HandshakeHelpers.cs +++ b/src/Microsoft.AspNetCore.WebSockets/Internal/HandshakeHelpers.cs @@ -8,7 +8,7 @@ using System.Text; namespace Microsoft.AspNetCore.WebSockets.Internal { - public static class HandshakeHelpers + internal static class HandshakeHelpers { /// /// Gets request headers needed process the handshake on the server. @@ -76,7 +76,6 @@ namespace Microsoft.AspNetCore.WebSockets.Internal /// /// Validates the Sec-WebSocket-Key request header - /// "The value of this header field MUST be a nonce consisting of a randomly selected 16-byte value that has been base64-encoded." /// /// /// @@ -97,14 +96,13 @@ namespace Microsoft.AspNetCore.WebSockets.Internal } } - /// - /// "...the base64-encoded SHA-1 of the concatenation of the |Sec-WebSocket-Key| (as a string, not base64-decoded) with the string - /// '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'" - /// - /// - /// public static string CreateResponseKey(string requestKey) { + // "The value of this header field is constructed by concatenating /key/, defined above in step 4 + // in Section 4.2.2, with the string "258EAFA5- E914-47DA-95CA-C5AB0DC85B11", taking the SHA-1 hash of + // this concatenated value to obtain a 20-byte value and base64-encoding" + // https://tools.ietf.org/html/rfc6455#section-4.2.2 + if (requestKey == null) { throw new ArgumentNullException(nameof(requestKey));