mirror of
https://github.com/swift-server/async-http-client.git
synced 2026-06-02 07:37:34 +00:00
64fbfdaeda
- a new `RequestOptions` struct was created, that can be used to set request specific options. It is required by the `HTTPExecutableRequest` - Added support for `ignoreUncleanSSLShutdown` in the `HTTPRequestStateMachine` and the `HTTP1ConnectionStateMachine`. In http/2 `ignoreUncleanSSLShutdown` is always off.
38 lines
1.3 KiB
Swift
38 lines
1.3 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 NIOCore
|
|
|
|
struct RequestOptions {
|
|
/// The maximal `TimeAmount` that is allowed to pass between `channelRead`s from the Channel.
|
|
var idleReadTimeout: TimeAmount?
|
|
|
|
/// Should `NIOSSLError.uncleanShutdown` be forwarded to the user in HTTP/1 mode.
|
|
var ignoreUncleanSSLShutdown: Bool
|
|
|
|
init(idleReadTimeout: TimeAmount?, ignoreUncleanSSLShutdown: Bool) {
|
|
self.idleReadTimeout = idleReadTimeout
|
|
self.ignoreUncleanSSLShutdown = ignoreUncleanSSLShutdown
|
|
}
|
|
}
|
|
|
|
extension RequestOptions {
|
|
static func fromClientConfiguration(_ configuration: HTTPClient.Configuration) -> Self {
|
|
RequestOptions(
|
|
idleReadTimeout: configuration.timeout.read,
|
|
ignoreUncleanSSLShutdown: configuration.ignoreUncleanSSLShutdown
|
|
)
|
|
}
|
|
}
|