mirror of https://github.com/fafhrd91/actix-web
Make 'ws' feature of actix-http optional
This commit is contained in:
parent
522f60fa8c
commit
3eac500591
|
@ -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 }
|
||||
|
||||
|
|
|
@ -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<BoxBody> {
|
||||
Response::from(self).map_into_boxed_body().into()
|
||||
|
|
Loading…
Reference in New Issue