Skip to content

Commit

Permalink
Define the extended HTTP headers. Fixes #717.
Browse files Browse the repository at this point in the history
  • Loading branch information
jungkees committed Nov 3, 2015
1 parent 4ff7da5 commit 12063af
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 2 deletions.
41 changes: 40 additions & 1 deletion spec/service_worker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ <h1>Dependencies</h1>
<li><a href="http://www.w3.org/TR/page-visibility/">Page Visibility (Second Edition)</a></li>
<li><a href="http://www.w3.org/2001/tag/doc/unsanctioned-tracking/">(Non-normative) Unsanctioned Web Tracking</a></li>
<li><a href="https://w3c.github.io/push-api/">Push API</a></li>
<li><a href="http://tools.ietf.org/html/rfc5234">Augmented BNF for Syntax Specifications: ABNF</a></li>
<li><a href="https://tools.ietf.org/html/rfc3986">Uniform Resource Identifier (URI): Generic Syntax</a></li>
</ul>
</spec-section>

Expand Down Expand Up @@ -912,7 +914,7 @@ <h1><code>clients</code></h1>
<spec-section id="service-worker-global-scope-registration">
<h1><code>registration</code></h1>

The <dfn id="service-worker-global-scope-scope-attribute"><code>registration</code></dfn> attribute <em class="rfc2119" title="MUST">must</em> return the <code><a href="#service-worker-registration-interface">ServiceWorkerRegistration</a></code> object that represents the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>.</p>
<p>The <dfn id="service-worker-global-scope-scope-attribute"><code>registration</code></dfn> attribute <em class="rfc2119" title="MUST">must</em> return the <code><a href="#service-worker-registration-interface">ServiceWorkerRegistration</a></code> object that represents the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>.</p>
</spec-section>

<spec-section id="service-worker-global-scope-skipwaiting">
Expand Down Expand Up @@ -3591,6 +3593,43 @@ <h1>Batch Cache Operations</h1>

</spec-clause>

<spec-clause id="extended-http-headers">
<h1>Appendix B: Extended HTTP headers</h1>

<spec-section id="service-worker-script-resource-request">
<h1>Service Worker Script Request</h1>
<p>An HTTP request to <a href="https://fetch.spec.whatwg.org/#concept-fetch">fetch</a> a <a href="#dfn-service-worker">service worker</a>'s <a href="#dfn-script-resource">script resource</a> can include the following <a href="https://fetch.spec.whatwg.org/#concept-header">header</a>:</p>

<dl>
<dt>`<dfn><code>Service-Worker</code></dfn>`</dt>
<dd>Indicates this request is a <a href="#dfn-service-worker">service worker</a>'s <a href="#dfn-script-resource">script resource</a> request.
<p class="note">This header helps administrators log the requests and detect threats.</p>
</dd>
</dl>
</spec-section>

<spec-section id="service-worker-script-resource-response">
<h1>Service Worker Script Response</h1>
<p>An HTTP response to a <a href="#dfn-service-worker">service worker</a>'s <a href="#dfn-script-resource">script resource</a> request can include the following <a href="https://fetch.spec.whatwg.org/#concept-header">header</a>:</p>

<dl>
<dt>`<dfn><code>Service-Worker-Allowed</code></dfn>`</dt>
<dd>Indicates the user agent <em class="rfc2119" title="MUST">must</em> override the path restriction, which limits the maximum allowed <a href="#dfn-scope-url">scope url</a> that the script can <a href="#dfn-control">control</a>, to the given value.
<p class="note">The value is a URL. If a relative URL is given, it is parsed against the script's URL.</p>
</dd>
</dl>
</spec-section>

<spec-section id="syntax">
<h1>Syntax</h1>
<p>ABNF for the values of the headers used by the <a href="#dfn-service-worker">service worker</a>'s <a href="#dfn-script-resource">script resource</a> requests and responses:</p>
<pre>
Service-Worker = "script" ; case-sensitive

This comment has been minimized.

Copy link
@annevk

annevk Nov 3, 2015

Member

If it has to be case-sensitive you need to use percent-encoding to spell it out.

This comment has been minimized.

Copy link
@jungkees

jungkees Nov 3, 2015

Author Collaborator

I see. Having it case-sensitive makes sense here BTW? I thought consistent value would be better in general.

This comment has been minimized.

Copy link
@annevk

annevk Nov 3, 2015

Member

Yeah seems fine to me.

This comment has been minimized.

Copy link
@jungkees

jungkees Nov 3, 2015

Author Collaborator

Done: 54bdb29.

Service-Worker-Allowed = <a href="https://tools.ietf.org/html/rfc3986#section-4.1">URI-reference</a>

This comment has been minimized.

Copy link
@annevk

annevk Nov 3, 2015

Member

This seems wrong, since browsers don't implement this as such.

This comment has been minimized.

Copy link
@jungkees

jungkees Nov 3, 2015

Author Collaborator

Do you have any pointer which can be used here?

This comment has been minimized.

Copy link
@annevk

annevk Nov 3, 2015

Member

No, sorry. I don't think this header would be ABNF validated basically. Just take the value and parse it. And perhaps deal with duplicates.

This comment has been minimized.

Copy link
@jungkees

jungkees Nov 3, 2015

Author Collaborator

We're already doing so in Update algorithm. Left a comment, though.

</pre>
</spec-section>
</spec-clause>

<spec-clause id="acknowledgements">
<h1>Acknowledgements</h1>
<!-- FIXME: INCOMPLETE!! Please add collaborators below. -->
Expand Down
41 changes: 40 additions & 1 deletion spec/service_worker_1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ <h1>Dependencies</h1>
<li><a href="http://www.w3.org/TR/page-visibility/">Page Visibility (Second Edition)</a></li>
<li><a href="http://www.w3.org/2001/tag/doc/unsanctioned-tracking/">(Non-normative) Unsanctioned Web Tracking</a></li>
<li><a href="https://w3c.github.io/push-api/">Push API</a></li>
<li><a href="http://tools.ietf.org/html/rfc5234">Augmented BNF for Syntax Specifications: ABNF</a></li>
<li><a href="https://tools.ietf.org/html/rfc3986">Uniform Resource Identifier (URI): Generic Syntax</a></li>
</ul>
</spec-section>

Expand Down Expand Up @@ -910,7 +912,7 @@ <h1><code>clients</code></h1>
<spec-section id="service-worker-global-scope-registration">
<h1><code>registration</code></h1>

The <dfn id="service-worker-global-scope-scope-attribute"><code>registration</code></dfn> attribute <em class="rfc2119" title="MUST">must</em> return the <code><a href="#service-worker-registration-interface">ServiceWorkerRegistration</a></code> object that represents the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>.</p>
<p>The <dfn id="service-worker-global-scope-scope-attribute"><code>registration</code></dfn> attribute <em class="rfc2119" title="MUST">must</em> return the <code><a href="#service-worker-registration-interface">ServiceWorkerRegistration</a></code> object that represents the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>.</p>
</spec-section>

<spec-section id="service-worker-global-scope-skipwaiting">
Expand Down Expand Up @@ -3589,6 +3591,43 @@ <h1>Batch Cache Operations</h1>

</spec-clause>

<spec-clause id="extended-http-headers">
<h1>Appendix B: Extended HTTP headers</h1>

<spec-section id="service-worker-script-resource-request">
<h1>Service Worker Script Request</h1>
<p>An HTTP request to <a href="https://fetch.spec.whatwg.org/#concept-fetch">fetch</a> a <a href="#dfn-service-worker">service worker</a>'s <a href="#dfn-script-resource">script resource</a> can include the following <a href="https://fetch.spec.whatwg.org/#concept-header">header</a>:</p>

<dl>
<dt>`<dfn><code>Service-Worker</code></dfn>`</dt>
<dd>Indicates this request is a <a href="#dfn-service-worker">service worker</a>'s <a href="#dfn-script-resource">script resource</a> request.
<p class="note">This header helps administrators log the requests and detect threats.</p>
</dd>
</dl>
</spec-section>

<spec-section id="service-worker-script-resource-response">
<h1>Service Worker Script Response</h1>
<p>An HTTP response to a <a href="#dfn-service-worker">service worker</a>'s <a href="#dfn-script-resource">script resource</a> request can include the following <a href="https://fetch.spec.whatwg.org/#concept-header">header</a>:</p>

<dl>
<dt>`<dfn><code>Service-Worker-Allowed</code></dfn>`</dt>
<dd>Indicates the user agent <em class="rfc2119" title="MUST">must</em> override the path restriction, which limits the maximum allowed <a href="#dfn-scope-url">scope url</a> that the script can <a href="#dfn-control">control</a>, to the given value.
<p class="note">The value is a URL. If a relative URL is given, it is parsed against the script's URL.</p>
</dd>
</dl>
</spec-section>

<spec-section id="syntax">
<h1>Syntax</h1>
<p>ABNF for the values of the headers used by the <a href="#dfn-service-worker">service worker</a>'s <a href="#dfn-script-resource">script resource</a> requests and responses:</p>
<pre>
Service-Worker = "script" ; case-sensitive
Service-Worker-Allowed = <a href="https://tools.ietf.org/html/rfc3986#section-4.1">URI-reference</a>
</pre>
</spec-section>
</spec-clause>

<spec-clause id="acknowledgements">
<h1>Acknowledgements</h1>
<!-- FIXME: INCOMPLETE!! Please add collaborators below. -->
Expand Down

0 comments on commit 12063af

Please sign in to comment.