From 04d0abb3c78483b45d736e945a45c6c3c17e3729 Mon Sep 17 00:00:00 2001 From: kindiana Date: Wed, 7 Mar 2018 15:38:58 +0800 Subject: [PATCH 1/2] make session an optional feature --- Cargo.toml | 7 +++++-- src/middleware/mod.rs | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a08198ba3..c64d72e49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ name = "actix_web" path = "src/lib.rs" [features] -default = [] +default = ["session"] # tls tls = ["native-tls", "tokio-tls"] @@ -35,6 +35,9 @@ tls = ["native-tls", "tokio-tls"] # openssl alpn = ["openssl", "openssl/v102", "openssl/v110", "tokio-openssl"] +# sessions +session = ["cookie/secure"] + [dependencies] actix = "^0.5.2" @@ -63,7 +66,7 @@ time = "0.1" encoding = "0.2" language-tags = "0.2" url = { version="1.7", features=["query_encoding"] } -cookie = { version="0.10", features=["percent-encode", "secure"] } +cookie = { version="0.10", features=["percent-encode"] } # io mio = "^0.6.13" diff --git a/src/middleware/mod.rs b/src/middleware/mod.rs index cfda04b9e..6f85dfeb5 100644 --- a/src/middleware/mod.rs +++ b/src/middleware/mod.rs @@ -6,12 +6,16 @@ use httprequest::HttpRequest; use httpresponse::HttpResponse; mod logger; + +#[cfg(feature = "session")] mod session; mod defaultheaders; pub mod cors; pub mod csrf; pub use self::logger::Logger; pub use self::defaultheaders::{DefaultHeaders, DefaultHeadersBuilder}; + +#[cfg(feature = "session")] pub use self::session::{RequestSession, Session, SessionImpl, SessionBackend, SessionStorage, CookieSessionError, CookieSessionBackend, CookieSessionBackendBuilder}; From 436a16a2c80acf94cb4f27d13ad71500e41131d1 Mon Sep 17 00:00:00 2001 From: messense Date: Wed, 7 Mar 2018 19:26:23 +0800 Subject: [PATCH 2/2] Use actix from crates.io in tools/wsload --- tools/wsload/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/wsload/Cargo.toml b/tools/wsload/Cargo.toml index 606615a0b..ff782817c 100644 --- a/tools/wsload/Cargo.toml +++ b/tools/wsload/Cargo.toml @@ -17,5 +17,5 @@ rand = "0.4" time = "*" num_cpus = "1" tokio-core = "0.1" -actix = { git = "https://github.com/actix/actix.git" } +actix = "0.5" actix-web = { path="../../" }