struct HTTPServerConfig {
...
var supportVersions: Set<HTTPVersionMajor>
...
}
public enum HTTPVersionMajor: Equatable, Hashable {
case one
case two
}
When .two appears in the supportVersions set, the HTTP server will add h2 to its supported ALPN protocols list. If the HTTP/2 client decides to use h2, the server will configure HTTP/2 streams similar to HTTP/1.1 TCP connections: each stream will get its own delegate handler.
By default, HTTPServerConfig will specify support for both HTTP/1.1 and HTTP/2.
Todo:
[ ] h2c aka HTTP/2 over TCP support. (Probably a separate PR)
This PR adds support for
h2
aka HTTP/2 over TLS via ALPN. To enable HTTP/2 support, a new fieldsupportVersions
has been added toHTTPServerConfig
.Here are the type declarations:
When
.two
appears in thesupportVersions
set, the HTTP server will addh2
to its supported ALPN protocols list. If the HTTP/2 client decides to useh2
, the server will configure HTTP/2 streams similar to HTTP/1.1 TCP connections: each stream will get its own delegate handler.By default,
HTTPServerConfig
will specify support for both HTTP/1.1 and HTTP/2.Todo:
h2c
aka HTTP/2 over TCP support. (Probably a separate PR)h2
aka websocket