Skip to content

Commit 098201c

Browse files
use HTTPRequestExecutorImpl client for libarchive
1 parent b70d3cc commit 098201c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Sources/SwiftlyCore/HTTPClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct SwiftlyUserAgentMiddleware: ClientMiddleware {
110110

111111
/// An `HTTPRequestExecutor` backed by a shared `HTTPClient`. This makes actual network requests.
112112
public final class HTTPRequestExecutorImpl: HTTPRequestExecutor {
113-
let httpClient: HTTPClient
113+
public let httpClient: HTTPClient
114114

115115
public init() {
116116
var proxy: HTTPClient.Configuration.Proxy?

Tools/build-swiftly-release/BuildSwiftlyRelease.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import AsyncHTTPClient
33
import Foundation
44
import SwiftlyCore
55
import SystemPackage
6+
import NIOPosix
67

78
#if os(macOS)
89
import MacOSPlatform
@@ -150,8 +151,9 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
150151
try? await fs.remove(atPath: libArchivePath)
151152

152153
// Download libarchive
154+
let httpExecutor = HTTPRequestExecutorImpl()
153155
let libarchiveRequest = HTTPClientRequest(url: "https://github.com/libarchive/libarchive/releases/download/v\(libArchiveVersion)/libarchive-\(libArchiveVersion).tar.gz")
154-
let libarchiveResponse = try await HTTPClient.shared.execute(libarchiveRequest, timeout: .seconds(60))
156+
let libarchiveResponse = try await httpExecutor.httpClient.execute(libarchiveRequest, timeout: .seconds(60))
155157
guard libarchiveResponse.status == .ok else {
156158
throw Error(message: "Download failed with status: \(libarchiveResponse.status)")
157159
}
@@ -180,8 +182,7 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
180182
}
181183

182184
let swiftVersion = swiftVerMatch.output.1
183-
184-
let httpExecutor = HTTPRequestExecutorImpl()
185+
print("Get toolchains")
185186
guard let swiftRelease = (try await httpExecutor.getReleaseToolchains()).first(where: { $0.name == swiftVersion }) else {
186187
throw Error(message: "Unable to find swift release using swift.org API: \(swiftVersion)")
187188
}

0 commit comments

Comments
 (0)