diff --git a/examples/server/Cargo.toml b/examples/server/Cargo.toml index 95e9a7c..d3bfa22 100644 --- a/examples/server/Cargo.toml +++ b/examples/server/Cargo.toml @@ -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" diff --git a/examples/server/src/keep_alive.rs b/examples/server/src/keep_alive.rs index 86aa88f..d997286 100644 --- a/examples/server/src/keep_alive.rs +++ b/examples/server/src/keep_alive.rs @@ -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(); } // diff --git a/examples/server/src/keep_alive_tp.rs b/examples/server/src/keep_alive_tp.rs index 252c53c..19287ee 100644 --- a/examples/server/src/keep_alive_tp.rs +++ b/examples/server/src/keep_alive_tp.rs @@ -8,3 +8,6 @@ pub fn index(req: HttpRequest) -> HttpResponse { .finish() } // +// ConnectionType::Close +// ConnectionType::KeepAlive +// ConnectionType::Upgrade diff --git a/examples/server/src/main.rs b/examples/server/src/main.rs index 735f613..6d43ee1 100644 --- a/examples/server/src/main.rs +++ b/examples/server/src/main.rs @@ -1,4 +1,4 @@ -// pub mod keep_alive; +pub mod keep_alive; // pub mod keep_alive_tp; pub mod signals; pub mod ssl;