mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System;
|
|
using System.Net;
|
|
using System.Net.Security;
|
|
using System.Security.Authentication;
|
|
using Wabbajack.Common;
|
|
using SysHttp = System.Net.Http;
|
|
|
|
namespace Wabbajack.Lib.Http
|
|
{
|
|
public static class ClientFactory
|
|
{
|
|
private static SysHttp.SocketsHttpHandler _socketsHandler { get; }
|
|
public static SysHttp.HttpClient Client { get; }
|
|
internal static CookieContainer Cookies { get; }
|
|
|
|
static ClientFactory()
|
|
{
|
|
Cookies = new CookieContainer();
|
|
_socketsHandler = new SysHttp.SocketsHttpHandler
|
|
{
|
|
CookieContainer = Cookies,
|
|
MaxConnectionsPerServer = 20,
|
|
PooledConnectionLifetime = TimeSpan.FromMilliseconds(100),
|
|
PooledConnectionIdleTimeout = TimeSpan.FromMilliseconds(100),
|
|
AutomaticDecompression = DecompressionMethods.All
|
|
|
|
};
|
|
Utils.Log($"Configuring with SSL {_socketsHandler.SslOptions.EnabledSslProtocols}");
|
|
Client = new SysHttp.HttpClient(_socketsHandler);
|
|
Client.DefaultRequestHeaders.Add("User-Agent", Consts.UserAgent);
|
|
}
|
|
}
|
|
}
|