wabbajack/Wabbajack.Lib/Http/ClientFactory.cs

32 lines
1.0 KiB
C#
Raw Normal View History

using System;
using System.Net;
2021-02-04 03:48:30 +00:00
using System.Net.Security;
using System.Security.Authentication;
using Wabbajack.Common;
using SysHttp = System.Net.Http;
2020-06-26 17:08:30 +00:00
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),
2021-02-04 03:48:30 +00:00
PooledConnectionIdleTimeout = TimeSpan.FromMilliseconds(100),
};
2021-02-04 03:48:30 +00:00
Utils.Log($"Configuring with SSL {_socketsHandler.SslOptions.EnabledSslProtocols}");
Client = new SysHttp.HttpClient(_socketsHandler);
}
}
}