idnits 2.17.1 draft-davidben-http-client-hint-reliability-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (1 June 2021) is 1031 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7234 (Obsoleted by RFC 9111) ** Obsolete normative reference: RFC 7540 (Obsoleted by RFC 9113) Summary: 3 errors (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTP D. Benjamin 3 Internet-Draft Google LLC 4 Updates: ietf-httpbis-client-hints (if approved) 1 June 2021 5 Intended status: Experimental 6 Expires: 3 December 2021 8 Client Hint Reliability 9 draft-davidben-http-client-hint-reliability-03 11 Abstract 13 This document defines the Critical-CH HTTP response header, and the 14 ACCEPT_CH HTTP/2 and HTTP/3 frames to allow HTTP servers to reliably 15 specify their Client Hint preferences, with minimal performance 16 overhead. 18 Discussion Venues 20 This note is to be removed before publishing as an RFC. 22 Source for this draft and an issue tracker can be found at 23 https://github.com/davidben/http-client-hint-reliability. 25 Status of This Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at https://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on 3 December 2021. 42 Copyright Notice 44 Copyright (c) 2021 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 49 license-info) in effect on the date of publication of this document. 50 Please review these documents carefully, as they describe your rights 51 and restrictions with respect to this document. Code Components 52 extracted from this document must include Simplified BSD License text 53 as described in Section 4.e of the Trust Legal Provisions and are 54 provided without warranty as described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 59 2. Conventions and Definitions . . . . . . . . . . . . . . . . . 3 60 3. The Critical-CH Response Header Field . . . . . . . . . . . . 3 61 3.1. Example . . . . . . . . . . . . . . . . . . . . . . . . . 4 62 4. The ACCEPT_CH Frame . . . . . . . . . . . . . . . . . . . . . 5 63 4.1. HTTP/2 ACCEPT_CH Frame . . . . . . . . . . . . . . . . . 5 64 4.2. HTTP/3 ACCEPT_CH Frame . . . . . . . . . . . . . . . . . 6 65 4.3. Processing ACCEPT_CH Frames . . . . . . . . . . . . . . . 7 66 4.4. Interaction with Critical-CH . . . . . . . . . . . . . . 9 67 5. Security Considerations . . . . . . . . . . . . . . . . . . . 9 68 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 69 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 10 70 7.1. Normative References . . . . . . . . . . . . . . . . . . 10 71 7.2. Informative References . . . . . . . . . . . . . . . . . 12 72 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 12 73 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 12 75 1. Introduction 77 [RFC8942] defines a response header, Accept-CH, for servers to 78 advertise a set of request headers used for proactive content 79 negotiation. This allows user agents to send request headers only 80 when used, improving their performance overhead as well as reducing 81 passive fingerprinting surface. 83 However, on the first HTTP request to a server, the user agent will 84 not have received the Accept-CH header and may not take the server 85 preferences into account. More generally, the server's configuration 86 may have changed since the most recent HTTP request to the server. 87 This document defines a pair of mechanisms to resolve this: 89 1. an HTTP response header, Critical-CH, for the server to instruct 90 the user agent to retry the request 92 2. an alternate delivery mechanism for Accept-CH in HTTP/2 [RFC7540] 93 and HTTP/3 [I-D.ietf-quic-http], which can avoid the performance 94 hit of a retry in most cases 96 2. Conventions and Definitions 98 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 99 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 100 "OPTIONAL" in this document are to be interpreted as described in BCP 101 14 [RFC2119] [RFC8174] when, and only when, they appear in all 102 capitals, as shown here. 104 This document uses the Augmented Backus-Naur Form (ABNF) notation of 105 [RFC5234]. 107 This document uses the variable-length integer encoding and frame 108 diagram format from [RFC9000]. 110 3. The Critical-CH Response Header Field 112 When a user agent requests a resource based on a missing or outdated 113 Accept-CH value, it may not send a desired request header field. 114 Neither user agent nor server has enough information to reliably and 115 efficiently recover from this situation. The server can observe that 116 the header is missing, but the user agent may not have supported the 117 header, or may have chosen not to send it. Triggering a new request 118 in these cases would risk an infinite loop or an unnecessary round- 119 trip. 121 Conversely, the user agent can observe that a request header appears 122 in the Accept-CH (Section 3.1 of [RFC8942]) and Vary (Section 7.1.4 123 of [RFC7231]) response header fields. However, retrying based on 124 this information would waste resources if the resource only used the 125 Client Hint as an optional optimization. 127 This document introduces critical Client Hints. These are the Client 128 Hints which meaningfully change the resulting resource. For example, 129 a server may use the Device-Memory Client Hint [DEVICE-MEMORY] to 130 select simple and complex variants of a resource to different user 131 agents. Such a resource should be fetched consistently across page 132 loads to avoid jarring user-visible switches. 134 The server specifies critical Client Hints with the Critical-CH 135 response header field. It is a Structured Header [RFC8941] whose 136 value MUST be an sf-list (Section 3.1 of [RFC8941]) whose members are 137 tokens (Section 3.3.4 of [RFC8941]). Its ABNF is: 139 Critical-CH = sf-list 141 For example: 143 Critical-CH: Sec-CH-Example, Sec-CH-Example-2 145 Each token listed in the Critical-CH header SHOULD additionally be 146 present in the Accept-CH and Vary response headers. 148 When a user agent receives an HTTP response containing a Critical-CH 149 header, it first processes the Accept-CH header as described in 150 Section 3.1 of [RFC8942]. It then performs the following steps: 152 1. If the request did not use a safe method (Section 4.2.1 of 153 [RFC7231]), ignore the Critical-CH header and continue processing 154 the response as usual. 156 2. If the response was already the result of a retry, ignore the 157 Critical-CH header and continue processing the response as usual. 159 3. Determine the Client Hints that would have been sent given the 160 updated Accept-CH value, incorporating the user agent's local 161 policy and user preferences. See also Section 2.1 of [RFC8942]. 163 4. Compare this result to the Client Hints which were sent. If any 164 Client Hint listed in the Critical-CH header was not previously 165 sent and would now have been sent, retry the request with the new 166 preferences. Otherwise, continue processing the response as 167 usual. 169 Note this procedure does not cause the user agent to send Client 170 Hints it would not otherwise send. 172 3.1. Example 174 For example, if the user agent loads https://example.com with no 175 knowledge of the server's Accept-CH preferences, it may send the 176 following response: 178 GET / HTTP/1.1 179 Host: example.com 181 HTTP/1.1 200 OK 182 Content-Type: text/html 183 Accept-CH: Sec-CH-Example, Sec-CH-Example-2 184 Vary: Sec-CH-Example 185 Critical-CH: Sec-CH-Example 187 In this example, the server, across the whole origin, uses both Sec- 188 CH-Example and Sec-CH-Example-2 Client Hints. However, this resource 189 only uses Sec-CH-Example, which it considers critical. 191 The user agent now processes the Accept-CH header and determines it 192 would have sent both headers. Sec-CH-Example is listed in Critical- 193 CH, so the user agent retries the request, and receives a more 194 specific response. 196 GET / HTTP/1.1 197 Host: example.com 198 Sec-CH-Example: 1 199 Sec-CH-Example-2: 2 201 HTTP/1.1 200 OK 202 Content-Type: text/html 203 Accept-CH: Sec-CH-Example, Sec-CH-Example-2 204 Vary: Sec-CH-Example 205 Critical-CH: Sec-CH-Example 207 4. The ACCEPT_CH Frame 209 While Critical-CH header provides reliability, it requires a retry on 210 some requests. This document additionally introduces the ACCEPT_CH 211 HTTP/2 and HTTP/3 frames as an optimization so the server's Client 212 Hint preferences are usually available before the client's first 213 request. 215 HTTP/2 and HTTP/3 servers which request Client Hints SHOULD send an 216 ACCEPT_CH frame as early as possible. Connections using TLS 217 [RFC8446] which negotiate the Application Layer Protocol Settings 218 (ALPS) [I-D.vvv-tls-alps] extension SHOULD include the ACCEPT_CH 219 frame in the ALPS value as described in [I-D.vvv-httpbis-alps]. This 220 ensures the information is available to the user agent when it makes 221 the first request. 223 [[TODO: Alternatively, is it time to revive draft-bishop-httpbis- 224 extended-settings?]] 226 4.1. HTTP/2 ACCEPT_CH Frame 228 The HTTP/2 ACCEPT_CH frame type is TBD (decimal TBD) and contains 229 zero or more entries, each consisting of a pair of length-delimited 230 strings: 232 +-------------------------------+ 233 | Origin-Len (16) | 234 +-------------------------------+-------------------------------+ 235 | Origin ... 236 +-------------------------------+-------------------------------+ 237 | Value-Len (16) | 238 +-------------------------------+-------------------------------+ 239 | Value ... 240 +---------------------------------------------------------------+ 242 The fields are defined as follows: 244 Origin-Len: An unsigned, 16-bit integer indicating the length, in 245 octets, of the Origin field. 247 Origin: A sequence of characters containing the ASCII serialization 248 of an origin (Section 6.2 of [RFC6454]) that the sender is 249 providing an Accept-CH value for. 251 Value-Len: An unsigned, 16-bit integer indicating the length, in 252 octets, of the Value field. 254 Value: A sequence of characters containing the Accept-CH value for 255 the corresponding origin. This value MUST satisfy the Accept-CH 256 ABNF defined in Section 3.1 of [RFC8942]. 258 Clients MUST NOT send ACCEPT_CH frames. Servers which receive an 259 ACCEPT_CH frame MUST respond with a connection error (Section 5.4.1 260 of [RFC7540]) of type PROTOCOL_ERROR. 262 ACCEPT_CH frames always apply to a single connection, never a single 263 stream. The stream identifier in the ACCEPT_CH frame MUST be zero. 264 The flags field of an ACCEPT_CH field is unused and MUST be zero. If 265 a user agent receives an ACCEPT_CH frame whose stream identifier or 266 flags field is non-zero, it MUST respond with a connection error of 267 type PROTOCOL_ERROR. 269 4.2. HTTP/3 ACCEPT_CH Frame 271 The HTTP/3 ACCEPT_CH frame type is TBD (decimal TBD) and contains 272 zero or more entries, each containing an origin and a corresponding 273 Accept-CH value. 275 HTTP/3 ACCEPT_CH Entry { 276 Origin Length (i), 277 Origin (..) 278 Value Length (i), 279 Value (..), 280 } 282 HTTP/3 ACCEPT_CH Frame { 283 Type (i) = TBD, 284 Length (i), 285 HTTP/3 ACCEPT_CH Entry (..) ..., 286 } 288 The fields of each HTTP/3 ACCEPT_CH Entry are defined as follows: 290 Origin Length: A variable-length integer containing the length, in 291 bytes, of the Origin field. 293 Origin: A sequence of characters containing the ASCII serialization 294 of an origin (Section 6.2 of [RFC6454]) that the sender is 295 providing an Accept-CH value for. 297 Value Length: A variable-length integer containing the length, in 298 bytes, of the Value field. 300 Value: A sequence of characters containing the Accept-CH value for 301 the corresponding origin. This value MUST satisfy the Accept-CH 302 ABNF defined in Section 3.1 of [RFC8942]. 304 Clients MUST NOT send ACCEPT_CH frames. Servers which receive an 305 ACCEPT_CH frame MUST respond with a connection error (Section 8 of 306 [I-D.ietf-quic-http]) of type H3_FRAME_UNEXPECTED. 308 ACCEPT_CH frames may only be sent on the control stream. Clients 309 which receive an ACCEPT_CH frame on any other stream MUST respond 310 with a connection error of type H3_FRAME_UNEXPECTED. 312 4.3. Processing ACCEPT_CH Frames 314 The user agent remembers the most recently received ACCEPT_CH frame 315 for each HTTP/2 or HTTP/3 connection. When it receives a new 316 ACCEPT_CH frame, either in application data or ALPS, it overwrites 317 this value. As this is an optimization, the user agent MAY bound the 318 size and ignore or forget entries to reduce resource usage. 320 When the user agent makes an HTTP request to a particular origin over 321 an HTTP/2 or HTTP/3 connection, it looks up the origin in the 322 remembered ACCEPT_CH, if any. If it finds a match, it determines 323 additional Client Hints to send, incorporating its local policy and 324 user preferences. See Section 2.1 of [RFC8942]. 326 If there are additional Client Hints, the user agent restarts the 327 request with updated headers. The connection has already been 328 established, so this restart does not incur any additional network 329 latency. Note it may result in a different secondary HTTP cache key 330 (see Section 4.1 of [RFC7234]) and select a different cached 331 response. If the new cached response does not need revalidation, it 332 may not use the connection at all. 334 User agents MUST NOT process Client Hint preferences in ACCEPT_CH 335 frames corresponding to origins for which the connection is not 336 authoritative. Note the procedure above implicitly satisfies this by 337 deferring processing to after the connection has been chosen for a 338 corresponding request. Unauthoritative origins and other unmatched 339 entries are ignored. 341 [[TODO: Some variations on this behavior we could choose instead: 343 * Do new ACCEPT_CH frames override the whole set or implement some 344 kind of update? Overriding the whole set seems simplest and most 345 consistent with an EXTENDED_SETTINGS variant. 347 * Should the user agent reject the ACCEPT_CH frame if there are 348 unexpected origins in there? Deferring avoids needing to worry 349 about this, and ignoring the unused ones may interact better with 350 secondary certs. 352 * Should ACCEPT_CH frames be deferred or just written to the cache 353 when received? Deferred simplifies reasoning about bad origins, 354 predictive connections, etc., but means interactions between 355 ACCEPT_CH and Accept-CH are more complex (see below). 357 * How should ACCEPT_CH and Accept-CH interact? The document 358 currently proposes unioning them, which is easy. Accept-CH first 359 would work, but unnecessarily ignore newer connection-level 360 ACCEPT_CHs. ACCEPT_CH would not; a stale connection-level 361 preference would get stuck. Whichever is received earlier would 362 also work, but requires tracking timestamps if deferred (see 363 above).]] 365 4.4. Interaction with Critical-CH 367 The ACCEPT_CH frame avoids a round-trip, so relying on it over 368 Critical-CH would be preferable. However, this is not always 369 possible: 371 * The server may be running older software without support for 372 ACCEPT_CH or ALPS. 374 * The server's Accept-CH preferences may change while existing 375 connections are open. Those connections will have outdated 376 ACCEPT_CH frames. While the server could send a new frame, it may 377 not arrive in time for the next request. Moreover, if the HTTP 378 serving frontend is an intermediary like a CDN, it may not be 379 proactively notified of origin server changes. 381 * HTTP/2 and HTTP/3 allow connection reuse across multiple origins 382 (Section 9.1.1 of [RFC7540] and Section 3.4 of 383 [I-D.ietf-quic-http]). Some origins may not be listed in the 384 ACCEPT_CH frame, particularly if the server used a wildcard X.509 385 certificate. 387 Thus this document defines both mechanisms. Critical-CH provides 388 reliable Client Hint delivery, while the ACCEPT_CH frame avoids the 389 retry in most cases. 391 5. Security Considerations 393 Request header fields may expose sensitive information about the 394 user's environment. Section 4.1 of [RFC8942] discusses some of these 395 considerations. The document augments the capabilities of Client 396 Hints, but does not change these considerations. The procedure 397 described in Section 3 does not result in the user agent sending 398 request headers it otherwise would not have. 400 The ACCEPT_CH frame does introduce a new way for HTTP/2 or HTTP/3 401 connections to make assertions about origins they are not 402 authoritative for, but the procedure in Section 4.3 defers processing 403 until after the user agent has decided to use the connection for a 404 particular request (Section 9.1.1 of [RFC7540] and Section 3.4 of 405 [I-D.ietf-quic-http]). The user agent will thus only use information 406 from an ACCEPT_CH frame if it considers the connection authoritative 407 for the origin. 409 6. IANA Considerations 411 This specification adds an entry to the "HTTP/2 Frame Type" registry 412 [RFC7540] with the following parameters: 414 * Frame Type: ACCEPT_CH 416 * Code: TBD 418 * Allowed in ALPS: Yes 420 * Reference: [[this document]] 422 This specification adds an entry to the "HTTP/3 Frame Type" registry 423 [I-D.ietf-quic-http] with the following parameters: 425 * Frame Type: ACCEPT_CH 427 * Code: TBD 429 * Allowed in ALPS: Yes 431 * Reference: [[this document]] 433 [[TODO: As of writing, the Frame Type registries do not include 434 Allowed in ALPS columns, but [I-D.vvv-httpbis-alps] adds them. This 435 document should be updated as that design evolves.]] 437 7. References 439 7.1. Normative References 441 [I-D.ietf-quic-http] 442 Bishop, M., "Hypertext Transfer Protocol Version 3 443 (HTTP/3)", Work in Progress, Internet-Draft, draft-ietf- 444 quic-http-34, 2 February 2021, 445 . 448 [I-D.vvv-httpbis-alps] 449 Vasiliev, V., "Using TLS Application-Layer Protocol 450 Settings (ALPS) in HTTP", Work in Progress, Internet- 451 Draft, draft-vvv-httpbis-alps-01, 21 January 2021, 452 . 455 [I-D.vvv-tls-alps] 456 Benjamin, D. and V. Vasiliev, "TLS Application-Layer 457 Protocol Settings Extension", Work in Progress, Internet- 458 Draft, draft-vvv-tls-alps-01, 21 September 2020, 459 . 462 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 463 Requirement Levels", BCP 14, RFC 2119, 464 DOI 10.17487/RFC2119, March 1997, 465 . 467 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 468 Specifications: ABNF", STD 68, RFC 5234, 469 DOI 10.17487/RFC5234, January 2008, 470 . 472 [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, 473 DOI 10.17487/RFC6454, December 2011, 474 . 476 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 477 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 478 DOI 10.17487/RFC7231, June 2014, 479 . 481 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 482 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 483 RFC 7234, DOI 10.17487/RFC7234, June 2014, 484 . 486 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 487 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 488 DOI 10.17487/RFC7540, May 2015, 489 . 491 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 492 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 493 May 2017, . 495 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 496 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 497 . 499 [RFC8941] Nottingham, M. and P-H. Kamp, "Structured Field Values for 500 HTTP", RFC 8941, DOI 10.17487/RFC8941, February 2021, 501 . 503 [RFC8942] Grigorik, I. and Y. Weiss, "HTTP Client Hints", RFC 8942, 504 DOI 10.17487/RFC8942, February 2021, 505 . 507 [RFC9000] Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 508 Multiplexed and Secure Transport", RFC 9000, 509 DOI 10.17487/RFC9000, May 2021, 510 . 512 7.2. Informative References 514 [DEVICE-MEMORY] 515 Panicker, S., "Device Memory", n.d., 516 . 518 Acknowledgments 520 This document has benefited from contributions and suggestions from 521 Ilya Grigorik, Nick Harper, Matt Menke, Aaron Tagliaboschi, Victor 522 Vasiliev, Yoav Weiss, and others. 524 Author's Address 526 David Benjamin 527 Google LLC 529 Email: davidben@google.com