Skip to content

Commit dffcb48

Browse files
committed
soundness
1 parent fdf9fa0 commit dffcb48

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

Sources/AsyncHTTPClient/ConnectionPool.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extension String {
2828
var ipv6Address = in6_addr()
2929
return self.withCString { host in
3030
inet_pton(AF_INET, host, &ipv4Address) == 1 ||
31-
inet_pton(AF_INET6, host, &ipv6Address) == 1
31+
inet_pton(AF_INET6, host, &ipv6Address) == 1
3232
}
3333
}
3434
}

Sources/AsyncHTTPClient/ConnectionPool/RequestOptions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import NIOCore
1717
struct RequestOptions {
1818
/// The maximal `TimeAmount` that is allowed to pass between `channelRead`s from the Channel.
1919
var idleReadTimeout: TimeAmount?
20-
20+
2121
var dnsOverride: [String: String]
2222

2323
init(idleReadTimeout: TimeAmount?, dnsOverride: [String: String]) {

Sources/AsyncHTTPClient/HTTPClient.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ public class HTTPClient {
711711
public struct Configuration {
712712
/// TLS configuration, defaults to `TLSConfiguration.makeClientConfiguration()`.
713713
public var tlsConfiguration: Optional<TLSConfiguration>
714-
714+
715715
/// Sometimes it can be useful to connect to one host e.g. `x.example.com` but
716716
/// request and validate the certificate chain as if we would connect to `y.example.com`.
717717
/// ``dnsOverride`` allows to do just that by mapping host names which we will request and validate the certificate chain, to a different
@@ -721,7 +721,7 @@ public class HTTPClient {
721721
/// `url` of `https://example.com/`, the ``HTTPClient`` will actually open a connection to `localhost` instead of `example.com`.
722722
/// ``HTTPClient`` will still request certificates from the server for `example.com` and validate them as if we would connect to `example.com`.
723723
public var dnsOverride: [String: String] = [:]
724-
724+
725725
/// Enables following 3xx redirects automatically.
726726
///
727727
/// Following redirects are supported:

Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ extension TLSConfiguration {
9191
will make AsyncHTTPClient use NIO on BSD Sockets and not Network.framework (which is the preferred \
9292
platform networking stack).
9393
"""
94-
94+
9595
if let serverNameIndicatorOverride = serverNameIndicatorOverride {
9696
serverNameIndicatorOverride.withCString { serverNameIndicatorOverride in
9797
sec_protocol_options_set_tls_server_name(options.securityProtocolOptions, serverNameIndicatorOverride)

Sources/AsyncHTTPClient/RequestBag.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ final class RequestBag<Delegate: HTTPClientResponseDelegate> {
2626
private static var maxConsumeBodyPartStackDepth: Int {
2727
50
2828
}
29-
29+
3030
let poolKey: ConnectionPool.Key
31-
31+
3232
let task: HTTPClient.Task<Delegate.Response>
3333
var eventLoop: EventLoop {
3434
self.task.eventLoop
@@ -395,7 +395,6 @@ final class RequestBag<Delegate: HTTPClientResponseDelegate> {
395395
}
396396

397397
extension RequestBag: HTTPSchedulableRequest {
398-
399398
var tlsConfiguration: TLSConfiguration? {
400399
self.request.tlsConfiguration
401400
}

Tests/AsyncHTTPClientTests/AsyncAwaitEndToEndTests+XCTest.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extension AsyncAwaitEndToEndTests {
4040
("testImmediateDeadline", testImmediateDeadline),
4141
("testConnectTimeout", testConnectTimeout),
4242
("testSelfSignedCertificateIsRejectedWithCorrectErrorIfRequestDeadlineIsExceeded", testSelfSignedCertificateIsRejectedWithCorrectErrorIfRequestDeadlineIsExceeded),
43+
("testDnsOverride", testDnsOverride),
4344
("testInvalidURL", testInvalidURL),
4445
("testRedirectChangesHostHeader", testRedirectChangesHostHeader),
4546
("testShutdown", testShutdown),

Tests/AsyncHTTPClientTests/AsyncAwaitEndToEndTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ final class AsyncAwaitEndToEndTests: XCTestCase {
491491
}
492492
}
493493
}
494-
494+
495495
func testDnsOverride() {
496496
guard #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) else { return }
497497
XCTAsyncTest(timeout: 5) {
@@ -517,7 +517,7 @@ final class AsyncAwaitEndToEndTests: XCTestCase {
517517
/// },
518518
/// issuerPrivateKey: .init(privateKey)
519519
/// )
520-
///```
520+
/// ```
521521
let certPath = Bundle.module.path(forResource: "example.com.cert", ofType: "pem")!
522522
let keyPath = Bundle.module.path(forResource: "example.com.private-key", ofType: "pem")!
523523
let localhostCert = try NIOSSLCertificate.fromPEMFile(certPath)
@@ -531,12 +531,12 @@ final class AsyncAwaitEndToEndTests: XCTestCase {
531531
var config = HTTPClient.Configuration()
532532
.enableFastFailureModeForTesting()
533533
var tlsConfig = TLSConfiguration.makeClientConfiguration()
534-
534+
535535
tlsConfig.trustRoots = .certificates(localhostCert)
536536
config.tlsConfiguration = tlsConfig
537537
// this is the actual configuration under test
538538
config.dnsOverride = ["example.com": "localhost"]
539-
539+
540540
let localClient = HTTPClient(eventLoopGroupProvider: .createNew, configuration: config)
541541
defer { XCTAssertNoThrow(try localClient.syncShutdown()) }
542542
let request = HTTPClientRequest(url: "https://example.com:\(bin.port)/echo-headers")

Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ internal final class HTTPBin<RequestHandler: ChannelInboundHandler> where
341341
compress: Bool = false,
342342
settings: HTTP2Settings? = nil
343343
)
344-
344+
345345
static func http1_1(ssl: Bool, compress: Bool = false) -> Self {
346346
.http1_1(tlsConfiguration: ssl ? nil : TestTLS.serverConfiguration, compress: compress)
347347
}
@@ -367,7 +367,7 @@ internal final class HTTPBin<RequestHandler: ChannelInboundHandler> where
367367
return customSettings
368368
}
369369
}
370-
370+
371371
var tlsConfiguration: TLSConfiguration? {
372372
switch self {
373373
case .refuse:

0 commit comments

Comments
 (0)