Path: redb-route/redb.Route.S3/S3ClientConfigSupport.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.S3/S3ClientConfigSupport.cs ---- using Amazon.Runtime; using Amazon.S3; namespace redb.Route.S3; /// /// Shared wiring of connection options into — one place for the /// endpoint-options path and the path (before it, /// SocketTimeout/RetryMode/TrustAllCertificates were declared but never reached the SDK). /// internal static class S3ClientConfigSupport { /// /// The region and service URL a built client talks to, for the "client created" log: read from the client's own /// configuration, so a connection factory's values show, not the endpoint's defaults. /// internal static (string Region, string ServiceUrl) Target(IClientConfig config) => ( config.RegionEndpoint?.SystemName ?? (string.IsNullOrEmpty(config.AuthenticationRegion) ? "(default)" : config.AuthenticationRegion), string.IsNullOrEmpty(config.ServiceURL) ? "(default)" : redb.Route.Abstractions.EndpointUri.Sanitize(config.ServiceURL)); /// /// Applies timeouts, connection limits, retry policy and certificate trust to the config. /// connectionTimeoutMs maps to , /// socketTimeoutMs to the overall request . /// internal static void Apply(AmazonS3Config config, int connectionTimeoutMs, int socketTimeoutMs, int maxConnections, int retryCount, string retryMode, bool trustAllCertificates) { config.ConnectTimeout = TimeSpan.FromMilliseconds(connectionTimeoutMs); config.Timeout = TimeSpan.FromMilliseconds(socketTimeoutMs); config.MaxConnectionsPerServer = maxConnections; config.MaxErrorRetry = retryCount; config.RetryMode = ParseRetryMode(retryMode); if (trustAllCertificates) config.HttpClientFactory = new TrustAllHttpClientFactory(); } // SDK v4 knows only Standard and Adaptive (Legacy retired with v3). private static RequestRetryMode ParseRetryMode(string retryMode) => string.Equals(retryMode, "adaptive", StringComparison.OrdinalIgnoreCase) ? RequestRetryMode.Adaptive : RequestRetryMode.Standard; } /// /// HTTP client factory that disables server-certificate validation — for MinIO/Ceph and /// friends behind self-signed TLS. Dangerous by definition; enabled only by the explicit option /// trustAllCertificates=true. /// internal sealed class TrustAllHttpClientFactory : HttpClientFactory { public override HttpClient CreateHttpClient(IClientConfig clientConfig) => new(new HttpClientHandler { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator, }); }