pub struct CspList(pub Vec<Policy>);
Expand description

https://www.w3.org/TR/CSP/#csp-list

Tuple Fields§

§0: Vec<Policy>

Implementations§

source§

impl CspList

source

pub fn is_valid(&self) -> bool

source

pub fn contains_a_header_delivered_content_security_policy(&self) -> bool

https://www.w3.org/TR/CSP/#contains-a-header-delivered-content-security-policy

source

pub fn parse( list: &str, source: PolicySource, disposition: PolicyDisposition ) -> CspList

https://www.w3.org/TR/CSP/#parse-serialized-policy-list

source

pub fn append(&mut self, other: CspList)

source

pub fn push(&mut self, policy: Policy)

source

pub fn report_violations_for_request(&self, request: &Request) -> Vec<Violation>

Given a request, this algorithm reports violations based on client’s “report only” policies.

https://www.w3.org/TR/CSP/#report-for-request

source

pub fn should_request_be_blocked( &self, request: &Request ) -> (CheckResult, Vec<Violation>)

Given a request, this algorithm returns Blocked or Allowed and reports violations based on request’s client’s Content Security Policy.

https://www.w3.org/TR/CSP/#should-block-request

source

pub fn should_response_to_request_be_blocked( &self, request: &Request, response: &Response ) -> (CheckResult, Vec<Violation>)

Given a response and a request, this algorithm returns Blocked or Allowed, and reports violations based on request’s client’s Content Security Policy.

https://www.w3.org/TR/CSP/#should-block-response

source

pub fn should_elements_inline_type_behavior_be_blocked( &self, element: &Element<'_>, type_: InlineCheckType, source: &str ) -> (CheckResult, Vec<Violation>)

https://www.w3.org/TR/CSP/#should-block-inline

source

pub fn is_base_allowed_for_document( &self, base: &Url, self_origin: &Origin ) -> (CheckResult, Vec<Violation>)

https://www.w3.org/TR/CSP/#allow-base-for-document

Note that, while this algoritm is defined as operating on a document, the only property it actually uses is the document’s CSP List. So this function operates on that.

source

pub fn get_sandboxing_flag_set_for_document(&self) -> Option<SandboxingFlagSet>

Trait Implementations§

source§

impl Clone for CspList

source§

fn clone(&self) -> CspList

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CspList

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for CspList

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for CspList

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Serialize for CspList

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,