pub struct Csp { /* private fields */ }Expand description
A Content-Security-Policy under construction
A value of 'nonce-{nonce}' in any directive is replaced with a fresh random
nonce per request, readable through Request::csp_nonce for inline
<script nonce="..."> tags.
Implementations§
Source§impl Csp
impl Csp
Sourcepub fn web() -> Self
pub fn web() -> Self
For server-rendered pages: same-origin resources only, no plugins, no framing, forms post to the same origin
pub fn script_src<I, S>(self, values: I) -> Self
pub fn style_src<I, S>(self, values: I) -> Self
pub fn img_src<I, S>(self, values: I) -> Self
pub fn connect_src<I, S>(self, values: I) -> Self
Sourcepub fn report_uri(self, uri: &str) -> Self
pub fn report_uri(self, uri: &str) -> Self
Where browsers send violation reports (report-uri)
Sourcepub fn report_only(self) -> Self
pub fn report_only(self) -> Self
Deliver as Content-Security-Policy-Report-Only: violations are reported,
nothing is blocked. Useful to roll a policy out.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Csp
impl RefUnwindSafe for Csp
impl Send for Csp
impl Sync for Csp
impl Unpin for Csp
impl UnsafeUnpin for Csp
impl UnwindSafe for Csp
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