Cleanup Cookie handling in HttpClient

pull/25/head
Qstick 4 years ago
parent 638b559a62
commit d932beba50

@ -200,7 +200,7 @@ namespace NzbDrone.Common.Http
private void HandleResponseCookies(HttpResponse response, CookieContainer cookieContainer)
{
var cookieHeaders = response.GetCookieHeaders();
var cookieHeaders = response.Cookies;
if (cookieHeaders.Empty())
{
return;
@ -212,11 +212,11 @@ namespace NzbDrone.Common.Http
{
var persistentCookieContainer = _cookieContainerCache.Get("container", () => new CookieContainer());
foreach (var cookieHeader in cookieHeaders)
foreach (Cookie cookieHeader in cookieHeaders)
{
try
{
persistentCookieContainer.SetCookies((Uri)response.Request.Url, cookieHeader);
persistentCookieContainer.Add((Uri)response.Request.Url, cookieHeader);
}
catch (Exception ex)
{

@ -59,11 +59,6 @@ namespace NzbDrone.Common.Http
StatusCode == HttpStatusCode.TemporaryRedirect ||
StatusCode == HttpStatusCode.Found;
public string[] GetCookieHeaders()
{
return Headers.GetValues("Set-Cookie") ?? Array.Empty<string>();
}
public Dictionary<string, string> GetCookies()
{
var result = new Dictionary<string, string>();

Loading…
Cancel
Save