mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-05-08 21:14:30 +02:00
Fixed: Use FlareSolverr response body instead of re-requesting
After FlareSolverr solves a Cloudflare challenge, Prowlarr discards the response body and makes a second HTTP request using only the returned cookies. This fails because Cloudflare's cf_clearance cookie is bound to the solver's TLS fingerprint, which .NET's HttpClient cannot replicate. Use the solved HTML body from FlareSolverr directly when available, falling back to the cookie-based retry only if no body was returned. Also fix the error status code reference (response → flaresolverrResponse). Fixes #2561
This commit is contained in:
parent
baa4baf3ca
commit
bc16c7421d
1 changed files with 15 additions and 2 deletions
|
|
@ -58,7 +58,7 @@ public override HttpResponse PostResponse(HttpResponse response)
|
|||
|
||||
if (flaresolverrResponse.StatusCode != HttpStatusCode.OK && flaresolverrResponse.StatusCode != HttpStatusCode.InternalServerError)
|
||||
{
|
||||
throw new FlareSolverrException("HTTP StatusCode not 200 or 500. Status is :" + response.StatusCode);
|
||||
throw new FlareSolverrException("HTTP StatusCode not 200 or 500. Status is :" + flaresolverrResponse.StatusCode);
|
||||
}
|
||||
|
||||
var result = JsonConvert.DeserializeObject<FlareSolverrResponse>(flaresolverrResponse.Content);
|
||||
|
|
@ -71,7 +71,20 @@ public override HttpResponse PostResponse(HttpResponse response)
|
|||
|
||||
InjectCookies(newRequest, result);
|
||||
|
||||
//Request again with User-Agent and Cookies from Flaresolverr
|
||||
// Use FlareSolverr's response body directly — a second HTTP request
|
||||
// gets 403'd because cf_clearance is bound to the solver's TLS fingerprint
|
||||
if (result.Solution.Response.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
return new HttpResponse(
|
||||
response.Request,
|
||||
response.Headers,
|
||||
response.Cookies,
|
||||
result.Solution.Response,
|
||||
response.ElapsedTime,
|
||||
HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
// Fallback: if FlareSolverr returned no body, try cookies (original behavior)
|
||||
var finalResponse = _httpClient.Execute(newRequest);
|
||||
|
||||
return finalResponse;
|
||||
|
|
|
|||
Loading…
Reference in a new issue