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

Merge web results classes into single class and update usages
This commit is contained in:
Cory
2020-06-10 16:22:29 -05:00
committed by ngosang
parent 124719acae
commit 67c7b4ca70
30 changed files with 67 additions and 90 deletions

View File

@@ -75,7 +75,7 @@ namespace Jackett.Common.Utils.Clients
ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
}
protected override async Task<WebClientByteResult> Run(WebRequest webRequest)
protected override async Task<WebResult> 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 WebClientByteResult
var result = new WebResult
{
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 BaseWebResult.IsRedirect because normally
// of this cloudflare approach..don't want to alter WebResult.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));