@@ -49,6 +49,9 @@ url: https://tools.ietf.org/html/rfc7234#section-1.2.1;text:delta-seconds;type:d
4949 "HTTP-CACHING": {
5050 "aliasOf": "RFC7234"
5151 },
52+ "HTTP-RANGE": {
53+ "aliasOf": "RFC7233"
54+ },
5255 "HTTP-AUTH": {
5356 "aliasOf": "RFC7235"
5457 },
@@ -95,7 +98,6 @@ url: https://tools.ietf.org/html/rfc7234#section-1.2.1;text:delta-seconds;type:d
9598 "href": "https://www.kb.cert.org/vuls/id/150227",
9699 "title": "HTTP proxy default configurations allow arbitrary TCP connections."
97100 }
98-
99101}
100102</pre>
101103
@@ -3140,6 +3142,9 @@ steps:
31403142<p class=note><i> CORS flag</i> is still a bookkeeping detail. As is
31413143<i> authentication-fetch flag</i> .
31423144
3145+ <p class=note> Some implementations might support caching of partial content, as per <cite> HTTP
3146+ Range Requests</cite> . [[HTTP-RANGE]] However, this is not widely supported by browser caches.
3147+
31433148<ol>
31443149 <li><p> Let <var> httpRequest</var> be null.
31453150
@@ -3364,88 +3369,107 @@ steps:
33643369 <var> httpRequest</var> 's
33653370 <a for=request>credentials mode</a> .
33663371
3367- <li><p> Let <var> response</var> be null.
3372+ <li><p> Let <var> response</var> and <var> storedResponse</var> be null.
3373+
3374+ <li><p> Let the <var> revalidatingFlag</var> be unset.
33683375
33693376 <li>
3370- <p> If <var> httpRequest</var> 's
3371- <a for=request>cache mode</a> is neither
3372- "<code> no-store</code> " nor "<code> reload</code> ", and there is a <em> complete</em>
3373- <a for=/>response</a> in the HTTP cache for
3374- <var> httpRequest</var> run these substeps:
3375- <!-- XXX xref "HTTP cache" -->
3377+ <p> If <var> httpRequest</var> 's <a for=request>cache mode</a> is neither "<code> no-store</code> "
3378+ nor "<code> reload</code> ", run these substeps:
33763379
33773380 <ol>
33783381 <li>
3379- <p> If <var> httpRequest </var> 's <a for=request>cache mode</a> is
3380- " <code> force-cache </code> " or " <code> only-if-cached </code> ", then set
3381- <var> response </var> to the <a for=/>response</a> in the HTTP cache for
3382- <var> httpRequest </var> .
3382+ <p> Set <var> storedResponse </var> to the result of selecting a response from the HTTP cache,
3383+ possibly needing validation, as per the
3384+ " <a href=https://tools.ietf.org/html/rfc7234#section-4>Constructing Responses from Caches</a> "
3385+ chapter of <cite> HTTP Caching </cite> [[!HTTP-CACHING]] , if any .
33833386
3384- <p class=note> As mandated by HTTP, this still takes the `<code> Vary</code> `
3385- <a>header</a> into account.
3387+ <li><p> If <var> storedResponse</var> is null, then abort these substeps.
33863388
3387- <li><p> Otherwise, if <var> httpRequest</var> 's
3388- <a for=request>cache mode</a> is "<code> default</code> " and the
3389- <a for=/>response</a> in the HTTP cache for <var> httpRequest</var> does
3390- not require revalidation, then set <var> response</var> to that
3391- <a for=/>response</a> .
3392- <!-- XXX xref "revalidation" -->
3389+ <!-- cache hit -->
3390+ <li><p> If <var> storedResponse</var> requires validation (i.e., it is not fresh), then set the
3391+ <var> revalidatingFlag</var> .
33933392
3394- <li><p> Otherwise, if <var> httpRequest</var> 's
3395- <a for=request>cache mode</a> is either "<code> default</code> "
3396- or "<code> no-cache</code> ", modify <var> httpRequest</var> 's
3397- <a for=request>header list</a> with revalidation
3398- <a>headers</a> .
3399- <!-- XXX modify, revalidation headers -->
3400- </ol>
3393+ <li>
3394+ <p> If <var> httpRequest</var> 's <a for=request>cache mode</a> is "<code> force-cache</code> " or
3395+ "<code> only-if-cached</code> ", then set <var> response</var> to <var> storedResponse</var> and
3396+ abort these substeps.
34013397
3402- <li><p> Otherwise, if <var> httpRequest</var> 's
3403- <a for=request>cache mode</a> is either
3404- "<code> default</code> " or "<code> force-cache</code> ", and there is a
3405- <em> partial</em> <a for=/>response</a> in the HTTP cache for
3406- <var> httpRequest</var> , modify <var> httpRequest</var> 's
3407- <a for=request>header list</a> with resume
3408- <a>headers</a> .
3409- <!-- XXX xref partial, modify, resume headers -->
3398+ <p class=note> As mandated by HTTP, this still takes the `<code> Vary</code> ` <a>header</a>
3399+ into account.
34103400
3411- <li>
3412- <p> If <var> response </var> is null, run these substeps :
3401+ <li>
3402+ <p> If the <var> revalidatingFlag </var> is set, then :
34133403
3414- <ol>
3415- <li><p> If <var> httpRequest</var> 's <a for=request>cache mode</a> is
3416- "<code> only-if-cached</code> ", then return a
3417- <a>network error</a> .
3404+ <ol>
3405+ <li><p> If <var> storedResponse</var> 's <a for=response>header list</a>
3406+ <a for="header list">contains</a> `<code> ETag</code> `, then <a for="header list">append</a>
3407+ `<code> If-None-Match</code> ` with its value to <var> httpRequest</var> 's
3408+ <a for=request>header list</a> .
34183409
3419- <li><p> Set <var> response</var> to the result of making an
3420- <a>HTTP-network fetch</a> using <var> httpRequest</var>
3421- with <i> credentials flag</i> if set.
3410+ <li><p> If <var> storedResponse</var> 's <a for=response>header list</a>
3411+ <a for="header list">contains</a> `<code> Last-Modified</code> `, then
3412+ <a for="header list">append</a> `<code> If-Modified-Since</code> ` with its value to
3413+ <var> httpRequest</var> 's <a for=request>header list</a> .
3414+ </ol>
3415+
3416+ <p class=note> See also the
3417+ "<a href=https://tools.ietf.org/html/rfc7234#section-4.3.4>Sending a Validation Request</a> "
3418+ chapter of <cite> HTTP Caching</cite> [[!HTTP-CACHING]] .
3419+
3420+ <li><p> Otherwise, if the <var> revalidatingFlag</var> is unset, then set <var> response</var> to
3421+ <var> storedResponse</var> .
34223422 </ol>
34233423
34243424 <li>
3425- <p> If <var> response</var> 's <a for=response>status</a> is <code> 304</code> and
3426- <var> httpRequest</var> 's <a for=request>cache mode</a> is either
3427- "<code> default</code> " or "<code> no-cache</code> ", run these substeps:
3425+ <!-- If response is still null, we require a forwarded request. -->
3426+ <p> If <var> response</var> is null, then run these substeps:
34283427
34293428 <ol>
3430- <li><p> Set <var> cachedResponse</var> to the result of selecting a stored
3431- <a for=/>response</a> from the HTTP cache using <var> httpRequest</var> , as
3432- per the
3433- "<a href=https://tools.ietf.org/html/rfc7234#section-4.3.4>Freshening Stored Responses upon Validation</a> "
3434- chapter of <cite> HTTP Caching</cite> . [[!HTTP-CACHING]]
3429+ <li><p> If <var> httpRequest</var> 's <a for=request>cache mode</a> is
3430+ "<code> only-if-cached</code> ", then return a <a>network error</a> .
34353431
3436- <li><p> If <var> cachedResponse</var> is null (i.e., one cannot be selected), return a
3437- <a>network error</a> .
3432+ <li><p> Set <var> forwardResponse</var> to the result of making an <a>HTTP-network fetch</a> using
3433+ <var> httpRequest</var> with <i> credentials flag</i> if set.
3434+
3435+ <li><p> If <var> httpRequest</var> 's <var> method</var> is
3436+ <a href=https://tools.ietf.org/html/rfc7231#safe.methods>unsafe</a> and
3437+ <var> forwardResponse</var> 's <a for=response>status</a> is in the range <code> 200</code> to
3438+ <code> 399</code> , inclusive, invalidate appropriate stored responses in the HTTP cache, as per
3439+ the "<a href=https://tools.ietf.org/html/rfc7234#section-4.4>Invalidation</a> " chapter of
3440+ <cite> HTTP Caching</cite> , and set <var> storedResponse</var> to null. [[!HTTP-CACHING]]
3441+
3442+ <li>
3443+ <p> If the <var> revalidatingFlag</var> is set and <var> forwardResponse</var> 's
3444+ <a for=response>status</a> is <code> 304</code> , then:
3445+
3446+ <ol>
3447+ <li>
3448+ <p> Update <var> storedResponse</var> 's <a for=response>header list</a> using
3449+ <var> forwardResponse</var> 's <a for=response>header list</a> , as per the
3450+ "<a href=https://tools.ietf.org/html/rfc7234#section-4.3.4>Freshening Stored Responses upon Validation</a> "
3451+ chapter of <cite> HTTP Caching</cite> . [[!HTTP-CACHING]]
3452+
3453+ <p class="note"> This updates the stored response in cache as well.
34383454
3439- <li><p> Update <var> cachedResponse</var> 's <a for=response>header list</a>
3440- using <var> response</var> 's <a for=response>header list</a> , as per the
3441- "<a href=https://tools.ietf.org/html/rfc7234#section-4.3.4>Freshening Stored Responses upon Validation</a> "
3442- chapter of <cite> HTTP Caching</cite> . [[!HTTP-CACHING]]
3455+ <li><p> Set <var> response</var> to <var> storedResponse</var> .
3456+
3457+ </ol>
34433458
34443459 <li>
3445- <p> Set <var> response</var> to the <var> cachedResponse </var> .
3460+ <p> If <var> response</var> is null, then:
34463461
3447- <p class="note no-backref"> This changes <var> response</var> entirely, including its
3448- <a for=response>status</a> which is most likely <code> 200</code> now.
3462+ <ol>
3463+ <li><p> Set <var> response</var> to <var> forwardResponse</var> .
3464+
3465+ <li>
3466+ <p> Store <var> httpRequest</var> and <var> forwardResponse</var> in the HTTP cache, as per the
3467+ "<a href=https://tools.ietf.org/html/rfc7234#section-3>Storing Responses in Caches</a> "
3468+ chapter of <cite> HTTP Caching</cite> . [[!HTTP-CACHING]]
3469+
3470+ <p class=note> If <var> forwardResponse</var> is a <a>network error</a> , this effectively caches
3471+ the network error, which is sometimes known as "negative caching".
3472+ </ol>
34493473 </ol>
34503474
34513475 <li>
0 commit comments