From 3eac500591544b0dac64b8f99db0dca3f0fc4a64 Mon Sep 17 00:00:00 2001 From: George Pollard Date: Wed, 20 Aug 2025 11:03:21 +1200 Subject: [PATCH 1/3] Make 'ws' feature of actix-http optional --- actix-web/Cargo.toml | 6 +++++- actix-web/src/error/response_error.rs | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) 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() From 9e2e3daa88e2c336f7b34044fe48b959b8e50104 Mon Sep 17 00:00:00 2001 From: George Pollard Date: Wed, 20 Aug 2025 11:06:44 +1200 Subject: [PATCH 2/3] Update CHANGES.md --- actix-web/CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/actix-web/CHANGES.md b/actix-web/CHANGES.md index ab40eea98..10e4ef2e8 100644 --- a/actix-web/CHANGES.md +++ b/actix-web/CHANGES.md @@ -12,6 +12,7 @@ - Ignore `Host` header in `Host` guard when connection protocol is HTTP/2. - Re-export `mime` dependency. - Update `brotli` dependency to `8`. +- Make `ws` feature of `actix-http` optional (controlled by `ws` feature in `actix-web`). ## 4.10.2 From 56465819d2229b12d64afdf4572746de4c8f863f Mon Sep 17 00:00:00 2001 From: George Pollard Date: Wed, 20 Aug 2025 11:13:48 +1200 Subject: [PATCH 3/3] Update actix-web-actors --- actix-web-actors/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actix-web-actors/Cargo.toml b/actix-web-actors/Cargo.toml index 61d454b55..c8ff628de 100644 --- a/actix-web-actors/Cargo.toml +++ b/actix-web-actors/Cargo.toml @@ -24,7 +24,7 @@ allowed_external_types = [ actix = { version = ">=0.12, <0.14", default-features = false } actix-codec = "0.5" actix-http = "3" -actix-web = { version = "4", default-features = false } +actix-web = { version = "4", default-features = false, features = ["ws"] } bytes = "1" bytestring = "1"