1
0
mirror of https://github.com/actix/actix-website synced 2024-11-24 00:41:07 +01:00
actix-website/docs/http2.md

39 lines
1.5 KiB
Markdown
Raw Normal View History

2018-05-22 23:15:08 +02:00
---
2020-09-12 17:21:54 +02:00
title: HTTP/2
2018-05-22 23:15:08 +02:00
---
import RenderCodeBlock from '@theme/CodeBlock';
import CodeBlock from '@site/src/components/code_block.js';
import { actixWebMajorVersion } from "@site/vars";
`actix-web` automatically upgrades connections to *HTTP/2* if possible.
2018-05-22 23:15:08 +02:00
# Negotiation
2020-09-12 17:21:54 +02:00
<!-- TODO: use rustls example -->
2022-02-26 05:41:49 +01:00
2022-03-07 14:40:36 +01:00
When either of the `rustls` or `openssl` features are enabled, `HttpServer` provides the [bind_rustls][bindrustls] method and [bind_openssl][bindopenssl] methods, respectively.
2018-05-22 23:15:08 +02:00
<!-- DEPENDENCY -->
<RenderCodeBlock className="language-toml">
{`[dependencies]
actix-web = { version = "${actixWebMajorVersion}", features = ["openssl"] }
2018-05-22 23:15:08 +02:00
openssl = { version = "0.10", features = ["v110"] }
`}
</RenderCodeBlock>
2022-02-26 05:41:49 +01:00
<CodeBlock example="http2" file="main.rs" section="main" />
2018-05-22 23:15:08 +02:00
2022-03-21 02:54:49 +01:00
Upgrades to HTTP/2 described in [RFC 7540 §3.2][rfcsection32] are not supported. Starting HTTP/2 with prior knowledge is supported for both cleartext and TLS connections ([RFC 7540 §3.4][rfcsection34]) (when using the lower level `actix-http` service builders).
2018-05-22 23:15:08 +02:00
2022-03-21 02:54:49 +01:00
> Check out [the TLS examples][examples] for concrete example.
2022-03-21 02:54:49 +01:00
[rfcsection32]: https://httpwg.org/specs/rfc7540.html#rfc.section.3.2
[rfcsection34]: https://httpwg.org/specs/rfc7540.html#rfc.section.3.4
2022-03-07 14:40:36 +01:00
[bindrustls]: https://docs.rs/actix-web/4/actix_web/struct.HttpServer.html#method.bind_rustls
2022-03-06 00:55:35 +01:00
[bindopenssl]: https://docs.rs/actix-web/4/actix_web/struct.HttpServer.html#method.bind_openssl
[tlsalpn]: https://tools.ietf.org/html/rfc7301
2022-03-21 02:54:49 +01:00
[examples]: https://github.com/actix/examples/tree/master/https-tls