mirror of
https://github.com/actix/actix-extras.git
synced 2025-02-17 16:43:30 +01:00
Deploying to gh-pages from @ 45643d4035cf81ef136d6d889826bc5fa566d00d 🚀
This commit is contained in:
parent
f438a616e1
commit
c3094d25f9
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="https://actix.rs/favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_cors/index.html'><div class='logo-container rust-logo'><img src='https://actix.rs/img/logo.png' alt='logo'></div></a><h2 class="location">Crate actix_cors</h2><div class="block version"><p>Version 0.6.0-beta.2</p></div><a id="all-types" href="index.html"><p>Back to index</p></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">List of all items</span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="https://actix.rs/favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_cors/index.html'><div class='logo-container rust-logo'><img src='https://actix.rs/img/logo.png' alt='logo'></div></a><h2 class="location">Crate actix_cors</h2><div class="block version"><p>Version 0.6.0-beta.3</p></div><a id="all-types" href="index.html"><p>Back to index</p></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">List of all items</span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span>
|
||||
</span>
|
||||
</h1><h3 id="Structs">Structs</h3><ul class="structs docblock"><li><a href="struct.Cors.html">Cors</a></li></ul><h3 id="Enums">Enums</h3><ul class="enums docblock"><li><a href="enum.CorsError.html">CorsError</a></li></ul></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_cors" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Cross-Origin Resource Sharing (CORS) controls for Actix Web."><meta name="keywords" content="rust, rustlang, rust-lang, actix_cors"><title>actix_cors - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="https://actix.rs/favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_cors/index.html'><div class='logo-container rust-logo'><img src='https://actix.rs/img/logo.png' alt='logo'></div></a><h2 class="location">Crate actix_cors</h2><div class="block version"><div class="narrow-helper"></div><p>Version 0.6.0-beta.2</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all actix_cors's items</p></a><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><div id="sidebar-vars" data-name="actix_cors" data-ty="mod" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">actix_cors</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../src/actix_cors/lib.rs.html#1-60" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cross-Origin Resource Sharing (CORS) controls for Actix Web.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Cross-Origin Resource Sharing (CORS) controls for Actix Web."><meta name="keywords" content="rust, rustlang, rust-lang, actix_cors"><title>actix_cors - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="https://actix.rs/favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_cors/index.html'><div class='logo-container rust-logo'><img src='https://actix.rs/img/logo.png' alt='logo'></div></a><h2 class="location">Crate actix_cors</h2><div class="block version"><div class="narrow-helper"></div><p>Version 0.6.0-beta.3</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all actix_cors's items</p></a><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><div id="sidebar-vars" data-name="actix_cors" data-ty="mod" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">actix_cors</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../src/actix_cors/lib.rs.html#1-60" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Cross-Origin Resource Sharing (CORS) controls for Actix Web.</p>
|
||||
<p>This middleware can be applied to both applications and resources. Once built, a
|
||||
<a href="struct.Cors.html" title="Cors"><code>Cors</code></a> builder can be used as an argument for Actix Web’s <code>App::wrap()</code>,
|
||||
<code>Scope::wrap()</code>, or <code>Resource::wrap()</code> methods.</p>
|
||||
|
@ -20,12 +20,12 @@ server will fail to start up or serve requests.</p>
|
||||
.<span class="ident">max_age</span>(<span class="number">3600</span>);
|
||||
|
||||
<span class="comment">// `cors` can now be used in `App::wrap`.</span></code></pre></div>
|
||||
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#80-450" title="goto source code">[src]</a></div><a href="#impl" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.permissive" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#85-109" title="goto source code">[src]</a></div><a href="#method.permissive" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.permissive" class="fnname">permissive</a>() -> Self</h4></div></summary><div class="docblock"><p>A very permissive set of default for quick development. Not recommended for production use.</p>
|
||||
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#80-451" title="goto source code">[src]</a></div><a href="#impl" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.permissive" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#85-110" title="goto source code">[src]</a></div><a href="#method.permissive" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.permissive" class="fnname">permissive</a>() -> Self</h4></div></summary><div class="docblock"><p>A very permissive set of default for quick development. Not recommended for production use.</p>
|
||||
<p><em>All</em> origins, methods, request headers and exposed headers allowed. Credentials supported.
|
||||
Max age 1 hour. Does not send wildcard.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allow_any_origin" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#114-120" title="goto source code">[src]</a></div><a href="#method.allow_any_origin" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allow_any_origin" class="fnname">allow_any_origin</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Resets allowed origin list to a state where any origin is accepted.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allow_any_origin" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#115-121" title="goto source code">[src]</a></div><a href="#method.allow_any_origin" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allow_any_origin" class="fnname">allow_any_origin</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Resets allowed origin list to a state where any origin is accepted.</p>
|
||||
<p>See <a href="struct.Cors.html#method.allowed_origin" title="Cors::allowed_origin"><code>Cors::allowed_origin</code></a> for more info on allowed origins.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_origin" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#146-173" title="goto source code">[src]</a></div><a href="#method.allowed_origin" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_origin" class="fnname">allowed_origin</a>(self, origin: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Add an origin that is allowed to make requests.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_origin" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#147-174" title="goto source code">[src]</a></div><a href="#method.allowed_origin" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_origin" class="fnname">allowed_origin</a>(self, origin: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Add an origin that is allowed to make requests.</p>
|
||||
<p>By default, requests from all origins are accepted by CORS logic. This method allows to
|
||||
specify a finite set of origins to verify the value of the <code>Origin</code> request header.</p>
|
||||
<p>These are <code>origin-or-null</code> types in the <a href="https://fetch.spec.whatwg.org/#origin-header">Fetch Standard</a>.</p>
|
||||
@ -43,39 +43,39 @@ allowed origins.</p>
|
||||
<li>If supplied origin is not valid uri</li>
|
||||
<li>If supplied origin is a wildcard (<code>*</code>). <a href="struct.Cors.html#method.send_wildcard" title="Cors::send_wildcard"><code>Cors::send_wildcard</code></a> should be used instead.</li>
|
||||
</ul>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_origin_fn" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#183-194" title="goto source code">[src]</a></div><a href="#method.allowed_origin_fn" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_origin_fn" class="fnname">allowed_origin_fn</a><F>(self, f: F) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(&<a class="struct" href="https://docs.rs/http/0.2.5/http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</a>, &RequestHead) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> + 'static, </span></h4></div></summary><div class="docblock"><p>Determinate allowed origins by processing requests which didn’t match any origins specified
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_origin_fn" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#184-195" title="goto source code">[src]</a></div><a href="#method.allowed_origin_fn" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_origin_fn" class="fnname">allowed_origin_fn</a><F>(self, f: F) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(&<a class="struct" href="https://docs.rs/http/0.2.5/http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</a>, &RequestHead) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> + 'static, </span></h4></div></summary><div class="docblock"><p>Determinate allowed origins by processing requests which didn’t match any origins specified
|
||||
in the <code>allowed_origin</code>.</p>
|
||||
<p>The function will receive two parameters, the Origin header value, and the <code>RequestHead</code> of
|
||||
each request, which can be used to determine whether to allow the request or not.</p>
|
||||
<p>If the function returns <code>true</code>, the client’s <code>Origin</code> request header will be echoed back
|
||||
into the <code>Access-Control-Allow-Origin</code> response header.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allow_any_method" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#199-205" title="goto source code">[src]</a></div><a href="#method.allow_any_method" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allow_any_method" class="fnname">allow_any_method</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Resets allowed methods list to all methods.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allow_any_method" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#200-206" title="goto source code">[src]</a></div><a href="#method.allow_any_method" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allow_any_method" class="fnname">allow_any_method</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Resets allowed methods list to all methods.</p>
|
||||
<p>See <a href="struct.Cors.html#method.allowed_methods" title="Cors::allowed_methods"><code>Cors::allowed_methods</code></a> for more info on allowed methods.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_methods" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#215-237" title="goto source code">[src]</a></div><a href="#method.allowed_methods" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_methods" class="fnname">allowed_methods</a><U, M>(self, methods: U) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = M>,<br> M: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/method/struct.Method.html" title="struct http::method::Method">Method</a>>,<br> <M as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/method/struct.Method.html" title="struct http::method::Method">Method</a>>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" title="type core::convert::TryInto::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>, </span></h4></div></summary><div class="docblock"><p>Set a list of methods which allowed origins can perform.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_methods" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#216-238" title="goto source code">[src]</a></div><a href="#method.allowed_methods" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_methods" class="fnname">allowed_methods</a><U, M>(self, methods: U) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = M>,<br> M: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/method/struct.Method.html" title="struct http::method::Method">Method</a>>,<br> <M as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/method/struct.Method.html" title="struct http::method::Method">Method</a>>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" title="type core::convert::TryInto::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>, </span></h4></div></summary><div class="docblock"><p>Set a list of methods which allowed origins can perform.</p>
|
||||
<p>These will be sent in the <code>Access-Control-Allow-Methods</code> response header as specified in
|
||||
the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
|
||||
<p>Defaults to <code>[GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE]</code></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allow_any_header" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#242-248" title="goto source code">[src]</a></div><a href="#method.allow_any_header" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allow_any_header" class="fnname">allow_any_header</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Resets allowed request header list to a state where any header is accepted.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allow_any_header" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#243-249" title="goto source code">[src]</a></div><a href="#method.allow_any_header" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allow_any_header" class="fnname">allow_any_header</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Resets allowed request header list to a state where any header is accepted.</p>
|
||||
<p>See <a href="struct.Cors.html#method.allowed_headers" title="Cors::allowed_headers"><code>Cors::allowed_headers</code></a> for more info on allowed request headers.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_header" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#253-275" title="goto source code">[src]</a></div><a href="#method.allowed_header" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_header" class="fnname">allowed_header</a><H>(self, header: H) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>,<br> <H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" title="type core::convert::TryInto::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>, </span></h4></div></summary><div class="docblock"><p>Add an allowed request header.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_header" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#254-276" title="goto source code">[src]</a></div><a href="#method.allowed_header" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_header" class="fnname">allowed_header</a><H>(self, header: H) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>,<br> <H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" title="type core::convert::TryInto::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>, </span></h4></div></summary><div class="docblock"><p>Add an allowed request header.</p>
|
||||
<p>See <a href="struct.Cors.html#method.allowed_headers" title="Cors::allowed_headers"><code>Cors::allowed_headers</code></a> for more info on allowed request headers.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_headers" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#287-314" title="goto source code">[src]</a></div><a href="#method.allowed_headers" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_headers" class="fnname">allowed_headers</a><U, H>(self, headers: U) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = H>,<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>,<br> <H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" title="type core::convert::TryInto::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>, </span></h4></div></summary><div class="docblock"><p>Set a list of request header field names which can be used when this resource is accessed by
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.allowed_headers" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#288-315" title="goto source code">[src]</a></div><a href="#method.allowed_headers" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.allowed_headers" class="fnname">allowed_headers</a><U, H>(self, headers: U) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = H>,<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>,<br> <H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" title="type core::convert::TryInto::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>, </span></h4></div></summary><div class="docblock"><p>Set a list of request header field names which can be used when this resource is accessed by
|
||||
allowed origins.</p>
|
||||
<p>If <code>All</code> is set, whatever is requested by the client in <code>Access-Control-Request-Headers</code>
|
||||
will be echoed back in the <code>Access-Control-Allow-Headers</code> header as specified in
|
||||
the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
|
||||
<p>Defaults to <code>All</code>.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.expose_any_header" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#319-325" title="goto source code">[src]</a></div><a href="#method.expose_any_header" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.expose_any_header" class="fnname">expose_any_header</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Resets exposed response header list to a state where any header is accepted.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.expose_any_header" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#320-326" title="goto source code">[src]</a></div><a href="#method.expose_any_header" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.expose_any_header" class="fnname">expose_any_header</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Resets exposed response header list to a state where any header is accepted.</p>
|
||||
<p>See <a href="struct.Cors.html#method.expose_headers" title="Cors::expose_headers"><code>Cors::expose_headers</code></a> for more info on exposed response headers.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.expose_headers" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#334-360" title="goto source code">[src]</a></div><a href="#method.expose_headers" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.expose_headers" class="fnname">expose_headers</a><U, H>(self, headers: U) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = H>,<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>,<br> <H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" title="type core::convert::TryInto::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>, </span></h4></div></summary><div class="docblock"><p>Set a list of headers which are safe to expose to the API of a CORS API specification.
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.expose_headers" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#335-361" title="goto source code">[src]</a></div><a href="#method.expose_headers" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.expose_headers" class="fnname">expose_headers</a><U, H>(self, headers: U) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = H>,<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>,<br> <H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" title="type core::convert::TryInto::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="https://docs.rs/http/0.2.5/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>, </span></h4></div></summary><div class="docblock"><p>Set a list of headers which are safe to expose to the API of a CORS API specification.
|
||||
This corresponds to the <code>Access-Control-Expose-Headers</code> response header as specified in
|
||||
the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
|
||||
<p>This defaults to an empty set.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.max_age" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#369-375" title="goto source code">[src]</a></div><a href="#method.max_age" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.max_age" class="fnname">max_age</a>(self, max_age: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Set a maximum time (in seconds) for which this CORS request maybe cached.
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.max_age" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#370-376" title="goto source code">[src]</a></div><a href="#method.max_age" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.max_age" class="fnname">max_age</a>(self, max_age: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Set a maximum time (in seconds) for which this CORS request maybe cached.
|
||||
This value is set as the <code>Access-Control-Max-Age</code> header as specified in
|
||||
the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
|
||||
<p>Pass a number (of seconds) or use None to disable sending max age header.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_wildcard" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#388-394" title="goto source code">[src]</a></div><a href="#method.send_wildcard" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_wildcard" class="fnname">send_wildcard</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Set to use wildcard origins.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_wildcard" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#389-395" title="goto source code">[src]</a></div><a href="#method.send_wildcard" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_wildcard" class="fnname">send_wildcard</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Set to use wildcard origins.</p>
|
||||
<p>If send wildcard is set and the <code>allowed_origins</code> parameter is <code>All</code>, a wildcard
|
||||
<code>Access-Control-Allow-Origin</code> response header is sent, rather than the request’s
|
||||
<code>Origin</code> header.</p>
|
||||
@ -83,7 +83,7 @@ the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard C
|
||||
<code>allow_credentials</code> set to <code>true</code>. Depending on the mode of usage, this will either result
|
||||
in an <code>CorsError::CredentialsWithWildcardOrigin</code> error during actix launch or runtime.</p>
|
||||
<p>Defaults to <code>false</code>.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.supports_credentials" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#411-417" title="goto source code">[src]</a></div><a href="#method.supports_credentials" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.supports_credentials" class="fnname">supports_credentials</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Allows users to make authenticated requests</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.supports_credentials" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#412-418" title="goto source code">[src]</a></div><a href="#method.supports_credentials" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.supports_credentials" class="fnname">supports_credentials</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Allows users to make authenticated requests</p>
|
||||
<p>If true, injects the <code>Access-Control-Allow-Credentials</code> header in responses. This allows
|
||||
cookies and credentials to be submitted across domains as specified in
|
||||
the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
|
||||
@ -92,27 +92,27 @@ the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard C
|
||||
<p>Defaults to <code>false</code>.</p>
|
||||
<p>A server initialization error will occur if credentials are allowed, but the Origin is set
|
||||
to send wildcards (<code>*</code>); this is not allowed by the CORS protocol.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.disable_vary_header" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#429-435" title="goto source code">[src]</a></div><a href="#method.disable_vary_header" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.disable_vary_header" class="fnname">disable_vary_header</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Disable <code>Vary</code> header support.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.disable_vary_header" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#430-436" title="goto source code">[src]</a></div><a href="#method.disable_vary_header" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.disable_vary_header" class="fnname">disable_vary_header</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Disable <code>Vary</code> header support.</p>
|
||||
<p>When enabled the header <code>Vary: Origin</code> will be returned as per the Fetch Standard
|
||||
implementation guidelines.</p>
|
||||
<p>Setting this header when the <code>Access-Control-Allow-Origin</code> is dynamically generated
|
||||
(eg. when there is more than one allowed origin, and an Origin other than ‘*’ is returned)
|
||||
informs CDNs and other caches that the CORS headers are dynamic, and cannot be cached.</p>
|
||||
<p>By default, <code>Vary</code> header support is enabled.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.disable_preflight" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#443-449" title="goto source code">[src]</a></div><a href="#method.disable_preflight" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.disable_preflight" class="fnname">disable_preflight</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Disable support for preflight requests.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.disable_preflight" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#444-450" title="goto source code">[src]</a></div><a href="#method.disable_preflight" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.disable_preflight" class="fnname">disable_preflight</a>(self) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>Disable support for preflight requests.</p>
|
||||
<p>When enabled CORS middleware automatically handles <code>OPTIONS</code> requests.
|
||||
This is useful for application level middleware.</p>
|
||||
<p>By default <em>preflight</em> support is enabled.</p>
|
||||
</div></details></div></details><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Debug" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#74" title="goto source code">[src]</a></div><a href="#impl-Debug" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#74" title="goto source code">[src]</a></div><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Default" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#452-483" title="goto source code">[src]</a></div><a href="#impl-Default" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.default" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#457-482" title="goto source code">[src]</a></div><a href="#method.default" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>A restrictive (security paranoid) set of defaults.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Default" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#453-484" title="goto source code">[src]</a></div><a href="#impl-Default" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.default" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#458-483" title="goto source code">[src]</a></div><a href="#method.default" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></div></summary><div class="docblock"><p>A restrictive (security paranoid) set of defaults.</p>
|
||||
<p><em>No</em> allowed origins, methods, request headers or exposed headers. Credentials
|
||||
not supported. No max age (will use browser’s default).</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Transform%3CS%2C%20ServiceRequest%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#485-544" title="goto source code">[src]</a></div><a href="#impl-Transform%3CS%2C%20ServiceRequest%3E" class="anchor"></a><h3 class="code-header in-band">impl<S, B> Transform<S, ServiceRequest> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,<br> S::Future: 'static,<br> B: MessageBody + 'static,<br> B::Error: <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">StdError</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Response" class="type trait-impl has-srclink"><a href="#associatedtype.Response" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Response" class="type">Response</a> = ServiceResponse</h4></div></summary><div class='docblock'><p>Responses produced by the service.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Transform%3CS%2C%20ServiceRequest%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#486-545" title="goto source code">[src]</a></div><a href="#impl-Transform%3CS%2C%20ServiceRequest%3E" class="anchor"></a><h3 class="code-header in-band">impl<S, B> Transform<S, ServiceRequest> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> <span class="where fmt-newline">where<br> S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,<br> S::Future: 'static,<br> B: MessageBody + 'static,<br> B::Error: <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">StdError</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Response" class="type trait-impl has-srclink"><a href="#associatedtype.Response" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Response" class="type">Response</a> = ServiceResponse</h4></div></summary><div class='docblock'><p>Responses produced by the service.</p>
|
||||
</div></details><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error" class="type trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Error" class="type">Error</a> = Error</h4></div></summary><div class='docblock'><p>Errors produced by the service.</p>
|
||||
</div></details><details class="rustdoc-toggle" open><summary><div id="associatedtype.InitError" class="type trait-impl has-srclink"><a href="#associatedtype.InitError" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.InitError" class="type">InitError</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></h4></div></summary><div class='docblock'><p>Errors produced while building a transform service.</p>
|
||||
</div></details><details class="rustdoc-toggle" open><summary><div id="associatedtype.Transform" class="type trait-impl has-srclink"><a href="#associatedtype.Transform" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Transform" class="type">Transform</a> = CorsMiddleware<S></h4></div></summary><div class='docblock'><p>The <code>TransformService</code> value created by this factory</p>
|
||||
</div></details><details class="rustdoc-toggle" open><summary><div id="associatedtype.Future" class="type trait-impl has-srclink"><a href="#associatedtype.Future" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Future" class="type">Future</a> = Ready<Result<Self::Transform, Self::InitError>></h4></div></summary><div class='docblock'><p>The future response value.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.new_transform" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#498-543" title="goto source code">[src]</a></div><a href="#method.new_transform" class="anchor"></a><h4 class="code-header">fn <a class="fnname">new_transform</a>(&self, service: S) -> Self::Future</h4></div></summary><div class='docblock'><p>Creates and returns a new Transform component, asynchronously</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.new_transform" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_cors/builder.rs.html#499-544" title="goto source code">[src]</a></div><a href="#method.new_transform" class="anchor"></a><h4 class="code-header">fn <a class="fnname">new_transform</a>(&self, service: S) -> Self::Future</h4></div></summary><div class='docblock'><p>Creates and returns a new Transform component, asynchronously</p>
|
||||
</div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><div id="impl-RefUnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-RefUnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div><div id="impl-Send" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Send" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div><div id="impl-Sync" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Sync" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div><div id="impl-Unpin" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Unpin" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div><div id="impl-UnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-UnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Any" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132-136" title="goto source code">[src]</a></div><a href="#impl-Any" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.type_id" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#133" title="goto source code">[src]</a></div><a href="#method.type_id" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></div></summary><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
|
@ -650,6 +650,12 @@
|
||||
<span id="650">650</span>
|
||||
<span id="651">651</span>
|
||||
<span id="652">652</span>
|
||||
<span id="653">653</span>
|
||||
<span id="654">654</span>
|
||||
<span id="655">655</span>
|
||||
<span id="656">656</span>
|
||||
<span id="657">657</span>
|
||||
<span id="658">658</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{
|
||||
<span class="ident">collections::HashSet</span>, <span class="ident">convert::TryInto</span>, <span class="ident">error::Error</span> <span class="kw">as</span> <span class="ident">StdError</span>, <span class="ident">iter::FromIterator</span>, <span class="ident">rc::Rc</span>,
|
||||
};
|
||||
@ -747,6 +753,7 @@
|
||||
|
||||
<span class="ident">expose_headers</span>: <span class="ident">AllOrSome::All</span>,
|
||||
<span class="ident">expose_headers_baked</span>: <span class="prelude-val">None</span>,
|
||||
|
||||
<span class="ident">max_age</span>: <span class="prelude-val">Some</span>(<span class="number">3600</span>),
|
||||
<span class="ident">preflight</span>: <span class="bool-val">true</span>,
|
||||
<span class="ident">send_wildcard</span>: <span class="bool-val">false</span>,
|
||||
@ -1196,13 +1203,18 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Only call when values are guaranteed to be valid header values and set is not empty.</span>
|
||||
<span class="kw">fn</span> <span class="ident">intersperse_header_values</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">val_set</span>: <span class="kw-2">&</span><span class="ident">HashSet</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) -> <span class="ident">HeaderValue</span>
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">intersperse_header_values</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">val_set</span>: <span class="kw-2">&</span><span class="ident">HashSet</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) -> <span class="ident">HeaderValue</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">AsRef</span><span class="op"><</span><span class="ident">str</span><span class="op">></span>,
|
||||
{
|
||||
<span class="macro">debug_assert!</span>(
|
||||
<span class="op">!</span><span class="ident">val_set</span>.<span class="ident">is_empty</span>(),
|
||||
<span class="string">"only call `intersperse_header_values` when set is not empty"</span>
|
||||
);
|
||||
|
||||
<span class="ident">val_set</span>
|
||||
.<span class="ident">iter</span>()
|
||||
.<span class="ident">fold</span>(<span class="ident">String::with_capacity</span>(<span class="number">32</span>), <span class="op">|</span><span class="kw-2">mut</span> <span class="ident">acc</span>, <span class="ident">val</span><span class="op">|</span> {
|
||||
.<span class="ident">fold</span>(<span class="ident">String::with_capacity</span>(<span class="number">64</span>), <span class="op">|</span><span class="kw-2">mut</span> <span class="ident">acc</span>, <span class="ident">val</span><span class="op">|</span> {
|
||||
<span class="ident">acc</span>.<span class="ident">push_str</span>(<span class="string">", "</span>);
|
||||
<span class="ident">acc</span>.<span class="ident">push_str</span>(<span class="ident">val</span>.<span class="ident">as_ref</span>());
|
||||
<span class="ident">acc</span>
|
||||
|
@ -212,7 +212,33 @@
|
||||
<span id="212">212</span>
|
||||
<span id="213">213</span>
|
||||
<span id="214">214</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">convert::TryInto</span>, <span class="ident">error::Error</span> <span class="kw">as</span> <span class="ident">StdError</span>, <span class="ident">rc::Rc</span>};
|
||||
<span id="215">215</span>
|
||||
<span id="216">216</span>
|
||||
<span id="217">217</span>
|
||||
<span id="218">218</span>
|
||||
<span id="219">219</span>
|
||||
<span id="220">220</span>
|
||||
<span id="221">221</span>
|
||||
<span id="222">222</span>
|
||||
<span id="223">223</span>
|
||||
<span id="224">224</span>
|
||||
<span id="225">225</span>
|
||||
<span id="226">226</span>
|
||||
<span id="227">227</span>
|
||||
<span id="228">228</span>
|
||||
<span id="229">229</span>
|
||||
<span id="230">230</span>
|
||||
<span id="231">231</span>
|
||||
<span id="232">232</span>
|
||||
<span id="233">233</span>
|
||||
<span id="234">234</span>
|
||||
<span id="235">235</span>
|
||||
<span id="236">236</span>
|
||||
<span id="237">237</span>
|
||||
<span id="238">238</span>
|
||||
<span id="239">239</span>
|
||||
<span id="240">240</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">collections::HashSet</span>, <span class="ident">convert::TryInto</span>, <span class="ident">error::Error</span> <span class="kw">as</span> <span class="ident">StdError</span>, <span class="ident">rc::Rc</span>};
|
||||
|
||||
<span class="kw">use</span> <span class="ident">actix_web</span>::{
|
||||
<span class="ident">body</span>::{<span class="ident">AnyBody</span>, <span class="ident">MessageBody</span>},
|
||||
@ -227,7 +253,7 @@
|
||||
<span class="kw">use</span> <span class="ident">futures_util::future</span>::{<span class="ident">ok</span>, <span class="ident">Either</span>, <span class="ident">FutureExt</span> <span class="kw">as</span> <span class="kw">_</span>, <span class="ident">LocalBoxFuture</span>, <span class="ident">Ready</span>, <span class="ident">TryFutureExt</span> <span class="kw">as</span> <span class="kw">_</span>};
|
||||
<span class="kw">use</span> <span class="ident">log::debug</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident"><span class="kw">crate</span>::Inner</span>;
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">builder::intersperse_header_values</span>, <span class="ident">AllOrSome</span>, <span class="ident">Inner</span>};
|
||||
|
||||
<span class="doccomment">/// Service wrapper for Cross-Origin Resource Sharing support.</span>
|
||||
<span class="doccomment">///</span>
|
||||
@ -292,8 +318,34 @@
|
||||
};
|
||||
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="kw-2">ref</span> <span class="ident">expose</span>) <span class="op">=</span> <span class="ident">inner</span>.<span class="ident">expose_headers_baked</span> {
|
||||
<span class="macro">log::trace!</span>(<span class="string">"exposing selected headers: {:?}"</span>, <span class="ident">expose</span>);
|
||||
|
||||
<span class="ident">res</span>.<span class="ident">headers_mut</span>()
|
||||
.<span class="ident">insert</span>(<span class="ident">header::ACCESS_CONTROL_EXPOSE_HEADERS</span>, <span class="ident">expose</span>.<span class="ident">clone</span>());
|
||||
} <span class="kw">else</span> <span class="kw">if</span> <span class="macro">matches!</span>(<span class="ident">inner</span>.<span class="ident">expose_headers</span>, <span class="ident">AllOrSome::All</span>) {
|
||||
<span class="comment">// intersperse_header_values requires that argument is non-empty</span>
|
||||
<span class="kw">if</span> <span class="op">!</span><span class="ident">res</span>.<span class="ident">request</span>().<span class="ident">headers</span>().<span class="ident">is_empty</span>() {
|
||||
<span class="comment">// extract header names from request</span>
|
||||
<span class="kw">let</span> <span class="ident">expose_all_request_headers</span> <span class="op">=</span> <span class="ident">res</span>
|
||||
.<span class="ident">request</span>()
|
||||
.<span class="ident">headers</span>()
|
||||
.<span class="ident">keys</span>()
|
||||
.<span class="ident">into_iter</span>()
|
||||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">name</span><span class="op">|</span> <span class="ident">name</span>.<span class="ident">as_str</span>())
|
||||
.<span class="ident">collect</span>::<span class="op"><</span><span class="ident">HashSet</span><span class="op"><</span><span class="kw">_</span><span class="op">></span><span class="op">></span>();
|
||||
|
||||
<span class="comment">// create comma separated string of header names</span>
|
||||
<span class="kw">let</span> <span class="ident">expose_headers_value</span> <span class="op">=</span> <span class="ident">intersperse_header_values</span>(<span class="kw-2">&</span><span class="ident">expose_all_request_headers</span>);
|
||||
|
||||
<span class="macro">log::trace!</span>(
|
||||
<span class="string">"exposing all headers from request: {:?}"</span>,
|
||||
<span class="ident">expose_headers_value</span>
|
||||
);
|
||||
|
||||
<span class="comment">// add header names to expose response header</span>
|
||||
<span class="ident">res</span>.<span class="ident">headers_mut</span>()
|
||||
.<span class="ident">insert</span>(<span class="ident">header::ACCESS_CONTROL_EXPOSE_HEADERS</span>, <span class="ident">expose_headers_value</span>);
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">if</span> <span class="ident">inner</span>.<span class="ident">supports_credentials</span> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user