From 16c85a524adfe9fbb39cf67fcf75980dea64bcb3 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 9 Mar 2019 21:45:11 +0900 Subject: [PATCH] [Modify] Replace it --- websocket-sharp/Net/Cookie.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/websocket-sharp/Net/Cookie.cs b/websocket-sharp/Net/Cookie.cs index bac31742..3f3ba7b9 100644 --- a/websocket-sharp/Net/Cookie.cs +++ b/websocket-sharp/Net/Cookie.cs @@ -517,9 +517,21 @@ namespace WebSocketSharp.Net } set { - string msg; - if (!canSetName (value, out msg)) - throw new CookieException (msg); + if (value == null) + throw new ArgumentNullException ("value"); + + 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; }