Added: Radarr now stores cookies for PTP beyond restarts. Should limit active sessions correctly. (#2643)

Fixes #2626
This commit is contained in:
Leonardo Galli
2018-04-01 20:21:24 +02:00
committed by GitHub
parent a2fa8c4594
commit 6eb678cd92
33 changed files with 1301 additions and 217 deletions

View File

@@ -55,20 +55,22 @@ namespace NzbDrone.Common.Http
StatusCode == HttpStatusCode.MovedPermanently ||
StatusCode == HttpStatusCode.Found;
public string[] GetCookieHeaders()
{
return Headers.GetValues("Set-Cookie") ?? new string[0];
}
public Dictionary<string, string> GetCookies()
{
var result = new Dictionary<string, string>();
var setCookieHeaders = Headers.GetValues("Set-Cookie");
if (setCookieHeaders != null)
var setCookieHeaders = GetCookieHeaders();
foreach (var cookie in setCookieHeaders)
{
foreach (var cookie in setCookieHeaders)
var match = RegexSetCookie.Match(cookie);
if (match.Success)
{
var match = RegexSetCookie.Match(cookie);
if (match.Success)
{
result[match.Groups[1].Value] = match.Groups[2].Value;
}
result[match.Groups[1].Value] = match.Groups[2].Value;
}
}