1
0
mirror of https://github.com/actix/actix-website synced 2025-01-23 00:25:55 +01:00

Updates http2 chapter after testing.

This commit is contained in:
Cameron Dershem 2019-06-18 17:17:43 -04:00
parent 1e8cdcd324
commit e20f6d9d56
4 changed files with 7 additions and 3 deletions

View File

@ -21,7 +21,7 @@ weight: 250
actix-web = { version = "{{< actix-version "actix-web" >}}", features = ["ssl"] } actix-web = { version = "{{< actix-version "actix-web" >}}", features = ["ssl"] }
openssl = { version = "0.10", features = ["v110"] } openssl = { version = "0.10", features = ["v110"] }
``` ```
{{< include-example example="http20" file="main.rs" section="main" >}} {{< include-example example="http2" file="main.rs" section="main" >}}
Upgrades to *HTTP/2.0* schema described in Upgrades to *HTTP/2.0* schema described in
[rfc section 3.2](https://http2.github.io/http2-spec/#rfc.section.3.2) is not supported. [rfc section 3.2](https://http2.github.io/http2-spec/#rfc.section.3.2) is not supported.

View File

@ -24,7 +24,7 @@ exclude = [
"middleware", "middleware",
"static-files", "static-files",
"websockets", "websockets",
"http20", "http2",
"databases", "databases",
"og_databases", "og_databases",
"sentry", "sentry",

View File

@ -1,5 +1,5 @@
[package] [package]
name = "http20" name = "http2"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2018"

View File

@ -8,6 +8,8 @@ fn index(_req: HttpRequest) -> impl Responder {
fn main() { fn main() {
// load ssl keys // load ssl keys
// to create a self-signed temporary cert for testing:
// `openssl req -x509 -newkey rsa:4096 -nodes -keyout key.pem -out cert.pem -days 365 -subj '/CN=localhost'`
let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap(); let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap();
builder builder
.set_private_key_file("key.pem", SslFiletype::PEM) .set_private_key_file("key.pem", SslFiletype::PEM)
@ -16,6 +18,8 @@ fn main() {
HttpServer::new(|| App::new().route("/", web::get().to(index))) HttpServer::new(|| App::new().route("/", web::get().to(index)))
.bind_ssl("127.0.0.1:8088", builder) .bind_ssl("127.0.0.1:8088", builder)
.unwrap()
.run()
.unwrap(); .unwrap();
} }
// </main> // </main>