Skip to content

Commit b88a643

Browse files
committed
Merge branch 'master' into try-from-bytes
2 parents b5b53d3 + ed680c4 commit b88a643

File tree

20 files changed

+494
-365
lines changed

20 files changed

+494
-365
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: seanmonstar

.github/workflows/ci.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Checkout
31-
uses: actions/checkout@v4
31+
uses: actions/checkout@v6
3232

3333
- name: Install Rust
3434
uses: dtolnay/rust-toolchain@stable
@@ -55,7 +55,7 @@ jobs:
5555

5656
steps:
5757
- name: Checkout
58-
uses: actions/checkout@v4
58+
uses: actions/checkout@v6
5959

6060
- name: Install Rust (${{ matrix.rust }})
6161
uses: dtolnay/rust-toolchain@master
@@ -74,7 +74,17 @@ jobs:
7474
runs-on: ubuntu-latest
7575
steps:
7676
- name: Checkout
77-
uses: actions/checkout@v4
77+
uses: actions/checkout@v6
78+
79+
- uses: dtolnay/rust-toolchain@stable
80+
81+
- uses: taiki-e/install-action@cargo-hack
82+
83+
- name: Remove dev-dependencies
84+
run: cargo hack --remove-dev-deps update
85+
86+
- name: Pin deps
87+
run: cargo update -p itoa --precise 1.0.15
7888

7989
- name: Get MSRV from package metadata
8090
id: metadata
@@ -96,7 +106,7 @@ jobs:
96106

97107
steps:
98108
- name: Checkout
99-
uses: actions/checkout@v4
109+
uses: actions/checkout@v6
100110

101111
- name: Install Rust
102112
uses: dtolnay/rust-toolchain@stable
@@ -109,7 +119,7 @@ jobs:
109119
minimal-versions:
110120
runs-on: ubuntu-latest
111121
steps:
112-
- uses: actions/checkout@v4
122+
- uses: actions/checkout@v6
113123
- uses: dtolnay/rust-toolchain@nightly
114124
- uses: dtolnay/rust-toolchain@stable
115125
- uses: taiki-e/install-action@cargo-hack
@@ -122,7 +132,7 @@ jobs:
122132

123133
steps:
124134
- name: Checkout
125-
uses: actions/checkout@v4
135+
uses: actions/checkout@v6
126136

127137
- name: Install Rust
128138
uses: dtolnay/rust-toolchain@nightly
@@ -136,7 +146,7 @@ jobs:
136146
name: semver
137147
runs-on: ubuntu-latest
138148
steps:
139-
- uses: actions/checkout@v4
149+
- uses: actions/checkout@v6
140150
- name: Check semver
141151
uses: obi1kenobi/cargo-semver-checks-action@v2
142152
with:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 1.4.0 (November 24, 2025)
2+
3+
- Add `StatusCode::EARLY_HINTS` constant for 103 Early Hints.
4+
- Make `StatusCode::from_u16` now a `const fn`.
5+
- Make `Authority::from_static` now a `const fn`.
6+
- Make `PathAndQuery::from_static` now a `const fn`.
7+
- MSRV increased to 1.57 (allows legible const fn panic messages).
8+
19
# 1.3.1 (March 11, 2025)
210

311
* Fix validation that all characters are UTF-8 in URI path and query.

Cargo.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name = "http"
44
# - Update html_root_url in lib.rs.
55
# - Update CHANGELOG.md.
66
# - Create git tag
7-
version = "1.3.1"
7+
version = "1.4.0"
88
readme = "README.md"
99
documentation = "https://docs.rs/http"
1010
repository = "https://github.com/hyperium/http"
@@ -19,9 +19,8 @@ A set of types for representing HTTP requests and responses.
1919
"""
2020
keywords = ["http"]
2121
categories = ["web-programming"]
22-
edition = "2018"
23-
# When updating this value, don't forget to also adjust the GitHub Actions config.
24-
rust-version = "1.49.0"
22+
edition = "2021"
23+
rust-version = "1.57.0"
2524

2625
[workspace]
2726
members = [
@@ -38,12 +37,11 @@ std = []
3837

3938
[dependencies]
4039
bytes = "1"
41-
fnv = "1.0.5"
4240
itoa = "1"
4341

4442
[dev-dependencies]
4543
quickcheck = "1"
46-
rand = "0.9.1"
44+
rand = "0.10"
4745
serde = "1.0"
4846
serde_json = "1.0"
4947
doc-comment = "0.3"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ fn main() {
6262

6363
# Supported Rust Versions
6464

65-
This project follows the [Tokio MSRV][msrv] and is currently set to `1.49`.
65+
This project follows the [hyper's MSRV _policy_][msrv], though it can be lower, and is currently set to `1.57`.
6666

67-
[msrv]: https://github.com/tokio-rs/tokio/#supported-rust-versions
67+
[msrv]: https://hyper.rs/contrib/msrv/
6868

6969
# License
7070

src/byte_str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ impl From<String> for ByteStr {
7474
}
7575
}
7676

77-
impl<'a> From<&'a str> for ByteStr {
77+
impl From<&str> for ByteStr {
7878
#[inline]
79-
fn from(src: &'a str) -> ByteStr {
79+
fn from(src: &str) -> ByteStr {
8080
ByteStr {
8181
// Invariant: src is a str so contains valid UTF-8.
8282
bytes: Bytes::copy_from_slice(src.as_bytes()),

src/extensions.rs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::any::{Any, TypeId};
1+
use std::any::{type_name, Any, TypeId};
22
use std::collections::HashMap;
33
use std::fmt;
44
use std::hash::{BuildHasherDefault, Hasher};
@@ -267,7 +267,21 @@ impl Extensions {
267267

268268
impl fmt::Debug for Extensions {
269269
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
270-
f.debug_struct("Extensions").finish()
270+
struct TypeName(&'static str);
271+
impl fmt::Debug for TypeName {
272+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
273+
f.write_str(self.0)
274+
}
275+
}
276+
277+
let mut set = f.debug_set();
278+
if let Some(map) = &self.map {
279+
set.entries(
280+
map.values()
281+
.map(|any_clone| TypeName(any_clone.as_ref().type_name())),
282+
);
283+
}
284+
set.finish()
271285
}
272286
}
273287

@@ -276,6 +290,7 @@ trait AnyClone: Any {
276290
fn as_any(&self) -> &dyn Any;
277291
fn as_any_mut(&mut self) -> &mut dyn Any;
278292
fn into_any(self: Box<Self>) -> Box<dyn Any>;
293+
fn type_name(&self) -> &'static str;
279294
}
280295

281296
impl<T: Clone + Send + Sync + 'static> AnyClone for T {
@@ -294,6 +309,10 @@ impl<T: Clone + Send + Sync + 'static> AnyClone for T {
294309
fn into_any(self: Box<Self>) -> Box<dyn Any> {
295310
self
296311
}
312+
313+
fn type_name(&self) -> &'static str {
314+
type_name::<T>()
315+
}
297316
}
298317

299318
impl Clone for Box<dyn AnyClone + Send + Sync> {
@@ -308,13 +327,23 @@ fn test_extensions() {
308327
struct MyType(i32);
309328

310329
let mut extensions = Extensions::new();
330+
assert_eq!(format!("{extensions:?}"), "{}");
311331

312332
extensions.insert(5i32);
313333
extensions.insert(MyType(10));
314334

315335
assert_eq!(extensions.get(), Some(&5i32));
316336
assert_eq!(extensions.get_mut(), Some(&mut 5i32));
317337

338+
let dbg = format!("{extensions:?}");
339+
// map order is NOT deterministic
340+
assert!(
341+
(dbg == "{http::extensions::test_extensions::MyType, i32}")
342+
|| (dbg == "{i32, http::extensions::test_extensions::MyType}"),
343+
"{}",
344+
dbg
345+
);
346+
318347
let ext2 = extensions.clone();
319348

320349
assert_eq!(extensions.remove::<i32>(), Some(5i32));

0 commit comments

Comments
 (0)