mirror of
https://github.com/actix/actix-website
synced 2025-06-27 15:39:02 +02:00
Updates http2 chapter after testing.
This commit is contained in:
@ -24,7 +24,7 @@ exclude = [
|
||||
"middleware",
|
||||
"static-files",
|
||||
"websockets",
|
||||
"http20",
|
||||
"http2",
|
||||
"databases",
|
||||
"og_databases",
|
||||
"sentry",
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "http20"
|
||||
name = "http2"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
@ -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();
|
||||
}
|
||||
// </main>
|
Reference in New Issue
Block a user