diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 045ae461f..a83e7dd93 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -4,12 +4,20 @@ ### Added - Implement `MessageBody` for `&mut B` where `B: MessageBody + Unpin`. [#2868] - Implement `MessageBody` for `Pin` where `B::Target: MessageBody`. [#2868] +- New header name constants in `header` module. [#????] + - `CROSS_ORIGIN_EMBEDDER_POLICY` + - `CROSS_ORIGIN_OPENER_POLICY` + - `PERMISSIONS_POLICY` + - `X_FORWARDED_FOR` + - `X_FORWARDED_HOST` + - `X_FORWARDED_PROTO` ### Performance - Improve overall performance of operations on `Extensions`. [#2890] [#2868]: https://github.com/actix/actix-web/pull/2868 [#2890]: https://github.com/actix/actix-web/pull/2890 +[#????]: https://github.com/actix/actix-web/pull/???? ## 3.2.2 - 2022-09-11 diff --git a/actix-http/src/header/mod.rs b/actix-http/src/header/mod.rs index 5f352fc12..cbd0493db 100644 --- a/actix-http/src/header/mod.rs +++ b/actix-http/src/header/mod.rs @@ -1,5 +1,8 @@ //! Pre-defined `HeaderName`s, traits for parsing and conversion, and other header utility methods. +// declaring new header consts will yield this error +#![allow(clippy::declare_interior_mutable_const)] + use percent_encoding::{AsciiSet, CONTROLS}; // re-export from http except header map related items @@ -27,6 +30,21 @@ pub use http::header::{ X_XSS_PROTECTION, }; +// other common headers not defined in `http` + +pub const CROSS_ORIGIN_EMBEDDER_POLICY: HeaderName = + HeaderName::from_static("cross-origin-embedder-policy"); +pub const CROSS_ORIGIN_OPENER_POLICY: HeaderName = + HeaderName::from_static("cross-origin-opener-policy"); + +pub const PERMISSIONS_POLICY: HeaderName = HeaderName::from_static("permissions-policy"); + +pub const X_FORWARDED_FOR: HeaderName = HeaderName::from_static("x-forwarded-for"); +pub const X_FORWARDED_HOST: HeaderName = HeaderName::from_static("x-forwarded-host"); +pub const X_FORWARDED_PROTO: HeaderName = HeaderName::from_static("x-forwarded-proto"); + +// end other common headers + use crate::{error::ParseError, HttpMessage}; mod as_name;