diff --git a/content/docs/http2.md b/content/docs/http2.md index 51951fb..2d7dfe1 100644 --- a/content/docs/http2.md +++ b/content/docs/http2.md @@ -21,7 +21,7 @@ weight: 250 actix-web = { version = "{{< actix-version "actix-web" >}}", features = ["ssl"] } 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 [rfc section 3.2](https://http2.github.io/http2-spec/#rfc.section.3.2) is not supported. diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 75fe191..e0cd8ca 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -24,7 +24,7 @@ exclude = [ "middleware", "static-files", "websockets", - "http20", + "http2", "databases", "og_databases", "sentry", diff --git a/examples/http20/Cargo.toml b/examples/http2/Cargo.toml similarity index 91% rename from examples/http20/Cargo.toml rename to examples/http2/Cargo.toml index 7796cce..9d376ce 100644 --- a/examples/http20/Cargo.toml +++ b/examples/http2/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "http20" +name = "http2" version = "0.1.0" edition = "2018" diff --git a/examples/http20/src/main.rs b/examples/http2/src/main.rs similarity index 74% rename from examples/http20/src/main.rs rename to examples/http2/src/main.rs index 6395581..a985211 100644 --- a/examples/http20/src/main.rs +++ b/examples/http2/src/main.rs @@ -8,6 +8,8 @@ fn index(_req: HttpRequest) -> impl Responder { fn main() { // 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(); builder .set_private_key_file("key.pem", SslFiletype::PEM) @@ -16,6 +18,8 @@ fn main() { HttpServer::new(|| App::new().route("/", web::get().to(index))) .bind_ssl("127.0.0.1:8088", builder) + .unwrap() + .run() .unwrap(); } //