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 e0ef6bc8a8
commit 22bced9ca3
30 changed files with 67 additions and 90 deletions

View File

@@ -30,7 +30,7 @@ namespace Jackett.Common.Utils.Clients
base.Init();
}
protected override async Task<WebClientByteResult> Run(WebRequest webRequest)
protected override async Task<WebResult> Run(WebRequest webRequest)
{
ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
@@ -117,7 +117,7 @@ namespace Jackett.Common.Utils.Clients
using (response = await client.SendAsync(request))
{
var result = new WebClientByteResult
var result = new WebResult
{
ContentBytes = await response.Content.ReadAsByteArrayAsync()
};
@@ -147,7 +147,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));