[−][src]Struct rocket_cors::Origins
Origins that are allowed to make CORS requests.
An origin is defined according to the defined syntax.
Origins can be specified as an exact match or using regex.
These Origins are specified as logical ORs
. That is, if any of the origins match, the entire
request is considered to be valid.
Exact matches are matched exactly with the ASCII Serialization of the origin.
Regular expressions are tested for matches against the ASCII Serialization of the origin.
Opaque Origins
The specification defines an Opaque Origin
as one that cannot be recreated. You can refer to the source code for the url::Url::origin
method to see how an Opaque Origin is determined. Examples of Opaque origins might include
schemes like file://
or Browser specific schemes like "moz-extension://
or
chrome-extension://
.
Opaque Origins cannot be matched exactly. You must use Regex to match Opaque Origins. If you
attempt to create Cors
from CorsOptions
, you will get an error.
Warning about Regex expressions
By default, regex expressions are unanchored.
This means that if the regex does not start with ^
or \A
, or end with $
or \z
,
then it is permitted to match anywhere in the text. You are encouraged to use the anchors when
crafting your Regex expressions.
Fields
allow_null: bool
Whether null origins are accepted
exact: Option<HashSet<String>>
Origins that must be matched exactly as provided.
These must be valid URL strings that will be parsed and validated when
creating Cors
.
Exact matches are matched exactly with the ASCII Serialization of the origin.
Opaque Origins
The specification defines an Opaque Origin
as one that cannot be recreated. You can refer to the source code for the url::Url::origin
method to see how an Opaque Origin is determined. Examples of Opaque origins might include
schemes like file://
or Browser specific schemes like "moz-extension://
or
chrome-extension://
.
Opaque Origins cannot be matched exactly. You must use Regex to match Opaque Origins. If you
attempt to create Cors
from CorsOptions
, you will get an error.
regex: Option<HashSet<String>>
Origins that will be matched via any regex in this list.
These must be valid Regex that will be parsed and validated when creating Cors
.
The regex will be matched according to the ASCII serialization of the incoming Origin.
For more information on the syntax of Regex in Rust, see the documentation.
Regular expressions are tested for matches against the ASCII Serialization of the origin.
Warning about Regex expressions
By default, regex expressions are unanchored.
Trait Implementations
impl Clone for Origins
[src]
impl Default for Origins
[src]
impl Eq for Origins
[src]
impl PartialEq<Origins> for Origins
[src]
impl Debug for Origins
[src]
impl StructuralPartialEq for Origins
[src]
impl StructuralEq for Origins
[src]
impl Serialize for Origins
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Origins where
Origins: Default,
[src]
Origins: Default,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Send for Origins
impl Sync for Origins
impl Unpin for Origins
impl UnwindSafe for Origins
impl RefUnwindSafe for Origins
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,