diff --git a/websocket-sharp/Net/CookieCollection.cs b/websocket-sharp/Net/CookieCollection.cs index e9f7c054..f7becc3f 100644 --- a/websocket-sharp/Net/CookieCollection.cs +++ b/websocket-sharp/Net/CookieCollection.cs @@ -44,7 +44,6 @@ using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Runtime.Serialization; using System.Text; namespace WebSocketSharp.Net @@ -382,6 +381,7 @@ namespace WebSocketSharp.Net var path = cookie.Path; var domain = cookie.Domain; var version = cookie.Version; + for (int i = _list.Count - 1; i >= 0; i--) { var c = _list [i]; if (c.Name.Equals (name, StringComparison.InvariantCultureIgnoreCase) && @@ -545,12 +545,12 @@ namespace WebSocketSharp.Net /// /// Copies the elements of the to the specified array of - /// , starting at the specified in the - /// . + /// , starting at the specified in + /// the . /// /// - /// An array of is the destination of the elements copied from the - /// . + /// An array of is the destination of the elements copied from + /// the . /// /// /// An that represents the zero-based index in @@ -585,7 +585,7 @@ namespace WebSocketSharp.Net /// Gets the enumerator to use to iterate through the . /// /// - /// A instance to use to iterate through + /// An instance to use to iterate through /// the . /// public IEnumerator GetEnumerator () diff --git a/websocket-sharp/Net/CookieCollectionComparer.cs b/websocket-sharp/Net/CookieCollectionComparer.cs index 29109a1a..0a3493dc 100644 --- a/websocket-sharp/Net/CookieCollectionComparer.cs +++ b/websocket-sharp/Net/CookieCollectionComparer.cs @@ -38,9 +38,15 @@ namespace WebSocketSharp.Net { public int Compare (Cookie x, Cookie y) { - if (x == null || y == null) + if (x == null && y == null) return 0; + if (x == null) + return -1; + + if (y == null) + return 1; + var c1 = x.Name.Length + x.Value.Length; var c2 = y.Name.Length + y.Value.Length;