From 0c06d065d5b8f87786b45fd00bb553721787d3cc Mon Sep 17 00:00:00 2001 From: baliasnyifeliks Date: Wed, 14 Jan 2026 12:58:57 +0200 Subject: [PATCH] refactor(http): migrate from HttpClientHandler to SocketsHttpHandler Update SSL certificate validation approach to use SslClientAuthenticationOptions with a custom validation callback. This modernizes the HTTP client implementation while maintaining the same security behavior of accepting all certificates. BREAKING CHANGE: The underlying HTTP handler implementation has changed from HttpClientHandler to SocketsHttpHandler, which may affect behavior in edge cases --- UAKino/UAKinoInvoke.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/UAKino/UAKinoInvoke.cs b/UAKino/UAKinoInvoke.cs index be6e528..a4c3b82 100644 --- a/UAKino/UAKinoInvoke.cs +++ b/UAKino/UAKinoInvoke.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; +using System.Net.Security; using System.Security.Authentication; using System.Text.Json; using System.Text.RegularExpressions; @@ -259,15 +260,17 @@ namespace UAKino private async Task GetString(string url, List headers, int timeoutSeconds = 15) { - var handler = new HttpClientHandler + var handler = new SocketsHttpHandler { AllowAutoRedirect = true, AutomaticDecompression = DecompressionMethods.Brotli | DecompressionMethods.GZip | DecompressionMethods.Deflate, - SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13 + SslOptions = new SslClientAuthenticationOptions + { + RemoteCertificateValidationCallback = (_, _, _, _) => true, + EnabledSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13 + } }; - handler.ServerCertificateCustomValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; - var proxy = _proxyManager.Get(); if (proxy != null) {