2020-02-14 22:23:27 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using SysHttp = System.Net.Http;
|
2020-06-26 17:08:30 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Lib.Http
|
2020-02-14 22:23:27 +00:00
|
|
|
|
{
|
|
|
|
|
public static class ClientFactory
|
|
|
|
|
{
|
|
|
|
|
private static SysHttp.SocketsHttpHandler _socketsHandler { get; }
|
2020-03-03 21:53:29 +00:00
|
|
|
|
public static SysHttp.HttpClient Client { get; }
|
2020-02-14 22:23:27 +00:00
|
|
|
|
internal static CookieContainer Cookies { get; }
|
|
|
|
|
|
|
|
|
|
static ClientFactory()
|
|
|
|
|
{
|
|
|
|
|
Cookies = new CookieContainer();
|
|
|
|
|
_socketsHandler = new SysHttp.SocketsHttpHandler
|
|
|
|
|
{
|
|
|
|
|
CookieContainer = Cookies,
|
2020-02-26 05:05:33 +00:00
|
|
|
|
MaxConnectionsPerServer = 20,
|
|
|
|
|
PooledConnectionLifetime = TimeSpan.FromMilliseconds(100),
|
|
|
|
|
PooledConnectionIdleTimeout = TimeSpan.FromMilliseconds(100)
|
2020-02-14 22:23:27 +00:00
|
|
|
|
};
|
|
|
|
|
Client = new SysHttp.HttpClient(_socketsHandler);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|