diff --git a/Cargo.toml b/Cargo.toml index ec56d7da6..88b7e201e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,4 +51,4 @@ awc = { path = "awc" } # actix-server = { path = "../actix-net/actix-server" } # Added for testing purpose while https://github.com/actix/actix-net/pull/508 is released -actix-tls = { git = "https://github.com/actix/actix-net", rev = "522a2f63b2a1ce426574d046704e537ee730a9ec" } \ No newline at end of file +actix-tls = { git = "https://github.com/actix/actix-net", rev = "1945fa06755555dfd96eb1de5b02d6ee40a81f22" } diff --git a/actix-http-test/CHANGES.md b/actix-http-test/CHANGES.md index bf50ab5f9..65678e6f7 100644 --- a/actix-http-test/CHANGES.md +++ b/actix-http-test/CHANGES.md @@ -3,8 +3,8 @@ ## Unreleased - Minimum supported Rust version (MSRV) is now 1.68 due to transitive `time` dependency. -- Updated `actix-tls` dependency to `4`. -- Updated `http` dependency to `1`. +- Updated `actix-tls` dependency to `3.2`. +- Added feature `http-1` for support to `http` crate version `1`. ## 3.1.0 diff --git a/actix-http-test/Cargo.toml b/actix-http-test/Cargo.toml index 0312f1501..1fd9ed05a 100644 --- a/actix-http-test/Cargo.toml +++ b/actix-http-test/Cargo.toml @@ -28,10 +28,13 @@ default = [] # openssl openssl = ["tls-openssl", "awc/openssl"] +# use http crate v1 +http-1 = ["dep:http-1", "awc/http-1"] + [dependencies] actix-service = "2" actix-codec = "0.5" -actix-tls = "4" +actix-tls = "3.1.1" actix-utils = "3" actix-rt = "2.2" actix-server = "2" @@ -39,7 +42,8 @@ awc = { version = "3", default-features = false } bytes = "1" futures-core = { version = "0.3.17", default-features = false } -http = "1" +http = "0.2" +http-1 = { version = "1", optional = true, package = "http" } log = "0.4" socket2 = "0.5" serde = "1" diff --git a/actix-http-test/src/lib.rs b/actix-http-test/src/lib.rs index 2f1725d1c..41213a36a 100644 --- a/actix-http-test/src/lib.rs +++ b/actix-http-test/src/lib.rs @@ -10,6 +10,9 @@ #[cfg(feature = "openssl")] extern crate tls_openssl as openssl; +#[cfg(feature = "http-1")] +extern crate http_1 as http; + use std::{net, thread, time::Duration}; use actix_codec::{AsyncRead, AsyncWrite, Framed}; diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index b2e54aa5d..2ee78e996 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -7,7 +7,8 @@ - Updated `zstd` dependency to `0.13`. - Updated `http` dependency to `1`. - Updated `h2` dependency to `0.4`. -- Updated `actix-tls` dependency to `4`. +- Updated `actix-tls` dependency to `3.2`. +- Added feature `http-1` for support to `http` crate version `1`. ### Fixed diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index 85c98c2fe..3b3cad664 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-http" -version = "3.4.0" +version = "3.5.0" authors = [ "Nikolay Kim ", "Rob Ede ", @@ -33,6 +33,9 @@ default = [] # HTTP/2 protocol support http2 = ["h2"] +# use http crate v1 +http-1 = ["dep:http-1", "dep:h2-0_4"] + # WebSocket protocol implementation ws = [ "local-channel", @@ -75,7 +78,8 @@ bytestring = "1" derive_more = "0.99.5" encoding_rs = "0.8" futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] } -http = "1" +http = "0.2" +http-1 = {version = "1", optional = true, package = "http" } httparse = "1.5.1" httpdate = "1.0.1" itoa = "1" @@ -89,7 +93,8 @@ tokio-util = { version = "0.7", features = ["io", "codec"] } tracing = { version = "0.1.30", default-features = false, features = ["log"] } # http2 -h2 = { version = "0.4", optional = true } +h2 = { version = "0.3", optional = true } +h2-0_4 = { package = "h2", version = "0.4", optional = true } # websockets local-channel = { version = "0.1", optional = true } @@ -98,7 +103,7 @@ rand = { version = "0.8", optional = true } sha1 = { version = "0.10", optional = true } # openssl/rustls -actix-tls = { version = "4", default-features = false, optional = true } +actix-tls = { version = "3.1.1", default-features = false, optional = true } # compress-* brotli = { version = "3.3.3", optional = true } @@ -108,7 +113,7 @@ zstd = { version = "0.13", optional = true } [dev-dependencies] actix-http-test = { version = "3", features = ["openssl"] } actix-server = "2" -actix-tls = { version = "4", features = ["openssl"] } +actix-tls = { version = "3.1.1", features = ["openssl"] } actix-web = "4" async-stream = "0.3" diff --git a/actix-http/src/error.rs b/actix-http/src/error.rs index fbd2eb7ae..19918e11c 100644 --- a/actix-http/src/error.rs +++ b/actix-http/src/error.rs @@ -6,6 +6,9 @@ use derive_more::{Display, Error, From}; pub use http::Error as HttpError; use http::{uri::InvalidUri, StatusCode}; +#[cfg(feature = "http-1")] +use h2_0_4 as h2; + use crate::{body::BoxBody, Response}; pub struct Error { @@ -274,7 +277,7 @@ pub enum PayloadError { /// HTTP/2 payload error. #[cfg(feature = "http2")] #[display(fmt = "{}", _0)] - Http2Payload(::h2::Error), + Http2Payload(h2::Error), /// Generic I/O error. #[display(fmt = "{}", _0)] @@ -297,8 +300,8 @@ impl std::error::Error for PayloadError { } #[cfg(feature = "http2")] -impl From<::h2::Error> for PayloadError { - fn from(err: ::h2::Error) -> Self { +impl From for PayloadError { + fn from(err: h2::Error) -> Self { PayloadError::Http2Payload(err) } } diff --git a/actix-http/src/h2/dispatcher.rs b/actix-http/src/h2/dispatcher.rs index 3e618820e..274f6a6a2 100644 --- a/actix-http/src/h2/dispatcher.rs +++ b/actix-http/src/h2/dispatcher.rs @@ -15,6 +15,9 @@ use actix_service::Service; use actix_utils::future::poll_fn; use bytes::{Bytes, BytesMut}; use futures_core::ready; +#[cfg(feature = "http-1")] +use h2_0_4 as h2; + use h2::{ server::{Connection, SendResponse}, Ping, PingPong, diff --git a/actix-http/src/h2/mod.rs b/actix-http/src/h2/mod.rs index e47099cac..7ea1da58c 100644 --- a/actix-http/src/h2/mod.rs +++ b/actix-http/src/h2/mod.rs @@ -1,4 +1,6 @@ //! HTTP/2 protocol. +#[cfg(feature = "http-1")] +use h2_0_4 as h2; use std::{ future::Future, diff --git a/actix-http/src/lib.rs b/actix-http/src/lib.rs index 382295fbc..ad3db87ab 100644 --- a/actix-http/src/lib.rs +++ b/actix-http/src/lib.rs @@ -28,6 +28,9 @@ #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] +#[cfg(feature = "http-1")] +extern crate http_1 as http; + pub use ::http::{uri, uri::Uri, Method, StatusCode, Version}; pub mod body; diff --git a/actix-http/src/payload.rs b/actix-http/src/payload.rs index 7d476c55f..883a2078b 100644 --- a/actix-http/src/payload.rs +++ b/actix-http/src/payload.rs @@ -10,6 +10,9 @@ use pin_project_lite::pin_project; use crate::error::PayloadError; +#[cfg(feature = "http-1")] +use h2_0_4 as h2; + /// A boxed payload stream. pub type BoxedPayloadStream = Pin>>>; @@ -54,8 +57,8 @@ impl From for Payload { } #[cfg(feature = "http2")] -impl From<::h2::RecvStream> for Payload { - fn from(stream: ::h2::RecvStream) -> Self { +impl From for Payload { + fn from(stream: h2::RecvStream) -> Self { Payload::H2 { payload: crate::h2::Payload::new(stream), } diff --git a/actix-router/CHANGES.md b/actix-router/CHANGES.md index 948e97665..adc489ab4 100644 --- a/actix-router/CHANGES.md +++ b/actix-router/CHANGES.md @@ -3,9 +3,7 @@ ## Unreleased - Minimum supported Rust version (MSRV) is now 1.68 due to transitive `time` dependency. - -### Changed -- Updated `http` dependency to `1`. +- Added `http-1` feature for support to `http` v1. ## 0.5.1 diff --git a/actix-router/Cargo.toml b/actix-router/Cargo.toml index 2cbb3c765..f5253a923 100644 --- a/actix-router/Cargo.toml +++ b/actix-router/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-router" -version = "0.5.1" +version = "0.5.2" authors = [ "Nikolay Kim ", "Ali MJ Al-Nasrawy ", @@ -19,16 +19,20 @@ path = "src/lib.rs" [features] default = ["http"] +# use http v1 +http-1 = ["dep:http-1"] + [dependencies] bytestring = ">=0.1.5, <2" -http = { version = "1", optional = true } +http = { version = "0.2", optional = true } +http-1 = { package = "http", version = "1", optional = true } regex = "1.5" serde = "1" tracing = { version = "0.1.30", default-features = false, features = ["log"] } [dev-dependencies] criterion = { version = "0.5", features = ["html_reports"] } -http = "1" +http = "0.2" serde = { version = "1", features = ["derive"] } percent-encoding = "2.1" diff --git a/actix-router/src/lib.rs b/actix-router/src/lib.rs index 53c0ad82a..6885c5d7a 100644 --- a/actix-router/src/lib.rs +++ b/actix-router/src/lib.rs @@ -15,10 +15,10 @@ mod resource; mod resource_path; mod router; -#[cfg(feature = "http")] +#[cfg(any(feature = "http", feature = "http-1"))] mod url; -#[cfg(feature = "http")] +#[cfg(any(feature = "http", feature = "http-1"))] pub use self::url::Url; pub use self::{ de::PathDeserializer, diff --git a/actix-router/src/url.rs b/actix-router/src/url.rs index b3d9e1121..b4ec2d83c 100644 --- a/actix-router/src/url.rs +++ b/actix-router/src/url.rs @@ -1,5 +1,8 @@ use crate::{Quoter, ResourcePath}; +#[cfg(feature = "http-1")] +use http_1 as http; + thread_local! { static DEFAULT_QUOTER: Quoter = Quoter::new(b"", b"%/+"); } diff --git a/actix-web/CHANGES.md b/actix-web/CHANGES.md index 6f4af3066..e640d3094 100644 --- a/actix-web/CHANGES.md +++ b/actix-web/CHANGES.md @@ -6,7 +6,8 @@ - Updated `zstd` dependency to `0.13`. - Compression middleware now prefers brotli over zstd over gzip. -- Updated `actix-tls` dependency to `4`. +- Updated `actix-tls` dependency to `3.2`. +- Added `http-1` feature for support to `http` crate version `1`. ### Fixed diff --git a/actix-web/Cargo.toml b/actix-web/Cargo.toml index 1f3a5d07a..09bb0bdc5 100644 --- a/actix-web/Cargo.toml +++ b/actix-web/Cargo.toml @@ -49,6 +49,11 @@ secure-cookies = ["cookies", "cookie/secure"] http2 = ["actix-http/http2"] +http-1 = [ + "actix-http/http-1", + "actix-router/http-1" +] + # TLS via OpenSSL openssl = ["http2", "actix-http/openssl", "actix-tls/accept", "actix-tls/openssl"] @@ -73,10 +78,10 @@ actix-rt = { version = "2.6", default-features = false } actix-server = "2" actix-service = "2" actix-utils = "3" -actix-tls = { version = "4.0", default-features = false, optional = true } +actix-tls = { version = "3.1.1", default-features = false, optional = true } actix-http = { version = "3.4", features = ["ws"] } -actix-router = "0.5" +actix-router = "0.5.2" actix-web-codegen = { version = "4.2", optional = true } ahash = "0.8" diff --git a/awc/CHANGES.md b/awc/CHANGES.md index 2ffddf8c4..a81873c98 100644 --- a/awc/CHANGES.md +++ b/awc/CHANGES.md @@ -4,9 +4,8 @@ - Update `trust-dns-resolver` dependency to `0.23`. - Updated `zstd` dependency to `0.13`. -- Updated `http` dependency to `1`. -- Updated `h2` dependency to `0.4`. -- Updated `actix-tls` dependency to `4`. +- Updated `actix-tls` dependency to `3.2`. +- Added feature `http-1` for support to `http` crate version `1`. ## 3.2.0 diff --git a/awc/Cargo.toml b/awc/Cargo.toml index dc853c963..7fec80def 100644 --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -21,7 +21,7 @@ path = "src/lib.rs" [package.metadata.docs.rs] # features that docs.rs will build with -features = ["openssl", "rustls-0_20", "rustls-0_21", "compress-brotli", "compress-gzip", "compress-zstd", "cookies"] +features = ["openssl", "rustls-0_20", "rustls-0_21", "compress-brotli", "compress-gzip", "compress-zstd", "cookies", "http-0", "http-1"] [features] default = ["compress-brotli", "compress-gzip", "compress-zstd", "cookies"] @@ -58,12 +58,18 @@ __compress = [] # DO NOT enable this over any internet use case. dangerous-h2c = [] +http-1 = [ + "dep:http-1", + "actix-http/http-1", + "dep:h2-0_4", +] + [dependencies] actix-codec = "0.5" actix-service = "2" -actix-http = { version = "3.4", features = ["http2", "ws"] } +actix-http = { version = "3.5", features = ["http2", "ws"] } actix-rt = { version = "2.1", default-features = false } -actix-tls = { version = "4.0", features = ["connect", "uri"] } +actix-tls = { version = "3.1.1", features = ["connect", "uri"] } actix-utils = "3" base64 = "0.21" @@ -72,8 +78,10 @@ cfg-if = "1" derive_more = "0.99.5" futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] } futures-util = { version = "0.3.17", default-features = false, features = ["alloc", "sink"] } -h2 = "0.4" -http = "1" +h2 = "0.3" +h2-0_4 = { version = "0.4", package = "h2", optional = true } +http = "0.2" +http-1 = { package = "http", version = "1", optional = true } itoa = "1" log =" 0.4" mime = "0.3" @@ -94,11 +102,11 @@ tls-rustls-0_21 = { package = "rustls", version = "0.21", optional = true, featu trust-dns-resolver = { version = "0.23", optional = true } [dev-dependencies] -actix-http = { version = "3.4", features = ["openssl"] } +actix-http = { version = "3.5", features = ["openssl"] } actix-http-test = { version = "3", features = ["openssl"] } actix-server = "2" actix-test = { version = "0.1", features = ["openssl", "rustls-0_21"] } -actix-tls = { version = "4", features = ["openssl", "rustls-0_21"] } +actix-tls = { version = "3.1.1", features = ["openssl", "rustls-0_21"] } actix-utils = "3" actix-web = { version = "4", features = ["openssl"] } diff --git a/awc/src/builder.rs b/awc/src/builder.rs index a54960382..dd76af01a 100644 --- a/awc/src/builder.rs +++ b/awc/src/builder.rs @@ -9,6 +9,9 @@ use actix_rt::net::{ActixStream, TcpStream}; use actix_service::{boxed, Service}; use base64::prelude::*; +#[cfg(feature = "http-1")] +use http_1 as http; + use crate::{ client::{ ClientConfig, ConnectInfo, Connector, ConnectorService, TcpConnectError, TcpConnection, diff --git a/awc/src/client/connection.rs b/awc/src/client/connection.rs index 5ed965bed..bbc1a3257 100644 --- a/awc/src/client/connection.rs +++ b/awc/src/client/connection.rs @@ -11,6 +11,9 @@ use actix_http::{body::MessageBody, h1::ClientCodec, Payload, RequestHeadType, R use actix_rt::task::JoinHandle; use bytes::Bytes; use futures_core::future::LocalBoxFuture; +#[cfg(feature = "http-1")] +use http_1 as http; + use h2::client::SendRequest; use super::{error::SendRequestError, h1proto, h2proto, pool::Acquired}; diff --git a/awc/src/client/connector.rs b/awc/src/client/connector.rs index 879d1895b..d5f34afe7 100644 --- a/awc/src/client/connector.rs +++ b/awc/src/client/connector.rs @@ -8,6 +8,9 @@ use std::{ time::Duration, }; +#[cfg(feature = "http-1")] +use http_1 as http; + use actix_http::Protocol; use actix_rt::{ net::{ActixStream, TcpStream}, diff --git a/awc/src/client/error.rs b/awc/src/client/error.rs index d351e1067..6085dbce7 100644 --- a/awc/src/client/error.rs +++ b/awc/src/client/error.rs @@ -4,6 +4,8 @@ use actix_http::error::{HttpError, ParseError}; #[cfg(feature = "openssl")] use actix_tls::accept::openssl::reexports::Error as OpensslError; use derive_more::{Display, From}; +#[cfg(feature = "http-1")] +use http_1 as http; use crate::BoxError; diff --git a/awc/src/client/h2proto.rs b/awc/src/client/h2proto.rs index c3f801f20..49ac6e2a6 100644 --- a/awc/src/client/h2proto.rs +++ b/awc/src/client/h2proto.rs @@ -7,6 +7,7 @@ use actix_http::{ }; use actix_utils::future::poll_fn; use bytes::Bytes; + use h2::{ client::{Builder, Connection, SendRequest}, SendStream, @@ -16,6 +17,9 @@ use http::{ request::Request, Method, Version, }; +#[cfg(feature = "http-1")] +use http_1 as http; + use log::trace; use super::{ diff --git a/awc/src/client/pool.rs b/awc/src/client/pool.rs index 2cf1f3ace..be30b30b2 100644 --- a/awc/src/client/pool.rs +++ b/awc/src/client/pool.rs @@ -19,7 +19,11 @@ use actix_rt::time::{sleep, Sleep}; use actix_service::Service; use futures_core::future::LocalBoxFuture; use futures_util::FutureExt as _; +#[cfg(feature = "http-1")] +use http_1 as http; + use http::uri::Authority; + use pin_project_lite::pin_project; use tokio::sync::{OwnedSemaphorePermit, Semaphore}; diff --git a/awc/src/lib.rs b/awc/src/lib.rs index ce2dfb34f..ea09887de 100644 --- a/awc/src/lib.rs +++ b/awc/src/lib.rs @@ -112,6 +112,9 @@ #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] +#[cfg(feature = "http-1")] +extern crate h2_0_4 as h2; + pub use actix_http::body; #[cfg(feature = "cookies")] pub use cookie;