From 0cd5632544e7f843e1207b11e0b991a860ca5a8b Mon Sep 17 00:00:00 2001 From: sta Date: Thu, 11 Apr 2019 21:27:39 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/CookieCollection.cs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/websocket-sharp/Net/CookieCollection.cs b/websocket-sharp/Net/CookieCollection.cs index 50807c3d..ec7177fe 100644 --- a/websocket-sharp/Net/CookieCollection.cs +++ b/websocket-sharp/Net/CookieCollection.cs @@ -291,25 +291,22 @@ namespace WebSocketSharp.Net continue; } - if (cookie != null) + if (cookie != null) { ret.Add (cookie); - - string name = null; - string val = String.Empty; + cookie = null; + } var idx = pair.IndexOf ('='); - if (idx == -1) { - name = pair; - } - else if (idx == pair.Length - 1) { - name = pair.Substring (0, idx).TrimEnd (' '); - } - else { - name = pair.Substring (0, idx).TrimEnd (' '); - val = pair.Substring (idx + 1).TrimStart (' '); - } + if (idx == -1) + continue; + if (idx == pair.Length - 1) + continue; + + var name = pair.Substring (0, idx).TrimEnd (' '); + var val = pair.Substring (idx + 1).TrimStart (' '); cookie = new Cookie (name, val); + if (ver != 0) cookie.Version = ver; }