Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/EchoServer/EchoServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import HTTPAPIs

/// This examples shows an HTTP echo server.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
@main
struct EchoServer {
static func main() async throws {
Expand Down
2 changes: 1 addition & 1 deletion Examples/ExampleMiddleware/ForwardingMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public struct ForwardingMiddleware<Input: ~Copyable & ~Escapable>: Middleware {
}
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension Middleware {
public func forwarding() -> ForwardingMiddleware<Input> {
ForwardingMiddleware()
Expand Down
8 changes: 4 additions & 4 deletions Examples/ExampleMiddleware/HTTPServerLoggingMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public import Middleware
/// decorators that output information about the HTTP request path, method, response status,
/// and the number of bytes read from the request body and written to the response body.
/// This middleware is useful for debugging and monitoring HTTP traffic.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public struct HTTPServerLoggingMiddleware<
RequestConcludingAsyncReader: ConcludingAsyncReader & ~Copyable,
ResponseConcludingAsyncWriter: ConcludingAsyncWriter & ~Copyable
Expand Down Expand Up @@ -98,7 +98,7 @@ where
}
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension Middleware where Input: ~Copyable, NextInput: ~Copyable {
/// Creates logging middleware for HTTP servers.
///
Expand Down Expand Up @@ -135,7 +135,7 @@ extension Middleware where Input: ~Copyable, NextInput: ~Copyable {
}
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public struct HTTPRequestLoggingConcludingAsyncReader<
Base: ConcludingAsyncReader & ~Copyable
>: ConcludingAsyncReader, ~Copyable
Expand Down Expand Up @@ -201,7 +201,7 @@ where
}
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public struct HTTPResponseLoggingConcludingAsyncWriter<
Base: ConcludingAsyncWriter & ~Copyable
>: ConcludingAsyncWriter, ~Copyable
Expand Down
2 changes: 1 addition & 1 deletion Examples/ExampleMiddleware/HTTPServerMiddlewareInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public import HTTPAPIs
/// request body reader, and response sender. This boxing is necessary because some of these
/// parameters are `~Copyable` types that cannot be stored in tuples, and it provides a
/// convenient way to pass all request-handling components through the middleware chain.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public struct HTTPServerMiddlewareInput<
RequestReader: ConcludingAsyncReader & ~Copyable,
ResponseWriter: ConcludingAsyncWriter & ~Copyable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public import Middleware
/// ``HTTPServerRequestHandlerMiddleware`` serves as an example terminal middleware that reads
/// the entire request body and writes it back as the response body with a 200 OK status.
/// This middleware has `Never` as its `NextInput` type, indicating it's the end of the chain.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public struct HTTPServerRequestHandlerMiddleware<
RequestConcludingAsyncReader: ConcludingAsyncReader & ~Copyable,
ResponseConcludingAsyncWriter: ConcludingAsyncWriter & ~Copyable,
Expand Down Expand Up @@ -63,7 +63,7 @@ where
}
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension Middleware where Input: ~Copyable, NextInput: ~Copyable {
/// Creates a request handler middleware that echoes the request body back as the response.
///
Expand Down
4 changes: 2 additions & 2 deletions Examples/MiddlewareClient/ExampleMiddlewareClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import HTTPAPIs
import Middleware

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
struct ExampleMiddlewareClient<Client: HTTPClient & ~Copyable, ClientMiddleware: Middleware<HTTPRequest, HTTPRequest>>: HTTPClient, ~Copyable {
typealias RequestOptions = Client.RequestOptions
typealias RequestWriter = Client.RequestWriter
Expand Down Expand Up @@ -56,7 +56,7 @@ struct ExampleMiddlewareClient<Client: HTTPClient & ~Copyable, ClientMiddleware:
}
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
struct RequestMiddleware<Client: HTTPClient & ~Copyable>: Middleware {
typealias Input = HTTPRequest
typealias NextInput = Input
Expand Down
2 changes: 1 addition & 1 deletion Examples/MiddlewareClient/MiddlewareClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Logging
import Middleware

/// This example shows how to use middleware together with an HTTP client.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
@main
struct MiddlewareClient {
static func main() async throws {
Expand Down
4 changes: 2 additions & 2 deletions Examples/MiddlewareServer/ExampleMiddlewareServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Logging
import Middleware

/// This is an example server that wraps an HTTP server inside a middleware.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
struct ExampleMiddlewareServer<
Server: HTTPServer,
ServerMiddleware: Middleware & Sendable
Expand Down Expand Up @@ -62,7 +62,7 @@ where
}
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
struct RequestMiddleware<Server: HTTPServer>: Middleware
where
Server.RequestConcludingReader: ~Copyable,
Expand Down
2 changes: 1 addition & 1 deletion Examples/MiddlewareServer/MiddlewareServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Logging
import Middleware

/// This example shows how to use middleware together with an HTTP server.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
@main
struct MiddlewareServer {
static func main() async throws {
Expand Down
2 changes: 1 addition & 1 deletion Examples/ProxyServer/ProxyServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Synchronization
///
/// Every incoming request is proxied via an HTTP client. This supports full bi-directional streaming
/// and trailers.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
@main
struct ProxyServer {
static func main() async throws {
Expand Down
2 changes: 1 addition & 1 deletion Sources/AHCHTTPClient/AHC+HTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import NIOCore
import NIOHTTP1
import Synchronization

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension AsyncHTTPClient.HTTPClient: HTTPAPIs.HTTPClient {
public typealias RequestWriter = RequestBodyWriter
public typealias ResponseConcludingReader = ResponseReader
Expand Down
1 change: 0 additions & 1 deletion Sources/FetchHTTPClient/FetchHTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ enum FetchError: Error {
case TrailersUnsupported
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, *)
public final class FetchHTTPClient: HTTPAPIs.HTTPClient {
public typealias RequestWriter = RequestBodyWriter
public typealias ResponseConcludingReader = ResponseReader
Expand Down
5 changes: 1 addition & 4 deletions Sources/HTTPAPIs/AsyncWriter+AsyncReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public import AsyncStreaming

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension AsyncWriter where Self: ~Copyable, Self: ~Escapable {
/// Writes all elements from an async reader to this writer.
///
Expand All @@ -35,9 +35,6 @@ extension AsyncWriter where Self: ~Copyable, Self: ~Escapable {
/// // Copy all data from reader to writer
/// try await fileWriter.write(dataReader)
/// ```
#if compiler(<6.3)
@_lifetime(self: copy self)
#endif
public mutating func write<Reader>(
_ reader: consuming Reader
) async throws
Expand Down
8 changes: 1 addition & 7 deletions Sources/HTTPAPIs/AsyncWriter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public import AsyncStreaming

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension AsyncWriter where Self: ~Copyable, Self: ~Escapable {
/// Writes the provided element to the underlying destination.
///
Expand All @@ -34,9 +34,6 @@ extension AsyncWriter where Self: ~Copyable, Self: ~Escapable {
/// // Write data to a file asynchronously
/// try await fileWriter.write(dataChunk)
/// ```
#if compiler(<6.3)
@_lifetime(self: copy self)
#endif
public mutating func write(_ element: consuming WriteElement) async throws(WriteFailure) {
// Since the element is ~Copyable but we don't have call-once closures
// we need to move it into an Optional and then take it out once. This
Expand All @@ -61,9 +58,6 @@ extension AsyncWriter where Self: ~Copyable, Self: ~Escapable {
/// - Parameter span: The elements to write.
///
/// - Throws: An error of type `WriteFailure` if the write operation cannot be completed successfully.
#if compiler(<6.3)
@_lifetime(self: copy self)
#endif
public mutating func write(_ span: Span<WriteElement>) async throws(WriteFailure)
where WriteElement: Copyable {
do {
Expand Down
20 changes: 1 addition & 19 deletions Sources/HTTPAPIs/Client/HTTPClient+Conveniences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public import struct Foundation.URL
public import struct Foundation.Data
#endif

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension HTTPClient
where
Self: ~Copyable & ~Escapable,
Expand All @@ -42,9 +42,6 @@ where
/// - Returns: The value returned by the response handler closure.
///
/// - Throws: An error if the request fails or if the response handler throws.
#if compiler(<6.3)
@_lifetime(&self)
#endif
public mutating func perform<Return: ~Copyable>(
request: HTTPRequest,
body: consuming HTTPClientRequestBody<RequestWriter>? = nil,
Expand All @@ -69,9 +66,6 @@ where
/// - Returns: A tuple containing the HTTP response header and the collected response body data.
///
/// - Throws: An error if the request fails, if the response body exceeds the limit, or if collection fails.
#if compiler(<6.3)
@_lifetime(&self)
#endif
public mutating func get(
url: URL,
headerFields: HTTPFields = [:],
Expand Down Expand Up @@ -103,9 +97,6 @@ where
/// - Returns: A tuple containing the HTTP response header and the collected response body data.
///
/// - Throws: An error if the request fails, if the response body exceeds the limit, or if collection fails.
#if compiler(<6.3)
@_lifetime(&self)
#endif
public mutating func post(
url: URL,
headerFields: HTTPFields = [:],
Expand Down Expand Up @@ -138,9 +129,6 @@ where
/// - Returns: A tuple containing the HTTP response header and the collected response body data.
///
/// - Throws: An error if the request fails, if the response body exceeds the limit, or if collection fails.
#if compiler(<6.3)
@_lifetime(&self)
#endif
public mutating func put(
url: URL,
headerFields: HTTPFields = [:],
Expand Down Expand Up @@ -173,9 +161,6 @@ where
/// - Returns: A tuple containing the HTTP response header and the collected response body data.
///
/// - Throws: An error if the request fails, if the response body exceeds the limit, or if collection fails.
#if compiler(<6.3)
@_lifetime(&self)
#endif
public mutating func delete(
url: URL,
headerFields: HTTPFields = [:],
Expand Down Expand Up @@ -208,9 +193,6 @@ where
/// - Returns: A tuple containing the HTTP response header and the collected response body data.
///
/// - Throws: An error if the request fails, if the response body exceeds the limit, or if collection fails.
#if compiler(<6.3)
@_lifetime(&self)
#endif
public mutating func patch(
url: URL,
headerFields: HTTPFields = [:],
Expand Down
5 changes: 1 addition & 4 deletions Sources/HTTPAPIs/Client/HTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
///
/// ``HTTPClient`` provides asynchronous request execution with streaming request
/// and response bodies.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public protocol HTTPClient<RequestOptions>: Sendable, ~Copyable, ~Escapable {
associatedtype RequestOptions: HTTPClientCapability.RequestOptions

Expand Down Expand Up @@ -51,9 +51,6 @@ public protocol HTTPClient<RequestOptions>: Sendable, ~Copyable, ~Escapable {
/// - Returns: The value returned by the response handler closure.
///
/// - Throws: An error if the request fails or if the response handler throws.
#if compiler(<6.3)
@_lifetime(&self)
#endif
mutating func perform<Return: ~Copyable>(
request: HTTPRequest,
body: consuming HTTPClientRequestBody<RequestWriter>?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//

/// The namespace for all protocols defining HTTP client capabilities.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public enum HTTPClientCapability {
/// The request options protocol.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public import NetworkTypes

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension HTTPClientCapability {
/// A protocol for HTTP request options that support TLS version constraints.
public protocol TLSVersionSelection: RequestOptions {
Expand Down
2 changes: 1 addition & 1 deletion Sources/HTTPAPIs/Client/HTTPClientRequestBody+Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public import struct FoundationEssentials.Data
public import struct Foundation.Data
#endif

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension HTTPClientRequestBody where Writer: ~Copyable {
/// Creates a seekable request body from `Data`.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/HTTPAPIs/Client/HTTPClientRequestBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import AsyncStreaming
/// // Handle the response
/// }
/// ```
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public struct HTTPClientRequestBody<Writer: AsyncWriter & ~Copyable>: Sendable
where Writer.WriteElement == UInt8, Writer: SendableMetatype {
/// The body can be asked to restart writing from an arbitrary offset.
Expand Down
2 changes: 1 addition & 1 deletion Sources/HTTPAPIs/ConcludingAsyncReader+collect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public import AsyncStreaming
import BasicContainers
public import ContainersPreview

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension ConcludingAsyncReader where Self: ~Copyable, Underlying: ~Copyable {
/// Collects elements from the underlying async reader and returns both the processed result and final element.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/HTTPAPIs/ConcludingAsyncReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// provide a conclusive element after completing all reads. This is particularly useful
/// for streams that have meaningful completion states beyond just terminating, such as
/// HTTP responses that include headers after the reader finishes the body.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public protocol ConcludingAsyncReader<Underlying, FinalElement>: ~Copyable, ~Escapable {
/// The underlying asynchronous reader type that produces elements.
associatedtype Underlying: AsyncReader, ~Copyable, ~Escapable
Expand Down
6 changes: 3 additions & 3 deletions Sources/HTTPAPIs/ConcludingAsyncWriter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// provide a conclusive element after writing completes. This is particularly useful
/// for streams that have meaningful completion states, such as HTTP responses that need
/// to finalize with optional trailers.
@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
public protocol ConcludingAsyncWriter<Underlying, FinalElement>: ~Copyable, ~Escapable {
/// The underlying asynchronous writer type.
associatedtype Underlying: AsyncWriter, ~Copyable, ~Escapable
Expand Down Expand Up @@ -47,7 +47,7 @@ public protocol ConcludingAsyncWriter<Underlying, FinalElement>: ~Copyable, ~Esc
) async throws -> Return
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension ConcludingAsyncWriter where Self: ~Copyable, Underlying: ~Copyable {
/// Produces a final element using the underlying async writer without returning a separate value.
///
Expand Down Expand Up @@ -79,7 +79,7 @@ extension ConcludingAsyncWriter where Self: ~Copyable, Underlying: ~Copyable {
}
}

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
extension ConcludingAsyncWriter where Self: ~Copyable, Underlying: ~Copyable {
/// Writes a single element to the underlying writer and concludes with a final element.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/HTTPAPIs/Server/HTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//

@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *)
@available(anyAppleOS 26.0, *)
/// A protocol that defines the interface for an HTTP server.
///
/// ``HTTPServer`` provides the contract for server implementations that accept
Expand Down
Loading
Loading