diff --git a/Package.swift b/Package.swift index 0c2cb084..f615bb84 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.7 +// swift-tools-version:5.9 import PackageDescription let package = Package( @@ -13,11 +13,11 @@ let package = Package( .library(name: "WebSocketKit", targets: ["WebSocketKit"]), ], dependencies: [ - .package(url: "https://github.com/apple/swift-nio.git", from: "2.53.0"), - .package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.16.0"), - .package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.24.0"), - .package(url: "https://github.com/apple/swift-nio-transport-services.git", from: "1.16.0"), - .package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"), + .package(url: "https://github.com/apple/swift-nio.git", from: "2.76.1"), + .package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.24.1"), + .package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.29.0"), + .package(url: "https://github.com/apple/swift-nio-transport-services.git", from: "1.23.0"), + .package(url: "https://github.com/apple/swift-atomics.git", from: "1.2.0"), ], targets: [ .target(name: "WebSocketKit", dependencies: [ diff --git a/Tests/WebSocketKitTests/AsyncWebSocketKitTests.swift b/Tests/WebSocketKitTests/AsyncWebSocketKitTests.swift index e662b2c6..902eb0b4 100644 --- a/Tests/WebSocketKitTests/AsyncWebSocketKitTests.swift +++ b/Tests/WebSocketKitTests/AsyncWebSocketKitTests.swift @@ -46,9 +46,10 @@ final class AsyncWebSocketKitTests: XCTestCase { try await server.close(mode: .all) } - func testBadURLInWebsocketConnect() async throws { + func testBadURLSchemeInWebsocketConnect() async throws { + do { - try await WebSocket.connect(to: "%w", on: self.elg, onUpgrade: { _ async in }) + try await WebSocket.connect(to: "w`:", on: self.elg, onUpgrade: { _ async in }) XCTAssertThrowsError({}()) } catch { XCTAssertThrowsError(try { throw error }()) { diff --git a/Tests/WebSocketKitTests/SSLTestHelpers.swift b/Tests/WebSocketKitTests/SSLTestHelpers.swift index a6776aab..812ddca3 100644 --- a/Tests/WebSocketKitTests/SSLTestHelpers.swift +++ b/Tests/WebSocketKitTests/SSLTestHelpers.swift @@ -71,12 +71,13 @@ func generateRSAPrivateKey() -> OpaquePointer { CNIOBoringSSL_BN_set_u64(exponent, 0x10001) - let rsa = CNIOBoringSSL_RSA_new()! + let rsa = CNIOBoringSSL_RSA_new() let generateRC = CNIOBoringSSL_RSA_generate_key_ex(rsa, CInt(2048), exponent, nil) precondition(generateRC == 1) let pkey = CNIOBoringSSL_EVP_PKEY_new()! - let assignRC = CNIOBoringSSL_EVP_PKEY_assign(pkey, EVP_PKEY_RSA, rsa) + let p = UnsafeMutableRawPointer(rsa) + let assignRC = CNIOBoringSSL_EVP_PKEY_assign(pkey, EVP_PKEY_RSA, p) precondition(assignRC == 1) return pkey @@ -125,7 +126,7 @@ func generateSelfSignedCert(keygenFunction: () -> OpaquePointer = generateRSAPri NID_commonName, MBSTRING_UTF8, UnsafeMutablePointer(mutating: pointer), - CInt(commonName.lengthOfBytes(using: .utf8)), + ossl_ssize_t(CInt(commonName.lengthOfBytes(using: .utf8))), -1, 0) } diff --git a/Tests/WebSocketKitTests/WebSocketKitTests.swift b/Tests/WebSocketKitTests/WebSocketKitTests.swift index 9fa402ba..caaaee49 100644 --- a/Tests/WebSocketKitTests/WebSocketKitTests.swift +++ b/Tests/WebSocketKitTests/WebSocketKitTests.swift @@ -478,8 +478,9 @@ final class WebSocketKitTests: XCTestCase { try server.close(mode: .all).wait() } - func testBadURLInWebsocketConnect() async throws { - XCTAssertThrowsError(try WebSocket.connect(to: "%w", on: self.elg, onUpgrade: { _ in }).wait()) { + func testBadURLSchemeInWebsocketConnect() throws { + + XCTAssertThrowsError(try WebSocket.connect(to: "w`:", on: self.elg, onUpgrade: { _ in }).wait()) { guard case .invalidURL = $0 as? WebSocketClient.Error else { return XCTFail("Expected .invalidURL but got \(String(reflecting: $0))") }