1
0
mirror of https://github.com/actix/actix-website synced 2024-11-27 18:12:57 +01:00

update http2 docs

This commit is contained in:
Rob Ede 2022-03-07 13:40:36 +00:00
parent 1f94bb7ce6
commit 91f1158c69
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933

View File

@ -4,17 +4,13 @@ menu: docs_protocols
weight: 250
---
`actix-web` automatically upgrades connections to _HTTP/2_ if possible.
Actix Web will prefer HTTP/2 connections if the client signals support for it via [TLS ALPN][tlsalpn].
# Negotiation
_HTTP/2_ protocol over TLS without prior knowledge requires [TLS ALPN][tlsalpn].
<!-- TODO: use rustls example -->
> Currently, only `rust-openssl` has support.
`alpn` negotiation requires enabling the feature. When enabled, `HttpServer` provides the [bind_openssl][bindopenssl] method.
When either of the `rustls` or `openssl` features are enabled, `HttpServer` provides the [bind_rustls][bindrustls] method and [bind_openssl][bindopenssl] methods, respectively.
```toml
[dependencies]
@ -24,12 +20,13 @@ openssl = { version = "0.10", features = ["v110"] }
{{< include-example example="http2" file="main.rs" section="main" >}}
Upgrades to _HTTP/2.0_ schema described in [rfc section 3.2][rfcsection32] is not supported. Starting _HTTP/2_ with prior knowledge is supported for both clear text connection and tls connection. [rfc section 3.4][rfcsection34].
Upgrades to HTTP/2 described in [RFC §3.2][rfcsection32] are not supported. Starting HTTP/2 with prior knowledge is supported for both cleartext and TLS connections ([RFC §3.4][rfcsection34]) (when using the lower level `actix-http` service builders).
> Check out [examples/tls][examples] for a concrete example.
[rfcsection32]: https://http2.github.io/http2-spec/#rfc.section.3.2
[rfcsection34]: https://http2.github.io/http2-spec/#rfc.section.3.4
[bindrustls]: https://docs.rs/actix-web/4/actix_web/struct.HttpServer.html#method.bind_rustls
[bindopenssl]: https://docs.rs/actix-web/4/actix_web/struct.HttpServer.html#method.bind_openssl
[tlsalpn]: https://tools.ietf.org/html/rfc7301
[examples]: https://github.com/actix/examples/tree/master/https-tls/rustls