diff --git a/.github/workflows/upload-doc.yml b/.github/workflows/upload-doc.yml
index 07f839e34..c47ea1d70 100644
--- a/.github/workflows/upload-doc.yml
+++ b/.github/workflows/upload-doc.yml
@@ -28,7 +28,7 @@ jobs:
run: echo '' > target/doc/index.html
- name: Deploy to GitHub Pages
- uses: JamesIves/github-pages-deploy-action@v4.4.0
+ uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
folder: target/doc
single-commit: true
diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml
index 30e436160..a8b888ef4 100644
--- a/actix-http/Cargo.toml
+++ b/actix-http/Cargo.toml
@@ -77,6 +77,8 @@ mime = "0.3"
percent-encoding = "2.1"
pin-project-lite = "0.2"
smallvec = "1.6.1"
+tokio = { version = "1.13.1", features = [] }
+tokio-util = { version = "0.7", features = ["io", "codec"] }
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
# http2
diff --git a/actix-http/examples/ws.rs b/actix-http/examples/ws.rs
index c4f0503cd..6af6d5095 100644
--- a/actix-http/examples/ws.rs
+++ b/actix-http/examples/ws.rs
@@ -10,13 +10,13 @@ use std::{
time::Duration,
};
-use actix_codec::Encoder;
use actix_http::{body::BodyStream, error::Error, ws, HttpService, Request, Response};
use actix_rt::time::{interval, Interval};
use actix_server::Server;
use bytes::{Bytes, BytesMut};
use bytestring::ByteString;
use futures_core::{ready, Stream};
+use tokio_util::codec::Encoder;
use tracing::{info, trace};
#[actix_rt::main]
diff --git a/actix-http/src/h1/client.rs b/actix-http/src/h1/client.rs
index 75c88d00c..6a0d531d0 100644
--- a/actix-http/src/h1/client.rs
+++ b/actix-http/src/h1/client.rs
@@ -1,9 +1,9 @@
use std::{fmt, io};
-use actix_codec::{Decoder, Encoder};
use bitflags::bitflags;
use bytes::{Bytes, BytesMut};
use http::{Method, Version};
+use tokio_util::codec::{Decoder, Encoder};
use super::{
decoder::{self, PayloadDecoder, PayloadItem, PayloadType},
diff --git a/actix-http/src/h1/codec.rs b/actix-http/src/h1/codec.rs
index 80afd7455..e11f175c9 100644
--- a/actix-http/src/h1/codec.rs
+++ b/actix-http/src/h1/codec.rs
@@ -1,9 +1,9 @@
use std::{fmt, io};
-use actix_codec::{Decoder, Encoder};
use bitflags::bitflags;
use bytes::BytesMut;
use http::{Method, Version};
+use tokio_util::codec::{Decoder, Encoder};
use super::{
decoder::{self, PayloadDecoder, PayloadItem, PayloadType},
diff --git a/actix-http/src/h1/dispatcher.rs b/actix-http/src/h1/dispatcher.rs
index 81090667d..60660b85b 100644
--- a/actix-http/src/h1/dispatcher.rs
+++ b/actix-http/src/h1/dispatcher.rs
@@ -8,13 +8,15 @@ use std::{
task::{Context, Poll},
};
-use actix_codec::{AsyncRead, AsyncWrite, Decoder as _, Encoder as _, Framed, FramedParts};
+use actix_codec::{Framed, FramedParts};
use actix_rt::time::sleep_until;
use actix_service::Service;
use bitflags::bitflags;
use bytes::{Buf, BytesMut};
use futures_core::ready;
use pin_project_lite::pin_project;
+use tokio::io::{AsyncRead, AsyncWrite};
+use tokio_util::codec::{Decoder as _, Encoder as _};
use tracing::{error, trace};
use crate::{
@@ -1004,7 +1006,7 @@ where
this.read_buf.reserve(HW_BUFFER_SIZE - remaining);
}
- match actix_codec::poll_read_buf(io.as_mut(), cx, this.read_buf) {
+ match tokio_util::io::poll_read_buf(io.as_mut(), cx, this.read_buf) {
Poll::Ready(Ok(n)) => {
this.flags.remove(Flags::FINISHED);
diff --git a/actix-http/src/ws/codec.rs b/actix-http/src/ws/codec.rs
index 4a2e741b6..6a149f9a4 100644
--- a/actix-http/src/ws/codec.rs
+++ b/actix-http/src/ws/codec.rs
@@ -1,7 +1,7 @@
-use actix_codec::{Decoder, Encoder};
use bitflags::bitflags;
use bytes::{Bytes, BytesMut};
use bytestring::ByteString;
+use tokio_util::codec::{Decoder, Encoder};
use tracing::error;
use super::{
diff --git a/actix-http/src/ws/dispatcher.rs b/actix-http/src/ws/dispatcher.rs
index 2f6b2363b..396f1e86c 100644
--- a/actix-http/src/ws/dispatcher.rs
+++ b/actix-http/src/ws/dispatcher.rs
@@ -76,7 +76,9 @@ mod inner {
use pin_project_lite::pin_project;
use tracing::debug;
- use actix_codec::{AsyncRead, AsyncWrite, Decoder, Encoder, Framed};
+ use actix_codec::Framed;
+ use tokio::io::{AsyncRead, AsyncWrite};
+ use tokio_util::codec::{Decoder, Encoder};
use crate::{body::BoxBody, Response};
diff --git a/actix-web-actors/Cargo.toml b/actix-web-actors/Cargo.toml
index 8222fc864..26b1c09de 100644
--- a/actix-web-actors/Cargo.toml
+++ b/actix-web-actors/Cargo.toml
@@ -24,6 +24,7 @@ bytestring = "1"
futures-core = { version = "0.3.7", default-features = false }
pin-project-lite = "0.2"
tokio = { version = "1.13.1", features = ["sync"] }
+tokio-util = { version = "0.7", features = ["codec"] }
[dev-dependencies]
actix-rt = "2.2"
diff --git a/actix-web-actors/src/ws.rs b/actix-web-actors/src/ws.rs
index 9a4880159..e1110eddb 100644
--- a/actix-web-actors/src/ws.rs
+++ b/actix-web-actors/src/ws.rs
@@ -74,7 +74,6 @@ use actix::{
Actor, ActorContext, ActorState, Addr, AsyncContext, Handler, Message as ActixMessage,
SpawnHandle,
};
-use actix_codec::{Decoder as _, Encoder as _};
use actix_http::ws::{hash_key, Codec};
pub use actix_http::ws::{
CloseCode, CloseReason, Frame, HandshakeError, Message, ProtocolError,
@@ -92,6 +91,7 @@ use bytestring::ByteString;
use futures_core::Stream;
use pin_project_lite::pin_project;
use tokio::sync::oneshot;
+use tokio_util::codec::{Decoder as _, Encoder as _};
/// Builder for Websocket session response.
///
diff --git a/actix-web/src/http/header/accept.rs b/actix-web/src/http/header/accept.rs
index 744c9b6e8..1be136b19 100644
--- a/actix-web/src/http/header/accept.rs
+++ b/actix-web/src/http/header/accept.rs
@@ -6,8 +6,7 @@ use super::{common_header, QualityItem};
use crate::http::header;
common_header! {
- /// `Accept` header, defined
- /// in [RFC 7231 §5.3.2](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2)
+ /// `Accept` header, defined in [RFC 7231 §5.3.2].
///
/// The `Accept` header field can be used by user agents to specify
/// response media types that are acceptable. Accept header fields can
@@ -71,6 +70,8 @@ common_header! {
/// ])
/// );
/// ```
+ ///
+ /// [RFC 7231 §5.3.2]: https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2
(Accept, header::ACCEPT) => (QualityItem)*
test_parse_and_format {
@@ -101,13 +102,12 @@ common_header! {
vec![b"text/plain; charset=utf-8"],
Some(Accept(vec![
QualityItem::max(mime::TEXT_PLAIN_UTF_8),
- ])));
+ ])));
crate::http::header::common_header_test!(
test4,
vec![b"text/plain; charset=utf-8; q=0.5"],
Some(Accept(vec![
- QualityItem::new(mime::TEXT_PLAIN_UTF_8,
- q(0.5)),
+ QualityItem::new(mime::TEXT_PLAIN_UTF_8, q(0.5)),
])));
#[test]