<?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-03" 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="6" day="20"/>

    <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>A server MUST NOT include Content-Length, Transfer-Encoding, or any hop-by-hop header fields
(<xref target="RFC7230"></xref>, Section 6.1) in a 103 (Early Hints) response.</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.</t>

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

<t>An intermediary MAY drop the informational response. It MAY send HTTP/2 (<xref target="RFC7540"></xref>) server pushes
using the information found in 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>

</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 (<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 may 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 when 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>
<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>
<section anchor="changes" title="Changes">

<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>


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



  </back>

<!-- ##markdown-source:
H4sIAAxjSlkAA7VZ23IbNxJ9x1dg5Ye1U7xIci4bOnFFZcm2KpLltZhKbblc
KXAGJBFigFkAI5p5yLfv6cYMOaQkZ/dh/WCNZgD07fTpbmg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