]>
An HTTP Status Code for Indicating HintsFastlykazuhooku@gmail.comGeneral
HTTPInternet-DraftThis memo introduces an informational HTTP status code that can be used to convey hints that
help a client make preparations for processing the final response.Discussion of this draft takes place on the HTTP working group mailing list (ietf-http-wg@w3.org),
which is archived at https://lists.w3.org/Archives/Public/ietf-http-wg/.Working Group information can be found at https://httpwg.github.io/; source code and issues list
for this draft can be found at https://github.com/httpwg/http-extensions/labels/early-hints.It is common for HTTP responses to contain links to external resources that need to be fetched
prior to their use; for example, rendering HTML by a Web browser. Having such links available to
the client as early as possible helps to minimize perceived latency.The “preload” () link relation can be used to convey such links in the Link header field
of an HTTP response. However, it is not always possible for an origin server to generate the
header block of a final response immediately after receiving a request. For example, the origin
server might delegate a request to an upstream HTTP server running at a distant location, or the
status code might depend on the result of a database query.The dilemma here is that even though it is preferable for an origin server to send some header fields as
soon as it receives a request, it cannot do so until the status code and the full header fields of the
final HTTP response are determined.HTTP/2 () server push can be used as a solution to this issue, but has its own
limitations. The responses that can be pushed using HTTP/2 are limited to those belonging to the
same origin. Also, it is impossible to send only the links using server push. Finally, sending HTTP
responses for every resource is an inefficient way of using bandwidth, especially when a caching
server exists as an intermediary.This memo defines a status code for sending an informational response (, Section 6.2) that
contains header fields that are likely to be included in the final response. A server can send the
informational response containing some of the header fields to help the client start making preparations
for processing the final response, and then run time-consuming operations to generate the final
response. The informational response can also be used by an origin server to trigger HTTP/2 server
push at a caching intermediary.The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
“RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in
.The 103 (Early Hints) informational status code indicates to the client that the server is likely to
send a final response with the header fields included in the informational response.Typically, a server will include the header fields sent in a 103 (Early Hints) response in the final
response as well. However, there might be cases when this is not desirable, such as when the server
learns that they are not correct before the final response is sent.A client can speculatively evaluate the header fields included in a 103 (Early Hints) response while
waiting for the final response. For example, a client might recognize a Link header field value
containing the relation type “preload” and start fetching the target resource.
However, these header fields only provide hints to the client; they do not replace the header
fields on the final response.Aside from performance optimizations, such evaluation of the 103
(Early Hints) response’s header fields MUST NOT affect how the final response is processed. A
client MUST NOT interpret the 103 (Early Hints) response header fields as if they applied to
the informational response itself (e.g., as metadata about the 103 (Early Hints) response).The following example illustrates a typical message exchange that involves a 103 (Early Hints) response.Client request:Server response:; rel=preload; as=style
Link: ; rel=preload; as=script
HTTP/1.1 200 OK
Date: Fri, 26 May 2017 10:02:11 GMT
Content-Length: 1234
Content-Type: text/html; charset=utf-8
Link: ; rel=preload; as=style
Link: ; rel=preload; as=script
[... rest of the response body is ommitted from the example ...]
]]>As is the case with any informational response, a server might emit more than one 103 (Early Hints)
response prior to sending a final response.
This can happen for example when a caching intermediary generates a 103 (Early Hints) response based
on the header fields of a stale-cached response, then forwards a 103 (Early Hints) response and a
final response that were sent from the origin server in response to a revalidation request.Some clients might have issues handling 103 (Early Hints), since informational responses are rarely
used in reply to requests not including an Expect header field (, Section 5.1.1).In particular, an HTTP/1.1 client that mishandles an informational response as a final response
is likely to consider all responses to the succeeding requests sent over the same connection to be
part of the final response. Such behavior might constitute a cross-origin information disclosure
vulnerability in case the client multiplexes requests to different origins onto a single persistent
connection.Therefore, a server might refrain from sending Early Hints over HTTP/1.1 unless the client is
known to handle informational responses correctly.HTTP/2 clients are less likely to suffer from incorrect framing since handling of the response
header fields does not affect how the end of the response body is determined.The HTTP Status Codes Registry will be updated with the following entry:Code: 103Description: Early HintsSpecification: [this document]Key words for use in RFCs to Indicate Requirement LevelsIn many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and RoutingThe Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document provides an overview of HTTP architecture and its associated terminology, defines the "http" and "https" Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations.Hypertext Transfer Protocol (HTTP/1.1): Semantics and ContentThe Hypertext Transfer Protocol (HTTP) is a stateless \%application- level protocol for distributed, collaborative, hypertext information systems. This document defines the semantics of HTTP/1.1 messages, as expressed by request methods, request header fields, response status codes, and response header fields, along with the payload of messages (metadata and body content) and mechanisms for content negotiation.Hypertext Transfer Protocol Version 2 (HTTP/2)This specification describes an optimized expression of the semantics of the Hypertext Transfer Protocol (HTTP), referred to as HTTP version 2 (HTTP/2). HTTP/2 enables a more efficient use of network resources and a reduced perception of latency by introducing header field compression and allowing multiple concurrent exchanges on the same connection. It also introduces unsolicited push of representations from servers to clients.This specification is an alternative to, but does not obsolete, the HTTP/1.1 message syntax. HTTP's existing semantics remain unchanged.PreloadRemoved statements that were either redundant or contradictory to RFC7230-7234.Clarified what the server’s expected behavior is.Explain that a server might want to send more than one 103 response.Editorial Changes.Editorial changes.Added an example.Editorial changes.Forbid processing the headers of a 103 response as part of the informational response.Thanks to Tatsuhiro Tsujikawa for coming up with the idea of sending the Link header fields using an
informational response.