diff --git a/actix-cors/Cargo.toml b/actix-cors/Cargo.toml index bcd40008a..ec388b3eb 100644 --- a/actix-cors/Cargo.toml +++ b/actix-cors/Cargo.toml @@ -17,8 +17,9 @@ name = "actix_cors" path = "src/lib.rs" [dependencies] -actix-web = { version = "4.0.0-beta.10", default-features = false } actix-service = "2.0.0" +actix-utils = "3" +actix-web = { version = "4.0.0-beta.10", default-features = false } derive_more = "0.99.5" futures-util = { version = "0.3.7", default-features = false } @@ -28,5 +29,5 @@ smallvec = "1.6" [dev-dependencies] actix-rt = "2" -pretty_env_logger = "0.4" +env_logger = "0.9" regex = "1.4" diff --git a/actix-cors/examples/cors.rs b/actix-cors/examples/cors.rs index c2bbd11ac..2ac419447 100644 --- a/actix-cors/examples/cors.rs +++ b/actix-cors/examples/cors.rs @@ -3,7 +3,7 @@ use actix_web::{http::header, web, App, HttpServer}; #[actix_web::main] async fn main() -> std::io::Result<()> { - pretty_env_logger::init(); + env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); HttpServer::new(move || { App::new() diff --git a/actix-cors/src/builder.rs b/actix-cors/src/builder.rs index 052d490d1..da23d5196 100644 --- a/actix-cors/src/builder.rs +++ b/actix-cors/src/builder.rs @@ -2,6 +2,7 @@ use std::{ collections::HashSet, convert::TryInto, error::Error as StdError, iter::FromIterator, rc::Rc, }; +use actix_utils::future::{self, Ready}; use actix_web::{ body::MessageBody, dev::{RequestHead, Service, ServiceRequest, ServiceResponse, Transform}, @@ -9,7 +10,6 @@ use actix_web::{ http::{self, header::HeaderName, Error as HttpError, HeaderValue, Method, Uri}, Either, }; -use futures_util::future::{self, Ready}; use log::error; use once_cell::sync::Lazy; use smallvec::smallvec; diff --git a/actix-cors/src/middleware.rs b/actix-cors/src/middleware.rs index acb53b088..a38cf524c 100644 --- a/actix-cors/src/middleware.rs +++ b/actix-cors/src/middleware.rs @@ -1,5 +1,6 @@ use std::{collections::HashSet, convert::TryInto, error::Error as StdError, rc::Rc}; +use actix_utils::future::{ok, Either, Ready}; use actix_web::{ body::{AnyBody, MessageBody}, dev::{Service, ServiceRequest, ServiceResponse}, @@ -10,7 +11,7 @@ use actix_web::{ }, HttpResponse, }; -use futures_util::future::{ok, Either, FutureExt as _, LocalBoxFuture, Ready, TryFutureExt as _}; +use futures_util::future::{FutureExt as _, LocalBoxFuture, TryFutureExt as _}; use log::debug; use crate::{builder::intersperse_header_values, AllOrSome, Inner}; @@ -155,7 +156,7 @@ where if self.inner.preflight && req.method() == Method::OPTIONS { let inner = Rc::clone(&self.inner); let res = Self::handle_preflight(&inner, req); - Either::Left(ok(res)) + Either::left(ok(res)) } else { let origin = req.headers().get(header::ORIGIN).cloned(); @@ -163,7 +164,7 @@ where // Only check requests with a origin header. if let Err(err) = self.inner.validate_origin(req.head()) { debug!("origin validation failed; inner service is not called"); - return Either::Left(ok(req.error_response(err))); + return Either::left(ok(req.error_response(err))); } } @@ -183,7 +184,7 @@ where .map_ok(|res| res.map_body(|_, body| AnyBody::new_boxed(body))) .boxed_local(); - Either::Right(res) + Either::right(res) } } } diff --git a/actix-cors/tests/tests.rs b/actix-cors/tests/tests.rs index df0a002a3..00d5a2f1c 100644 --- a/actix-cors/tests/tests.rs +++ b/actix-cors/tests/tests.rs @@ -1,11 +1,11 @@ use actix_service::fn_service; +use actix_utils::future::ok; use actix_web::{ dev::{ServiceRequest, Transform}, http::{header, HeaderValue, Method, StatusCode}, test::{self, TestRequest}, HttpResponse, }; -use futures_util::future::ok; use regex::bytes::Regex; use actix_cors::Cors; diff --git a/actix-identity/Cargo.toml b/actix-identity/Cargo.toml index d19db3bb7..56020e1f5 100644 --- a/actix-identity/Cargo.toml +++ b/actix-identity/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Nikolay Kim "] description = "Identity service for Actix web" keywords = ["actix", "auth", "identity", "web", "security"] homepage = "https://actix.rs" -repository = "https://github.com/actix/actix-extras" +repository = "https://github.com/actix/actix-extras.git" license = "MIT OR Apache-2.0" edition = "2018" @@ -15,6 +15,7 @@ path = "src/lib.rs" [dependencies] actix-service = "2.0.0" +actix-utils = "3" actix-web = { version = "4.0.0-beta.10", default-features = false, features = ["cookies", "secure-cookies"] } futures-util = { version = "0.3.7", default-features = false } serde = "1.0" diff --git a/actix-identity/src/cookie.rs b/actix-identity/src/cookie.rs index e4d818e77..91b889f55 100644 --- a/actix-identity/src/cookie.rs +++ b/actix-identity/src/cookie.rs @@ -1,6 +1,6 @@ use std::{rc::Rc, time::SystemTime}; -use futures_util::future::{ready, Ready}; +use actix_utils::future::{ready, Ready}; use serde::{Deserialize, Serialize}; use time::Duration; diff --git a/actix-identity/src/identity.rs b/actix-identity/src/identity.rs index 667c04c10..8c8075579 100644 --- a/actix-identity/src/identity.rs +++ b/actix-identity/src/identity.rs @@ -2,7 +2,7 @@ use actix_web::{ dev::{Extensions, Payload}, Error, FromRequest, HttpRequest, }; -use futures_util::future::{ready, Ready}; +use actix_utils::future::{ready, Ready}; pub(crate) struct IdentityItem { pub(crate) id: Option, diff --git a/actix-identity/src/middleware.rs b/actix-identity/src/middleware.rs index 6886409e6..7bcfb61e8 100644 --- a/actix-identity/src/middleware.rs +++ b/actix-identity/src/middleware.rs @@ -1,11 +1,12 @@ use std::{error::Error as StdError, rc::Rc}; +use actix_utils::future::{ready, Ready}; use actix_web::{ body::{AnyBody, MessageBody}, dev::{Service, ServiceRequest, ServiceResponse, Transform}, Error, HttpMessage, Result, }; -use futures_util::future::{ready, FutureExt as _, LocalBoxFuture, Ready, TryFutureExt as _}; +use futures_util::future::{FutureExt as _, LocalBoxFuture, TryFutureExt as _}; use crate::{identity::IdentityItem, IdentityPolicy}; @@ -129,7 +130,8 @@ mod tests { #[actix_rt::test] async fn test_borrowed_mut_error() { - use futures_util::future::{lazy, ok, Ready}; + use actix_utils::future::{ok, Ready}; + use futures_util::future::lazy; struct Ident; impl IdentityPolicy for Ident { diff --git a/actix-protobuf/Cargo.toml b/actix-protobuf/Cargo.toml index fd22d9bf2..0cf95e716 100644 --- a/actix-protobuf/Cargo.toml +++ b/actix-protobuf/Cargo.toml @@ -9,7 +9,7 @@ authors = [ description = "Protobuf support for Actix web" keywords = ["actix", "protobuf", "protocol", "rpc"] homepage = "https://actix.rs" -repository = "https://github.com/actix/actix-extras" +repository = "https://github.com/actix/actix-extras.git" license = "MIT OR Apache-2.0" exclude = [".cargo/config", "/examples/**"] diff --git a/actix-redis/Cargo.toml b/actix-redis/Cargo.toml index 54df28a69..c8e46fadb 100644 --- a/actix-redis/Cargo.toml +++ b/actix-redis/Cargo.toml @@ -6,7 +6,7 @@ description = "Redis integration for Actix and session store for Actix Web" license = "MIT OR Apache-2.0" keywords = ["actix", "redis", "async", "session"] homepage = "https://actix.rs" -repository = "https://github.com/actix/actix-extras" +repository = "https://github.com/actix/actix-extras.git" categories = ["network-programming", "asynchronous"] exclude = [".cargo/config"] edition = "2018" diff --git a/actix-session/Cargo.toml b/actix-session/Cargo.toml index 34eba3ba2..5ca7ad0b9 100644 --- a/actix-session/Cargo.toml +++ b/actix-session/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Nikolay Kim "] description = "Sessions for Actix web" keywords = ["http", "web", "framework", "async", "session"] homepage = "https://actix.rs" -repository = "https://github.com/actix/actix-extras" +repository = "https://github.com/actix/actix-extras.git" license = "MIT OR Apache-2.0" edition = "2018" @@ -18,8 +18,9 @@ default = ["cookie-session"] cookie-session = ["actix-web/secure-cookies"] [dependencies] -actix-web = { version = "4.0.0-beta.10", default_features = false, features = ["cookies"] } actix-service = "2.0.0" +actix-utils = "3" +actix-web = { version = "4.0.0-beta.10", default_features = false, features = ["cookies"] } derive_more = "0.99.5" futures-util = { version = "0.3.7", default-features = false } diff --git a/actix-session/src/cookie.rs b/actix-session/src/cookie.rs index bda4e54d6..01888f494 100644 --- a/actix-session/src/cookie.rs +++ b/actix-session/src/cookie.rs @@ -2,6 +2,7 @@ use std::{collections::HashMap, error::Error as StdError, rc::Rc}; +use actix_utils::future::{ok, Ready}; use actix_web::{ body::{AnyBody, MessageBody}, cookie::{Cookie, CookieJar, Key, SameSite}, @@ -10,7 +11,7 @@ use actix_web::{ Error, ResponseError, }; use derive_more::Display; -use futures_util::future::{ok, FutureExt as _, LocalBoxFuture, Ready}; +use futures_util::future::{FutureExt as _, LocalBoxFuture}; use serde_json::error::Error as JsonError; use time::{Duration, OffsetDateTime}; diff --git a/actix-session/src/lib.rs b/actix-session/src/lib.rs index ee375b56d..2989377eb 100644 --- a/actix-session/src/lib.rs +++ b/actix-session/src/lib.rs @@ -49,11 +49,11 @@ use std::{ rc::Rc, }; +use actix_utils::future::{ok, Ready}; use actix_web::{ dev::{Extensions, Payload, RequestHead, ServiceRequest, ServiceResponse}, Error, FromRequest, HttpMessage, HttpRequest, }; -use futures_util::future::{ok, Ready}; use serde::{de::DeserializeOwned, Serialize}; #[cfg(feature = "cookie-session")] diff --git a/actix-web-httpauth/Cargo.toml b/actix-web-httpauth/Cargo.toml index 3f2366d04..53c05d236 100644 --- a/actix-web-httpauth/Cargo.toml +++ b/actix-web-httpauth/Cargo.toml @@ -18,10 +18,13 @@ name = "actix_web_httpauth" path = "src/lib.rs" [dependencies] -actix-web = { version = "4.0.0-beta.10", default_features = false } actix-service = "2.0.0" +actix-utils = "3" +actix-web = { version = "4.0.0-beta.10", default_features = false } + base64 = "0.13" futures-util = { version = "0.3.7", default-features = false } +futures-core = { version = "0.3.7", default-features = false } pin-project-lite = "0.2.7" [dev-dependencies] diff --git a/actix-web-httpauth/src/extractors/basic.rs b/actix-web-httpauth/src/extractors/basic.rs index e8156e660..817cc5175 100644 --- a/actix-web-httpauth/src/extractors/basic.rs +++ b/actix-web-httpauth/src/extractors/basic.rs @@ -2,10 +2,10 @@ use std::borrow::Cow; +use actix_utils::future::{ready, Ready}; use actix_web::dev::{Payload, ServiceRequest}; use actix_web::http::header::Header; use actix_web::{FromRequest, HttpRequest}; -use futures_util::future::{ready, Ready}; use super::config::AuthExtractorConfig; use super::errors::AuthenticationError; diff --git a/actix-web-httpauth/src/extractors/bearer.rs b/actix-web-httpauth/src/extractors/bearer.rs index ec67ee919..04b86ec16 100644 --- a/actix-web-httpauth/src/extractors/bearer.rs +++ b/actix-web-httpauth/src/extractors/bearer.rs @@ -1,19 +1,17 @@ //! Extractor for the "Bearer" HTTP Authentication Scheme -use std::borrow::Cow; -use std::default::Default; +use std::{borrow::Cow, default::Default}; -use actix_web::dev::{Payload, ServiceRequest}; -use actix_web::http::header::Header; -use actix_web::{FromRequest, HttpRequest}; -use futures_util::future::{ready, Ready}; +use actix_utils::future::{ready, Ready}; +use actix_web::{ + dev::{Payload, ServiceRequest}, + http::header::Header, + FromRequest, HttpRequest, +}; -use super::config::AuthExtractorConfig; -use super::errors::AuthenticationError; -use super::AuthExtractor; -use crate::headers::authorization; -use crate::headers::www_authenticate::bearer; +use super::{config::AuthExtractorConfig, errors::AuthenticationError, AuthExtractor}; pub use crate::headers::www_authenticate::bearer::Error; +use crate::headers::{authorization, www_authenticate::bearer}; /// [BearerAuth](./struct/BearerAuth.html) extractor configuration. #[derive(Debug, Clone, Default)] diff --git a/actix-web-httpauth/src/extractors/mod.rs b/actix-web-httpauth/src/extractors/mod.rs index 497cc983d..9114b1570 100644 --- a/actix-web-httpauth/src/extractors/mod.rs +++ b/actix-web-httpauth/src/extractors/mod.rs @@ -8,7 +8,7 @@ use std::{ use actix_web::dev::ServiceRequest; use actix_web::Error; -use futures_util::ready; +use futures_core::ready; use pin_project_lite::pin_project; pub mod basic; diff --git a/actix-web-httpauth/src/middleware.rs b/actix-web-httpauth/src/middleware.rs index 3072fd846..987d46253 100644 --- a/actix-web-httpauth/src/middleware.rs +++ b/actix-web-httpauth/src/middleware.rs @@ -1,7 +1,13 @@ //! HTTP Authentication middleware. use std::{ - error::Error as StdError, future::Future, marker::PhantomData, pin::Pin, rc::Rc, sync::Arc, + error::Error as StdError, + future::Future, + marker::PhantomData, + pin::Pin, + rc::Rc, + sync::Arc, + task::{Context, Poll}, }; use actix_web::{ @@ -9,11 +15,8 @@ use actix_web::{ dev::{Service, ServiceRequest, ServiceResponse, Transform}, Error, }; -use futures_util::{ - future::{self, FutureExt as _, LocalBoxFuture, TryFutureExt as _}, - ready, - task::{Context, Poll}, -}; +use futures_core::ready; +use futures_util::future::{self, FutureExt as _, LocalBoxFuture, TryFutureExt as _}; use crate::extractors::{basic, bearer, AuthExtractor};