diff --git a/Sources/AsyncHTTPClient/ConnectionPool/HTTPConnectionPool+Factory.swift b/Sources/AsyncHTTPClient/ConnectionPool/HTTPConnectionPool+Factory.swift index f26fc8c08..2d8a17496 100644 --- a/Sources/AsyncHTTPClient/ConnectionPool/HTTPConnectionPool+Factory.swift +++ b/Sources/AsyncHTTPClient/ConnectionPool/HTTPConnectionPool+Factory.swift @@ -574,15 +574,17 @@ extension HTTPConnectionPool.ConnectionFactory { } var tlsConfig = self.tlsConfiguration - switch self.clientConfiguration.httpVersion.configuration { - case .automatic: - // since we can support h2, we need to advertise this in alpn - // "ProtocolNameList" contains the list of protocols advertised by the - // client, in descending order of preference. - // https://datatracker.ietf.org/doc/html/rfc7301#section-3.1 - tlsConfig.applicationProtocols = ["h2", "http/1.1"] - case .http1Only: - tlsConfig.applicationProtocols = ["http/1.1"] + if tlsConfig.applicationProtocols.isEmpty { + switch self.clientConfiguration.httpVersion.configuration { + case .automatic: + // since we can support h2, we need to advertise this in alpn + // "ProtocolNameList" contains the list of protocols advertised by the + // client, in descending order of preference. + // https://datatracker.ietf.org/doc/html/rfc7301#section-3.1 + tlsConfig.applicationProtocols = ["h2", "http/1.1"] + case .http1Only: + tlsConfig.applicationProtocols = ["http/1.1"] + } } #if canImport(Network)