Skip to content

Commit 25315f0

Browse files
use HTTPRequestExecutorImpl client for libarchive (#420)
1 parent 19e30a8 commit 25315f0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
150150
try? await fs.remove(atPath: libArchivePath)
151151

152152
// Download libarchive
153+
let httpExecutor = HTTPRequestExecutorImpl()
153154
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))
155+
let libarchiveResponse = try await httpExecutor.httpClient.execute(libarchiveRequest, timeout: .seconds(60))
155156
guard libarchiveResponse.status == .ok else {
156157
throw Error(message: "Download failed with status: \(libarchiveResponse.status)")
157158
}
@@ -180,8 +181,6 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
180181
}
181182

182183
let swiftVersion = swiftVerMatch.output.1
183-
184-
let httpExecutor = HTTPRequestExecutorImpl()
185184
guard let swiftRelease = (try await httpExecutor.getReleaseToolchains()).first(where: { $0.name == swiftVersion }) else {
186185
throw Error(message: "Unable to find swift release using swift.org API: \(swiftVersion)")
187186
}

0 commit comments

Comments
 (0)