mirror of
https://github.com/C9Glax/tranga.git
synced 2025-06-23 11:34:16 +02:00
Better Debugging for HttpDownloadClient
This commit is contained in:
@ -30,6 +30,15 @@ internal class HttpDownloadClient : DownloadClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
Log.Debug($"Request returned status code {(int)response.StatusCode} {response.StatusCode}");
|
||||||
|
if (response.Headers.Server.Any(s =>
|
||||||
|
(s.Product?.Name ?? "").Contains("cloudflare", StringComparison.InvariantCultureIgnoreCase)))
|
||||||
|
{
|
||||||
|
Log.Debug("Retrying with FlareSolverr!");
|
||||||
|
return new FlareSolverrDownloadClient().MakeRequestInternal(url, referrer, clickButton);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Log.Debug($"Request returned status code {(int)response.StatusCode} {response.StatusCode}:\n" +
|
Log.Debug($"Request returned status code {(int)response.StatusCode} {response.StatusCode}:\n" +
|
||||||
$"=====\n" +
|
$"=====\n" +
|
||||||
@ -43,7 +52,7 @@ internal class HttpDownloadClient : DownloadClient
|
|||||||
$"{response.Version}\n" +
|
$"{response.Version}\n" +
|
||||||
$"Headers:\n\t{string.Join("\n\t", response.Headers.Select(h => $"{h.Key}: <{string.Join(">, <", h.Value)}"))}>\n" +
|
$"Headers:\n\t{string.Join("\n\t", response.Headers.Select(h => $"{h.Key}: <{string.Join(">, <", h.Value)}"))}>\n" +
|
||||||
$"{response.Content.ReadAsStringAsync().Result}");
|
$"{response.Content.ReadAsStringAsync().Result}");
|
||||||
return new FlareSolverrDownloadClient().MakeRequestInternal(url, referrer, clickButton);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream stream;
|
Stream stream;
|
||||||
|
Reference in New Issue
Block a user