pub struct SafeHeader;Expand description
Safe header operations
Implementations§
Source§impl SafeHeader
impl SafeHeader
Sourcepub fn is_valid_name(name: &str) -> bool
pub fn is_valid_name(name: &str) -> bool
Check if header name is a valid token per RFC 7230
Sourcepub fn is_dangerous(name: &str) -> bool
pub fn is_dangerous(name: &str) -> bool
Check if header name is in the dangerous headers list
Sourcepub fn make_safe(name: &str, value: &str) -> Result<Header>
pub fn make_safe(name: &str, value: &str) -> Result<Header>
Create header, blocking dangerous headers
Sourcepub fn build_hsts(
max_age: u64,
include_subdomains: bool,
preload: bool,
) -> String
pub fn build_hsts( max_age: u64, include_subdomains: bool, preload: bool, ) -> String
Build Strict-Transport-Security header value
Sourcepub fn build_csp(directives: &[(String, Vec<String>)]) -> String
pub fn build_csp(directives: &[(String, Vec<String>)]) -> String
Build Content-Security-Policy header value from directives
Sourcepub fn security_headers() -> Vec<Header>
pub fn security_headers() -> Vec<Header>
Get common security headers preset
Auto Trait Implementations§
impl Freeze for SafeHeader
impl RefUnwindSafe for SafeHeader
impl Send for SafeHeader
impl Sync for SafeHeader
impl Unpin for SafeHeader
impl UnwindSafe for SafeHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more