Skip to content

Commit 1fad3ea

Browse files
authored
feat: add cache-status and cdn-cache-control header name constants (#583)
Docs include pointers to the relevant RFCs, as these are not in the base HTTP semantics spec.
1 parent f0ba97f commit 1fad3ea

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Unreleased
2+
3+
* Add `HeaderName` constants for `cache-status` and `cdn-cache-control`.
4+
15
# 0.2.8 (June 6, 2022)
26

37
* Fix internal usage of uninitialized memory to use `MaybeUninit` inside `HeaderName`.

benches/src/header_map/basic.rs

+2
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ const STD: &'static [HeaderName] = &[
536536
ALT_SVC,
537537
AUTHORIZATION,
538538
CACHE_CONTROL,
539+
CACHE_STATUS,
540+
CDN_CACHE_CONTROL,
539541
CONNECTION,
540542
CONTENT_DISPOSITION,
541543
CONTENT_ENCODING,

src/header/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ pub use self::name::{
101101
ALT_SVC,
102102
AUTHORIZATION,
103103
CACHE_CONTROL,
104+
CACHE_STATUS,
105+
CDN_CACHE_CONTROL,
104106
CONNECTION,
105107
CONTENT_DISPOSITION,
106108
CONTENT_ENCODING,

src/header/name.rs

+12
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,18 @@ standard_headers! {
345345
/// response.
346346
(CacheControl, CACHE_CONTROL, b"cache-control");
347347

348+
/// Indicates how caches have handled a response and its corresponding request.
349+
///
350+
/// See [RFC 9211](https://www.rfc-editor.org/rfc/rfc9211.html).
351+
(CacheStatus, CACHE_STATUS, b"cache-status");
352+
353+
/// Specifies directives that allow origin servers to control the behavior of CDN caches
354+
/// interposed between them and clients separately from other caches that might handle the
355+
/// response.
356+
///
357+
/// See [RFC 9213](https://www.rfc-editor.org/rfc/rfc9213.html).
358+
(CdnCacheControl, CDN_CACHE_CONTROL, b"cdn-cache-control");
359+
348360
/// Controls whether or not the network connection stays open after the
349361
/// current transaction finishes.
350362
///

tests/header_map.rs

+2
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ const STD: &'static [HeaderName] = &[
346346
ALT_SVC,
347347
AUTHORIZATION,
348348
CACHE_CONTROL,
349+
CACHE_STATUS,
350+
CDN_CACHE_CONTROL,
349351
CONNECTION,
350352
CONTENT_DISPOSITION,
351353
CONTENT_ENCODING,

tests/header_map_fuzz.rs

+2
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ fn gen_header_name(g: &mut StdRng) -> HeaderName {
282282
header::ALT_SVC,
283283
header::AUTHORIZATION,
284284
header::CACHE_CONTROL,
285+
header::CACHE_STATUS,
286+
header::CDN_CACHE_CONTROL,
285287
header::CONNECTION,
286288
header::CONTENT_DISPOSITION,
287289
header::CONTENT_ENCODING,

0 commit comments

Comments
 (0)