Use a pinned IP

This commit is contained in:
Timothy Baldridge 2021-05-17 17:20:03 -06:00
parent 04bbbfed7f
commit bf0d098b44
4 changed files with 21 additions and 7 deletions

View File

@ -92,7 +92,7 @@ namespace Wabbajack.Common
public static string ModlistMetadataURL = "https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/modlists.json";
public static string UtilityModlistMetadataURL = "https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/utility_modlists.json";
public static string UnlistedModlistMetadataURL = "https://raw.githubusercontent.com/wabbajack-tools/mod-lists/master/unlisted_modlists.json";
public static string ModlistSummaryURL = "http://build.wabbajack.org/lists/status.json";
public static string ModlistSummaryURL = "https://build.wabbajack.org/lists/status.json";
public static string UserAgent
{
get
@ -120,7 +120,7 @@ namespace Wabbajack.Common
public static string WabbajackCacheHostname = "build.wabbajack.org";
// Direct IP to the CDN
public static string NetworkWorkaroundHost = "storage.wabbajack.org"; //"51.81.80.6";
public static string NetworkWorkaroundHost = "51.81.80.6";
public static bool UseNetworkWorkaroundMode = false;
public static Uri WabbajackBuildServerUri = new Uri("https://build.wabbajack.org");

View File

@ -83,7 +83,7 @@ namespace Wabbajack.Lib.Downloaders
using var mmfile = MemoryMappedFile.CreateFromFile(fs, null, definition.Size, MemoryMappedFileAccess.ReadWrite, HandleInheritability.None, false);
var client = new Wabbajack.Lib.Http.Client();
if (!DomainRemaps.ContainsKey(Url.Host))
if (!DomainRemaps.ContainsKey(Url.Host))
client.Headers.Add(("Host", Url.Host));
using var queue = new WorkQueue();

View File

@ -76,8 +76,14 @@ namespace Wabbajack.Lib.Http
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage msg, HttpCompletionOption responseHeadersRead = HttpCompletionOption.ResponseHeadersRead, bool errorsAsExceptions = true, bool retry = true, CancellationToken? token = null)
{
msg = FixupMessage(msg);
foreach (var (k, v) in Headers)
msg.Headers.Add(k, v);
foreach (var (k, v) in Headers)
{
if (k == "Host")
msg.Headers.Host = v;
else
msg.Headers.Add(k, v);
}
if (Cookies.Count > 0)
Cookies.ForEach(c => ClientFactory.Cookies.Add(c));
int retries = 0;

View File

@ -22,10 +22,18 @@ namespace Wabbajack.Lib.Http
MaxConnectionsPerServer = 20,
PooledConnectionLifetime = TimeSpan.FromMilliseconds(100),
PooledConnectionIdleTimeout = TimeSpan.FromMilliseconds(100),
AutomaticDecompression = DecompressionMethods.All
AutomaticDecompression = DecompressionMethods.All,
};
Utils.Log($"Configuring with SSL {_socketsHandler.SslOptions.EnabledSslProtocols}");
ServicePointManager.ServerCertificateValidationCallback +=
(sender, certificate, chain, errors) =>
{
if (Consts.UseNetworkWorkaroundMode)
return true;
return errors == SslPolicyErrors.None;
};
Client = new SysHttp.HttpClient(_socketsHandler);
Client.DefaultRequestHeaders.Add("User-Agent", Consts.UserAgent);
}