Skip to content

Commit

Permalink
Don't verify range values in range responses
Browse files Browse the repository at this point in the history
User-agents don't actually perform these verifications.
The only important verification is origin of responses.

See whatwg#7655 (comment)
  • Loading branch information
noamr committed Apr 4, 2022
1 parent 4c6e6f1 commit 89aeded
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2557,10 +2557,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="concept-response-location-url" data-x-href="https://fetch.spec.whatwg.org/#concept-response-location-url">location URL</dfn></li>
<li><dfn data-x="concept-response-timing-info" data-x-href="https://fetch.spec.whatwg.org/#concept-response-timing-info">timing info</dfn></li>
<li><dfn data-x="concept-response-service-worker-timing-info" data-x-href="https://fetch.spec.whatwg.org/#response-service-worker-timing-info">service worker timing info</dfn></li>
<li>
<dfn data-x-href="https://wicg.github.io/background-fetch/#extract-content-range-values">extract content-range values</dfn>
<!-- TODO: move this to FETCH -->
</li>
</ul>
</li>
<li>
Expand Down Expand Up @@ -34685,19 +34681,21 @@ interface <dfn interface>MediaError</dfn> {
</ol>

<p>To <dfn>verify a media response</dfn> given a <span data-x="concept-response">response</span>
<var>response</var>, a <span>media resource</span> <var>resource</var>, and
"<code data-x="">entire resource</code>" or a
(number, number or "<code data-x="">until end</code>") tuple <var>byteRange</var>:</p>
<var>response</var>, and a <span>media resource</span> <var>resource</var>:</p>

<ol>
<li><p>If <var>response</var> is a <span>network error</span>, then return false.</p></li>

<li><p>If <var>byteRange</var> is "<code data-x="">entire resource</code>", then return
true.</p></li>

<li><p>Let <var>internalResponse</var> be <var>response</var>'s
<span>unsafe response</span>.</p></li>

<li>
<p>If <var>internalResponse</var>'s <span data-x="concept-response-status">status</span> is
200, then return true.</p>

<p class="note">Range headers may be ignored, returning the whole resource instead.</p>
</li>

<li><p>If <var>internalResponse</var>'s <span data-x="concept-response-status">status</span> is
not 206, then return false.</p></li>

Expand Down Expand Up @@ -34733,14 +34731,6 @@ interface <dfn interface>MediaError</dfn> {
by being patched together with other responses from different origins.</p>
</li>

<li><p>Let (<var>start</var>, <var>end</var>) be the result of
<span data-x="extract content-range values">extracting content-range values</span> from
<var>internalResponse</var>.</p></li>

<li><p>If <var>start</var> is not <var>byteRange</var>[0], or if
<var>byteRange</var>[1] is neither "<code data-x="">until end</code>" or <var>end</var>,
return false.</p></li>

<li><p>Return true.</p></li>
</ol>

Expand Down Expand Up @@ -34879,8 +34869,8 @@ interface <dfn interface>MediaError</dfn> {
</li>

<li><p>If the result of <span data-x="verify a media response">verifying</span>
<var>response</var> given the <var>current media resource</var> and
<var>byteRange</var> is false, then call <var>finalize</var>. Otherwise,
<var>response</var> given the <var>current media resource</var>is false, then call
<var>finalize</var>. Otherwise,
<span data-x="body-incrementally-read">incrementally read</span> <var>response</var>'s
<span data-x="concept-response-body">body</span> given <var>updateMedia</var>,
<var>processEndOfMedia</var>, <var>finalize</var>, and <var>global</var>.</p></li>
Expand Down

0 comments on commit 89aeded

Please sign in to comment.