Skip to content

Commit 84b5dfe

Browse files
authored
Block partial responses entering the cache (#1210)
This change adds a guard to put() and addAll() that blocks 206 responses entering the cache. Fixes #937.
1 parent 5474d11 commit 84b5dfe

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/index.bs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
20062006
1. Run the following substeps [=in parallel=]:
20072007
* [=/Fetch=] |r|.
20082008
* To [=process response=] for |response|, run these substeps:
2009-
1. If |response|'s [=response/type=] is "<code>error</code>", or |response|'s [=response/status=] is not an [=ok status=], reject |responsePromise| with a `TypeError`.
2009+
1. If |response|'s [=response/type=] is "<code>error</code>", or |response|'s [=response/status=] is not an [=ok status=] or is `206`, reject |responsePromise| with a `TypeError`.
20102010
1. Else if |response|'s [=response/header list=] contains a [=header=] [=header/named=] \``Vary`\`, then:
20112011
1. Let |fieldValues| be the [=list=] containing the elements corresponding to the [=http/field-values=] of the [=Vary=] header.
20122012
1. [=list/For each=] |fieldValue| of |fieldValues|:
@@ -2056,6 +2056,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
20562056
1. Else if |request| is a string, then:
20572057
1. Set |r| to the associated [=Request/request=] of the result of invoking the initial value of {{Request}} as constructor with |request| as its argument. If this [=throws=] an exception, return [=a promise rejected with=] that exception.
20582058
1. If |r|'s [=request/url=]'s [=url/scheme=] is not one of "`http`" and "`https`", return [=a promise rejected with=] a `TypeError`.
2059+
1. If |response|'s associated [=Response/response=]'s [=response/status=] is `206`, return [=a promise rejected with=] a `TypeError`.
20592060
1. If |response|'s associated [=Response/response=]'s [=response/header list=] contains a <a>header</a> [=header/named=] \`<code>Vary</code>\`, then:
20602061
1. Let |fieldValues| be the [=list=] containing the [=list/items=] corresponding to the [=Vary=] header's [=http/field-values=].
20612062
1. [=list/For each=] |fieldValue| in |fieldValues|:

docs/v1/index.bs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
16621662
1. Run the following substeps [=in parallel=]:
16631663
* [=/Fetch=] |r|.
16641664
* To [=process response=] for |response|, run these substeps:
1665-
1. If |response|'s [=response/type=] is "<code>error</code>", or |response|'s [=response/status=] is not an [=ok status=], reject |responsePromise| with a `TypeError`.
1665+
1. If |response|'s [=response/type=] is "<code>error</code>", or |response|'s [=response/status=] is not an [=ok status=] or is `206`, reject |responsePromise| with a `TypeError`.
16661666
1. Else if |response|'s [=response/header list=] contains a [=header=] [=header/named=] \``Vary`\`, then:
16671667
1. Let |fieldValues| be the [=list=] containing the elements corresponding to the [=http/field-values=] of the [=Vary=] header.
16681668
1. [=list/For each=] |fieldValue| of |fieldValues|:
@@ -1712,6 +1712,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
17121712
1. Else if |request| is a string, then:
17131713
1. Set |r| to the associated [=Request/request=] of the result of invoking the initial value of {{Request}} as constructor with |request| as its argument. If this [=throws=] an exception, return [=a promise rejected with=] that exception.
17141714
1. If |r|'s [=request/url=]'s [=url/scheme=] is not one of "`http`" and "`https`", return [=a promise rejected with=] a `TypeError`.
1715+
1. If |response|'s associated [=Response/response=]'s [=response/status=] is `206`, return [=a promise rejected with=] a `TypeError`.
17151716
1. If |response|'s associated [=Response/response=]'s [=response/header list=] contains a <a>header</a> [=header/named=] \`<code>Vary</code>\`, then:
17161717
1. Let |fieldValues| be the [=list=] containing the [=list/items=] corresponding to the [=Vary=] header's [=http/field-values=].
17171718
1. [=list/For each=] |fieldValue| in |fieldValues|:

0 commit comments

Comments
 (0)