From 0d1025d60a05bb4be863f5cfb9b4ffba564d3935 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 31 Jul 2021 00:04:28 -0400 Subject: [PATCH] Fixed: (Cardigann) Input pairs in HandleRequest should be form data Should fix some download links not working for Cardigann indexers --- .../Cardigann/CardigannRequestGenerator.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs index 16230b620..52aa156bd 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs @@ -688,13 +688,20 @@ namespace NzbDrone.Core.Indexers.Cardigann var httpRequest = new HttpRequestBuilder(requestLinkStr) .SetCookies(Cookies ?? new Dictionary()) - .SetHeaders(pairs ?? new Dictionary()) - .SetHeader("Referer", referer) - .Build(); + .SetHeader("Referer", referer); httpRequest.Method = method; - var response = await HttpClient.ExecuteAsync(httpRequest); + // Add form data for POST requests + if (method == HttpMethod.POST) + { + foreach (var param in pairs) + { + httpRequest.AddFormParameter(param.Key, param.Value); + } + } + + var response = await HttpClient.ExecuteAsync(httpRequest.Build()); _logger.Debug($"CardigannIndexer ({_definition.Id}): handleRequest() remote server returned {response.StatusCode.ToString()}"); return response;