fix cookie handling

This commit is contained in:
kaso17
2017-02-24 17:35:21 +01:00
parent ff025825ec
commit 3b3420086f
2 changed files with 4 additions and 2 deletions

View File

@@ -40,11 +40,12 @@ namespace Jackett.Utils.Clients
if (!string.IsNullOrEmpty(webRequest.Cookies))
{
var uri = new Uri(webRequest.Url);
var cookieUrl = new Uri("//" + uri.Host); // don't include the path
foreach (var c in webRequest.Cookies.Split(';'))
{
try
{
cookies.SetCookies(uri, c);
cookies.SetCookies(cookieUrl, c.Trim());
}
catch (CookieException ex)
{

View File

@@ -86,6 +86,7 @@ namespace Jackett.Utils.Clients
if (!string.IsNullOrEmpty(webRequest.Cookies))
{
// add cookies to cookiecontainer
var cookieUrl = new Uri("//" + request.RequestUri.Host); // don't include the path
foreach (var ccookiestr in webRequest.Cookies.Split(';'))
{
var cookiestrparts = ccookiestr.Split('=');
@@ -96,7 +97,7 @@ namespace Jackett.Utils.Clients
if (cookiestrparts.Length >= 2)
value = cookiestrparts[1].Trim();
var cookie = new Cookie(name, value);
cookies.Add(request.RequestUri, cookie);
cookies.Add(cookieUrl, cookie);
}
}