Skip to content

Commit

Permalink
feat: hyper v1 upgrade (#2059)
Browse files Browse the repository at this point in the history
This is a big and breaking change. A lot of the internals were worked
on. But the breakage shouldn't be that visible to public API.

The main differences are:

- Publicly exposes `http` v1, instead of v0.2.
- Integration with `hyper::Body` has changed.

Co-authored-by: =?UTF-8?q?Lo=C3=AFs=20Postula?= <[email protected]>
Co-authored-by: Jakub Wieczorek <[email protected]>
  • Loading branch information
3 people authored Mar 8, 2024
1 parent 7e77674 commit 2c11ef0
Show file tree
Hide file tree
Showing 30 changed files with 712 additions and 518 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
- "feat.: default-tls disabled"
- "feat.: rustls-tls"
- "feat.: rustls-tls-manual-roots"
- "feat.: rustls-tls-native-roots"
- "feat.: native-tls"
- "feat.: default-tls and rustls-tls"
- "feat.: cookies"
Expand Down Expand Up @@ -101,23 +102,23 @@ jobs:
- name: windows / stable-x86_64-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
features: "--features blocking,gzip,brotli,deflate,json,multipart"
features: "--features blocking,gzip,brotli,deflate,json,multipart,stream"
- name: windows / stable-i686-msvc
os: windows-latest
target: i686-pc-windows-msvc
features: "--features blocking,gzip,brotli,deflate,json,multipart"
features: "--features blocking,gzip,brotli,deflate,json,multipart,stream"
- name: windows / stable-x86_64-gnu
os: windows-latest
rust: stable-x86_64-pc-windows-gnu
target: x86_64-pc-windows-gnu
features: "--features blocking,gzip,brotli,deflate,json,multipart"
features: "--features blocking,gzip,brotli,deflate,json,multipart,stream"
package_name: mingw-w64-x86_64-gcc
mingw64_path: "C:\\msys64\\mingw64\\bin"
- name: windows / stable-i686-gnu
os: windows-latest
rust: stable-i686-pc-windows-gnu
target: i686-pc-windows-gnu
features: "--features blocking,gzip,brotli,deflate,json,multipart"
features: "--features blocking,gzip,brotli,deflate,json,multipart,stream"
package_name: mingw-w64-i686-gcc
mingw64_path: "C:\\msys64\\mingw32\\bin"

Expand All @@ -127,6 +128,8 @@ jobs:
features: "--no-default-features --features rustls-tls"
- name: "feat.: rustls-tls-manual-roots"
features: "--no-default-features --features rustls-tls-manual-roots"
- name: "feat.: rustls-tls-native-roots"
features: "--no-default-features --features rustls-tls-native-roots"
- name: "feat.: native-tls"
features: "--features native-tls"
- name: "feat.: default-tls and rustls-tls"
Expand All @@ -136,11 +139,11 @@ jobs:
- name: "feat.: blocking"
features: "--features blocking"
- name: "feat.: gzip"
features: "--features gzip"
features: "--features gzip,stream"
- name: "feat.: brotli"
features: "--features brotli"
features: "--features brotli,stream"
- name: "feat.: deflate"
features: "--features deflate"
features: "--features deflate,stream"
- name: "feat.: json"
features: "--features json"
- name: "feat.: multipart"
Expand Down Expand Up @@ -204,11 +207,12 @@ jobs:
with:
toolchain: 'stable'

- name: Check
run: RUSTFLAGS="--cfg reqwest_unstable" cargo check --features http3
#- name: Check
# run: RUSTFLAGS="--cfg reqwest_unstable" cargo check --features http3

docs:
name: Docs
needs: [test]
runs-on: ubuntu-latest

steps:
Expand Down
45 changes: 25 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ default-tls = ["hyper-tls", "native-tls-crate", "__tls", "tokio-native-tls"]

# Enables native-tls specific functionality not available by default.
native-tls = ["default-tls"]
native-tls-alpn = ["native-tls", "native-tls-crate/alpn"]
native-tls-alpn = ["native-tls", "native-tls-crate/alpn", "hyper-tls/alpn"]
native-tls-vendored = ["native-tls", "native-tls-crate/vendored"]

rustls-tls = ["rustls-tls-webpki-roots"]
rustls-tls-manual-roots = ["__rustls"]
rustls-tls-webpki-roots = ["webpki-roots", "__rustls"]
rustls-tls-native-roots = ["rustls-native-certs", "__rustls"]

blocking = ["futures-util/io", "tokio/sync"]
blocking = ["futures-channel/sink", "futures-util/io", "futures-util/sink", "tokio/rt-multi-thread", "tokio/sync"]

cookies = ["cookie_crate", "cookie_store"]

Expand All @@ -64,7 +64,8 @@ stream = ["tokio/fs", "tokio-util", "wasm-streams"]
socks = ["tokio-socks"]

# Experimental HTTP/3 client.
http3 = ["rustls-tls-manual-roots", "h3", "h3-quinn", "quinn", "futures-channel"]
# Disabled while waiting for quinn to upgrade.
#http3 = ["rustls-tls-manual-roots", "h3", "h3-quinn", "quinn", "futures-channel"]

# Internal (PRIVATE!) features used to aid testing.
# Don't rely on these whatsoever. They may disappear at anytime.
Expand All @@ -74,14 +75,14 @@ __tls = ["dep:rustls-pemfile"]

# Enables common rustls code.
# Equivalent to rustls-tls-manual-roots but shorter :)
__rustls = ["hyper-rustls", "tokio-rustls", "rustls", "__tls"]
__rustls = ["hyper-rustls", "tokio-rustls", "rustls", "__tls", "dep:rustls-pemfile", "rustls-pki-types"]

# When enabled, disable using the cached SYS_PROXIES.
__internal_proxy_sys_no_cache = []

[dependencies]
base64 = "0.21"
http = "0.2"
http = "1"
url = "2.2"
bytes = "1.0"
serde = "1.0"
Expand All @@ -100,9 +101,11 @@ mime_guess = { version = "2.0", default-features = false, optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
encoding_rs = "0.8"
http-body = "0.4.0"
hyper = { version = "0.14.21", default-features = false, features = ["tcp", "http1", "http2", "client", "runtime"] }
h2 = "0.3.14"
http-body = "1"
http-body-util = "0.1"
hyper = { version = "1", features = ["http1", "http2", "client"] }
hyper-util = { version = "0.1.3", features = ["http1", "http2", "client", "client-legacy", "tokio"] }
h2 = "0.4"
once_cell = "1"
log = "0.4"
mime = "0.3.16"
Expand All @@ -115,16 +118,17 @@ ipnet = "2.3"
rustls-pemfile = { version = "1.0", optional = true }

## default-tls
hyper-tls = { version = "0.5", optional = true }
hyper-tls = { version = "0.6", optional = true }
native-tls-crate = { version = "0.2.10", optional = true, package = "native-tls" }
tokio-native-tls = { version = "0.3.0", optional = true }

# rustls-tls
hyper-rustls = { version = "0.24.0", default-features = false, optional = true }
rustls = { version = "0.21.6", features = ["dangerous_configuration"], optional = true }
tokio-rustls = { version = "0.24", optional = true }
webpki-roots = { version = "0.25", optional = true }
rustls-native-certs = { version = "0.6", optional = true }
hyper-rustls = { version = "0.26.0", default-features = false, optional = true }
rustls = { version = "0.22.2", optional = true }
rustls-pki-types = { version = "1.1.0", features = ["alloc"] ,optional = true }
tokio-rustls = { version = "0.25", optional = true }
webpki-roots = { version = "0.26.0", optional = true }
rustls-native-certs = { version = "0.7", optional = true }

## cookies
cookie_crate = { version = "0.17.0", package = "cookie", optional = true }
Expand All @@ -141,15 +145,16 @@ tokio-socks = { version = "0.5.1", optional = true }
trust-dns-resolver = { version = "0.23", optional = true, features = ["tokio-runtime"] }

# HTTP/3 experimental support
h3 = { version = "0.0.3", optional = true }
h3-quinn = { version = "0.0.4", optional = true }
h3 = { version = "0.0.4", optional = true }
h3-quinn = { version = "0.0.5", optional = true }
quinn = { version = "0.10", default-features = false, features = ["tls-rustls", "ring", "runtime-tokio"], optional = true }
futures-channel = { version = "0.3", optional = true }


[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
env_logger = "0.10"
hyper = { version = "0.14", default-features = false, features = ["tcp", "stream", "http1", "http2", "client", "server", "runtime"] }
hyper = { version = "1.1.0", default-features = false, features = ["http1", "http2", "client", "server"] }
hyper-util = { version = "0.1", features = ["http1", "http2", "client", "client-legacy", "server-auto", "tokio"] }
serde = { version = "1.0", features = ["derive"] }
libflate = "1.0"
brotli_crate = { package = "brotli", version = "3.3.0" }
Expand Down Expand Up @@ -237,17 +242,17 @@ required-features = ["cookies"]
[[test]]
name = "gzip"
path = "tests/gzip.rs"
required-features = ["gzip"]
required-features = ["gzip", "stream"]

[[test]]
name = "brotli"
path = "tests/brotli.rs"
required-features = ["brotli"]
required-features = ["brotli", "stream"]

[[test]]
name = "deflate"
path = "tests/deflate.rs"
required-features = ["deflate"]
required-features = ["deflate", "stream"]

[[test]]
name = "multipart"
Expand Down
Loading

0 comments on commit 2c11ef0

Please sign in to comment.