Skip to content

Commit fb319ab

Browse files
committed
Merge remote-tracking branch 'upstream/master' into server-ffi
2 parents 89b23fc + 621d8e4 commit fb319ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1059
-576
lines changed

.github/workflows/CI.yml

+35-7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- features
2424
- ffi
2525
- ffi-header
26+
- ffi-cargo-c
2627
- doc
2728
- check-external-types
2829
- udeps
@@ -104,9 +105,16 @@ jobs:
104105
- name: Checkout
105106
uses: actions/checkout@v4
106107

108+
- uses: dtolnay/rust-toolchain@stable
109+
110+
- name: Resolve MSRV aware dependencies
111+
run: cargo update
112+
env:
113+
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback
114+
107115
- name: Get MSRV from package metadata
108116
id: msrv
109-
run: grep rust-version Cargo.toml | cut -d'"' -f2 | sed 's/^/version=/' >> $GITHUB_OUTPUT
117+
run: echo "version=$(yq '.package.rust-version' Cargo.toml)" >> $GITHUB_OUTPUT
110118

111119
- name: Install Rust (${{ steps.msrv.outputs.version }})
112120
uses: dtolnay/rust-toolchain@master
@@ -115,11 +123,6 @@ jobs:
115123

116124
- uses: Swatinem/rust-cache@v2
117125

118-
- name: Pin some dependencies
119-
run: |
120-
cargo update -p tokio --precise 1.38.1
121-
cargo update -p tokio-util --precise 0.7.11
122-
123126
- name: Check
124127
run: cargo check --features full
125128

@@ -225,6 +228,31 @@ jobs:
225228
- name: Ensure that hyper.h is up to date
226229
run: ./capi/gen_header.sh --verify
227230

231+
ffi-cargo-c:
232+
name: Test cargo-c support (FFI)
233+
needs: [style]
234+
runs-on: ubuntu-latest
235+
steps:
236+
- name: Checkout
237+
uses: actions/checkout@v4
238+
239+
- name: Install Rust
240+
uses: dtolnay/rust-toolchain@stable
241+
242+
- uses: Swatinem/rust-cache@v2
243+
244+
- name: Install cargo-c
245+
env:
246+
LINK: https://github.com/lu-zero/cargo-c/releases/latest/download
247+
CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz
248+
run: |
249+
curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin
250+
251+
- name: Build with cargo-c
252+
env:
253+
RUSTFLAGS: --cfg hyper_unstable_ffi
254+
run: cargo cbuild --features client,http1,http2,ffi
255+
228256
doc:
229257
name: Build docs
230258
needs: [style, test]
@@ -252,7 +280,7 @@ jobs:
252280
- name: Install Rust
253281
uses: dtolnay/rust-toolchain@master
254282
with:
255-
toolchain: nightly-2024-05-01 # Compatible version for cargo-check-external-types
283+
toolchain: nightly-2024-05-01 # Compatible version for cargo-check-external-types
256284

257285
- name: Install cargo-check-external-types
258286
uses: taiki-e/cache-cargo-install-action@v2

CHANGELOG.md

+47
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
## v1.6.0 (2025-01-28)
2+
3+
4+
#### Bug Fixes
5+
6+
* **server:**
7+
* start http1 header read timeout when conn is idle (#3828) ([10b09ffc](https://github.com/hyperium/hyper/commit/10b09ffc04a97bbc96444172b7c5e02665827c67), closes [#3780](https://github.com/hyperium/hyper/issues/3780), [#3781](https://github.com/hyperium/hyper/issues/3781))
8+
* change `max_local_error_reset_streams` function to `&mut self` (#3820) ([e981a91e](https://github.com/hyperium/hyper/commit/e981a91e68aa92b0dee771362de771daa31c713e))
9+
10+
11+
#### Features
12+
13+
* **ext:** add `ext::on_informational()` callback extension (#3818) ([8ce1fcfa](https://github.com/hyperium/hyper/commit/8ce1fcfae97611ace027b9e26717ae957b323f24), closes [#2565](https://github.com/hyperium/hyper/issues/2565))
14+
* **server:** add `http1::Builder::ignore_invalid_headers(bool)` option (#3824) ([3817a79b](https://github.com/hyperium/hyper/commit/3817a79b213f840302d7e27fac8508de9caada0f))
15+
16+
17+
#### Breaking Changes
18+
19+
* `http2::Builder::max_local_error_reset_streams()` now takes `&mut self` and returns `&mut Self`. In practice, this shouldn't break almost anyone. It was the wrong receiver and return types.
20+
([e981a91e](https://github.com/hyperium/hyper/commit/e981a91e68aa92b0dee771362de771daa31c713e))
21+
22+
23+
### v1.5.2 (2024-12-16)
24+
25+
26+
#### Bug Fixes
27+
28+
* **http1:**
29+
* fix intermitent panic parsing partial headers (#3812) ([a131111f](https://github.com/hyperium/hyper/commit/a131111f9c3189bab36fed9f46872c88dc0d601e), closes [#3811](https://github.com/hyperium/hyper/issues/3811))
30+
* skip debug assertion of content length for HEAD responses (#3795) ([eaf2267c](https://github.com/hyperium/hyper/commit/eaf2267cdc148604469fb09da22646f31710107a), closes [#3794](https://github.com/hyperium/hyper/issues/3794))
31+
32+
33+
#### Features
34+
35+
* **ffi:** add cargo-c support (#3787) ([7f4a6826](https://github.com/hyperium/hyper/commit/7f4a68265cb897d15b04fc772639234554ba79e8), closes [#3786](https://github.com/hyperium/hyper/issues/3786))
36+
37+
38+
### v1.5.1 (2024-11-19)
39+
40+
41+
#### Bug Fixes
42+
43+
* **http2:**
44+
* pass proper value to h2 max_local_error_reset_streams ([4a20147a](https://github.com/hyperium/hyper/commit/4a20147a1b73003860a8391c4b89ccd8a78a832e))
45+
* improve graceful shutdown during handshake (#3729) ([13b05943](https://github.com/hyperium/hyper/commit/13b0594348916b901ad7e1c838b9d90298db6af4))
46+
47+
148
## v1.5.0 (2024-10-15)
249

350

Cargo.toml

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "hyper"
3-
version = "1.5.0"
4-
description = "A fast and correct HTTP library."
3+
version = "1.6.0"
4+
description = "A protective and efficient HTTP library for all."
55
readme = "README.md"
66
homepage = "https://hyper.rs"
77
documentation = "https://docs.rs/hyper"
@@ -31,10 +31,9 @@ futures-channel = { version = "0.3", optional = true }
3131
futures-util = { version = "0.3", default-features = false, optional = true }
3232
h2 = { version = "0.4.2", optional = true }
3333
http-body-util = { version = "0.1", optional = true }
34-
httparse = { version = "1.8", optional = true }
34+
httparse = { version = "1.9", optional = true }
3535
httpdate = { version = "1.0", optional = true }
3636
itoa = { version = "1", optional = true }
37-
libc = { version = "0.2", optional = true }
3837
pin-project-lite = { version = "0.2.4", optional = true }
3938
smallvec = { version = "1.12", features = ["const_generics", "const_new"], optional = true }
4039
tracing = { version = "0.1", default-features = false, features = ["std"], optional = true }
@@ -46,6 +45,7 @@ futures-channel = { version = "0.3", features = ["sink"] }
4645
futures-util = { version = "0.3", default-features = false, features = ["sink"] }
4746
http-body-util = "0.1"
4847
pretty_env_logger = "0.5"
48+
pin-project-lite = "0.2.4"
4949
spmc = "0.3"
5050
serde = { version = "1.0", features = ["derive"] }
5151
serde_json = "1.0"
@@ -80,7 +80,11 @@ client = ["dep:want", "dep:pin-project-lite", "dep:smallvec"]
8080
server = ["dep:httpdate", "dep:pin-project-lite", "dep:smallvec"]
8181

8282
# C-API support (currently unstable (no semver))
83-
ffi = ["dep:libc", "full", "dep:http-body-util", "futures-util?/alloc"]
83+
ffi = ["full", "dep:http-body-util", "futures-util?/alloc"]
84+
85+
# Cargo-C support (used by cargo-c to identify packages that has to be built as
86+
# C-libraries within a workspace)
87+
capi = []
8488

8589
# Utilize tracing (currently unstable)
8690
tracing = ["dep:tracing"]
@@ -102,6 +106,13 @@ rustdoc-args = ["--cfg", "hyper_unstable_ffi", "--cfg", "hyper_unstable_tracing"
102106
[package.metadata.playground]
103107
features = ["full"]
104108

109+
[package.metadata.capi.header]
110+
generation = false
111+
subdirectory = false
112+
113+
[package.metadata.capi.install.include]
114+
asset = [{ from="capi/include/hyper.h" }]
115+
105116
[profile.release]
106117
codegen-units = 1
107118
incremental = false

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014-2021 Sean McArthur
1+
Copyright (c) 2014-2025 Sean McArthur
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

benches/end_to_end.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn http1_parallel_x10_req_10kb_100_chunks(b: &mut test::Bencher) {
8282
#[bench]
8383
#[ignore]
8484
fn http1_parallel_x10_res_1mb(b: &mut test::Bencher) {
85-
let body = &[b'x'; 1024 * 1024 * 1];
85+
let body = &[b'x'; 1024 * 1024];
8686
opts().parallel(10).response_body(body).bench(b)
8787
}
8888

@@ -177,7 +177,7 @@ fn http2_parallel_x10_req_10kb_100_chunks_max_window(b: &mut test::Bencher) {
177177

178178
#[bench]
179179
fn http2_parallel_x10_res_1mb(b: &mut test::Bencher) {
180-
let body = &[b'x'; 1024 * 1024 * 1];
180+
let body = &[b'x'; 1024 * 1024];
181181
opts()
182182
.http2()
183183
.parallel(10)

capi/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ The C API is part of the Rust library, but isn't compiled by default. Using `car
1515
```
1616
RUSTFLAGS="--cfg hyper_unstable_ffi" cargo rustc --features client,http1,http2,ffi --crate-type cdylib
1717
```
18+
19+
### (Optional) With `cargo-c`
20+
21+
If using `cargo-c`, you can build and install a shared library with the following command:
22+
23+
```
24+
RUSTFLAGS="--cfg hyper_unstable_ffi" cargo cbuild --features client,http1,http2,ffi --release
25+
```

capi/gen_header.sh

+12-6
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
set -e
1212

1313
CAPI_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
14+
header_file="$CAPI_DIR/include/hyper.h"
1415
header_file_backup="$CAPI_DIR/include/hyper.h.backup"
15-
16+
verify_flag=$1
1617
function cleanup {
1718
rm -rf "$WORK_DIR" || true
18-
rm "$header_file_backup" || true
19+
if [[ "--verify" == "$verify_flag" ]]; then
20+
rm "$header_file_backup" || true
21+
fi
1922
}
2023

2124
trap cleanup EXIT
@@ -28,7 +31,10 @@ if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
2831
exit 1
2932
fi
3033

31-
cp "$CAPI_DIR/include/hyper.h" "$header_file_backup"
34+
# backup hyper.h
35+
if [[ "--verify" == "$verify_flag" ]]; then
36+
cp "$header_file" "$header_file_backup"
37+
fi
3238

3339
# Expand just the ffi module
3440
if ! RUSTFLAGS='--cfg hyper_unstable_ffi' cargo expand --features ffi,server,client,http1,http2 ::ffi 2> $WORK_DIR/expand_stderr.err > $WORK_DIR/expanded.rs; then
@@ -39,13 +45,13 @@ fi
3945
if ! cbindgen \
4046
--config "$CAPI_DIR/cbindgen.toml" \
4147
--lockfile "$CAPI_DIR/../Cargo.lock" \
42-
--output "$CAPI_DIR/include/hyper.h" \
48+
--output "$header_file" \
4349
"${@}"\
4450
$WORK_DIR/expanded.rs 2> $WORK_DIR/cbindgen_stderr.err; then
4551
bindgen_exit_code=$?
46-
if [[ "--verify" == "$1" ]]; then
52+
if [[ "--verify" == "$verify_flag" ]]; then
4753
echo "Changes from previous header (old < > new)"
48-
diff -u "$header_file_backup" "$CAPI_DIR/include/hyper.h"
54+
diff -u "$header_file_backup" "$header_file"
4955
else
5056
echo "cbindgen failed:"
5157
cat $WORK_DIR/cbindgen_stderr.err

0 commit comments

Comments
 (0)