mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Closes #3060
This commit is contained in:
@@ -125,8 +125,7 @@ internal static class GitHub {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
result[versionText!] = dateTime.ToUniversalTime();
|
||||
result[versionText] = dateTime.ToUniversalTime();
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -270,7 +269,7 @@ internal static class GitHub {
|
||||
return null;
|
||||
}
|
||||
|
||||
return BackingChangelog = ExtractChangelogFromBody(MarkdownBody!);
|
||||
return BackingChangelog = ExtractChangelogFromBody(MarkdownBody);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,14 +66,9 @@ public sealed class WebBrowser : IDisposable {
|
||||
|
||||
HttpClientHandler = new HttpClientHandler {
|
||||
AllowAutoRedirect = false, // This must be false if we want to handle custom redirection schemes such as "steammobile://"
|
||||
|
||||
#if NETFRAMEWORK || NETSTANDARD
|
||||
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
|
||||
#else
|
||||
AutomaticDecompression = DecompressionMethods.All,
|
||||
#endif
|
||||
|
||||
CookieContainer = CookieContainer
|
||||
CookieContainer = CookieContainer,
|
||||
MaxConnectionsPerServer = MaxConnections
|
||||
};
|
||||
|
||||
if (webProxy != null) {
|
||||
@@ -86,14 +81,6 @@ public sealed class WebBrowser : IDisposable {
|
||||
}
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK || NETSTANDARD
|
||||
if (!RuntimeMadness.IsRunningOnMono) {
|
||||
HttpClientHandler.MaxConnectionsPerServer = MaxConnections;
|
||||
}
|
||||
#else
|
||||
HttpClientHandler.MaxConnectionsPerServer = MaxConnections;
|
||||
#endif
|
||||
|
||||
HttpClient = GenerateDisposableHttpClient(extendedTimeout);
|
||||
}
|
||||
|
||||
@@ -107,9 +94,7 @@ public sealed class WebBrowser : IDisposable {
|
||||
byte connectionTimeout = ASF.GlobalConfig?.ConnectionTimeout ?? GlobalConfig.DefaultConnectionTimeout;
|
||||
|
||||
HttpClient result = new(HttpClientHandler, false) {
|
||||
#if !NETFRAMEWORK && !NETSTANDARD
|
||||
DefaultRequestVersion = HttpVersion.Version30,
|
||||
#endif
|
||||
Timeout = TimeSpan.FromSeconds(extendedTimeout ? ExtendedTimeout : connectionTimeout)
|
||||
};
|
||||
|
||||
@@ -710,13 +695,7 @@ public sealed class WebBrowser : IDisposable {
|
||||
ServicePointManager.Expect100Continue = false;
|
||||
|
||||
// Reuse ports if possible
|
||||
#if NETFRAMEWORK || NETSTANDARD
|
||||
if (!RuntimeMadness.IsRunningOnMono) {
|
||||
ServicePointManager.ReusePort = true;
|
||||
}
|
||||
#else
|
||||
ServicePointManager.ReusePort = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
private async Task<HttpResponseMessage?> InternalGet(Uri request, IReadOnlyCollection<KeyValuePair<string, string>>? headers = null, Uri? referer = null, ERequestOptions requestOptions = ERequestOptions.None, HttpCompletionOption httpCompletionOption = HttpCompletionOption.ResponseContentRead) {
|
||||
@@ -745,9 +724,7 @@ public sealed class WebBrowser : IDisposable {
|
||||
|
||||
while (true) {
|
||||
using (HttpRequestMessage requestMessage = new(httpMethod, request)) {
|
||||
#if !NETFRAMEWORK && !NETSTANDARD
|
||||
requestMessage.Version = HttpClient.DefaultRequestVersion;
|
||||
#endif
|
||||
|
||||
if (headers != null) {
|
||||
foreach ((string header, string value) in headers) {
|
||||
|
||||
@@ -35,7 +35,7 @@ internal static class WebBrowserUtilities {
|
||||
// We're going to create compressed stream and copy original content to it
|
||||
MemoryStream compressionOutput = new();
|
||||
|
||||
(Stream compressionInput, string contentEncoding) = GetBestSupportedCompressionMethod(compressionOutput);
|
||||
BrotliStream compressionInput = new(compressionOutput, CompressionLevel.SmallestSize, true);
|
||||
|
||||
await using (compressionInput.ConfigureAwait(false)) {
|
||||
await content.CopyToAsync(compressionInput).ConfigureAwait(false);
|
||||
@@ -51,18 +51,8 @@ internal static class WebBrowserUtilities {
|
||||
}
|
||||
|
||||
// Inform the server that we're sending compressed data
|
||||
result.Headers.ContentEncoding.Add(contentEncoding);
|
||||
result.Headers.ContentEncoding.Add("br");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static (Stream CompressionInput, string ContentEncoding) GetBestSupportedCompressionMethod(Stream output) {
|
||||
ArgumentNullException.ThrowIfNull(output);
|
||||
|
||||
#if NETFRAMEWORK || NETSTANDARD
|
||||
return (new GZipStream(output, CompressionLevel.Optimal, true), "gzip");
|
||||
#else
|
||||
return (new BrotliStream(output, CompressionLevel.SmallestSize, true), "br");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user