aboutsummaryrefslogtreecommitdiff
path: root/SocketHttpListener/Net/CookieHelper.cs
diff options
context:
space:
mode:
authorAndrew Rabert <6550543+nvllsvm@users.noreply.github.com>2019-01-22 18:13:47 -0500
committerGitHub <noreply@github.com>2019-01-22 18:13:47 -0500
commit28483bdb54be96ae83e0fded097f534d7e26ba1e (patch)
treee7f4b92326417ebf55eecdf68a01d2c3b9e660d7 /SocketHttpListener/Net/CookieHelper.cs
parent920c39454c05e979eabe81877269cd4517a03ccf (diff)
parent8106c8393b711a7e1d40487e3caf2b014decbe28 (diff)
Merge pull request #651 from jellyfin/release-10.1.0
Release 10.1.0
Diffstat (limited to 'SocketHttpListener/Net/CookieHelper.cs')
-rw-r--r--SocketHttpListener/Net/CookieHelper.cs12
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)