From 98b7cfb49f6006a9ccd9db36ef62b90c094721bd Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 14 Jul 2020 10:58:24 +0200 Subject: [PATCH 1/3] Return null if parsing a structured field value fails All usage of structured fields in the web platform should not distinguish between the header not being there and failing to parse per the structured field parsing algorithm. This also aligns Fetch slightly with terminology changes in HTTP that more clearly separate headers and trailers. A future change might rename other concepts to also align with that (e.g., header list to field list). Fixes #1053. --- fetch.bs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/fetch.bs b/fetch.bs index bf9966c62..615ba8adf 100644 --- a/fetch.bs +++ b/fetch.bs @@ -16,9 +16,9 @@ url:https://tools.ietf.org/html/rfc7230#section-3.2;text:field-content;type:dfn; url:https://tools.ietf.org/html/rfc7230#section-3.2;text:field-value;type:dfn;spec:http url:https://tools.ietf.org/html/rfc7230#section-3.1.2;text:reason-phrase;type:dfn;spec:http url:https://tools.ietf.org/html/rfc7234#section-1.2.1;text:delta-seconds;type:dfn;spec:http-caching -url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-2;text:structured header value;type:dfn;spec:header-structure -url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-4.1;text:serializing structured headers;type:dfn;spec:header-structure -url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-4.2;text:parsing structured headers;type:dfn;spec:header-structure +url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-2;text:structured field value;type:dfn;spec:header-structure +url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-4.1;text:serializing structured fields;type:dfn;spec:header-structure +url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-4.2;text:parsing structured fields;type:dfn;spec:header-structure
@@ -89,7 +89,7 @@ url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-4.2;
         "authors": ["Mark Nottingham","Paul-Henning Kamp"],
         "href": "https://tools.ietf.org/html/draft-ietf-httpbis-header-structure",
         "publisher": "IETF",
-        "title": "Structured Headers for HTTP"
+        "title": "Structured Field Values for HTTP"
     }
 }
 
@@ -384,7 +384,7 @@ for consistency. specialized multimap. An ordered list of key-value pairs with potentially duplicate keys.

To -get a structured header +get a structured field value given a name and a type from a header list list, run these steps: @@ -397,28 +397,28 @@ these steps:

  • If value is null, then return null. -

  • Let result be the result of executing the parsing structured headers - algorithm with input_string set to value, and - header_type set to type. +

  • Let result be the result of parsing structured fields with + input_string set to value and header_type set to + type. -

  • If parsing failed, then return failure. +

  • If parsing failed, then return null.

  • Return result.

    To -set a structured header -name/structured header value name/structuredValue +set a structured field value +name/structured field value name/structuredValue pair in a header list list, run these steps:

    1. Let serializedValue be the result of executing the - serializing structured headers algorithm on structuredValue. + serializing structured fields algorithm on structuredValue.

    2. Set name/serializedValue in list.

    -

    Structured header values are defined as objects which HTTP can (eventually) +

    Structured field values are defined as objects which HTTP can (eventually) serialize in interesting and efficient ways. For the moment, Fetch only supports header values as byte sequences, which means that these objects can be set in header lists only via serialization, and they can be obtained from From 10e9552889d9308a5380116013c078f1d930ce16 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 14 Jul 2020 11:20:31 +0200 Subject: [PATCH 2/3] correct name of author and format consistently --- fetch.bs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fetch.bs b/fetch.bs index 615ba8adf..aa8653a4c 100644 --- a/fetch.bs +++ b/fetch.bs @@ -75,9 +75,7 @@ url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-4.2; "title": "HTTP proxy default configurations allow arbitrary TCP connections." }, "EXPECT-CT": { - "authors": [ - "Emily Stark" - ], + "authors": ["Emily Stark"], "href": "https://tools.ietf.org/html/draft-ietf-httpbis-expect-ct-02", "publisher": "IETF", "title": "Expect-CT Extension for HTTP" @@ -86,7 +84,7 @@ url:https://tools.ietf.org/html/draft-ietf-httpbis-header-structure#section-4.2; "aliasOf": "RFC2560" }, "HEADER-STRUCTURE": { - "authors": ["Mark Nottingham","Paul-Henning Kamp"], + "authors": ["Mark Nottingham", "Poul-Henning Kamp"], "href": "https://tools.ietf.org/html/draft-ietf-httpbis-header-structure", "publisher": "IETF", "title": "Structured Field Values for HTTP" From b15a670fcb487b32738f408f78941f00f2320f59 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 15 Jul 2020 06:41:15 +0200 Subject: [PATCH 3/3] add a note --- fetch.bs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fetch.bs b/fetch.bs index aa8653a4c..360f24c73 100644 --- a/fetch.bs +++ b/fetch.bs @@ -404,6 +404,10 @@ these steps:

  • Return result. +

    Get a structured field value intentionally does not distinguish between a +header not being present and its value failing to parse as a +structured field value. This ensures uniform processing across the web platform. +

    To set a structured field value name/structured field value name/structuredValue