From a55790458882be1fbdf0ae5010948b0b09259779 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Horo Date: Wed, 12 Aug 2020 13:25:37 +0900 Subject: [PATCH 01/21] Update loading spec to support subresource substitution --- loading.bs | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/loading.bs b/loading.bs index c5f8441f..9453c4bd 100644 --- a/loading.bs +++ b/loading.bs @@ -331,6 +331,67 @@ Note: Applying the signed exchange's response here has the effect of letting a newer HTTP cache entry override a signed exchange's content, and of not storing the signed exchange's response in the HTTP cache. +# Subresource substitution # {#subresource-substitution} + +To support [Signed Exchange subresource substitution](https://github.com/WICG/webpackage/blob/master/explainers/signed-exchange-subresource-subtitution-explainer.md), +this secion describes how web browsers prefetch subresource signed exchanges. + + +In [Fetching the resource hint +link](https://w3c.github.io/resource-hints/#fetching-the-resource-hint-link), +add the following lines: + +The user agent SHOULD prefetch the alternate subresources signed exchanges if +declared in link headers in the outer and the inner response header of the +signed exchanges by running the following steps: + 1. When the UA detects a "preload" link HTTP header in a signed exchange + inner response, check whether a matching “allowed-alt-sxg” link HTTP + header in the inner response exists or not. (Note that multiple + `allowed-alt-sxg` links can be present for the same preload if they + include `variants` and `variant-key` attributes. In that case, the UA + uses the algorithm written in [HTTP Representation + Variants](https://httpwg.org/http-extensions/draft-ietf-httpbis-variants.html) + spec to find the matching header.) + 1. If an `allowed-alt-sxg` link exists, check whether the signed exchange + was served with a matching “alternate” link HTTP header. + 1. If the outer signed exchange did identify an alternate version of the + subresource, prefetch the subresource signed exchange. + 1. If the resulting signed exchange is valid and matches the allowed-alt-sxg + link, attach it to the top-level prefetch. + +

+Monkeypatch Navigating across documents

+In [navigating across documents](https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents), +add the following step: + 1. Copy the signed exchanges that were prefetched above to the target + document except for the one that serves the navigation itself. +- Note that as browsers move toward partitioned HTTP caches, the source + document's cache will likely be separate from the target's cache, so + we can't just pass prefetched content through the cache. + + + + +The navigated-to document has a set of preloads for which it uses the +allowed-alt-sxg link relation to declare that they can be served by signed +exchanges. The UA either serves all of them from SXGs prefetched by the previous +page, or none of them. +So in [processing](https://www.w3.org/TR/preload/#processing) of [Link type +"preload"](https://www.w3.org/TR/preload/#link-type-preload) add the following +step: + 1. For each preload, use the imagesrcset and imagesizes attributes to pick a + single URL to preload. + 1. Identify the subset |SxgPreloads| of those preloads with an + `allowed-alt-sxg` link for that selected URL. + 1. If every member of |SxgPreloads| has a valid signed exchange that was + transferred from the referring document, use the signed contents of + those resources to satisfy the preloads. Ignore any other prefetched + signed exchanges. + 1. Otherwise, ignore all prefetched signed exchanges and re-fetch the + preloads from their original URLs. + # Structures # {#structs}

Exchange

From 6bd76c71d944db4d1492a42f10d9746c416f9cf5 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Horo Date: Fri, 14 Aug 2020 21:00:59 +0900 Subject: [PATCH 02/21] Incorporated jyasskin's comment --- go.mod | 2 + loading.bs | 242 ++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 204 insertions(+), 40 deletions(-) diff --git a/go.mod b/go.mod index 5c88c521..f59b73fe 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/WICG/webpackage +go 1.15 + require ( github.com/mrichman/hargo v0.1.2-0.20190117125451-162adce4527e github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 diff --git a/loading.bs b/loading.bs index 9453c4bd..47b15487 100644 --- a/loading.bs +++ b/loading.bs @@ -116,6 +116,13 @@ spec: RFC7231; urlPrefix: https://tools.ietf.org/html/rfc7231# text: HTTP media type; url: section-3.1.1.1 type: http-header text: Date; url: section-7.1.1.2 +spec: RFC8288; urlPrefix: https://tools.ietf.org/html/rfc8288# + type: http-header + text: Link; url: section-3 + type: dfn + text: link target; url: section-3.1 + type: dfn + text: anchor; url: section-3.2 spec: RFC8446; urlPrefix: https://tools.ietf.org/html/draft-ietf-tls-tls13-28# text: ecdsa_secp256r1_sha256; type: dfn; url: section-4.2.3 spec: draft-ietf-httpbis-variants; urlPrefix: https://httpwg.org/http-extensions/draft-ietf-httpbis-variants.html# @@ -333,64 +340,219 @@ the signed exchange's response in the HTTP cache. # Subresource substitution # {#subresource-substitution} -To support [Signed Exchange subresource substitution](https://github.com/WICG/webpackage/blob/master/explainers/signed-exchange-subresource-subtitution-explainer.md), -this secion describes how web browsers prefetch subresource signed exchanges. +To let the UA know that subresources of a page it's prenavigating to, can +be retrieved as signed exchanges from the source site, this section introduces +an extension to the HTTP Link header. + +* A allowed-alt-sxg link is a relationship that is used + in HTTP Link header of inner HTTP response of main + resource signed exchange to indicate that the subresource of the + [=link target=] can be loaded from different URL as a signed exchange. This + link has a + [rel](https://html.spec.whatwg.org/multipage/semantics.html#attr-link-rel) + parameter contains `allowed-alt-sxg` and a `header-integrity` parameter set + to the value of the [=header integrity value=] of the [=alternate signed + exchange=] +* A alternate signed exchange link is a relationship + that is used in HTTP Link header of outer HTTP response + of main resource signed exchange to indicate that the + alternate signed exchange of the [=link target=] can + be loaded instead of the subresource of the URL declared at the [=anchor=] + parameter. This link has a + [rel](https://html.spec.whatwg.org/multipage/semantics.html#attr-link-rel) + parameter contains + [alternate](https://html.spec.whatwg.org/multipage/links.html#rel-alternate) + keyword and a + [type](https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-type) + parameter set to the value 'application/signed-exchange' and an [=anchor=] + parameter set to the original subresource URL. +* A header integrity value is the SHA256 hash value of + the |signedHeaders| value from the + [application/signed-exchange format](https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#application-signed-exchange) + for integrity checking. + + Note: This |signedHeaders| is *"the canonical serialization of the CBOR + representation of the response headers of the exchange represented by the + application/signed-exchange resource, excluding the Signature header + field"*. So this value doesn’t change even if the publisher signs the + content again or changes the signing key, but it does change if any of the + headers or body change. (It catches changes to the body because a valid + signed exchange's headers have to include a `Digest` value that covers + the body.) + +

+Monkeypatch Document

+In the end of +[the Document object](https://html.spec.whatwg.org/multipage/dom.html#the-document-object) +section, add the following lines: + +The Document has a prefetched singed exchanges +for navigation, which is a set of [=exchanges=], initially empty. + +The document has a prefetched +subresource singed exchanges, which is a set of [=exchanges=], initially +empty. + +The document has a transferred +subresource singed exchanges, which is a set of [=exchanges=], initially empty. + +The document has a allowed alternate +subresource signed exchange links, which is a set of +[=allowed-alt-sxg link=], initially empty. + +

+Monkeypatch navigation params struct

+In the +[navigation params struct](https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigation-params), +add the following item: + +
+: prefetched subresource singed exchanges +:: A a set of [=exchanges=], initially empty. +: allowed alternate subresource signed exchange links +:: A a set of [=allowed-alt-sxg link=], initially empty. + +
-In [Fetching the resource hint -link](https://w3c.github.io/resource-hints/#fetching-the-resource-hint-link), -add the following lines: +In the end of +[Fetching the resource hint link](https://w3c.github.io/resource-hints/#fetching-the-resource-hint-link) +section, add the following lines: + +The user agent SHOULD run the following steps if the response of the prefetched +resource is a valid signed exchange: + 1. Let |clonedResponse| be the result of [=response/cloning=] the response. + 1. Create an [=exchange=] with the request URL and |clonedResponse|, + and store the exchange to the + [=prefetched singed exchanges for navigation=] of the Document. The user agent SHOULD prefetch the alternate subresources signed exchanges if declared in link headers in the outer and the inner response header of the signed exchanges by running the following steps: 1. When the UA detects a "preload" link HTTP header in a signed exchange - inner response, check whether a matching “allowed-alt-sxg” link HTTP - header in the inner response exists or not. (Note that multiple - `allowed-alt-sxg` links can be present for the same preload if they - include `variants` and `variant-key` attributes. In that case, the UA - uses the algorithm written in [HTTP Representation + inner response, check whether a matching [=allowed-alt-sxg link=] in the + inner HTTP response exists or not. + + Note: multiple [=allowed-alt-sxg links=] can be present for the same + preload if they include `variants` and `variant-key` attributes. In that + case, the UA uses the algorithm written in [HTTP Representation Variants](https://httpwg.org/http-extensions/draft-ietf-httpbis-variants.html) spec to find the matching header.) - 1. If an `allowed-alt-sxg` link exists, check whether the signed exchange - was served with a matching “alternate” link HTTP header. - 1. If the outer signed exchange did identify an alternate version of the - subresource, prefetch the subresource signed exchange. - 1. If the resulting signed exchange is valid and matches the allowed-alt-sxg - link, attach it to the top-level prefetch. - -

-Monkeypatch Navigating across documents

-In [navigating across documents](https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents), -add the following step: - 1. Copy the signed exchanges that were prefetched above to the target - document except for the one that serves the navigation itself. -- Note that as browsers move toward partitioned HTTP caches, the source - document's cache will likely be separate from the target's cache, so - we can't just pass prefetched content through the cache. + 1. If an [=allowed-alt-sxg link=] exists, check whether the signed exchange + was served with a matching [=alternate signed exchange link=] in the + outer HTTP response. + 1. If there is an [=alternate signed exchange link=] which identify an + alternate version of the subresource, prefetch the + [=alternate signed exchange=]. + 1. If the resulting [=alternate signed exchange=] is valid and the + [=header integrity value=] of it matches the `header-integrity` + parameter of the [=allowed-alt-sxg link=], create a [=exchange=] + with the URL of the [=allowed-alt-sxg link=]'s [=link target=] URL and + the result of [=response/cloning=] the inner response of the + [=alternate signed exchange=], and store the exchange to the + [=document-obj/prefetched subresource singed exchanges=] of the + document. + +

+Monkeypatch process a navigate fetch

+In [process a navigate fetch](https://html.spec.whatwg.org/multipage/browsing-the-web.html#process-a-navigate-fetch) +before + +> 9. While true: + +add the following steps: + + 9. Let |allowed alternate subresource signed exchange links| be null. + + 10. If |sourceBrowsingContext|'s [=active document=]'s + [=prefetched singed exchanges for navigation=] has a matching exchange + for the |request|'s [=request/url=], then: + + 1. Let |clonedExchange| be the result of creating a new [=exchange=] + with the matching exchange's [=exchange/request URL=] and the result + of [=response/cloning=] the matching exchange's + [=exchange/response=]. + + 1. Move |clonedExchange| to the |request|'s + [=request/stashed exchange=]. + + 1. Copy [=allowed-alt-sxg link=] of the exchange's + [=exchange/response=]'s inner response to + |allowed alternate subresource signed exchange links|. + + + +And before + +> 17. Run process a navigate response with navigationType, the source browsing +> context, and navigationParams. + +add the following steps: + + 19. Copy |sourceBrowsingContext|'s [=active document=]'s + [=document-obj/prefetched subresource singed exchanges=] + to navigationParams's + [=navigation params/prefetched subresource singed exchanges=]. + + 20. Set navigationParams's + [=navigation params/allowed alternate subresource signed exchange links=] + to |allowed alternate subresource signed exchange links|. + +Note: As browsers move toward partitioned HTTP caches, the source document's + cache will likely be separate from the target's cache, so we can't just pass + prefetched content through the cache. + + +

+Monkeypatch Initialize a Document object

+In +[initialize a Document object](https://html.spec.whatwg.org/multipage/browsing-the-web.html#initialise-the-document-object) +before + +> 15. Return document. + +add the following steps: + + 15. Move the navigationParams's + [=navigation params/prefetched subresource singed exchanges=] to the + document's [=document-obj/transferred subresource singed exchanges=]. + + 16. Set document's + [=document-obj/allowed alternate subresource signed exchange links=] to + navigationParams's + [=navigation params/allowed alternate subresource signed exchange links=]. The navigated-to document has a set of preloads for which it uses the -allowed-alt-sxg link relation to declare that they can be served by signed +[=allowed-alt-sxg link=] relation to declare that they can be served by signed exchanges. The UA either serves all of them from SXGs prefetched by the previous page, or none of them. -So in [processing](https://www.w3.org/TR/preload/#processing) of [Link type -"preload"](https://www.w3.org/TR/preload/#link-type-preload) add the following -step: - 1. For each preload, use the imagesrcset and imagesizes attributes to pick a - single URL to preload. - 1. Identify the subset |SxgPreloads| of those preloads with an - `allowed-alt-sxg` link for that selected URL. - 1. If every member of |SxgPreloads| has a valid signed exchange that was - transferred from the referring document, use the signed contents of - those resources to satisfy the preloads. Ignore any other prefetched - signed exchanges. - 1. Otherwise, ignore all prefetched signed exchanges and re-fetch the - preloads from their original URLs. +So in the +[linked resource fetch setup steps for preload type of linked resource](https://html.spec.whatwg.org/multipage/links.html#link-type-preload:linked-resource-fetch-setup-steps) +before + +> 5. Return true. + +add the following steps: + + 5. If |el| is for the main resource's HTTP Link header, + and the document's + [=document-obj/allowed alternate subresource signed exchange links=] + has a matching link to |request|'s url, then run the following steps in + parallel: + + 1. Wait until there is no remaining preload Link header of the main + resource to be processed. + + 1. If every |el|'s in this step has a matching exchange in the + document's [=document-obj/transferred subresource singed exchanges=], + set the |request|'s [=request/stashed exchange=] to the exchange. + + 1. Return true. # Structures # {#structs} From 4349a3bcb345bab578ca2b5f15afe0d2b60c30b7 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Horo Date: Fri, 14 Aug 2020 21:12:10 +0900 Subject: [PATCH 03/21] Revert change in go.mod --- go.mod | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.mod b/go.mod index f59b73fe..5c88c521 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,5 @@ module github.com/WICG/webpackage -go 1.15 - require ( github.com/mrichman/hargo v0.1.2-0.20190117125451-162adce4527e github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 From 50e04278625babe9a66f196910a32543526c3cd1 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Horo Date: Wed, 19 Aug 2020 18:36:59 +0900 Subject: [PATCH 04/21] Incorporated jyasskin's comment --- loading.bs | 126 +++++++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 56 deletions(-) diff --git a/loading.bs b/loading.bs index 47b15487..cb922de8 100644 --- a/loading.bs +++ b/loading.bs @@ -120,9 +120,9 @@ spec: RFC8288; urlPrefix: https://tools.ietf.org/html/rfc8288# type: http-header text: Link; url: section-3 type: dfn - text: link target; url: section-3.1 + text: Link Target; url: section-3.1 type: dfn - text: anchor; url: section-3.2 + text: Link Context; url: section-3.2 spec: RFC8446; urlPrefix: https://tools.ietf.org/html/draft-ietf-tls-tls13-28# text: ecdsa_secp256r1_sha256; type: dfn; url: section-4.2.3 spec: draft-ietf-httpbis-variants; urlPrefix: https://httpwg.org/http-extensions/draft-ietf-httpbis-variants.html# @@ -340,45 +340,47 @@ the signed exchange's response in the HTTP cache. # Subresource substitution # {#subresource-substitution} -To let the UA know that subresources of a page it's prenavigating to, can -be retrieved as signed exchanges from the source site, this section introduces -an extension to the HTTP Link header. +When prenavigating to a page held in a signed exchange, it can be useful to +also prefetch subresources of that page as signed exchanges from the same +server. To identify those transitive prefetchable resources, this section +introduces an extension to the HTTP Link header. -* A allowed-alt-sxg link is a relationship that is used +* Link type "allowed-alt-sxg" + + The [=allowed-alt-sxg=] keyword may be used in HTTP Link header of inner HTTP response of main - resource signed exchange to indicate that the subresource of the - [=link target=] can be loaded from different URL as a signed exchange. This - link has a - [rel](https://html.spec.whatwg.org/multipage/semantics.html#attr-link-rel) - parameter contains `allowed-alt-sxg` and a `header-integrity` parameter set - to the value of the [=header integrity value=] of the [=alternate signed - exchange=] -* A alternate signed exchange link is a relationship - that is used in HTTP Link header of outer HTTP response - of main resource signed exchange to indicate that the - alternate signed exchange of the [=link target=] can - be loaded instead of the subresource of the URL declared at the [=anchor=] - parameter. This link has a - [rel](https://html.spec.whatwg.org/multipage/semantics.html#attr-link-rel) - parameter contains - [alternate](https://html.spec.whatwg.org/multipage/links.html#rel-alternate) - keyword and a - [type](https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-type) - parameter set to the value 'application/signed-exchange' and an [=anchor=] - parameter set to the original subresource URL. -* A header integrity value is the SHA256 hash value of - the |signedHeaders| value from the - [application/signed-exchange format](https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#application-signed-exchange) - for integrity checking. - - Note: This |signedHeaders| is *"the canonical serialization of the CBOR - representation of the response headers of the exchange represented by the - application/signed-exchange resource, excluding the Signature header - field"*. So this value doesn’t change even if the publisher signs the - content again or changes the signing key, but it does change if any of the - headers or body change. (It catches changes to the body because a valid - signed exchange's headers have to include a `Digest` value that covers - the body.) + resource signed exchange to indicate an + allowed-alt-sxg link that the subresource of the + [=Link Target=] can be loaded from different URL as a signed exchange. This + link has a `header-integrity` parameter set to the value of the + [=exchange/header integrity value=] of the [=alternate signed exchange=]. + +* An alternate signed exchange link is a `` `Link` `` header sent + with a signed exchange |S|, with the [=alternate=] link type, the `type` + parameter set to `application/signed-exchange`, and a [=Link Context=]. The + [=Link Context=] MUST be the [=Link Target=] of a [=preload=] `` `Link` `` + header inside the signed content of |S|, and the + [=alternate signed exchange link=] means that this resource can also be + found inside the alternate signed exchange at the + [=Link Target=] of the [=alternate signed exchange link=]. + +

Monkeypatch Document

@@ -386,17 +388,17 @@ In the end of [the Document object](https://html.spec.whatwg.org/multipage/dom.html#the-document-object) section, add the following lines: -The Document has a prefetched singed exchanges -for navigation, which is a set of [=exchanges=], initially empty. +The {{Document}} has a set of prefetched singed +exchanges for navigation, which is a set of [=exchanges=], initially empty. -The document has a prefetched +The {{Document}} has a prefetched subresource singed exchanges, which is a set of [=exchanges=], initially empty. -The document has a transferred +The {{Document}} has a transferred subresource singed exchanges, which is a set of [=exchanges=], initially empty. -The document has a allowed alternate +The {{Document}} has a allowed alternate subresource signed exchange links, which is a set of [=allowed-alt-sxg link=], initially empty. @@ -425,7 +427,7 @@ resource is a valid signed exchange: 1. Let |clonedResponse| be the result of [=response/cloning=] the response. 1. Create an [=exchange=] with the request URL and |clonedResponse|, and store the exchange to the - [=prefetched singed exchanges for navigation=] of the Document. + [=Document/prefetched singed exchanges for navigation=] of the Document. The user agent SHOULD prefetch the alternate subresources signed exchanges if declared in link headers in the outer and the inner response header of the @@ -446,12 +448,12 @@ signed exchanges by running the following steps: alternate version of the subresource, prefetch the [=alternate signed exchange=]. 1. If the resulting [=alternate signed exchange=] is valid and the - [=header integrity value=] of it matches the `header-integrity` + [=exchange/header integrity value=] of it matches the `header-integrity` parameter of the [=allowed-alt-sxg link=], create a [=exchange=] - with the URL of the [=allowed-alt-sxg link=]'s [=link target=] URL and + with the URL of the [=allowed-alt-sxg link=]'s [=Link Target=] URL and the result of [=response/cloning=] the inner response of the [=alternate signed exchange=], and store the exchange to the - [=document-obj/prefetched subresource singed exchanges=] of the + [=Document/prefetched subresource singed exchanges=] of the document.

@@ -466,7 +468,7 @@ add the following steps: 9. Let |allowed alternate subresource signed exchange links| be null. 10. If |sourceBrowsingContext|'s [=active document=]'s - [=prefetched singed exchanges for navigation=] has a matching exchange + [=Document/prefetched singed exchanges for navigation=] has a matching exchange for the |request|'s [=request/url=], then: 1. Let |clonedExchange| be the result of creating a new [=exchange=] @@ -491,7 +493,7 @@ And before add the following steps: 19. Copy |sourceBrowsingContext|'s [=active document=]'s - [=document-obj/prefetched subresource singed exchanges=] + [=Document/prefetched subresource singed exchanges=] to navigationParams's [=navigation params/prefetched subresource singed exchanges=]. @@ -516,10 +518,10 @@ add the following steps: 15. Move the navigationParams's [=navigation params/prefetched subresource singed exchanges=] to the - document's [=document-obj/transferred subresource singed exchanges=]. + document's [=Document/transferred subresource singed exchanges=]. 16. Set document's - [=document-obj/allowed alternate subresource signed exchange links=] to + [=Document/allowed alternate subresource signed exchange links=] to navigationParams's [=navigation params/allowed alternate subresource signed exchange links=]. @@ -541,7 +543,7 @@ add the following steps: 5. If |el| is for the main resource's HTTP Link header, and the document's - [=document-obj/allowed alternate subresource signed exchange links=] + [=Document/allowed alternate subresource signed exchange links=] has a matching link to |request|'s url, then run the following steps in parallel: @@ -549,7 +551,7 @@ add the following steps: resource to be processed. 1. If every |el|'s in this step has a matching exchange in the - document's [=document-obj/transferred subresource singed exchanges=], + document's [=Document/transferred subresource singed exchanges=], set the |request|'s [=request/stashed exchange=] to the exchange. 1. Return true. @@ -564,6 +566,14 @@ An exchange is a [=struct=] with the following items: * request URL, a [=URL=]. * response, a [=response=]. +* header integrity value, a [=byte sequence=] holding the [=SHA-256=] + hash that verified the [=exchange/response=]'s [=response/header list=]. + + Note: [=exchange/Header integrity value=] doesn’t change even if the + publisher signs the content again or changes the signing key, but it does + change if any of the headers or body change. (It catches changes to the body + because a valid signed exchange's headers have to include a `Digest` value + that covers the body.) @@ -1123,7 +1133,9 @@ a URL |requestUrl| returns a failure or an [=exchange=] via the following steps: |responseHeaders|. 1. Let |response| be a new [=response=] with [=response/status=] |headers|[1][`` `:status` ``] and [=response/header list=] |responseHeaders|. -1. Return an [=exchange=] of |requestUrl| and |response|. +1. Let |headerIntegrityValue| be the [=SHA-256=] hash of |headerBytes|. +1. Return an [=exchange=] of |requestUrl|, |response| and + |headerIntegrityValue|. Note: This ignores |requestHeaders|, which can't be encoded in b3 and later. @@ -1151,7 +1163,9 @@ a URL |requestUrl| returns a failure or an [=exchange=] via the following steps: 1. If |responseHeaders| is a failure, return it. 1. Let |response| be a new [=response=] with [=response/status=] |headers|[`` `:status` ``] and [=response/header list=] |responseHeaders|. -1. Return an [=exchange=] of |requestUrl| and |response|. +1. Let |headerIntegrityValue| be the [=SHA-256=] hash of |headerBytes|. +1. Return an [=exchange=] of |requestUrl|, |response| and + |headerIntegrityValue|.

Converting a map to a header list

From ee0092b49283424fdabbbb2ed18fcb66e2a00ebc Mon Sep 17 00:00:00 2001 From: Tsuyoshi Horo Date: Thu, 20 Aug 2020 10:54:53 +0900 Subject: [PATCH 05/21] Incorporated jyasskin's comment --- loading.bs | 96 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/loading.bs b/loading.bs index cb922de8..05095ab0 100644 --- a/loading.bs +++ b/loading.bs @@ -345,15 +345,19 @@ also prefetch subresources of that page as signed exchanges from the same server. To identify those transitive prefetchable resources, this section introduces an extension to the HTTP Link header. -* Link type "allowed-alt-sxg" - - The [=allowed-alt-sxg=] keyword may be used - in HTTP Link header of inner HTTP response of main - resource signed exchange to indicate an - allowed-alt-sxg link that the subresource of the - [=Link Target=] can be loaded from different URL as a signed exchange. This - link has a `header-integrity` parameter set to the value of the - [=exchange/header integrity value=] of the [=alternate signed exchange=]. +* Link type "allowed-alt-sxg" + + The <{link/rel/allowed-alt-sxg}> keyword may be used in the HTTP + Link header of the inner HTTP response of the main + resource signed exchange to indicate that the content of the [=Link Target=] + is also available as a particular signed exchange identified by the + <{link/header-integrity}> parameter. + The header-integrity parameter holds the + value of the [=exchange/header integrity value=] of the + [=alternate signed exchange=], encoded as a [[CSP]] + hash-source. + * An alternate signed exchange link is a `` `Link` `` header sent - with a signed exchange |S|, with the [=alternate=] link type, the `type` - parameter set to `application/signed-exchange`, and a [=Link Context=]. The - [=Link Context=] MUST be the [=Link Target=] of a [=preload=] `` `Link` `` - header inside the signed content of |S|, and the - [=alternate signed exchange link=] means that this resource can also be - found inside the alternate signed exchange at the + with a signed exchange |S|, with the <{link/rel/alternate}> link type, the + `type` parameter set to `application/signed-exchange`, and a + [=Link Context=]. The [=Link Context=] MUST be the [=Link Target=] of a + <{link/rel/preload}> `` `Link` `` header inside the signed content of |S|, + and the [=alternate signed exchange link=] means that this resource can also + be found inside the alternate signed exchange at the [=Link Target=] of the [=alternate signed exchange link=].