From b9f0faafde1d451cc73776992a99a1eb03595a69 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 21 Jan 2023 00:02:54 +0000 Subject: [PATCH] add cache-status and cdn-cache-control header names (#2968) * add cache-status and cdn-cache-control header names * fix changelog * update docs with rfc numbers --- actix-http/CHANGES.md | 5 ++++- actix-http/src/header/common.rs | 12 ++++++++++++ actix-http/src/header/mod.rs | 5 +++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 7feec2a1a..4f765e28b 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -7,7 +7,9 @@ - Implement `MessageBody` for `Pin` where `B::Target: MessageBody`. [#2868] - Automatic h2c detection via new service finalizer `HttpService::tcp_auto_h2c()`. [#2957] - `HeaderMap::retain()` [#2955]. -- Header name constants in `header` module. [#2956] +- Header name constants in `header` module. [#2956] [#2968] + - `CACHE_STATUS` + - `CDN_CACHE_CONTROL` - `CROSS_ORIGIN_EMBEDDER_POLICY` - `CROSS_ORIGIN_OPENER_POLICY` - `PERMISSIONS_POLICY` @@ -24,6 +26,7 @@ [#2957]: https://github.com/actix/actix-web/pull/2957 [#2955]: https://github.com/actix/actix-web/pull/2955 [#2956]: https://github.com/actix/actix-web/pull/2956 +[#2968]: https://github.com/actix/actix-web/pull/2968 ## 3.2.2 - 2022-09-11 diff --git a/actix-http/src/header/common.rs b/actix-http/src/header/common.rs index 52909099a..67b0a9069 100644 --- a/actix-http/src/header/common.rs +++ b/actix-http/src/header/common.rs @@ -4,6 +4,18 @@ use http::header::HeaderName; +/// Response header field that indicates how caches have handled that response and its corresponding +/// request. +/// +/// See [RFC 9211](https://www.rfc-editor.org/rfc/rfc9211) for full semantics. +pub const CACHE_STATUS: HeaderName = HeaderName::from_static("cache-status"); + +/// Response header field that allows 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) for full semantics. +pub const CDN_CACHE_CONTROL: HeaderName = HeaderName::from_static("cdn-cache-control"); + /// Response header that prevents a document from loading any cross-origin resources that don't /// explicitly grant the document permission (using [CORP] or [CORS]). /// diff --git a/actix-http/src/header/mod.rs b/actix-http/src/header/mod.rs index e2c2fe912..a63174a92 100644 --- a/actix-http/src/header/mod.rs +++ b/actix-http/src/header/mod.rs @@ -55,8 +55,9 @@ pub use self::{ // re-export list is explicit so that any updates to `http` do not conflict with this set pub use self::common::{ - CROSS_ORIGIN_EMBEDDER_POLICY, CROSS_ORIGIN_OPENER_POLICY, CROSS_ORIGIN_RESOURCE_POLICY, - PERMISSIONS_POLICY, X_FORWARDED_FOR, X_FORWARDED_HOST, X_FORWARDED_PROTO, + CACHE_STATUS, CDN_CACHE_CONTROL, CROSS_ORIGIN_EMBEDDER_POLICY, CROSS_ORIGIN_OPENER_POLICY, + CROSS_ORIGIN_RESOURCE_POLICY, PERMISSIONS_POLICY, X_FORWARDED_FOR, X_FORWARDED_HOST, + X_FORWARDED_PROTO, }; /// An interface for types that already represent a valid header.