diff --git a/actix-web/Cargo.toml b/actix-web/Cargo.toml index 7ed774acc..75d4f5abd 100644 --- a/actix-web/Cargo.toml +++ b/actix-web/Cargo.toml @@ -68,6 +68,7 @@ default = [ "http2", "unicode", "compat", + "ws", ] # Brotli algorithm content-encoding support @@ -89,6 +90,9 @@ secure-cookies = ["cookies", "cookie/secure"] # HTTP/2 support (including h2c). http2 = ["actix-http/http2"] +# Websockets support +ws = ["actix-http/ws"] + # TLS via OpenSSL openssl = ["__tls", "http2", "actix-http/openssl", "actix-tls/accept", "actix-tls/openssl"] @@ -132,7 +136,7 @@ actix-service = "2" actix-tls = { version = "3.4", default-features = false, optional = true } actix-utils = "3" -actix-http = { version = "3.11", features = ["ws"] } +actix-http = { version = "3.11" } actix-router = { version = "0.5.3", default-features = false, features = ["http"] } actix-web-codegen = { version = "4.3", optional = true, default-features = false } diff --git a/actix-web/src/error/response_error.rs b/actix-web/src/error/response_error.rs index f5d8cf467..0b7d67153 100644 --- a/actix-web/src/error/response_error.rs +++ b/actix-web/src/error/response_error.rs @@ -7,6 +7,7 @@ use std::{ io::{self, Write as _}, }; +#[cfg(feature = "ws")] use actix_http::Response; use bytes::BytesMut; @@ -126,6 +127,7 @@ impl ResponseError for actix_http::error::PayloadError { } } +#[cfg(feature = "ws")] impl ResponseError for actix_http::ws::ProtocolError {} impl ResponseError for actix_http::error::ContentTypeError { @@ -134,6 +136,7 @@ impl ResponseError for actix_http::error::ContentTypeError { } } +#[cfg(feature = "ws")] impl ResponseError for actix_http::ws::HandshakeError { fn error_response(&self) -> HttpResponse { Response::from(self).map_into_boxed_body().into()