コード例 #1
0
        private static SocketsHttpHandler CreateHandler(GlobalCacheKey key)
        {
            var handler = new SocketsHttpHandler
            {
                Proxy                       = key.Proxy,
                UseProxy                    = key.Proxy != null,
                ConnectTimeout              = key.ConnectionTimeout,
                AllowAutoRedirect           = key.AllowAutoRedirect,
                PooledConnectionIdleTimeout = key.ConnectionIdleTimeout,
                PooledConnectionLifetime    = key.ConnectionLifetime,
                MaxConnectionsPerServer     = key.MaxConnectionsPerEndpoint,
                AutomaticDecompression      = DecompressionMethods.None,
                MaxResponseHeadersLength    = 64 * 1024,
                MaxAutomaticRedirections    = 3,
                UseCookies                  = false,
                SslOptions                  =
                {
                    CertificateRevocationCheckMode      = X509RevocationMode.NoCheck,
                    RemoteCertificateValidationCallback = (_,                        __,___, ____) => true,
                }
            };

            key.CustomTuning?.Invoke(handler);

            return(handler);
        }
コード例 #2
0
        private static HttpMessageHandler CreateHandler(GlobalCacheKey key)
        {
            var handler = NetCore21Utils.CreateSocketsHandler(
                key.Proxy,
                key.AllowAutoRedirect,
                key.ConnectionTimeout,
                key.ConnectionIdleTimeout,
                key.ConnectionLifetime,
                key.MaxConnectionsPerEndpoint,
                key.ClientCertificates,
                key.RemoteCertificateValidationCallback);

            if (RuntimeDetector.IsDotNet50AndNewer)
            {
                NetCore50Utils.TuneHandler(handler);
            }

            return(handler);
        }
コード例 #3
0
 bool Equals(GlobalCacheKey <TLocalKey> other)
 {
     return(Key.Equals(other.Key));
 }