Skip to content

Define preconnect and dns-prefetch with CSP #1620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PR nits
  • Loading branch information
noamr committed May 8, 2023
commit ef41a25eaf44ce15543e8cbf6a68d040734f596f
37 changes: 19 additions & 18 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2850,16 +2850,7 @@ steps:
<a>connection</a>.
</ol>

<li>
<p>Let <var>proxies</var> be the result of finding proxies for <var>url</var> in an
<a>implementation-defined</a> manner. If there are no proxies, let <var>proxies</var> be
« "<code>DIRECT</code>" ».

<p class=note>This is where non-standard technology such as
<a href="https://en.wikipedia.org/wiki/Web_Proxy_Auto-Discovery_Protocol">Web Proxy Auto-Discovery Protocol (WPAD)</a>
and <a href="https://en.wikipedia.org/wiki/Proxy_auto-config">proxy auto-config (PAC)</a> come
into play. The "<code>DIRECT</code>" value means to not use a proxy for this particular
<var>url</var>.
<li><p>Let <var>proxies</var> of calling <a>resolve proxies</a>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing words.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What words are missing? The note was moved to resolve proxies.


<li><p>Let <var>timingInfo</var> be a new <a for=/>connection timing info</a>.

Expand Down Expand Up @@ -2916,6 +2907,19 @@ reused across <a>connections</a> whose <a for=connection>credentials</a> are fal

<hr>

<div algorithm>
<p>To <dfn>resolve proxies</dfn>, return the result of finding proxies for <var>url</var> in an
<a>implementation-defined</a> manner. If there are no proxies, return « "<code>DIRECT</code>" ».
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does url come from here? If it needs to be an argument, let's make it explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


<p class=note>This is where non-standard technology such as
<a href="https://en.wikipedia.org/wiki/Web_Proxy_Auto-Discovery_Protocol">Web Proxy Auto-Discovery Protocol (WPAD)</a>
and <a href="https://en.wikipedia.org/wiki/Proxy_auto-config">proxy auto-config (PAC)</a> come
into play. The "<code>DIRECT</code>" value means to not use a proxy for this particular
<var>url</var>.
</div>

<hr>

<div algorithm>
<p>To <dfn>create a connection</dfn>, given a <a for=/>network partition key</a> <var>key</var>,
<a for=/>origin</a> <var>origin</var>, boolean <var>credentials</var>, string <var>proxy</var>,
Expand Down Expand Up @@ -3027,7 +3031,7 @@ details of reused connections are not exposed and time values are coarsened.
</div>


<h3 id=preemptive-connection-operations>Preemptive connection operations</h3>
<h3 id=preemptive-connections>Preemptive connections</h3>

<div algorithm="preemmptively-obtain-a-connection">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does algorithm need this value? Normally it works without.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<p>To <dfn export>preemptively obtain a connection</dfn>, given an
Expand Down Expand Up @@ -3070,13 +3074,11 @@ these steps:
<li><p><a>Check CSP for preemptive operation</a> with <var>environment</var> and <var>url</var>. If
that returns <b>blocked</b>, return.

<li><p>Let <var>proxies</var> be the result of finding proxies for <var>url</var> in an
<a>implementation-defined</a> manner.
<li><p>Let <var>proxies</var> be the result of calling <a>resolve proxies</a>.

<li>
<p>If <var>proxies</var> is <a for=list>empty</a>, or if <var>proxies</var>
<a for=list>contains</a> "<code>DIRECT</code>", then <a>resolve an origin</a> given <var>key</var>
and <var>url</var>'s <a for=url>origin</a>.
<p>If <var>proxies</var> <a for=list>contains</a> "<code>DIRECT</code>", then
<a>resolve an origin</a> given <var>key</var> and <var>url</var>'s <a for=url>origin</a>.

<p class=note>As the results of this algorithm can be cached, future fetches could be faster.
</ol>
Expand All @@ -3094,7 +3096,6 @@ run these steps:

<li><p>Return the result of running <a>should request be blocked by Content Security Policy?</a>
given <var>request</var>.

</ol>
</div>

Expand Down Expand Up @@ -8792,7 +8793,7 @@ to discuss. [[CSP]]
<a>environment settings object</a> you're operating in. Web-exposed APIs are generally defined with
Web IDL, for which every object that implements an <a>interface</a> has a
<a>relevant settings object</a> you can use. For example, a <a for=/>request</a> associated with an
{{Element}} would set the <a for=/>request</a>'s <a for=request>client</a> to the element's
<a for=/>element</a> would set the <a for=/>request</a>'s <a for=request>client</a> to the element's
<a>node document</a>'s <a>relevant settings object</a>. All features that are directly web-exposed
by JavaScript, HTML, CSS, or other {{Document}} subresources should have a
<a for=request>client</a>.
Expand Down