diff --git a/rustls/Cargo.toml b/rustls/Cargo.toml index 1acd1820..477cb3d2 100644 --- a/rustls/Cargo.toml +++ b/rustls/Cargo.toml @@ -10,6 +10,6 @@ path = "src/main.rs" [dependencies] env_logger = "0.5" -rustls = "0.13" +rustls = "0.14" actix = "0.7" actix-web = { version = "0.7", features=["rust-tls"] } diff --git a/rustls/src/main.rs b/rustls/src/main.rs index 47dbb177..58220215 100644 --- a/rustls/src/main.rs +++ b/rustls/src/main.rs @@ -9,6 +9,7 @@ use std::io::BufReader; use actix_web::{http, middleware, server, App, Error, HttpRequest, HttpResponse}; use rustls::internal::pemfile::{certs, rsa_private_keys}; use rustls::{NoClientAuth, ServerConfig}; +use server::ServerFlags; use actix_web::fs::StaticFiles; @@ -36,7 +37,10 @@ fn main() { config.set_single_cert(cert_chain, keys.remove(0)).unwrap(); // actix acceptor - let acceptor = server::RustlsAcceptor::new(config); + let acceptor = server::RustlsAcceptor::with_flags( + config, + ServerFlags::HTTP1 | ServerFlags::HTTP2, + ); server::new(|| { App::new() @@ -51,7 +55,7 @@ fn main() { .finish() })) .handler("/static", StaticFiles::new("static").unwrap()) - }).bind_with("127.0.0.1:8443", acceptor) + }).bind_with("127.0.0.1:8443", move || acceptor.clone()) .unwrap() .start();