Skip to content

Commit

Permalink
feat: add cache-status and cdn-cache-control header name constants (#583
Browse files Browse the repository at this point in the history
)

Docs include pointers to the relevant RFCs, as these are not in the base HTTP semantics spec.
  • Loading branch information
acfoltzer authored Feb 17, 2023
1 parent f0ba97f commit 1fad3ea
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

* Add `HeaderName` constants for `cache-status` and `cdn-cache-control`.

# 0.2.8 (June 6, 2022)

* Fix internal usage of uninitialized memory to use `MaybeUninit` inside `HeaderName`.
Expand Down
2 changes: 2 additions & 0 deletions benches/src/header_map/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ const STD: &'static [HeaderName] = &[
ALT_SVC,
AUTHORIZATION,
CACHE_CONTROL,
CACHE_STATUS,
CDN_CACHE_CONTROL,
CONNECTION,
CONTENT_DISPOSITION,
CONTENT_ENCODING,
Expand Down
2 changes: 2 additions & 0 deletions src/header/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ pub use self::name::{
ALT_SVC,
AUTHORIZATION,
CACHE_CONTROL,
CACHE_STATUS,
CDN_CACHE_CONTROL,
CONNECTION,
CONTENT_DISPOSITION,
CONTENT_ENCODING,
Expand Down
12 changes: 12 additions & 0 deletions src/header/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,18 @@ standard_headers! {
/// response.
(CacheControl, CACHE_CONTROL, b"cache-control");

/// Indicates how caches have handled a response and its corresponding request.
///
/// See [RFC 9211](https://www.rfc-editor.org/rfc/rfc9211.html).
(CacheStatus, CACHE_STATUS, b"cache-status");

/// Specifies directives that allow origin servers to control the behavior of CDN caches
/// interposed between them and clients separately from other caches that might handle the
/// response.
///
/// See [RFC 9213](https://www.rfc-editor.org/rfc/rfc9213.html).
(CdnCacheControl, CDN_CACHE_CONTROL, b"cdn-cache-control");

/// Controls whether or not the network connection stays open after the
/// current transaction finishes.
///
Expand Down
2 changes: 2 additions & 0 deletions tests/header_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ const STD: &'static [HeaderName] = &[
ALT_SVC,
AUTHORIZATION,
CACHE_CONTROL,
CACHE_STATUS,
CDN_CACHE_CONTROL,
CONNECTION,
CONTENT_DISPOSITION,
CONTENT_ENCODING,
Expand Down
2 changes: 2 additions & 0 deletions tests/header_map_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ fn gen_header_name(g: &mut StdRng) -> HeaderName {
header::ALT_SVC,
header::AUTHORIZATION,
header::CACHE_CONTROL,
header::CACHE_STATUS,
header::CDN_CACHE_CONTROL,
header::CONNECTION,
header::CONTENT_DISPOSITION,
header::CONTENT_ENCODING,
Expand Down

0 comments on commit 1fad3ea

Please sign in to comment.