mirror of
https://github.com/swift-server/async-http-client.git
synced 2026-06-02 07:37:34 +00:00
Adds support for request-specific TLS configuration: Request(url: "https://webserver.com", tlsConfiguration: .forClient())
33 lines
1.0 KiB
Swift
33 lines
1.0 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the AsyncHTTPClient open source project
|
|
//
|
|
// Copyright (c) 2021 Apple Inc. and the AsyncHTTPClient project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of AsyncHTTPClient project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import NIOSSL
|
|
|
|
/// Wrapper around `TLSConfiguration` from NIOSSL to provide a best effort implementation of `Hashable`
|
|
struct BestEffortHashableTLSConfiguration: Hashable {
|
|
let base: TLSConfiguration
|
|
|
|
init(wrapping base: TLSConfiguration) {
|
|
self.base = base
|
|
}
|
|
|
|
func hash(into hasher: inout Hasher) {
|
|
self.base.bestEffortHash(into: &hasher)
|
|
}
|
|
|
|
static func == (lhs: BestEffortHashableTLSConfiguration, rhs: BestEffortHashableTLSConfiguration) -> Bool {
|
|
return lhs.base.bestEffortEquals(rhs.base)
|
|
}
|
|
}
|