<?xml version="1.0" encoding="UTF-8"?>
<!--
    This XML document is the output of clean-for-DTD.xslt; a tool that strips
    extensions to RFC2629(bis) from documents for processing with xml2rfc.
-->
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc subcompact="no"?>
<?rfc rfcedstyle="yes"?>
<!DOCTYPE rfc
  PUBLIC "" "rfc2629.dtd">
<rfc ipr="trust200902" docName="draft-prudhommeaux-http-status-2nn-00" category="exp">

  

	<front>
  <title abbrev="HTTP Status Code 2NN">The Hypertext Transfer Protocol (HTTP) Status Code 2NN (Contents of Related)</title>
  <author initials="E. G." surname="Prud'hommeaux" fullname="Eric G. Prud'hommeaux">
    <organization abbrev="W3C">World Wide Web Consortium</organization>
    <address>
      <postal>
        <street>32 Vassar St.</street>
        <city>Cambridge</city><region>MA</region><code>02140</code>
        <country>USA</country>
      </postal>
      <email>eric@w3.org</email>	
      <uri>http://www.w3.org/People/Eric/ericP-foaf#ericP</uri>	
    </address>
  </author>

  <date month="June" year="2014" day="30"/>
  
  <keyword>HTTP</keyword>
  <keyword>redirect</keyword>
  <keyword>status code</keyword>

  <abstract>
    <t>
      This document specifies the additional HyperText Transfer Protocol (HTTP) Status Code 2NN (Contents of Related).
      It also specified a Prefer header value "contents-of-related" which clients can use to indicate that they can accept 2NN responses.
    </t>
  </abstract>
  

  <note title="Editorial Note (To be removed by RFC Editor before publication)">
    <t>
      Distribution of this document is unlimited.
      Comments should be sent to the W3C Technical Architecture Group mailing list at <eref target="mailto:www-tag@w3.org">www-tag@w3.org</eref> (<eref target="http://lists.w3.org/Archives/Public/www-tag/">public archive</eref>) and the Linked Data Platform mailing list at <eref target="mailto:public-ldp-comments@w3.org">public-ldp-comments@w3.org</eref> (<eref target="http://lists.w3.org/Archives/Public/public-ldp-comments/">public archive</eref>).
      The latter list may be joined by sending a message with subject "subscribe" to <eref target="mailto:public-ldp-comments-request@w3.org?subject=subscribe">public-ldp-comments-request@w3.org</eref>.
    </t>
    <t>
      XML versions, latest edits, and the issues list for this document
      are available from <eref target="http://www.w3.org/2014/02/2xx/draft-prudhommeaux-http-status-2NN"/>.
    </t>
    <t>
      Test cases related to redirection in general and the status code 2NN in particular can be found at <eref target="http://www.w3.org/2014/02/2xx/tests/"/> as a template.
    </t>
  </note>


  </front>

  <middle>






<section title="Introduction" anchor="introduction">
<t>
  HTTP 2xx status codes indicate that the client's request was successfully received, understood, and accepted.
  The 2NN status code response asserts that the Location response header identifies a resource related to the requested resource and that the response contents are a representation of that related resource.
  The 2NN response bypasses the extra round trip required for use cases conventionally solved with a 303 (See Other) response followed by the client performing a second GET on the target of that redirect.
  For example, 2NN streamlines these interactions which conventionally involve a server response with a Location header referencing the information needed by the client:

<list style="symbols">
    <t>An HTTP client performs a GET on a resource which is not an information resource.
       The server responds with a 303 and the client performs a second GET to retrieve an information resource related to the previous resource.
       (This idiom is frequently used to provide information about a resource while keeping that resource distinct from any page describing it.)
    </t>
    <t>An HTTP server responds to a POST request by creating a new resource and returning a 303 to redirect the client to that new resource.
       (This use case is described in <eref target="http://tools.ietf.org/html/rfc7231#section-6.4.4"/> .)
    </t>
    <t>The resource requested in a GET is prohibitively large to serve and the server instead responds with a redirect to the beginning of a series of resources paginating the initial resource.
       The paginating resources are interlinked with the 'prev' and 'next' link headers described in <eref target="https://tools.ietf.org/html/rfc5005#section-3"/> .
    </t>
    <t>A client has requested a Web application and the server responds with a multi-document response including e.g. HTML, images, CSS, Javascript and data for the web application.
    </t>
    <t>A client performs a POST which creates a new resource.
       The server has requested a Web application and the server responds with a multi-document response including e.g. HTML, images, CSS, Javascript and data for the web application.
    </t>
</list>
</t>
</section>  

<section title="Notational Conventions" anchor="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"/>.
</t>
</section>

<section title="2NN Contents of Related" anchor="status.2NN">

<t>
  The 2NN (Contents of Related) status code indicates that the server is providing a response for the request method (e.g. GET or POST) performed on the URI in the Location response header, henceforth called the "related resource".
  The "expected response" is the response that the client would have received had it performed a GET on the related resource.
  If the initial request method is HEAD, the expected response has no message body (see RFC 7231 4.3.2. HEAD <eref target="http://tools.ietf.org/html/rfc7231#section-4.3.2"/>).
</t>
<t>
  By returning a 2NN status code, the server asserts that:
  <list style="symbols">
    <t>The expected response has a status code of 200.</t>
    <t>The expected response has no Location header.</t>
  </list>
  The 2NN response is the same as the expected response with the following changes:
  <list style="symbols">
    <t>The status code is 2NN (instead of 200).</t>
    <t>A Location header identifies the related resource.</t>
  </list>
  As with Content-Location, such a claim can only be trusted if both identifiers share the same resource owner, which cannot be programmatically determined via HTTP (see RFC 7231 3.1.4.2. Content-Location <eref target="http://tools.ietf.org/html/rfc7231#section-3.1.4.2"/>).
</t>
<t>
  For caching purposes, see <xref target="caching"/> below.
  For purposes other than caching, the response is interpreted as if the response code were 200 and the effective request URI were the related resource.
  This defines the semantics for all current headers other than Location, as well as future headers defined as extensions to HTTP 1.1.
  A 2NN MUST NOT be used if the expected response includes a Location header.
</t>

<t>
  The following example demonstrates the use of 2NN responses to streamline the creation of new resources as described by <xref target="LDP"/>.
  The 2NN response is generic; it can be used for any use case where the server expects a client to dereference a Location header, for example, image tiling or packaging web applications.
</t>

<figure>
  <preamble>Client request:</preamble>
  <artwork type="message/http; msgtype=&#34;request&#34;"><![CDATA[
  GET /bigDoc HTTP/1.1
  Host: bigco.example
  Accept: text/turtle, q=1.0; application/rdf+xml, q=0.9
  Prefer: contents-of-related
  
  ]]></artwork></figure>
<figure>
  <preamble>Server 2NN response:</preamble>
  <artwork type="message/http; msgtype=&#34;response&#34;"><![CDATA[
  HTTP/1.1 2NN Contents of Related
  Content-Type: text/turtle
  Location: http://bigco-static.example/p1
  Link: <http://bigco-static.example/p2>; rel="next"
  Content-Location: http://bigco-static.example/p1.ttl
  Content-Length: 145

  <http://bigco.example/bigDoc> <http://purl.org/dc/terms/description>
            "Here is everything we know about this giant resource...".
  ]]></artwork></figure>

<t>
  Here, the related resource is http://bigco-static.example/p1 and the expected response is same as the Server 2NN response above, but with a 200 status code and no Location header.
  The above example communicates the same response as the following client-server exchanges where the client performs an operation on a resource, the server responds with a 303, and the client performs a GET (or HEAD) on the resource in the Location header of the servers 303 response:
</t>

<figure>
  <preamble>Client request:</preamble>
  <artwork type="message/http; msgtype=&#34;request&#34;"><![CDATA[
  GET /bigDoc HTTP/1.1
  Host: bigco.example
  Accept: text/turtle, q=1.0; application/rdf+xml, q=0.9
  
  ]]></artwork></figure>
<figure>
  <preamble>Server 303 response:</preamble>
  <artwork type="message/http; msgtype=&#34;response&#34;"><![CDATA[
  HTTP/1.1 303 See Other
  Content-Type: text/html
  Location: http://bigco-static.example/p1
  Content-Length: 125

  <html><head><title>303</title></head><body><p>
  You probably want <a href="http://bigco-static.example/p1">this</a>.
  </p></body></html>
  ]]></artwork></figure>

<figure>
  <preamble>Client request on the "related resource":</preamble>
  <artwork type="message/http; msgtype=&#34;request&#34;"><![CDATA[
  GET /p1 HTTP/1.1
  Host: bigco-static.example
  Accept: text/turtle, q=1.0; application/rdf+xml, q=0.9
  
  ]]></artwork></figure>
<figure>
  <preamble>Server response (defined as the "expected response"):</preamble>
  <artwork type="message/http; msgtype=&#34;response&#34;"><![CDATA[
  HTTP/1.1 200 OK
  Content-Type: text/turtle
  Link: <http://bigco-static.example/p2>; rel="next"
  Content-Location: http://bigco-static.example/p1.ttl
  Content-Length: 145

  <http://bigco.example/bigDoc> <http://purl.org/dc/terms/description>
            "Here is everything we know about this giant resource...".
  ]]></artwork></figure>

<t>
  Note that in the Server 2NN response above, the Content-Location provides a content-negotiated representation of the requested resource and the Link provides paging information.
  Both illustrate how a 2NN response header (other than Location) is interpreted as applying to the resource in the Location header, http://bigco-static.example/p1 in this example.
</t>
<section title="Caching Semantics" anchor="caching">
<t>
  The client and any intervening proxies SHOULD cache the 2NN response for the original effective request URI.
  If the client has out of band reason to trust the server's claim that a GET performed on the value of the Location header would have elicited the same response, they may additionally cache a 200 response for a GET on value of the Location header.
</t>

<t>
  In the example Server 2NN response above, the client and intervening proxies should cache the 2NN response to the GET of http://bigco.example/bigDoc with the associated Accept header.
  If the client has out of band knowledge that bigco.example has some authority to answer for http://bigco-static.example/p1 and http://bigco-static.example/p1.ttl , it may associate the expected response with those resources as well.
</t>
</section>

</section>

<section title="contents-of-related Prefer header value" anchor="contents-of-related">
<t>
  Per <eref target="http://tools.ietf.org/html/rfc5226#section-5"/>, this document registers the Prefer header (<xref target="RFC7240"/>) value "contents-of-related".
  A client MAY include a "Prefer: contents-of-related" header with a request to indicate that the client can accept 2NN responses.
</t>
</section>

<section title="Deployment Considerations" anchor="deployment.considerations">
<t>
  Section 4 of <eref target="http://tools.ietf.org/html/rfc7231#section-3.1.4.2"/> specified that all 2xx status codes indicate a successful request.
  However, some conventional clients may not be specifically programmed to accept content accompanying a 2xx response other than 200.
  Therefore, initial use of status code 2NN will be restricted to cases where the server has sufficient confidence in the clients understanding the new code.
  The contents-of-related Prefer header value (see <xref target="contents-of-related"/>) is one way for the client to advertise its support for 2NN responses.
</t>

</section>

<section title="Security Considerations" anchor="security.considerations">
<t>
  All security considerations that apply to either 303 or 200 response codes apply also to the 2NN status code (see Section 12 of <xref target="RFC7231"/>).
  Additionally, indiscriminately caching the 2NN response as the response to the related resource permits malicious or irresponsible servers to poison cache entries for 3rd parties.
  See RFC 7231 <eref target="http://tools.ietf.org/html/rfc7231#section-3.1.4.2"/> for similar constraints about associating cache entries with the value of a Content-Location header.
  In particular, the caching semantics including the warning "can only be trusted if both identifiers share the same resource owner, which cannot be programmatically determined via HTTP."
</t>
</section>  

<section title="IANA Considerations" anchor="iana.considerations">
<t>
   The registration below shall be added to the HTTP Status Code Registry
   (defined in Section 4.2 of <xref target="RFC7231"/>
   and located at <eref target="http://www.iana.org/assignments/http-status-codes"/>):
</t>
<texttable align="left" suppress-title="true" anchor="iana.status.code.registration.table">
   <ttcol>Value</ttcol>
   <ttcol>Description</ttcol>
   <ttcol>Reference</ttcol>
   <c>2NN</c>
   <c>Contents of Related</c>
   <c>
      <xref target="status.2NN"/> of this specification
   </c>
</texttable>
</section>

<section title="Acknowledgements" anchor="acknowledgements">
<t>
  The definition for the new status code 2NN re-uses text from the HTTP/1.1 definitions of 2xx status codes.
  The structure and much of the text of this draft was taken from <eref target="http://tools.ietf.org/html/draft-reschke-http-status-308-07"/>.
  John Arwe, Jenni Tennison, and the W3C TAG and Linked Data Working Group for excellent input and review.
</t>
</section>
  </middle>
  <back>
  
<references title="Normative References">

<reference anchor="RFC2119">
  <front>
    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
    <author initials="S." surname="Bradner" fullname="Scott Bradner">
      <organization>Harvard University</organization>
      <address><email>sob@harvard.edu</email></address>
    </author>
    <date month="March" year="1997"/>
  </front>
  <seriesInfo name="BCP" value="14"/>
  <seriesInfo name="RFC" value="2119"/>
</reference>

<!-- reference anchor="RFC3986">
 <front>
  <title abbrev="URI Generic Syntax">Uniform Resource Identifier (URI): Generic Syntax</title>
  <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
    <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
    <address>
       <email>timbl@w3.org</email>
       <uri>http://www.w3.org/People/Berners-Lee/</uri>
    </address>
  </author>
  <author initials="R." surname="Fielding" fullname="Roy T. Fielding">
    <organization abbrev="Day Software">Day Software</organization>
    <address>
      <email>fielding@gbiv.com</email>
      <uri>http://roy.gbiv.com/</uri>
    </address>
  </author>
  <author initials="L." surname="Masinter" fullname="Larry Masinter">
    <organization abbrev="Adobe Systems">Adobe Systems Incorporated</organization>
    <address>
      <email>LMM@acm.org</email>
      <uri>http://larry.masinter.net/</uri>
    </address>
  </author>
  <date month="January" year="2005"/>
 </front>
 <seriesInfo name="STD" value="66"/>
 <seriesInfo name="RFC" value="3986"/>
</reference -->


<!-- reference anchor="RFC7230">
  <front>
    <title abbrev="HTTP/1.1">HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title>
    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
      <address><email>fielding@gbiv.com</email></address>
    </author>
    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
      <organization abbrev="W3C">World Wide Web Consortium</organization>
      <address><email>ylafon@w3.org</email></address>
    </author>
    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
      <organization abbrev="greenbytes">greenbytes GmbH</organization>
      <address><email>julian.reschke@greenbytes.de</email></address>
    </author>
    <date month="March" year="2012"/>
  </front>
  <seriesInfo name="RFC" value="7230"/>
  
</reference -->

<reference anchor="RFC7231">
  <front>
    <title abbrev="HTTP/1.1">HTTP/1.1, part 2: Message Semantics</title>
    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
      <address><email>fielding@gbiv.com</email></address>
    </author>
    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
      <organization abbrev="W3C">World Wide Web Consortium</organization>
      <address><email>ylafon@w3.org</email></address>
    </author>
    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
      <organization abbrev="greenbytes">greenbytes GmbH</organization>
      <address><email>julian.reschke@greenbytes.de</email></address>
    </author>
    <date month="March" year="2012"/>
  </front>
  <seriesInfo name="RFC" value="7231"/>
  
</reference>

<!-- reference anchor="RFC7234">
  <front>
    <title abbrev="HTTP/1.1">HTTP/1.1, part 6: Caching</title>
    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
      <address><email>fielding@gbiv.com</email></address>
    </author>
    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
      <organization abbrev="W3C">World Wide Web Consortium</organization>
      <address><email>ylafon@w3.org</email></address>
    </author>
    <author initials="M." surname="Nottingham" fullname="Mark Nottingham" role="editor">
      <organization>Rackspace</organization>
      <address><email>mnot@mnot.net</email></address>
    </author>
    <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
      <organization abbrev="greenbytes">greenbytes GmbH</organization>
      <address><email>julian.reschke@greenbytes.de</email></address>
    </author>
    <date month="March" year="2012"/>
  </front>
  <seriesInfo name="RFC" value="7234"/>
  
</reference -->

<reference anchor="RFC7240">
  <front>
    <title abbrev="HTTP/1.1">HTTP/1.1, part 2: Message Semantics</title>
    <author initials="J." surname="Snell" fullname="J. Snell" role="editor">
    </author>
    <date month="June" year="2012"/>
  </front>
  <seriesInfo name="RFC" value="7240"/>
  
</reference>


</references>


<references title="Informative References">
<reference anchor="LDP" target="http://www.w3.org/turtle">
  <front>
    <title>Linked Data Platform 1.0</title>
    <author initials="S." surname="Speicher" fullname="Steve Speicher" role="editor">
      <organization>IBM Corporation</organization>
      <address><email>@@@></email></address>
    </author>
    <author initials="J." surname="Arwe" fullname="John Arwe" role="editor">
      <organization>IBM Corporation</organization>
      <address><email>@@@</email></address>
    </author>
    <author initials="A." surname="Malhotra" fullname="Ashok Malhotra" role="editor">
      <organization>Oracle Corporation</organization>
      <address><email>@@@</email></address>
    </author>
    <date year="2014" month="June" day="19"/>
  </front>
  <seriesInfo name="W3C Candidate Recommendation" value="CR-ldp-20140619"/>
  <annotation>
    Latest version available at
    <eref target="http://www.w3.org/TR/ldp/"/>.
  </annotation>
</reference>
</references>


<section title="Implementations (to be removed by RFC Editor before publication)" anchor="implementations">
<t>
  @@Expected from W3C Linked Data Platform Working Group
</t>
</section>

<section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log">
<section title="No previous version"><!-- Since draft-prudhommeaux-http-status-2NN-00 -->
<t>
  ...
</t>
</section>

</section>
  <section title="Resolved issues (to be removed by RFC Editor before publication)"><t>
          Issues that were either rejected or resolved in this version of this
          document.
        </t><section title="noPreviousVersion"><t>
        no previous versions
      </t><t>
    ...
  </t></section></section><section title="Open issues (to be removed by RFC Editor prior to publication)"><section title="edit"><t>
      Type: edit</t><t>eric@w3.org (2014-02-21): 
    Umbrella issue for editorial fixes/enhancements.
  </t></section></section></back>

</rfc>