Skip to content

Commit c3f5630

Browse files
committed
Formatting
1 parent 5024ee6 commit c3f5630

20 files changed

+83
-83
lines changed

Sources/AsyncHTTPClient/AsyncAwait/HTTPClient+execute.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ extension HTTPClient {
128128
defer {
129129
deadlineTask.cancel()
130130
}
131-
return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<HTTPClientResponse, Swift.Error>) -> Void in
131+
return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<HTTPClientResponse, Swift.Error>) in
132132
let transaction = Transaction(
133133
request: request,
134134
requestOptions: .fromClientConfiguration(self.configuration),

Sources/AsyncHTTPClient/AsyncAwait/HTTPClientRequest.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extension HTTPClientRequest {
7070
/// are already entirely in memory.
7171
public struct Body: Sendable {
7272
@usableFromInline
73-
internal enum Mode: Sendable {
73+
enum Mode: Sendable {
7474
/// - parameters:
7575
/// - length: complete body length.
7676
/// If `length` is `.known`, `nextBodyPart` is not allowed to produce more bytes than `length` defines.
@@ -95,10 +95,10 @@ extension HTTPClientRequest {
9595
}
9696

9797
@usableFromInline
98-
internal var mode: Mode
98+
var mode: Mode
9999

100100
@inlinable
101-
internal init(_ mode: Mode) {
101+
init(_ mode: Mode) {
102102
self.mode = mode
103103
}
104104
}
@@ -151,7 +151,7 @@ extension HTTPClientRequest.Body {
151151
_ bytes: Bytes,
152152
length: Length
153153
) -> Self where Bytes.Element == UInt8 {
154-
Self._bytes(
154+
self._bytes(
155155
bytes,
156156
length: length,
157157
bagOfBytesToByteBufferConversionChunkSize: bagOfBytesToByteBufferConversionChunkSize,
@@ -323,7 +323,7 @@ extension HTTPClientRequest.Body {
323323

324324
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
325325
extension Optional where Wrapped == HTTPClientRequest.Body {
326-
internal var canBeConsumedMultipleTimes: Bool {
326+
var canBeConsumedMultipleTimes: Bool {
327327
switch self?.mode {
328328
case .none: return true
329329
case .byteBuffer: return true
@@ -346,7 +346,7 @@ extension HTTPClientRequest.Body {
346346
}
347347

348348
@usableFromInline
349-
internal var storage: RequestBodyLength
349+
var storage: RequestBodyLength
350350
}
351351
}
352352

Sources/AsyncHTTPClient/ConnectionPool/HTTP1/HTTP1ClientChannelHandler.swift

+13-13
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
4242
if let idleReadTimeout = newRequest.requestOptions.idleReadTimeout {
4343
self.idleReadTimeoutStateMachine = .init(timeAmount: idleReadTimeout)
4444
}
45-
45+
4646
if let idleWriteTimeout = newRequest.requestOptions.idleWriteTimeout {
4747
self.idleWriteTimeoutStateMachine = .init(
4848
timeAmount: idleWriteTimeout,
@@ -64,7 +64,7 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
6464
/// We therefore give each timer an ID and increase the ID every time we reset or cancel it.
6565
/// We check in the task if the timer ID has changed in the meantime and do not execute any action if has changed.
6666
private var currentIdleReadTimeoutTimerID: Int = 0
67-
67+
6868
private var idleWriteTimeoutStateMachine: IdleWriteStateMachine?
6969
private var idleWriteTimeoutTimer: Scheduled<Void>?
7070

@@ -121,7 +121,7 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
121121
self.logger.trace("Channel writability changed", metadata: [
122122
"ahc-channel-writable": "\(context.channel.isWritable)",
123123
])
124-
124+
125125
if let timeoutAction = self.idleWriteTimeoutStateMachine?.channelWritabilityChanged(context: context) {
126126
self.runTimeoutAction(timeoutAction, context: context)
127127
}
@@ -170,11 +170,11 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
170170
self.request = req
171171

172172
self.logger.debug("Request was scheduled on connection")
173-
173+
174174
if let timeoutAction = self.idleWriteTimeoutStateMachine?.write() {
175175
self.runTimeoutAction(timeoutAction, context: context)
176176
}
177-
177+
178178
req.willExecuteRequest(self)
179179

180180
let action = self.state.runNewRequest(
@@ -224,7 +224,7 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
224224
if let readTimeoutAction = self.idleReadTimeoutStateMachine?.requestEndSent() {
225225
self.runTimeoutAction(readTimeoutAction, context: context)
226226
}
227-
227+
228228
if let writeTimeoutAction = self.idleWriteTimeoutStateMachine?.requestEndSent() {
229229
self.runTimeoutAction(writeTimeoutAction, context: context)
230230
}
@@ -238,7 +238,7 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
238238
if let readTimeoutAction = self.idleReadTimeoutStateMachine?.requestEndSent() {
239239
self.runTimeoutAction(readTimeoutAction, context: context)
240240
}
241-
241+
242242
if let writeTimeoutAction = self.idleWriteTimeoutStateMachine?.requestEndSent() {
243243
self.runTimeoutAction(writeTimeoutAction, context: context)
244244
}
@@ -412,7 +412,7 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
412412
break
413413
}
414414
}
415-
415+
416416
private func runTimeoutAction(_ action: IdleWriteStateMachine.Action, context: ChannelHandlerContext) {
417417
switch action {
418418
case .startIdleWriteTimeoutTimer(let timeAmount):
@@ -459,7 +459,7 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
459459
promise?.fail(HTTPClientError.requestStreamCancelled)
460460
return
461461
}
462-
462+
463463
if let timeoutAction = self.idleWriteTimeoutStateMachine?.write() {
464464
self.runTimeoutAction(timeoutAction, context: context)
465465
}
@@ -498,7 +498,7 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
498498
}
499499

500500
self.logger.trace("Request was cancelled")
501-
501+
502502
if let timeoutAction = self.idleWriteTimeoutStateMachine?.cancelRequest() {
503503
self.runTimeoutAction(timeoutAction, context: context)
504504
}
@@ -641,7 +641,7 @@ struct IdleWriteStateMachine {
641641
self.state = .waitingForWritabilityEnabled
642642
}
643643
}
644-
644+
645645
mutating func cancelRequest() -> Action {
646646
switch self.state {
647647
case .waitingForRequestEnd, .waitingForWritabilityEnabled:
@@ -662,7 +662,7 @@ struct IdleWriteStateMachine {
662662
preconditionFailure("If the request end has been sent, we can't write more data.")
663663
}
664664
}
665-
665+
666666
mutating func requestEndSent() -> Action {
667667
switch self.state {
668668
case .waitingForRequestEnd:
@@ -674,7 +674,7 @@ struct IdleWriteStateMachine {
674674
return .none
675675
}
676676
}
677-
677+
678678
mutating func channelWritabilityChanged(context: ChannelHandlerContext) -> Action {
679679
if context.channel.isWritable {
680680
switch self.state {

Sources/AsyncHTTPClient/ConnectionPool/HTTP2/HTTP2ClientRequestHandler.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ final class HTTP2ClientRequestHandler: ChannelDuplexHandler {
5353

5454
private var idleReadTimeoutStateMachine: IdleReadStateMachine?
5555
private var idleReadTimeoutTimer: Scheduled<Void>?
56-
56+
5757
private var idleWriteTimeoutStateMachine: IdleWriteStateMachine?
5858
private var idleWriteTimeoutTimer: Scheduled<Void>?
5959

@@ -91,7 +91,7 @@ final class HTTP2ClientRequestHandler: ChannelDuplexHandler {
9191
if let timeoutAction = self.idleWriteTimeoutStateMachine?.channelWritabilityChanged(context: context) {
9292
self.runTimeoutAction(timeoutAction, context: context)
9393
}
94-
94+
9595
let action = self.state.writabilityChanged(writable: context.channel.isWritable)
9696
self.run(action, context: context)
9797
}
@@ -124,7 +124,7 @@ final class HTTP2ClientRequestHandler: ChannelDuplexHandler {
124124
// The `HTTPRequestStateMachine` ensures that a `HTTP2ClientRequestHandler` only handles
125125
// a single request.
126126
self.request = request
127-
127+
128128
if let timeoutAction = self.idleWriteTimeoutStateMachine?.write() {
129129
self.runTimeoutAction(timeoutAction, context: context)
130130
}
@@ -175,7 +175,7 @@ final class HTTP2ClientRequestHandler: ChannelDuplexHandler {
175175
if let readTimeoutAction = self.idleReadTimeoutStateMachine?.requestEndSent() {
176176
self.runTimeoutAction(readTimeoutAction, context: context)
177177
}
178-
178+
179179
if let writeTimeoutAction = self.idleWriteTimeoutStateMachine?.requestEndSent() {
180180
self.runTimeoutAction(writeTimeoutAction, context: context)
181181
}
@@ -194,7 +194,7 @@ final class HTTP2ClientRequestHandler: ChannelDuplexHandler {
194194
if let readTimeoutAction = self.idleReadTimeoutStateMachine?.requestEndSent() {
195195
self.runTimeoutAction(readTimeoutAction, context: context)
196196
}
197-
197+
198198
if let writeTimeoutAction = self.idleWriteTimeoutStateMachine?.requestEndSent() {
199199
self.runTimeoutAction(writeTimeoutAction, context: context)
200200
}
@@ -321,7 +321,7 @@ final class HTTP2ClientRequestHandler: ChannelDuplexHandler {
321321
break
322322
}
323323
}
324-
324+
325325
private func runTimeoutAction(_ action: IdleWriteStateMachine.Action, context: ChannelHandlerContext) {
326326
switch action {
327327
case .startIdleWriteTimeoutTimer(let timeAmount):
@@ -364,7 +364,7 @@ final class HTTP2ClientRequestHandler: ChannelDuplexHandler {
364364
promise?.fail(HTTPClientError.requestStreamCancelled)
365365
return
366366
}
367-
367+
368368
if let timeoutAction = self.idleWriteTimeoutStateMachine?.write() {
369369
self.runTimeoutAction(timeoutAction, context: context)
370370
}
@@ -398,7 +398,7 @@ final class HTTP2ClientRequestHandler: ChannelDuplexHandler {
398398
// See code comment in `writeRequestBodyPart0`
399399
return
400400
}
401-
401+
402402
if let timeoutAction = self.idleWriteTimeoutStateMachine?.cancelRequest() {
403403
self.runTimeoutAction(timeoutAction, context: context)
404404
}

Sources/AsyncHTTPClient/ConnectionPool/RequestBodyLength.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import NIOCore
1616

1717
/// - Note: use `HTTPClientRequest.Body.Length` if you want to expose `RequestBodyLength` publicly
1818
@usableFromInline
19-
internal enum RequestBodyLength: Hashable, Sendable {
19+
enum RequestBodyLength: Hashable, Sendable {
2020
/// size of the request body is not known before starting the request
2121
case unknown
2222
/// size of the request body is fixed and exactly `count` bytes

Sources/AsyncHTTPClient/ConnectionPool/State Machine/HTTPConnectionPool+HTTP2Connections.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,8 @@ extension HTTPConnectionPool {
482482
func backingOffTimerDone(
483483
for eventLoop: EventLoop
484484
) -> RetryConnectionCreationContext {
485-
var hasGeneralPurposeConnection: Bool = false
486-
var hasConnectionOnSpecifiedEventLoop: Bool = false
485+
var hasGeneralPurposeConnection = false
486+
var hasConnectionOnSpecifiedEventLoop = false
487487
for connection in self.connections {
488488
guard connection.isStartingOrActive else { continue }
489489
hasGeneralPurposeConnection = true

Sources/AsyncHTTPClient/HTTPClient+HTTPCookie.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ extension HTTPClient {
127127
/// - maxAge: The cookie's age in seconds, defaults to nil.
128128
/// - httpOnly: Whether this cookie should be used by HTTP servers only, defaults to false.
129129
/// - secure: Whether this cookie should only be sent using secure channels, defaults to false.
130-
internal init(name: String, value: String, path: String = "/", domain: String? = nil, expires_timestamp: Int64? = nil, maxAge: Int? = nil, httpOnly: Bool = false, secure: Bool = false) {
130+
init(name: String, value: String, path: String = "/", domain: String? = nil, expires_timestamp: Int64? = nil, maxAge: Int? = nil, httpOnly: Bool = false, secure: Bool = false) {
131131
self.name = name
132132
self.value = value
133133
self.path = path

Sources/AsyncHTTPClient/HTTPClient.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class HTTPClient {
7979
private var state: State
8080
private let stateLock = NIOLock()
8181

82-
internal static let loggingDisabled = Logger(label: "AHC-do-not-log", factory: { _ in SwiftLogNoOpLogHandler() })
82+
static let loggingDisabled = Logger(label: "AHC-do-not-log", factory: { _ in SwiftLogNoOpLogHandler() })
8383

8484
/// Create an ``HTTPClient`` with specified `EventLoopGroup` provider and configuration.
8585
///
@@ -184,7 +184,7 @@ public class HTTPClient {
184184
/// throw the appropriate error if needed. For instance, if its internal connection pool has any non-released connections,
185185
/// this indicate shutdown was called too early before tasks were completed or explicitly canceled.
186186
/// In general, setting this parameter to `true` should make it easier and faster to catch related programming errors.
187-
internal func syncShutdown(requiresCleanClose: Bool) throws {
187+
func syncShutdown(requiresCleanClose: Bool) throws {
188188
if let eventLoop = MultiThreadedEventLoopGroup.currentEventLoop {
189189
preconditionFailure("""
190190
BUG DETECTED: syncShutdown() must not be called when on an EventLoop.
@@ -1014,7 +1014,7 @@ extension HTTPClient.Configuration {
10141014
}
10151015

10161016
public struct HTTPVersion: Sendable, Hashable {
1017-
internal enum Configuration {
1017+
enum Configuration {
10181018
case http1Only
10191019
case automatic
10201020
}
@@ -1025,7 +1025,7 @@ extension HTTPClient.Configuration {
10251025
/// HTTP/2 is used if we connect to a server with HTTPS and the server supports HTTP/2, otherwise we use HTTP/1
10261026
public static let automatic: Self = .init(configuration: .automatic)
10271027

1028-
internal var configuration: Configuration
1028+
var configuration: Configuration
10291029
}
10301030
}
10311031

Sources/AsyncHTTPClient/HTTPHandler.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ extension HTTPClient {
723723
private let makeOrGetFileIOThreadPool: () -> NIOThreadPool
724724

725725
/// The shared thread pool of a ``HTTPClient`` used for file IO. It is lazily created on first access.
726-
internal var fileIOThreadPool: NIOThreadPool {
726+
var fileIOThreadPool: NIOThreadPool {
727727
self.makeOrGetFileIOThreadPool()
728728
}
729729

@@ -800,11 +800,11 @@ extension HTTPClient {
800800

801801
extension HTTPClient.Task: @unchecked Sendable {}
802802

803-
internal struct TaskCancelEvent {}
803+
struct TaskCancelEvent {}
804804

805805
// MARK: - RedirectHandler
806806

807-
internal struct RedirectHandler<ResponseType> {
807+
struct RedirectHandler<ResponseType> {
808808
let request: HTTPClient.Request
809809
let redirectState: RedirectState
810810
let execute: (HTTPClient.Request, RedirectState) -> HTTPClient.Task<ResponseType>

Sources/AsyncHTTPClient/RedirectState.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ extension RedirectState {
5151
/// - Parameter redirectURL: the new URL to redirect the request to
5252
/// - Throws: if it reaches the redirect limit or detects a redirect cycle if and `allowCycles` is false
5353
mutating func redirect(to redirectURL: String) throws {
54-
guard self.visited.count <= limit else {
54+
guard self.visited.count <= self.limit else {
5555
throw HTTPClientError.redirectLimitReached
5656
}
5757

58-
guard allowCycles || !self.visited.contains(redirectURL) else {
58+
guard self.allowCycles || !self.visited.contains(redirectURL) else {
5959
throw HTTPClientError.redirectCycleDetected
6060
}
6161
self.visited.append(redirectURL)

Sources/AsyncHTTPClient/Utils.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public final class HTTPClientCopyingDelegate: HTTPClientResponseDelegate {
4343
/// This is currently the only way to do this in Swift: see
4444
/// https://forums.swift.org/t/support-debug-only-code/11037 for a discussion.
4545
@inlinable
46-
internal func debugOnly(_ body: () -> Void) {
46+
func debugOnly(_ body: () -> Void) {
4747
assert({ body(); return true }())
4848
}
4949

Tests/AsyncHTTPClientTests/AsyncAwaitEndToEndTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ final class AsyncAwaitEndToEndTests: XCTestCase {
486486
/// openssl req -x509 -newkey rsa:4096 -keyout self_signed_key.pem -out self_signed_cert.pem -sha256 -days 99999 -nodes -subj '/CN=localhost'
487487
let certPath = Bundle.module.path(forResource: "self_signed_cert", ofType: "pem")!
488488
let keyPath = Bundle.module.path(forResource: "self_signed_key", ofType: "pem")!
489-
let configuration = TLSConfiguration.makeServerConfiguration(
490-
certificateChain: try NIOSSLCertificate.fromPEMFile(certPath).map { .certificate($0) },
489+
let configuration = try TLSConfiguration.makeServerConfiguration(
490+
certificateChain: NIOSSLCertificate.fromPEMFile(certPath).map { .certificate($0) },
491491
privateKey: .file(keyPath)
492492
)
493493
let sslContext = try NIOSSLContext(configuration: configuration)

0 commit comments

Comments
 (0)