mirror of
https://github.com/Jackett/Jackett.git
synced 2025-10-02 08:34:32 +02:00
Merge string/byte request code
This commit is contained in:
@@ -14,6 +14,7 @@ using Jackett.Common.Models;
|
||||
using Jackett.Common.Models.IndexerConfig;
|
||||
using Jackett.Common.Services.Interfaces;
|
||||
using Jackett.Common.Utils;
|
||||
using Jackett.Common.Utils.Clients;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NLog;
|
||||
using static Jackett.Common.Models.IndexerConfig.ConfigurationData;
|
||||
@@ -150,13 +151,13 @@ namespace Jackett.Common.Indexers
|
||||
|
||||
// Make search request
|
||||
var searchUri = GetAbsoluteUrl("?" + queryParameters.GetQueryString());
|
||||
var response = await RequestStringWithCookiesAndRetry(searchUri.AbsoluteUri);
|
||||
var response = await RequestWithCookiesAndRetryAsync(searchUri.AbsoluteUri);
|
||||
|
||||
// Check for DDOS Guard
|
||||
if (response.Status == System.Net.HttpStatusCode.Forbidden)
|
||||
{
|
||||
await ConfigureDDoSGuardCookie();
|
||||
response = await RequestStringWithCookiesAndRetry(searchUri.AbsoluteUri);
|
||||
response = await RequestWithCookiesAndRetryAsync(searchUri.AbsoluteUri);
|
||||
}
|
||||
|
||||
if (response.Status != System.Net.HttpStatusCode.OK)
|
||||
@@ -216,7 +217,7 @@ namespace Jackett.Common.Indexers
|
||||
private async Task ConfigureDDoSGuardCookie()
|
||||
{
|
||||
const string ddosPostUrl = "https://check.ddos-guard.net/check.js";
|
||||
var response = await RequestStringWithCookies(ddosPostUrl, string.Empty);
|
||||
var response = await WebRequestWithCookiesAsync(ddosPostUrl, string.Empty);
|
||||
if (response.Status != System.Net.HttpStatusCode.OK)
|
||||
throw new WebException($"Unexpected DDOS Guard response: Status: {response.Status}", WebExceptionStatus.ProtocolError);
|
||||
if (response.IsRedirect)
|
||||
|
Reference in New Issue
Block a user