From 5a92f256c0ab63fd12e2180f99e603230955dfbc Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Thu, 19 Nov 2020 23:38:56 +0100 Subject: [PATCH] Upgrade to bytes 0.6 (#497) * Upgrade to bytes 0.6 * Update Cargo.toml Co-authored-by: Eliza Weisman * Update tests/h2-support/Cargo.toml Co-authored-by: Eliza Weisman Co-authored-by: Eliza Weisman --- Cargo.toml | 8 ++++---- src/codec/framed_write.rs | 2 +- src/frame/headers.rs | 2 +- src/hpack/encoder.rs | 4 ++-- src/hpack/test/fixture.rs | 2 +- src/hpack/test/fuzz.rs | 2 +- src/proto/streams/prioritize.rs | 2 +- tests/h2-fuzz/Cargo.toml | 4 ++-- tests/h2-support/Cargo.toml | 4 ++-- tests/h2-support/src/prelude.rs | 5 +---- tests/h2-tests/Cargo.toml | 2 +- 11 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6c806de..3b55d08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,9 +45,9 @@ members = [ futures-core = { version = "0.3", default-features = false } futures-sink = { version = "0.3", default-features = false } futures-util = { version = "0.3", default-features = false } -tokio-util = { version = "0.4.0", features = ["codec"] } -tokio = { version = "0.3", features = ["io-util"] } -bytes = "0.5.2" +tokio-util = { version = "0.5", features = ["codec"] } +tokio = { version = "0.3.2", features = ["io-util"] } +bytes = "0.6" http = "0.2" tracing = { version = "0.1.13", default-features = false, features = ["std", "log"] } tracing-futures = { version = "0.2", default-features = false, features = ["std-future"]} @@ -68,7 +68,7 @@ serde = "1.0.0" serde_json = "1.0.0" # Examples -tokio = { version = "0.3", features = ["rt-multi-thread", "macros", "sync", "net"] } +tokio = { version = "0.3.2", features = ["rt-multi-thread", "macros", "sync", "net"] } env_logger = { version = "0.5.3", default-features = false } rustls = "0.18" tokio-rustls = "0.20.0" diff --git a/src/codec/framed_write.rs b/src/codec/framed_write.rs index 53032ce..870b558 100644 --- a/src/codec/framed_write.rs +++ b/src/codec/framed_write.rs @@ -3,7 +3,7 @@ use crate::codec::UserError::*; use crate::frame::{self, Frame, FrameSize}; use crate::hpack; -use bytes::{buf::BufMutExt, Buf, BufMut, BytesMut}; +use bytes::{buf::BufMut, Buf, BytesMut}; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; diff --git a/src/frame/headers.rs b/src/frame/headers.rs index 0719f14..ad37393 100644 --- a/src/frame/headers.rs +++ b/src/frame/headers.rs @@ -10,7 +10,7 @@ use bytes::{Bytes, BytesMut}; use std::fmt; use std::io::Cursor; -type EncodeBuf<'a> = bytes::buf::ext::Limit<&'a mut BytesMut>; +type EncodeBuf<'a> = bytes::buf::Limit<&'a mut BytesMut>; // Minimum MAX_FRAME_SIZE is 16kb, so save some arbitrary space for frame // head and other header bits. diff --git a/src/hpack/encoder.rs b/src/hpack/encoder.rs index e6881dd..ee264d5 100644 --- a/src/hpack/encoder.rs +++ b/src/hpack/encoder.rs @@ -1,7 +1,7 @@ use super::table::{Index, Table}; use super::{huffman, Header}; -use bytes::{buf::ext::Limit, BufMut, BytesMut}; +use bytes::{buf::Limit, BufMut, BytesMut}; use http::header::{HeaderName, HeaderValue}; type DstBuf<'a> = Limit<&'a mut BytesMut>; @@ -428,7 +428,7 @@ fn rewind(buf: &mut DstBuf<'_>, pos: usize) { mod test { use super::*; use crate::hpack::Header; - use bytes::buf::BufMutExt; + use bytes::buf::BufMut; use http::*; #[test] diff --git a/src/hpack/test/fixture.rs b/src/hpack/test/fixture.rs index 20ee127..9828f04 100644 --- a/src/hpack/test/fixture.rs +++ b/src/hpack/test/fixture.rs @@ -1,6 +1,6 @@ use crate::hpack::{Decoder, Encoder, Header}; -use bytes::{buf::BufMutExt, BytesMut}; +use bytes::{buf::BufMut, BytesMut}; use hex::FromHex; use serde_json::Value; diff --git a/src/hpack/test/fuzz.rs b/src/hpack/test/fuzz.rs index dbf9b3c..0abb66a 100644 --- a/src/hpack/test/fuzz.rs +++ b/src/hpack/test/fuzz.rs @@ -2,7 +2,7 @@ use crate::hpack::{Decoder, Encode, Encoder, Header}; use http::header::{HeaderName, HeaderValue}; -use bytes::{buf::BufMutExt, Bytes, BytesMut}; +use bytes::{buf::BufMut, Bytes, BytesMut}; use quickcheck::{Arbitrary, Gen, QuickCheck, TestResult}; use rand::{Rng, SeedableRng, StdRng}; diff --git a/src/proto/streams/prioritize.rs b/src/proto/streams/prioritize.rs index 9379820..96b65d7 100644 --- a/src/proto/streams/prioritize.rs +++ b/src/proto/streams/prioritize.rs @@ -6,7 +6,7 @@ use crate::frame::{Reason, StreamId}; use crate::codec::UserError; use crate::codec::UserError::*; -use bytes::buf::ext::{BufExt, Take}; +use bytes::buf::{Buf, Take}; use std::io; use std::task::{Context, Poll, Waker}; use std::{cmp, fmt, mem}; diff --git a/tests/h2-fuzz/Cargo.toml b/tests/h2-fuzz/Cargo.toml index 40e985d..d76a8f6 100644 --- a/tests/h2-fuzz/Cargo.toml +++ b/tests/h2-fuzz/Cargo.toml @@ -11,5 +11,5 @@ h2 = { path = "../.." } env_logger = { version = "0.5.3", default-features = false } futures = { version = "0.3", default-features = false, features = ["std"] } honggfuzz = "0.5" -http = "0.2" -tokio = { version = "0.3", features = [] } +http = { git = "https://github.com/paolobarbolini/http.git", branch = "bytes06" } +tokio = { version = "0.3.2", features = [] } diff --git a/tests/h2-support/Cargo.toml b/tests/h2-support/Cargo.toml index 183013f..c441ded 100644 --- a/tests/h2-support/Cargo.toml +++ b/tests/h2-support/Cargo.toml @@ -7,10 +7,10 @@ edition = "2018" [dependencies] h2 = { path = "../..", features = ["stream", "unstable"] } -bytes = "0.5" +bytes = "0.6" tracing = "0.1" tracing-subscriber = { version = "0.2", default-features = false, features = ["fmt", "chrono", "ansi"] } futures = { version = "0.3", default-features = false } http = "0.2" -tokio = { version = "0.3", features = ["time"] } +tokio = { version = "0.3.2", features = ["time"] } tokio-test = "0.3" diff --git a/tests/h2-support/src/prelude.rs b/tests/h2-support/src/prelude.rs index dafdd29..f4b2e82 100644 --- a/tests/h2-support/src/prelude.rs +++ b/tests/h2-support/src/prelude.rs @@ -42,10 +42,7 @@ pub use super::client_ext::SendRequestExt; // Re-export HTTP types pub use http::{uri, HeaderMap, Method, Request, Response, StatusCode, Version}; -pub use bytes::{ - buf::{BufExt, BufMutExt}, - Buf, BufMut, Bytes, BytesMut, -}; +pub use bytes::{Buf, BufMut, Bytes, BytesMut}; pub use tokio::io::{AsyncRead, AsyncWrite}; diff --git a/tests/h2-tests/Cargo.toml b/tests/h2-tests/Cargo.toml index b5f3c6e..ac16043 100644 --- a/tests/h2-tests/Cargo.toml +++ b/tests/h2-tests/Cargo.toml @@ -11,4 +11,4 @@ edition = "2018" h2-support = { path = "../h2-support" } tracing = "0.1.13" futures = { version = "0.3", default-features = false, features = ["alloc"] } -tokio = { version = "0.3", features = ["macros", "net", "rt", "io-util"] } +tokio = { version = "0.3.2", features = ["macros", "net", "rt", "io-util"] }