mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Make cookie merging more robust (#669)
This commit is contained in:
@@ -186,7 +186,7 @@ namespace Jackett.Indexers
|
|||||||
private String ResolveCookies(String incomingCookies = "")
|
private String ResolveCookies(String incomingCookies = "")
|
||||||
{
|
{
|
||||||
var redirRequestCookies = (CookieHeader != null && CookieHeader != "" ? CookieHeader + " " : "") + incomingCookies;
|
var redirRequestCookies = (CookieHeader != null && CookieHeader != "" ? CookieHeader + " " : "") + incomingCookies;
|
||||||
System.Text.RegularExpressions.Regex expression = new System.Text.RegularExpressions.Regex(@"([^\s]+)=([^=]+)(?:\s|$)");
|
System.Text.RegularExpressions.Regex expression = new System.Text.RegularExpressions.Regex(@"([^\\,;\s]+)=([^=\\,;\s]+)");
|
||||||
Dictionary<string, string> cookieDIctionary = new Dictionary<string, string>();
|
Dictionary<string, string> cookieDIctionary = new Dictionary<string, string>();
|
||||||
var matches = expression.Match(redirRequestCookies);
|
var matches = expression.Match(redirRequestCookies);
|
||||||
while (matches.Success)
|
while (matches.Success)
|
||||||
@@ -194,7 +194,7 @@ namespace Jackett.Indexers
|
|||||||
if (matches.Groups.Count > 2) cookieDIctionary[matches.Groups[1].Value] = matches.Groups[2].Value;
|
if (matches.Groups.Count > 2) cookieDIctionary[matches.Groups[1].Value] = matches.Groups[2].Value;
|
||||||
matches = matches.NextMatch();
|
matches = matches.NextMatch();
|
||||||
}
|
}
|
||||||
return string.Join(" ", cookieDIctionary.Select(kv => kv.Key.ToString() + "=" + kv.Value.ToString()).ToArray());
|
return string.Join("; ", cookieDIctionary.Select(kv => kv.Key.ToString() + "=" + kv.Value.ToString()).ToArray());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user