From 5416d22ea2246932a0e0c496654ea3ce860b1f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Fri, 5 May 2023 11:12:07 +0200 Subject: [PATCH] Implement the Early-Data (RFC 8470) header Closes #529 --- benches/src/header_map/basic.rs | 1 + src/header/mod.rs | 1 + src/header/name.rs | 3 +++ tests/header_map.rs | 1 + tests/header_map_fuzz.rs | 1 + 5 files changed, 7 insertions(+) diff --git a/benches/src/header_map/basic.rs b/benches/src/header_map/basic.rs index 8c198a02..f554ac9b 100644 --- a/benches/src/header_map/basic.rs +++ b/benches/src/header_map/basic.rs @@ -551,6 +551,7 @@ const STD: &'static [HeaderName] = &[ COOKIE, DNT, DATE, + EARLY_DATA, ETAG, EXPECT, EXPIRES, diff --git a/src/header/mod.rs b/src/header/mod.rs index 1ca49450..9a2e543e 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -116,6 +116,7 @@ pub use self::name::{ COOKIE, DNT, DATE, + EARLY_DATA, ETAG, EXPECT, EXPIRES, diff --git a/src/header/name.rs b/src/header/name.rs index 6080cf08..c3ed3c21 100644 --- a/src/header/name.rs +++ b/src/header/name.rs @@ -485,6 +485,9 @@ standard_headers! { /// Contains the date and time at which the message was originated. (Date, DATE, b"date"); + /// Indicates that the request has been conveyed in early data and that a client understands the 425 (Too Early) status code. + (EarlyData, EARLY_DATA, b"early-data"); + /// Identifier for a specific version of a resource. /// /// This header allows caches to be more efficient, and saves bandwidth, as diff --git a/tests/header_map.rs b/tests/header_map.rs index f2beba08..fbe36c5b 100644 --- a/tests/header_map.rs +++ b/tests/header_map.rs @@ -361,6 +361,7 @@ const STD: &'static [HeaderName] = &[ COOKIE, DNT, DATE, + EARLY_DATA, ETAG, EXPECT, EXPIRES, diff --git a/tests/header_map_fuzz.rs b/tests/header_map_fuzz.rs index 68a8604f..debfb9e4 100644 --- a/tests/header_map_fuzz.rs +++ b/tests/header_map_fuzz.rs @@ -297,6 +297,7 @@ fn gen_header_name(g: &mut StdRng) -> HeaderName { header::COOKIE, header::DNT, header::DATE, + header::EARLY_DATA, header::ETAG, header::EXPECT, header::EXPIRES,