[Modify] Set an empty string if null
This commit is contained in:
parent
33bb147d30
commit
1ea61947ba
@ -115,7 +115,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal Cookie ()
|
internal Cookie ()
|
||||||
{
|
{
|
||||||
init (String.Empty, "\"\"", String.Empty, String.Empty);
|
init (String.Empty, String.Empty, String.Empty, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -305,9 +305,6 @@ namespace WebSocketSharp.Net
|
|||||||
if (name == null)
|
if (name == null)
|
||||||
throw new ArgumentNullException ("name");
|
throw new ArgumentNullException ("name");
|
||||||
|
|
||||||
if (value == null)
|
|
||||||
throw new ArgumentNullException ("value");
|
|
||||||
|
|
||||||
if (name.Length == 0)
|
if (name.Length == 0)
|
||||||
throw new ArgumentException ("An empty string.", "name");
|
throw new ArgumentException ("An empty string.", "name");
|
||||||
|
|
||||||
@ -321,6 +318,9 @@ namespace WebSocketSharp.Net
|
|||||||
throw new ArgumentException (msg, "name");
|
throw new ArgumentException (msg, "name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value == null)
|
||||||
|
value = String.Empty;
|
||||||
|
|
||||||
if (value.Contains (_reservedCharsForValue)) {
|
if (value.Contains (_reservedCharsForValue)) {
|
||||||
if (!value.IsEnclosedIn ('"')) {
|
if (!value.IsEnclosedIn ('"')) {
|
||||||
var msg = "A string not enclosed in double quotes.";
|
var msg = "A string not enclosed in double quotes.";
|
||||||
@ -328,12 +328,7 @@ namespace WebSocketSharp.Net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init (
|
init (name, value, path ?? String.Empty, domain ?? String.Empty);
|
||||||
name,
|
|
||||||
value.Length > 0 ? value : "\"\"",
|
|
||||||
path ?? String.Empty,
|
|
||||||
domain ?? String.Empty
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -728,7 +723,7 @@ namespace WebSocketSharp.Net
|
|||||||
|
|
||||||
set {
|
set {
|
||||||
if (value == null)
|
if (value == null)
|
||||||
throw new ArgumentNullException ("value");
|
value = String.Empty;
|
||||||
|
|
||||||
if (value.Contains (_reservedCharsForValue)) {
|
if (value.Contains (_reservedCharsForValue)) {
|
||||||
if (!value.IsEnclosedIn ('"')) {
|
if (!value.IsEnclosedIn ('"')) {
|
||||||
@ -737,7 +732,7 @@ namespace WebSocketSharp.Net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_value = value.Length > 0 ? value : "\"\"";
|
_value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user