refactoring

This commit is contained in:
Mikhail Thompson
2024-06-28 21:13:21 +03:00
parent c7250cdf24
commit 1229104086
10 changed files with 228 additions and 310 deletions

View File

@@ -1,4 +1,5 @@
using EmbedIO;
using nksrv.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -19,14 +20,14 @@ namespace nksrv.IntlServer
protected override async Task HandleAsync()
{
Console.WriteLine("li-sg redirect in: " + Content);
HttpClientHandler handler = new HttpClientHandler()
HttpClientHandler handler = new()
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => true,
AllowAutoRedirect = true // from gameassembly dll
};
HttpClient client = new HttpClient(new LoggingHandler(handler));
HttpClient client = new(new LoggingHttpHandler(handler));
client.DefaultRequestHeaders
.Accept
.Add(new MediaTypeWithQualityHeaderValue("*/*"));//ACCEPT header

View File

@@ -6,6 +6,7 @@ using System.Net;
using System.Text;
using System.Threading.Tasks;
using EmbedIO;
using nksrv.Utils;
namespace nksrv.IntlServer
{
@@ -19,14 +20,14 @@ namespace nksrv.IntlServer
protected override async Task HandleAsync()
{
Console.WriteLine("AWS NA redirect in: " + Content);
HttpClientHandler handler = new HttpClientHandler()
HttpClientHandler handler = new()
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => true,
AllowAutoRedirect = true // from gameassembly dll
};
HttpClient client = new HttpClient(new LoggingHandler(handler));
HttpClient client = new(new LoggingHttpHandler(handler));
client.DefaultRequestHeaders
.Accept
.Add(new MediaTypeWithQualityHeaderValue("*/*"));//ACCEPT header
@@ -36,7 +37,7 @@ namespace nksrv.IntlServer
// client.DefaultRequestHeaders.Remove("User-agent");
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://50.18.221.30" + ctx.Request.RawUrl);
HttpRequestMessage request = new(HttpMethod.Post, "https://50.18.221.30" + ctx.Request.RawUrl);
request.Version = HttpVersion.Version11;
request.Headers.TryAddWithoutValidation("Host", "aws-na.intlgame.com");