Revert "core: refactor http webclient part 12 #8529 (#8939)"

This reverts commit 22bced9ca3.
This commit is contained in:
ngosang
2020-09-21 08:02:58 +02:00
parent ca61f965e9
commit a8d055f0d5
30 changed files with 90 additions and 67 deletions

View File

@@ -75,7 +75,7 @@ namespace Jackett.Common.Utils.Clients
ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
}
protected override async Task<WebResult> Run(WebRequest webRequest)
protected override async Task<WebClientByteResult> Run(WebRequest webRequest)
{
HttpResponseMessage response = null;
var request = new HttpRequestMessage();
@@ -143,7 +143,7 @@ namespace Jackett.Common.Utils.Clients
response = await client.SendAsync(request);
var result = new WebResult
var result = new WebClientByteResult
{
ContentBytes = await response.Content.ReadAsByteArrayAsync()
};
@@ -173,7 +173,7 @@ namespace Jackett.Common.Utils.Clients
redirval = value.Substring(start + 1);
result.RedirectingTo = redirval;
// normally we don't want a serviceunavailable (503) to be a redirect, but that's the nature
// of this cloudflare approach..don't want to alter WebResult.IsRedirect because normally
// of this cloudflare approach..don't want to alter BaseWebResult.IsRedirect because normally
// it shoudln't include service unavailable..only if we have this redirect header.
response.StatusCode = System.Net.HttpStatusCode.Redirect;
redirtime = int.Parse(value.Substring(0, end));