[Modify] Replace it

This commit is contained in:
sta 2019-03-09 21:45:11 +09:00
parent 73c3c738b3
commit 16c85a524a

View File

@ -517,9 +517,21 @@ namespace WebSocketSharp.Net
} }
set { set {
string msg; if (value == null)
if (!canSetName (value, out msg)) throw new ArgumentNullException ("value");
throw new CookieException (msg);
if (value.Length == 0)
throw new ArgumentException ("An empty string.", "value");
if (value[0] == '$') {
var msg = "It starts with a dollar sign.";
throw new ArgumentException (msg, "value");
}
if (value.Contains (_reservedCharsForName)) {
var msg = "It contains an invalid character.";
throw new ArgumentException (msg, "value");
}
_name = value; _name = value;
} }