diff --git a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs index 20b407a69..da4269363 100644 --- a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs +++ b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs @@ -234,6 +234,7 @@ namespace NzbDrone.Common.Http.Dispatchers webRequest.Headers.TransferEncoding.ParseAdd(header.Value); break; case "User-Agent": + webRequest.Headers.UserAgent.Clear(); webRequest.Headers.UserAgent.ParseAdd(header.Value); break; case "Proxy-Connection": diff --git a/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs b/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs index baa873222..7cbf6844d 100644 --- a/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs +++ b/src/NzbDrone.Core/IndexerProxies/FlareSolverr/FlareSolverr.cs @@ -112,9 +112,9 @@ namespace NzbDrone.Core.IndexerProxies.FlareSolverr } else if (request.Method == HttpMethod.Post) { - var contentTypeType = request.Headers.ContentType; + var contentTypeType = request.Headers.ContentType.ToLower() ?? ""; - if (contentTypeType == "application/x-www-form-urlencoded") + if (contentTypeType.Contains("application/x-www-form-urlencoded")) { var contentTypeValue = request.Headers.ContentType.ToString(); var postData = request.GetContent(); @@ -133,7 +133,8 @@ namespace NzbDrone.Core.IndexerProxies.FlareSolverr UserAgent = userAgent }; } - else if (contentTypeType.Contains("multipart/form-data")) + else if (contentTypeType.Contains("multipart/form-data") + || contentTypeType.Contains("text/html")) { //TODO Implement - check if we just need to pass the content-type with the relevant headers throw new FlareSolverrException("Unimplemented POST Content-Type: " + request.Headers.ContentType); @@ -153,9 +154,10 @@ namespace NzbDrone.Core.IndexerProxies.FlareSolverr newRequest.Headers.ContentType = "application/json"; newRequest.Method = HttpMethod.Post; + newRequest.LogResponseContent = true; newRequest.SetContent(req.ToJson()); - _logger.Debug("Applying FlareSolverr Proxy {0} to request {1}", Name, request.Url); + _logger.Debug("Cloudflare Detected, Applying FlareSolverr Proxy {0} to request {1}", Name, request.Url); return newRequest; }