Skip to content

Commit d62c475

Browse files
authored
Drop Swift 5.5 (swift-server#686)
1 parent 333e60c commit d62c475

File tree

54 files changed

+5
-2332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+5
-2332
lines changed

[email protected]

-75
This file was deleted.

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,12 @@ Please have a look at [SECURITY.md](SECURITY.md) for AsyncHTTPClient's security
323323

324324
## Supported Versions
325325

326-
The most recent versions of AsyncHTTPClient support Swift 5.5.2 and newer. The minimum Swift version supported by AsyncHTTPClient releases are detailed below:
326+
The most recent versions of AsyncHTTPClient support Swift 5.6 and newer. The minimum Swift version supported by AsyncHTTPClient releases are detailed below:
327327

328328
AsyncHTTPClient | Minimum Swift Version
329329
--------------------|----------------------
330330
`1.0.0 ..< 1.5.0` | 5.0
331331
`1.5.0 ..< 1.10.0` | 5.2
332332
`1.10.0 ..< 1.13.0` | 5.4
333-
`1.13.0 ...` | 5.5.2
333+
`1.13.0 ..< 1.18.0` | 5.5.2
334+
`1.18.0 ...` | 5.6

Sources/AsyncHTTPClient/AsyncAwait/HTTPClientRequest.swift

-110
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ extension HTTPClientRequest.Body {
9191
self.init(.byteBuffer(byteBuffer))
9292
}
9393

94-
#if swift(>=5.6)
9594
/// Create an ``HTTPClientRequest/Body-swift.struct`` from a `RandomAccessCollection` of bytes.
9695
///
9796
/// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
@@ -106,21 +105,6 @@ extension HTTPClientRequest.Body {
106105
) -> Self where Bytes.Element == UInt8 {
107106
Self._bytes(bytes)
108107
}
109-
#else
110-
/// Create an ``HTTPClientRequest/Body-swift.struct`` from a `RandomAccessCollection` of bytes.
111-
///
112-
/// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
113-
/// usage of this construction will be double the size of the original collection. The construction
114-
/// of the `ByteBuffer` will be delayed until it's needed.
115-
///
116-
/// - parameter bytes: The bytes of the request body.
117-
@inlinable
118-
public static func bytes<Bytes: RandomAccessCollection>(
119-
_ bytes: Bytes
120-
) -> Self where Bytes.Element == UInt8 {
121-
Self._bytes(bytes)
122-
}
123-
#endif
124108

125109
@inlinable
126110
static func _bytes<Bytes: RandomAccessCollection>(
@@ -139,7 +123,6 @@ extension HTTPClientRequest.Body {
139123
})
140124
}
141125

142-
#if swift(>=5.6)
143126
/// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Sequence` of bytes.
144127
///
145128
/// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
@@ -165,32 +148,6 @@ extension HTTPClientRequest.Body {
165148
) -> Self where Bytes.Element == UInt8 {
166149
Self._bytes(bytes, length: length)
167150
}
168-
#else
169-
/// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Sequence` of bytes.
170-
///
171-
/// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
172-
/// usage of this construction will be double the size of the original collection. The construction
173-
/// of the `ByteBuffer` will be delayed until it's needed.
174-
///
175-
/// Unlike ``bytes(_:)-1uns7``, this construction does not assume that the body can be replayed. As a result,
176-
/// if a redirect is encountered that would need us to replay the request body, the redirect will instead
177-
/// not be followed. Prefer ``bytes(_:)-1uns7`` wherever possible.
178-
///
179-
/// Caution should be taken with this method to ensure that the `length` is correct. Incorrect lengths
180-
/// will cause unnecessary runtime failures. Setting `length` to ``Length/unknown`` will trigger the upload
181-
/// to use `chunked` `Transfer-Encoding`, while using ``Length/known(_:)`` will use `Content-Length`.
182-
///
183-
/// - parameters:
184-
/// - bytes: The bytes of the request body.
185-
/// - length: The length of the request body.
186-
@inlinable
187-
public static func bytes<Bytes: Sequence>(
188-
_ bytes: Bytes,
189-
length: Length
190-
) -> Self where Bytes.Element == UInt8 {
191-
Self._bytes(bytes, length: length)
192-
}
193-
#endif
194151

195152
@inlinable
196153
static func _bytes<Bytes: Sequence>(
@@ -210,7 +167,6 @@ extension HTTPClientRequest.Body {
210167
})
211168
}
212169

213-
#if swift(>=5.6)
214170
/// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Collection` of bytes.
215171
///
216172
/// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
@@ -232,28 +188,6 @@ extension HTTPClientRequest.Body {
232188
) -> Self where Bytes.Element == UInt8 {
233189
Self._bytes(bytes, length: length)
234190
}
235-
#else
236-
/// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Collection` of bytes.
237-
///
238-
/// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
239-
/// usage of this construction will be double the size of the original collection. The construction
240-
/// of the `ByteBuffer` will be delayed until it's needed.
241-
///
242-
/// Caution should be taken with this method to ensure that the `length` is correct. Incorrect lengths
243-
/// will cause unnecessary runtime failures. Setting `length` to ``Length/unknown`` will trigger the upload
244-
/// to use `chunked` `Transfer-Encoding`, while using ``Length/known(_:)`` will use `Content-Length`.
245-
///
246-
/// - parameters:
247-
/// - bytes: The bytes of the request body.
248-
/// - length: The length of the request body.
249-
@inlinable
250-
public static func bytes<Bytes: Collection>(
251-
_ bytes: Bytes,
252-
length: Length
253-
) -> Self where Bytes.Element == UInt8 {
254-
Self._bytes(bytes, length: length)
255-
}
256-
#endif
257191

258192
@inlinable
259193
static func _bytes<Bytes: Collection>(
@@ -273,7 +207,6 @@ extension HTTPClientRequest.Body {
273207
})
274208
}
275209

276-
#if swift(>=5.6)
277210
/// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of `ByteBuffer`s.
278211
///
279212
/// This construction will stream the upload one `ByteBuffer` at a time.
@@ -293,26 +226,6 @@ extension HTTPClientRequest.Body {
293226
) -> Self where SequenceOfBytes.Element == ByteBuffer {
294227
Self._stream(sequenceOfBytes, length: length)
295228
}
296-
#else
297-
/// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of `ByteBuffer`s.
298-
///
299-
/// This construction will stream the upload one `ByteBuffer` at a time.
300-
///
301-
/// Caution should be taken with this method to ensure that the `length` is correct. Incorrect lengths
302-
/// will cause unnecessary runtime failures. Setting `length` to ``Length/unknown`` will trigger the upload
303-
/// to use `chunked` `Transfer-Encoding`, while using ``Length/known(_:)`` will use `Content-Length`.
304-
///
305-
/// - parameters:
306-
/// - sequenceOfBytes: The bytes of the request body.
307-
/// - length: The length of the request body.
308-
@inlinable
309-
public static func stream<SequenceOfBytes: AsyncSequence>(
310-
_ sequenceOfBytes: SequenceOfBytes,
311-
length: Length
312-
) -> Self where SequenceOfBytes.Element == ByteBuffer {
313-
Self._stream(sequenceOfBytes, length: length)
314-
}
315-
#endif
316229

317230
@inlinable
318231
static func _stream<SequenceOfBytes: AsyncSequence>(
@@ -328,7 +241,6 @@ extension HTTPClientRequest.Body {
328241
return body
329242
}
330243

331-
#if swift(>=5.6)
332244
/// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of bytes.
333245
///
334246
/// This construction will consume 1kB chunks from the `Bytes` and send them at once. This optimizes for
@@ -350,28 +262,6 @@ extension HTTPClientRequest.Body {
350262
) -> Self where Bytes.Element == UInt8 {
351263
Self._stream(bytes, length: length)
352264
}
353-
#else
354-
/// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of bytes.
355-
///
356-
/// This construction will consume 1kB chunks from the `Bytes` and send them at once. This optimizes for
357-
/// `AsyncSequence`s where larger chunks are buffered up and available without actually suspending, such
358-
/// as those provided by `FileHandle`.
359-
///
360-
/// Caution should be taken with this method to ensure that the `length` is correct. Incorrect lengths
361-
/// will cause unnecessary runtime failures. Setting `length` to ``Length/unknown`` will trigger the upload
362-
/// to use `chunked` `Transfer-Encoding`, while using ``Length/known(_:)`` will use `Content-Length`.
363-
///
364-
/// - parameters:
365-
/// - bytes: The bytes of the request body.
366-
/// - length: The length of the request body.
367-
@inlinable
368-
public static func stream<Bytes: AsyncSequence>(
369-
_ bytes: Bytes,
370-
length: Length
371-
) -> Self where Bytes.Element == UInt8 {
372-
Self._stream(bytes, length: length)
373-
}
374-
#endif
375265

376266
@inlinable
377267
static func _stream<Bytes: AsyncSequence>(

Sources/AsyncHTTPClient/ConnectionPool/HTTP1/HTTP1ClientChannelHandler.swift

-2
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,8 @@ final class HTTP1ClientChannelHandler: ChannelDuplexHandler {
433433
}
434434
}
435435

436-
#if swift(>=5.6)
437436
@available(*, unavailable)
438437
extension HTTP1ClientChannelHandler: Sendable {}
439-
#endif
440438

441439
extension HTTP1ClientChannelHandler: HTTPRequestExecutor {
442440
func writeRequestBodyPart(_ data: IOData, request: HTTPExecutableRequest, promise: EventLoopPromise<Void>?) {

Sources/AsyncHTTPClient/Docs.docc/index.md

-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ This library provides the following:
1313
- Automatic HTTP/2 over HTTPS (since version 1.7.0)
1414
- Cookie parsing (but not storage)
1515

16-
---
17-
18-
**NOTE**: You will need [Xcode 13.2](https://apps.apple.com/gb/app/xcode/id497799835?mt=12) or [Swift 5.5.2](https://swift.org/download/#swift-552) to try out `AsyncHTTPClient`s new async/await APIs.
19-
20-
---
21-
2216
### Getting Started
2317

2418
#### Adding the dependency

Sources/AsyncHTTPClient/HTTPClient.swift

-18
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ public class HTTPClient {
200200
}
201201
}
202202

203-
#if swift(>=5.6)
204203
/// Shuts down the client and event loop gracefully.
205204
///
206205
/// This function is clearly an outlier in that it uses a completion
@@ -213,17 +212,6 @@ public class HTTPClient {
213212
) {
214213
self.shutdown(requiresCleanClose: false, queue: queue, callback)
215214
}
216-
#else
217-
/// Shuts down the client and event loop gracefully.
218-
///
219-
/// This function is clearly an outlier in that it uses a completion
220-
/// callback instead of an EventLoopFuture. The reason for that is that NIO's EventLoopFutures will call back on an event loop.
221-
/// The virtue of this function is to shut the event loop down. To work around that we call back on a DispatchQueue
222-
/// instead.
223-
public func shutdown(queue: DispatchQueue = .global(), _ callback: @escaping (Error?) -> Void) {
224-
self.shutdown(requiresCleanClose: false, queue: queue, callback)
225-
}
226-
#endif
227215

228216
/// Shuts down the ``HTTPClient`` and releases its resources.
229217
///
@@ -917,11 +905,7 @@ public class HTTPClient {
917905
case enabled(limit: NIOHTTPDecompression.DecompressionLimit)
918906
}
919907

920-
#if swift(>=5.6)
921908
typealias ShutdownCallback = @Sendable (Error?) -> Void
922-
#else
923-
typealias ShutdownCallback = (Error?) -> Void
924-
#endif
925909

926910
enum State {
927911
case upAndRunning
@@ -934,10 +918,8 @@ public class HTTPClient {
934918
extension HTTPClient.Configuration: Sendable {}
935919
#endif
936920

937-
#if swift(>=5.6)
938921
extension HTTPClient.EventLoopGroupProvider: Sendable {}
939922
extension HTTPClient.EventLoopPreference: Sendable {}
940-
#endif
941923

942924
// HTTPClient is thread-safe because its shared mutable state is protected through a lock
943925
extension HTTPClient: @unchecked Sendable {}

0 commit comments

Comments
 (0)