From 48ef4d7a2686bd0500e091c1e041542d32280a7f Mon Sep 17 00:00:00 2001 From: Maxim Vorobjov Date: Thu, 27 Feb 2020 02:34:49 +0200 Subject: [PATCH] Add actix-http support for actix error messages (#1379) * Moved actix-http for actix from actix crate * remove resolver feature * renamed actix feature to actor * fixed doc attr for actors, add documentation --- MIGRATION.md | 2 ++ actix-http/CHANGES.md | 2 ++ actix-http/Cargo.toml | 6 +++++- actix-http/src/error.rs | 10 ++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/MIGRATION.md b/MIGRATION.md index aef382a21..86721e0eb 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -3,6 +3,8 @@ * Setting a cookie's SameSite property, explicitly, to `SameSite::None` will now result in `SameSite=None` being sent with the response Set-Cookie header. To create a cookie without a SameSite attribute, remove any calls setting same_site. +* actix-http support for Actors messages was moved to actix-http crate and is enabled + with feature `actors` ## 2.0.0 diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 4e8d7fd42..f2ef217c1 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -6,6 +6,8 @@ * Update the `time` dependency to 0.2.7 +* Moved actors messages support from actix crate, enabled with feature `actors`. + ### Fixed * Allow `SameSite=None` cookies to be sent in a response. diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index 81203a2f4..afdb548f5 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -15,7 +15,7 @@ license = "MIT/Apache-2.0" edition = "2018" [package.metadata.docs.rs] -features = ["openssl", "rustls", "failure", "compress", "secure-cookies"] +features = ["openssl", "rustls", "failure", "compress", "secure-cookies","actors"] [lib] name = "actix_http" @@ -39,6 +39,9 @@ failure = ["fail-ure"] # support for secure cookies secure-cookies = ["ring"] +# support for actix Actor messages +actors = ["actix"] + [dependencies] actix-service = "1.0.1" actix-codec = "0.2.0" @@ -47,6 +50,7 @@ actix-utils = "1.0.3" actix-rt = "1.0.0" actix-threadpool = "0.3.1" actix-tls = { version = "1.0.0", optional = true } +actix = { version = "0.10.0-alpha.1", optional = true } base64 = "0.11" bitflags = "1.2" diff --git a/actix-http/src/error.rs b/actix-http/src/error.rs index c19aef2aa..4b8f13cf0 100644 --- a/actix-http/src/error.rs +++ b/actix-http/src/error.rs @@ -951,6 +951,16 @@ where /// Compatibility for `failure::Error` impl ResponseError for fail_ure::Error {} +#[cfg(feature = "actors")] +/// `InternalServerError` for `actix::MailboxError` +/// This is supported on feature=`actors` only +impl ResponseError for actix::MailboxError {} + +#[cfg(feature = "actors")] +/// `InternalServerError` for `actix::ResolverError` +/// This is supported on feature=`actors` only +impl ResponseError for actix::actors::resolver::ResolverError {} + #[cfg(test)] mod tests { use super::*;