idnits 2.17.1 draft-ietf-httpbis-early-hints-05.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 (October 28, 2017) is 2372 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- == Unused Reference: 'RFC7230' is defined on line 260, but no explicit reference was found in the text ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7540 (Obsoleted by RFC 9113) Summary: 3 errors (**), 0 flaws (~~), 2 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTP Working Group K. Oku 3 Internet-Draft Fastly 4 Intended status: Experimental October 28, 2017 5 Expires: May 1, 2018 7 An HTTP Status Code for Indicating Hints 8 draft-ietf-httpbis-early-hints-05 10 Abstract 12 This memo introduces an informational HTTP status code that can be 13 used to convey hints that help a client make preparations for 14 processing the final response. 16 Note to Readers 18 Discussion of this draft takes place on the HTTP working group 19 mailing list (ietf-http-wg@w3.org), which is archived at 20 https://lists.w3.org/Archives/Public/ietf-http-wg/ . 22 Working Group information can be found at https://httpwg.github.io/ ; 23 source code and issues list for this draft can be found at 24 https://github.com/httpwg/http-extensions/labels/early-hints . 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at http://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on May 1, 2018. 43 Copyright Notice 45 Copyright (c) 2017 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (http://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 61 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 62 2. 103 Early Hints . . . . . . . . . . . . . . . . . . . . . . . 3 63 3. Security Considerations . . . . . . . . . . . . . . . . . . . 5 64 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 65 5. References . . . . . . . . . . . . . . . . . . . . . . . . . 6 66 5.1. Normative References . . . . . . . . . . . . . . . . . . 6 67 5.2. Informative References . . . . . . . . . . . . . . . . . 6 68 Appendix A. Changes . . . . . . . . . . . . . . . . . . . . . . 6 69 A.1. Since draft-ietf-httpbis-early-hints-04 . . . . . . . . . 6 70 A.2. Since draft-ietf-httpbis-early-hints-03 . . . . . . . . . 7 71 A.3. Since draft-ietf-httpbis-early-hints-02 . . . . . . . . . 7 72 A.4. Since draft-ietf-httpbis-early-hints-01 . . . . . . . . . 7 73 A.5. Since draft-ietf-httpbis-early-hints-00 . . . . . . . . . 7 74 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 7 75 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 7 77 1. Introduction 79 It is common for HTTP responses to contain links to external 80 resources that need to be fetched prior to their use; for example, 81 rendering HTML by a Web browser. Having such links available to the 82 client as early as possible helps to minimize perceived latency. 84 The "preload" ([Preload]) link relation can be used to convey such 85 links in the Link header field of an HTTP response. However, it is 86 not always possible for an origin server to generate the header block 87 of a final response immediately after receiving a request. For 88 example, the origin server might delegate a request to an upstream 89 HTTP server running at a distant location, or the status code might 90 depend on the result of a database query. 92 The dilemma here is that even though it is preferable for an origin 93 server to send some header fields as soon as it receives a request, 94 it cannot do so until the status code and the full header fields of 95 the final HTTP response are determined. 97 HTTP/2 ([RFC7540]) server push can accelerate the delivery of 98 resources, but only resources for which the server is authoritative. 99 The other limitation of server push is that the response will be 100 transmitted regardless of whether the client has the response cached. 101 At the cost of spending one extra round-trip compared to server push 102 in the worst case, delivering Link header fields in a timely fashion 103 is more flexible and might consume less bandwidth. 105 This memo defines a status code for sending an informational response 106 ([RFC7231], Section 6.2) that contains header fields that are likely 107 to be included in the final response. A server can send the 108 informational response containing some of the header fields to help 109 the client start making preparations for processing the final 110 response, and then run time-consuming operations to generate the 111 final response. The informational response can also be used by an 112 origin server to trigger HTTP/2 server push at a caching 113 intermediary. 115 1.1. Notational Conventions 117 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 118 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 119 document are to be interpreted as described in [RFC2119]. 121 2. 103 Early Hints 123 The 103 (Early Hints) informational status code indicates to the 124 client that the server is likely to send a final response with the 125 header fields included in the informational response. 127 Typically, a server will include the header fields sent in a 103 128 (Early Hints) response in the final response as well. However, there 129 might be cases when this is not desirable, such as when the server 130 learns that they are not correct before the final response is sent. 132 A client can speculatively evaluate the header fields included in a 133 103 (Early Hints) response while waiting for the final response. For 134 example, a client might recognize a Link header field value 135 containing the relation type "preload" and start fetching the target 136 resource. However, these header fields only provide hints to the 137 client; they do not replace the header fields on the final response. 139 Aside from performance optimizations, such evaluation of the 103 140 (Early Hints) response's header fields MUST NOT affect how the final 141 response is processed. A client MUST NOT interpret the 103 (Early 142 Hints) response header fields as if they applied to the informational 143 response itself (e.g., as metadata about the 103 (Early Hints) 144 response). 146 A server MAY use a 103 (Early Hints) response to indicate only some 147 of the header fields that are expected to be found in the final 148 response. A client SHOULD NOT interpret the nonexistence of a header 149 field in a 103 (Early Hints) response as a speculation that the 150 header field is unlikely to be part of the final response. 152 The following example illustrates a typical message exchange that 153 involves a 103 (Early Hints) response. 155 Client request: 157 GET / HTTP/1.1 158 Host: example.com 160 Server response: 162 HTTP/1.1 103 Early Hints 163 Link: ; rel=preload; as=style 164 Link: ; rel=preload; as=script 166 HTTP/1.1 200 OK 167 Date: Fri, 26 May 2017 10:02:11 GMT 168 Content-Length: 1234 169 Content-Type: text/html; charset=utf-8 170 Link: ; rel=preload; as=style 171 Link: ; rel=preload; as=script 173 174 [... rest of the response body is omitted from the example ...] 176 As is the case with any informational response, a server might emit 177 more than one 103 (Early Hints) response prior to sending a final 178 response. This can happen for example when a caching intermediary 179 generates a 103 (Early Hints) response based on the header fields of 180 a stale-cached response, then forwards a 103 (Early Hints) response 181 and a final response that were sent from the origin server in 182 response to a revalidation request. 184 A server MAY emit multiple 103 (Early Hints) responses with 185 additional header fields as new information becomes available while 186 the request is being processed. It does not need to repeat the 187 fields that were already emitted, though it doesn't have to exclude 188 them either. The client can consider any combination of header 189 fields received in multiple 103 (Early Hints) responses when 190 anticipating the list of header fields expected in the final 191 response. 193 The following example illustrates a series of responses that a server 194 might emit. In the example, the server uses two 103 (Early Hints) 195 responses to notify the client that it is likely to send three Link 196 header fields in the final response. Two of the three expected 197 header fields are found in the final response. The other header 198 field is replaced by another Link header field that contains a 199 different value. 201 HTTP/1.1 103 Early Hints 202 Link: ; rel=preload; as=style 204 HTTP/1.1 103 Early Hints 205 Link: ; rel=preload; as=style 206 Link: ; rel=preload; as=script 208 HTTP/1.1 200 OK 209 Date: Fri, 26 May 2017 10:02:11 GMT 210 Content-Length: 1234 211 Content-Type: text/html; charset=utf-8 212 Link: ; rel=preload; as=style 213 Link: ; rel=preload; as=style 214 Link: ; rel=preload; as=script 216 217 [... rest of the response body is omitted from the example ...] 219 3. Security Considerations 221 Some clients might have issues handling 103 (Early Hints), since 222 informational responses are rarely used in reply to requests not 223 including an Expect header field ([RFC7231], Section 5.1.1). 225 In particular, an HTTP/1.1 client that mishandles an informational 226 response as a final response is likely to consider all responses to 227 the succeeding requests sent over the same connection to be part of 228 the final response. Such behavior might constitute a cross-origin 229 information disclosure vulnerability in case the client multiplexes 230 requests to different origins onto a single persistent connection. 232 Therefore, a server might refrain from sending Early Hints over 233 HTTP/1.1 unless the client is known to handle informational responses 234 correctly. 236 HTTP/2 clients are less likely to suffer from incorrect framing since 237 handling of the response header fields does not affect how the end of 238 the response body is determined. 240 4. IANA Considerations 242 The HTTP Status Codes Registry will be updated with the following 243 entry: 245 o Code: 103 247 o Description: Early Hints 249 o Specification: [this document] 251 5. References 253 5.1. Normative References 255 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 256 Requirement Levels", BCP 14, RFC 2119, 257 DOI 10.17487/RFC2119, March 1997, . 260 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 261 Protocol (HTTP/1.1): Message Syntax and Routing", 262 RFC 7230, DOI 10.17487/RFC7230, June 2014, 263 . 265 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 266 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 267 DOI 10.17487/RFC7231, June 2014, . 270 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 271 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 272 DOI 10.17487/RFC7540, May 2015, . 275 5.2. Informative References 277 [Preload] Grigorik, I., "Preload", n.d., . 280 Appendix A. Changes 282 A.1. Since draft-ietf-httpbis-early-hints-04 284 o Clarified that the server is allowed to add headers not found in a 285 103 response to the final response. 287 o Clarify client's behavior when it receives more than one 103 288 response. 290 A.2. Since draft-ietf-httpbis-early-hints-03 292 o Removed statements that were either redundant or contradictory to 293 RFC7230-7234. 295 o Clarified what the server's expected behavior is. 297 o Explain that a server might want to send more than one 103 298 response. 300 o Editorial Changes. 302 A.3. Since draft-ietf-httpbis-early-hints-02 304 o Editorial changes. 306 o Added an example. 308 A.4. Since draft-ietf-httpbis-early-hints-01 310 o Editorial changes. 312 A.5. Since draft-ietf-httpbis-early-hints-00 314 o Forbid processing the headers of a 103 response as part of the 315 informational response. 317 Appendix B. Acknowledgements 319 Thanks to Tatsuhiro Tsujikawa for coming up with the idea of sending 320 the Link header fields using an informational response. 322 Author's Address 324 Kazuho Oku 325 Fastly 327 Email: kazuhooku@gmail.com