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

Server section is as good as I'm qualified.

This commit is contained in:
Cameron Dershem 2019-06-19 20:26:25 -04:00
parent ea7bc84f8d
commit 4291b822fc
4 changed files with 13 additions and 7 deletions

View File

@ -9,3 +9,4 @@ actix-rt = "0.2"
actix-web = { version = "1.0", features = ["ssl"] }
futures = "0.1"
openssl = "0.10"
actix-http = "0.2"

View File

@ -2,19 +2,21 @@
use actix_web::{web, App, HttpResponse, HttpServer};
pub fn main() {
HttpServer::new(|| {
let one = HttpServer::new(|| {
App::new().route("/", web::get().to(|| HttpResponse::Ok()))
})
.keep_alive(75); // <- Set keep-alive to 75 seconds
HttpServer::new(|| {
App::new().route("/", web::get().to(|| HttpResponse::Ok()))
})
.keep_alive(server::KeepAlive::Tcp(75)); // <- Use `SO_KEEPALIVE` socket option.
// let _two = HttpServer::new(|| {
// App::new().route("/", web::get().to(|| HttpResponse::Ok()))
// })
// .keep_alive(); // <- Use `SO_KEEPALIVE` socket option.
HttpServer::new(|| {
let _three = HttpServer::new(|| {
App::new().route("/", web::get().to(|| HttpResponse::Ok()))
})
.keep_alive(None); // <- Disable keep-alive
one.bind("127.0.0.1:8088").unwrap().run().unwrap();
}
// </keep-alive>

View File

@ -8,3 +8,6 @@ pub fn index(req: HttpRequest) -> HttpResponse {
.finish()
}
// </example>
// ConnectionType::Close
// ConnectionType::KeepAlive
// ConnectionType::Upgrade

View File

@ -1,4 +1,4 @@
// pub mod keep_alive;
pub mod keep_alive;
// pub mod keep_alive_tp;
pub mod signals;
pub mod ssl;