<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.2.2 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc toc="yes"?>
<?rfc docindent="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>

<rfc ipr="trust200902" docName="draft-ietf-httpbis-early-hints-04" category="exp">

  <feedback xmlns='http://purl.org/net/xml2rfc/ext' template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&amp;body=%3c{ref}%3e:"/><front>
    <title abbrev="Early Hints">An HTTP Status Code for Indicating Hints</title>

    <author initials="K." surname="Oku" fullname="Kazuho Oku">
      <organization>Fastly</organization>
      <address>
        <email>kazuhooku@gmail.com</email>
      </address>
    </author>

    <date year="2017" month="July" day="11"/>

    <area>General</area>
    <workgroup>HTTP</workgroup>
    <keyword>Internet-Draft</keyword>

    <abstract>


<t>This 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.</t>



    </abstract>


    <note title="Note to Readers">


<t>Discussion of this draft takes place on the HTTP working group mailing list (ietf-http-wg@w3.org),
which is archived at <eref target="https://lists.w3.org/Archives/Public/ietf-http-wg/">https://lists.w3.org/Archives/Public/ietf-http-wg/</eref>.</t>

<t>Working Group information can be found at <eref target="https://httpwg.github.io/">https://httpwg.github.io/</eref>; source code and issues list
for this draft can be found at <eref target="https://github.com/httpwg/http-extensions/labels/early-hints">https://github.com/httpwg/http-extensions/labels/early-hints</eref>.</t>


    </note>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>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.</t>

<t>The “preload” (<xref target="Preload"></xref>) 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.</t>

<t>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.</t>

<t>HTTP/2 (<xref target="RFC7540"></xref>) 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.</t>

<t>This memo defines a status code for sending an informational response (<xref target="RFC7231"></xref>, 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.</t>

<section anchor="notational-conventions" title="Notational Conventions">

<t>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
<xref target="RFC2119"></xref>.</t>

</section>
</section>
<section anchor="early-hints" title="103 Early Hints">

<t>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.</t>

<t>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.</t>

<t>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.</t>

<t>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).</t>

<t>The following example illustrates a typical message exchange that involves a 103 (Early Hints) response.</t>

<t>Client request:</t>

<figure><artwork type="example"><![CDATA[
  GET / HTTP/1.1
  Host: example.com

]]></artwork></figure>

<t>Server response:</t>

<figure><artwork type="example"><![CDATA[
  HTTP/1.1 103 Early Hints
  Link: </style.css>; rel=preload; as=style
  Link: </script.js>; 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: </style.css>; rel=preload; as=style
  Link: </script.js>; rel=preload; as=script

  <!doctype html>
  [... rest of the response body is ommitted from the example ...]
]]></artwork></figure>

<t>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.</t>

</section>
<section anchor="security-considerations" title="Security Considerations">

<t>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 (<xref target="RFC7231"></xref>, Section 5.1.1).</t>

<t>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.</t>

<t>Therefore, a server might refrain from sending Early Hints over HTTP/1.1 unless the client is
known to handle informational responses correctly.</t>

<t>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.</t>

</section>
<section anchor="iana-considerations" title="IANA Considerations">

<t>The HTTP Status Codes Registry will be updated with the following entry:</t>

<t><list style="symbols">
  <t>Code: 103</t>
  <t>Description: Early Hints</t>
  <t>Specification: [this document]</t>
</list></t>

</section>


  </middle>

  <back>

    <references title='Normative References'>





<reference  anchor="RFC2119" target='http://www.rfc-editor.org/info/rfc2119'>
<front>
<title>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='S. Bradner'><organization /></author>
<date year='1997' month='March' />
<abstract><t>In 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.</t></abstract>
</front>
<seriesInfo name='BCP' value='14'/>
<seriesInfo name='RFC' value='2119'/>
<seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>



<reference  anchor="RFC7230" target='http://www.rfc-editor.org/info/rfc7230'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding' role='editor'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke' role='editor'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The 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 &quot;http&quot; and &quot;https&quot; Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations.</t></abstract>
</front>
<seriesInfo name='RFC' value='7230'/>
<seriesInfo name='DOI' value='10.17487/RFC7230'/>
</reference>



<reference  anchor="RFC7231" target='http://www.rfc-editor.org/info/rfc7231'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding' role='editor'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke' role='editor'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The 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.</t></abstract>
</front>
<seriesInfo name='RFC' value='7231'/>
<seriesInfo name='DOI' value='10.17487/RFC7231'/>
</reference>



<reference  anchor="RFC7540" target='http://www.rfc-editor.org/info/rfc7540'>
<front>
<title>Hypertext Transfer Protocol Version 2 (HTTP/2)</title>
<author initials='M.' surname='Belshe' fullname='M. Belshe'><organization /></author>
<author initials='R.' surname='Peon' fullname='R. Peon'><organization /></author>
<author initials='M.' surname='Thomson' fullname='M. Thomson' role='editor'><organization /></author>
<date year='2015' month='May' />
<abstract><t>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.</t><t>This specification is an alternative to, but does not obsolete, the HTTP/1.1 message syntax.  HTTP's existing semantics remain unchanged.</t></abstract>
</front>
<seriesInfo name='RFC' value='7540'/>
<seriesInfo name='DOI' value='10.17487/RFC7540'/>
</reference>




    </references>

    <references title='Informative References'>

<reference anchor="Preload" target="https://w3c.github.io/preload/">
  <front>
    <title>Preload</title>
    <author initials="I." surname="Grigorik">
      <organization></organization>
    </author>
    <date year="n.d."/>
  </front>
</reference>


    </references>


<section anchor="changes" title="Changes">

<section anchor="since-draft-ietf-httpbis-early-hints-03" title="Since draft-ietf-httpbis-early-hints-03">

<t><list style="symbols">
  <t>Removed statements that were either redundant or contradictory to RFC7230-7234.</t>
  <t>Clarified what the server’s expected behavior is.</t>
  <t>Explain that a server might want to send more than one 103 response.</t>
  <t>Editorial Changes.</t>
</list></t>

</section>
<section anchor="since-draft-ietf-httpbis-early-hints-02" title="Since draft-ietf-httpbis-early-hints-02">

<t><list style="symbols">
  <t>Editorial changes.</t>
  <t>Added an example.</t>
</list></t>

</section>
<section anchor="since-draft-ietf-httpbis-early-hints-01" title="Since draft-ietf-httpbis-early-hints-01">

<t><list style="symbols">
  <t>Editorial changes.</t>
</list></t>

</section>
<section anchor="since-draft-ietf-httpbis-early-hints-00" title="Since draft-ietf-httpbis-early-hints-00">

<t><list style="symbols">
  <t>Forbid processing the headers of a 103 response as part of the informational response.</t>
</list></t>

</section>
</section>
<section anchor="acknowledgements" title="Acknowledgements">

<t>Thanks to Tatsuhiro Tsujikawa for coming up with the idea of sending the Link header fields using an
informational response.</t>

</section>


  </back>

<!-- ##markdown-source:
H4sIAMYsZVkAA7VZ23IbNxJ9x1dg5Ye1XSR1sZNs6MQVluWLKpLltZRKbblc
KXAGJLGcAWYBjGjmId++pxsYckhRzuZh/WCPZwD07fTpbnA4HIpoYqXHcmLl
u9vbD/ImqtgG+cqVWs6clxe2NIWKxs7lO2NjEGo69fpuLF8rX63zu9IVVtU4
pfRqFodGx9lwEWMzNWGoad1wQeuGJ89FqSLWnZ2cfidwrJ47vx5L/aURwjR+
LKNvQzw7Ofn+5Ewor9VYvtVWe1WJlfPLuXdtM2ZFxVKv8aocQ8OovdVxeE7C
hQhR2fI3VTkLQWsdRGPG8lN0xUBCT2NLbeNABuej17OAp3WdH6I3BT4Vrm5U
fqixGJ+MrYzVn4VQbVw4PxZyKCT+GBvG8ueRvF62/P/khZ/V7+3CbV46P1fW
/A4nOjuWb1SI1Zo/6FqZaiyXvNwt25/m9GIEsUJY52vsuNOQJT++eXV2evp9
fvzu7NnJ9vG0e/zmOd4KY2f9nR+8rpwqxywvhzq/41cbe+TGnIuRfOsNAmOW
aZfycx3HkgIaxsfHq2fFaG7iop2OjDtu0mHHQgyHQ6mmcCJ8J8TtwgRZ69rh
0Ohd2RY6SGXlRj9nVZUgFxLkCoJcXKgoC6ybatkGXcro8MHe6bVkCPECsdBV
I5UsKoPwyFottYQejfJ8bmDgNt5BZCDgxgWwbEie16HBAj0SSV/rov7tPf0V
3W8ftSq1D0Kcm1C02OqsdDPshiUMbLhiCSuaShVa4iOdyxYQNkkQ41NSEOl/
lQlRPt4kw3A1/2n1bAQ0PBmI1cIUC4mDlS8WiFUpYfcPnYtpZxilxceTtCIc
f2inlSmO+wcev4Qlv2bpb1l6z8GdI2eutbsC6N/VvBfGly+QEa2HXRwGZBCU
Cy2sJV0EObTnhwfPzQcC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