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); }