diff options
Diffstat (limited to 'SocketHttpListener/Net/CookieHelper.cs')
| -rw-r--r-- | SocketHttpListener/Net/CookieHelper.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/SocketHttpListener/Net/CookieHelper.cs b/SocketHttpListener/Net/CookieHelper.cs index a32131956..3ad76ff23 100644 --- a/SocketHttpListener/Net/CookieHelper.cs +++ b/SocketHttpListener/Net/CookieHelper.cs @@ -1,9 +1,8 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Net; using System.Text; -using System.Threading.Tasks; namespace SocketHttpListener.Net { @@ -36,7 +35,7 @@ namespace SocketHttpListener.Net if (pair.StartsWith("version", StringComparison.OrdinalIgnoreCase)) { if (cookie != null) - cookie.Version = Int32.Parse(pair.GetValueInternal("=").Trim('"')); + cookie.Version = int.Parse(pair.GetValueInternal("=").Trim('"')); } else if (pair.StartsWith("expires", StringComparison.OrdinalIgnoreCase)) { @@ -44,13 +43,12 @@ namespace SocketHttpListener.Net if (i < pairs.Length - 1) buffer.AppendFormat(", {0}", pairs[++i].Trim()); - DateTime expires; if (!DateTime.TryParseExact( buffer.ToString(), new[] { "ddd, dd'-'MMM'-'yyyy HH':'mm':'ss 'GMT'", "r" }, new CultureInfo("en-US"), DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, - out expires)) + out var expires)) expires = DateTime.Now; if (cookie != null && cookie.Expires == DateTime.MinValue) @@ -58,7 +56,7 @@ namespace SocketHttpListener.Net } else if (pair.StartsWith("max-age", StringComparison.OrdinalIgnoreCase)) { - var max = Int32.Parse(pair.GetValueInternal("=").Trim('"')); + var max = int.Parse(pair.GetValueInternal("=").Trim('"')); var expires = DateTime.Now.AddSeconds((double)max); if (cookie != null) cookie.Expires = expires; @@ -113,7 +111,7 @@ namespace SocketHttpListener.Net cookies.Add(cookie); string name; - string val = String.Empty; + string val = string.Empty; var pos = pair.IndexOf('='); if (pos == -1) |
