Abstract API: add server transport capability request option#146
Abstract API: add server transport capability request option#146nakulbajaj wants to merge 5 commits into
Conversation
| /// | ||
| /// ``HTTPVersion`` provides type-safe access to supported HTTP protocol versions, | ||
| /// allowing clients and servers to communicate version capabilities. | ||
| public enum HTTPVersion: UInt8, Sendable, Hashable { |
There was a problem hiding this comment.
| public enum HTTPVersion: UInt8, Sendable, Hashable { | |
| @nonexhaustive | |
| public enum HTTPVersion: UInt8, Sendable, Hashable { |
| /// Providing server HTTP version information allows the client to optimize | ||
| /// connection establishment. For example, if a server is known to support HTTP/3, | ||
| /// the client can attempt a QUIC connection directly. | ||
| public protocol ServerHTTPVersionCapability: RequestOptions { |
There was a problem hiding this comment.
Can we include "Hint" in the name here
6746279 to
8a363cf
Compare
| case tcp | ||
|
|
||
| /// TCP with TLS transport. | ||
| case tcpWithTLS |
There was a problem hiding this comment.
I think we don't need this case since whether the server supports TLS is already known to the user when they put http or https in the URL.
| /// capabilities. New transports may be added in future releases, so client | ||
| /// code must handle unknown cases. | ||
| @nonexhaustive | ||
| public enum TransportVersion: Sendable, Hashable { |
There was a problem hiding this comment.
Let's name it HTTPTransportProtocol since this is specific to HTTP
| public var allowsExpensiveNetworkAccess: Bool = true | ||
| public var allowsConstrainedNetworkAccess: Bool = true | ||
| public var assumesHTTP3Capable: Bool = false | ||
| public var serverSupportedTransports: Set<TransportVersion> = [] |
There was a problem hiding this comment.
We should default it to [.tcp], maybe call it a hint in the property name as well?
There was a problem hiding this comment.
Updated to serverSupportedTransportsHint and the protocol name to just ServerTransportHint, I realized it doesn't need Capability in the name
| public struct RequestOptions: HTTPClientCapability.RequestOptions { | ||
|
|
||
| public struct RequestOptions: HTTPClientCapability.ServerTransportHint { | ||
| public var serverSupportedTransportsHint: Set<NetworkTypes.HTTPTransportVersion> = [] |
There was a problem hiding this comment.
Should AHC conform or should we keep it to URLSession? Also let's make this .tcp by default as well
No description provided.