diff --git a/index.bs b/index.bs index 8fa55f6..d90457d 100644 --- a/index.bs +++ b/index.bs @@ -77,29 +77,35 @@ provide a [=payment method manifest=] file in JSON format containing two key pie
https://alicepay.com/
") which is more suitable for human-readable content. Instead, a
-HTTP Link header is used to direct user agents seeking out the [=payment method manifest=] toward
-another location. [[RFC8288]]
+The machine-readable [=payment method manifest=] might be found either directly at the
+[=payment method identifier=] URL, or in a location indicated indirectly by following a HTTP
+`Link
` header from that URL. [[RFC8288]]
+
+This potential indirection allows the use of generic, human-readable URLs (such as
+"https://alicepay.com/
") to serve as [=payment method identifiers=], while still
+locating the actual [=payment method manifest=] at a different URL.
For an example [=payment method=] AlicePay, with [=payment method identifier=]
-"https://alicepay.com/
", a user agent might issue a request to that
+"https://alicepay.com/
", a user agent would issue a GET request to that
[=payment method identifier=] URL as follows:
- HEAD / HTTP/2 + GET / HTTP/2 Host: alicepay.com User-Agent: Mellblomenator/9000-The server would then respond: +The server could then either respond with
HTTP/2 204 Link: </pay/payment-manifest.json>; rel="payment-method-manifest"+to redirect the user agent to "
https://alicepay.com/pay/payment-manifest.json
", or
+could respond with the JSON contents of the payment method manifest directly in a
+200
-status response.
+
HEAD
`,
+ 1. Let |manifestURLString| be null.
+ 1. Let |identifierRequest| be a new [=request=] whose [=request/method=] is `GET
`,
[=request/url=] is |identifierURL|, [=request/client=] is |client|, [=request/mode=] is
"cors
", [=request/credentials mode=] is "omit
",
[=request/redirect mode=] is "error
", and [=request/referrer policy=] is
"strict-origin-when-cross-origin
".
- 1. [=Fetch=] |identifierRequest|. To [=process response=] with the [=response=]
- |identifierResponse|:
+ 1. [=Fetch=] |identifierRequest|.
+
+ To [=process response=] with the [=response=] |identifierResponse|:
1. If |identifierResponse| is a [=network error=] or |identifierResponse|'s [=response/status=]
is not an [=ok status=], [=iteration/continue=].
1. Let |linkHeaders| be the result of
[=extract header list values|extracting header list values=] given `Link
` and
|identifierResponse|'s [=response/header list=].
- 1. Let |manifestURLString| be null.
1. [=list/For each=] |linkHeader| of |linkHeaders|:
1. Parse |linkHeader| according to the link-value
production. If it cannot be
parsed, [=iteration/continue=]. [[!RFC8288]]
@@ -279,6 +286,8 @@ manifest.
string given by the URI-Reference
production in the parsed header, and
[=iteration/break=].
1. If |manifestURLString| is not null, then:
+ 1. [=fetch/terminated|Terminate=] the ongoing fetch of |identifierRequest| (since the
+ [=response/body=] will not be needed).
1. Let |manifestURL| be the result of [=basic URL parser|basic URL parsing=]
|manifestURLString| with base URL given by |identifierResponse|'s [=response/url=]. If the
result is failure, [=iteration/continue=].
@@ -299,6 +308,17 @@ manifest.
|body| with |reader|.
1. [=Upon fulfillment=] of |promise| with a [=byte sequence=] |bytes|, [=map/set=]
|manifestsMap|[|identifierURL|] to |bytes|.
+
+ To [=process response end-of-body=] with the [=response=] |identifierResponse|:
+ 1. If |manifestURLString| is not null, [=iteration/continue=].
+ 1. Let |body| be |identifierResponse|'s [=response/body=].
+ 1. If |body| is null, [=iteration/continue=].
+ 1. Let |reader| be the result of [=ReadableStream/get a reader|getting a reader=] from
+ |body|.
+ 1. Let |promise| be the result of [=ReadableStream/read all bytes|reading all bytes=] from
+ |body| with |reader|.
+ 1. [=Upon fulfillment=] of |promise| with a [=byte sequence=] |bytes|, [=map/set=]
+ |manifestsMap|[|identifierURL|] to |bytes|.
1. Once all ongoing [=fetch=] algorithms initiated by the above steps are complete, including the
specified [=process response=] and [=process response end-of-body=] steps, asynchronously
complete this algorithm with |manifestsMap|.