From bd249ac6e3937308f70a8693af9e990cc4f6d2f7 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 28 Mar 2020 20:59:59 +0900 Subject: [PATCH] [Modify] Replace it --- websocket-sharp/Net/WebHeaderCollection.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/websocket-sharp/Net/WebHeaderCollection.cs b/websocket-sharp/Net/WebHeaderCollection.cs index 8b007dea..de947fda 100644 --- a/websocket-sharp/Net/WebHeaderCollection.cs +++ b/websocket-sharp/Net/WebHeaderCollection.cs @@ -1412,7 +1412,22 @@ namespace WebSocketSharp.Net /// public static bool IsRestricted (string headerName, bool response) { - headerName = checkName (headerName); + if (headerName == null) + throw new ArgumentNullException ("headerName"); + + if (headerName.Length == 0) + throw new ArgumentException ("An empty string.", "headerName"); + + headerName = headerName.Trim (); + + if (headerName.Length == 0) + throw new ArgumentException ("A string of spaces.", "headerName"); + + if (!headerName.IsToken ()) { + var msg = "It contains an invalid character."; + + throw new ArgumentException (msg, "headerName"); + } return isRestricted (headerName, response); }