[Modify] Replace it

This commit is contained in:
sta 2020-03-28 20:59:59 +09:00
parent f56521f6a7
commit bd249ac6e3

View File

@ -1412,7 +1412,22 @@ namespace WebSocketSharp.Net
/// </exception> /// </exception>
public static bool IsRestricted (string headerName, bool response) 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); return isRestricted (headerName, response);
} }