<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  <!ENTITY RFC0793 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.0793.xml'>
  <!ENTITY RFC1738 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.1738.xml'>
  <!ENTITY RFC1950 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.1950.xml'>
  <!ENTITY RFC2119 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
  <!ENTITY RFC2285 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2285.xml'>
  <!ENTITY RFC2616 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml'>
  <!ENTITY RFC2617 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2617.xml'>
  <!ENTITY RFC2629 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2629.xml'>
  <!ENTITY RFC2818 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2818.xml'>
  <!ENTITY RFC4366 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4366.xml'>
  <!ENTITY RFC4559 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4559.xml'>
  <!ENTITY RFC5246 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml'>
  <!ENTITY RFC6454 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6454.xml'>
  <!ENTITY RFC6455 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6455.xml'>
]>

<?xml-stylesheet type="text/xsl" href="rfc2629.xml"?>

<?rfc toc="yes" symrefs="yes"?>

<rfc ipr="trust200902" docName="draft-montenegro-httpbis-http2-negotiation-00">
  <front>
	  <title abbrev="HTTP 2.0 Negotiation">HTTP 2.0 Negotiation</title>
    <author initials="W." surname="Tarreau" fullname="Willy Tarreau">
      <organization>Exceliance</organization>
      <address>
        <email>w@1wt.eu</email>
      </address>
    </author>
    <author initials="G." surname="Montenegro" fullname="Gabriel Montenegro">
      <organization>Microsoft</organization>
      <address>
        <email>Gabriel.Montenegro@microsoft.com</email>
      </address>
    </author>

    <date month="October" year="2012" />
    <area>Applications</area>
    <keyword>HTTP</keyword>
    <abstract>
	    <t>
This document describes an Upgrade-based protocol negotiation proposal for HTTP 2.0. 
	    </t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro" title="Introduction">
	<t>

		HTTP/2.0 will have the capability (but not the requirement) to use the 
		same ports as HTTP/1.X, typically, but not limited to, 80 (in the clear) 
		and 443 (when over TLS/SSL). Of course, it is possible for a client to 
		somehow acquire knowledge that a server implements HTTP/2.0 at a given
		port. In such a case, the client can immediately begin sending HTTP/2.0 
		binary frames to the server, and the server can immediately respond
		with the corresponding HTTP/2.0 frames. How that knowledge is acquired
		is not the subject of this note. It could be acquired by some out-of-band
		means such as using the DNS/DANE, or by some configuration prior to the
		HTTP/2.0 exchange. Or it could have been aquired earlier in-band in an
		earlier exchange. It could have been acquired at an earlier phase of this
		same exchange, for example, via TLS-NPN.
	</t>
	<t>
		Nevertheless, there may be some situations, in which the client can only
		assume that a server speaks HTTP/1.X. In such cases, a connection upgrade
		mechanism to opportunistically attempt to HTTP/2.0 is essential. 
		Otherwise, the exchange will remain at HTTP/1.X despite both client and
		server being able to speak HTTP/2.0. 
	</t>
	<t>
		This document specifies such a connection upgrade for HTTP/2.0.
		This handshake does not incur any extra delay in obtaining a response in 
		HTTP/2.0, as the protocol switch is immediate and effective within the
		first round trip. There is no delay either if there is no protocol
		switch, as the server is capable to respond via HTTP/1.1 also within the
		first initial round trip.
	</t>
	<t>
		This handshake uses the Upgrade header defined in 
		HTTP/1.1 <xref target='I-D.ietf-httpbis-p1-messaging'/>. 
		This Upgrade header is also in wide use by the WebSocket protocol for
		similar purposes <xref target="RFC6455"/>.
	</t>
	<t>
		The goal of this document is to propose additional text to the HTTP/2.0 specification.
		The starting point for HTTP/2.0, the SPDY <xref target='I-D.mbelshe-httpbis-spdy'/>
		protocol, has no language with respect to a connection upgrade procedure. Hence, the 
		text below could be incorporated as a new section or sections within the HTTP/2.0
		document.
	</t>
	</section>


<section title="Negotiation">
	<t>
		If a client has no knowledge about a server's support for HTTP/2.0, it
		starts with HTTP/1.1 and attempt an upgrade to HTTP/2.0 as follows:
	</t>
        <figure>
          <artwork>
     GET /default.htm HTTP/1.1
     Host: server.example.com
     Connection: Upgrade
     Upgrade: HTTP/2.0
          </artwork>
        </figure>
	<t>
   If the server does not support the new protocol, it will simply
   respond to the client using HTTP/1.1:
	</t>
        <figure>
          <artwork>
     HTTP/1.1 200 OK
     Content-length: 243
     Content-type: text/html
     ...
          </artwork>
        </figure>
	<t>
   If the server switches to the new protocol, it will signal so via a 101
   response. The server switches to HTTP/2.0 immediately after the empty line
   which terminates the 101 response <xref target='I-D.ietf-httpbis-p2-semantics'/>.
	</t>
        <figure>
          <artwork>
     HTTP/1.1 101 Switching Protocols
     Connection: Upgrade
     Upgrade: HTTP/2.0

     [ HTTP/2.0 frame ] 
          </artwork>
        </figure>
   
	<t>
	</t>

</section>

    <section title="Optimizing the Handshake">
      <t>

	      This handshake may be further optimized by the definition of HTTP headers
	      of the form "HTTP2-header_name". These "HTTP2" headers would be meant
	      to be interpreted exclusively by HTTP/2.0 servers and applied upon a
	      successful Upgrade to further optimize or proactively configure the 
	      subsequent HTTP/2.0 exchanges. These headers would be ignored by HTTP/1.1 servers.
	      The HTTP2 headers are for future revisions of this document.
      </t>
    </section>


    <section title="Acknowledgements">
      <t>
   This document incorporates material from <xref target='I-D.tarreau-httpbis-network-friendly'/> and <xref target='I-D.montenegro-httpbis-speed-mobility'/>. 
      </t>
      <t>
   This document was produced using the xml2rfc tool <xref target="RFC2629"/>.
      </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      &RFC2119;
      &RFC2616;
      <?rfc include='reference.I-D.ietf-httpbis-p1-messaging.xml'?>
      <?rfc include='reference.I-D.ietf-httpbis-p2-semantics.xml'?>
   </references>

   <references title="Informative References">
      &RFC2629;
      &RFC6455;
      <?rfc include='reference.I-D.mbelshe-httpbis-spdy.xml'?>
      <?rfc include='reference.I-D.montenegro-httpbis-speed-mobility.xml'?>
      <?rfc include='reference.I-D.tarreau-httpbis-network-friendly.xml'?>
   </references>
  </back>
</rfc>

