* WGs marked with an * asterisk has had at least one new draft made available during the last 5 days

Changeset 2733


Ignore:
Timestamp:
2014-09-04 04:06:36 (3 months ago)
Author:
julian.reschke@gmx.de
Message:

update HTML versions of published RFCs

Location:
specs
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • specs/rfc7230.html

    r2732 r2733  
    4141        } 
    4242         
    43         insertErrata(rfcno, cont); 
    44    
    45         cont.style.display = "block"; 
    46       } else { 
    47         console.error(xhr.statusText); 
    48       } 
    49     } 
    50   }; 
    51   xhr.onerror = function (e) { 
    52     console.error(xhr.status + " " + xhr.statusText); 
    53   }; 
    54   xhr.send(null); 
    55 } 
    56  
    57 function insertErrata(rfcno, container) { 
    58   var xhr = new XMLHttpRequest(); 
    59   xhr.open("GET", "http://greenbytes.de/tech/webdav/rfcerrata.raw", true); 
    60   xhr.onload = function (e) { 
    61     if (xhr.readyState === 4) { 
    62       if (xhr.status === 200) { 
    63         var t = "\n" + xhr.responseText + "\n"; 
    64         if (t.indexOf(rfcno) >= 0) { 
    65           container.appendChild(newElement("br")); 
     43        c = getChildByName(info, "errata"); 
     44        if (c !== null) { 
     45          cont.appendChild(newElement("br")); 
    6646          var link = newElementWithText("a", "errata"); 
    6747          link.setAttribute("href", "http://www.rfc-editor.org/errata_search.php?rfc=" + rfcno); 
     
    6949          errata.appendChild(link); 
    7050          errata.appendChild(newText(".")); 
    71           container.appendChild(errata); 
     51          cont.appendChild(errata); 
    7252        } 
     53 
     54        cont.style.display = "block"; 
    7355      } else { 
    7456        console.error(xhr.statusText); 
     
    146128body { 
    147129  color: black; 
    148   font-family: cambria, helvetica, arial, sans-serif; 
     130  font-family: cambria, georgia, serif; 
    149131  font-size: 12pt; 
    150132  margin: 2em auto; 
     
    152134} 
    153135samp, tt, code, pre { 
    154   font-family: consolas, monospace; 
     136  font-family: consolas, monaco, monospace; 
    155137} 
    156138cite { 
     
    234216  background-color: white; 
    235217  padding: 0em; 
     218  page-break-inside: auto; 
    236219} 
    237220pre.text { 
     
    361344} 
    362345.title, .filename, h1, h2, h3, h4 { 
    363   font-family: candara, helvetica, arial, sans-serif; 
    364 } 
    365 samp, tt, code, pre { 
    366   font: consolas, monospace; 
     346  font-family: candara, calibri, segoe, optima, arial, sans-serif; 
    367347} 
    368348ul.ind, ul.ind ul { 
     
    478458  } 
    479459 
    480   ul.toc a:nth-child(2)::after { 
     460  ul.toc a:last-child::after { 
    481461    content: leader('.') target-counter(attr(href), page); 
    482462  } 
     
    529509    } 
    530510} 
    531 </style><link rel="Contents" href="#rfc.toc"><link rel="Author" href="#rfc.authors"><link rel="Copyright" href="#rfc.copyrightnotice"><link rel="Index" href="#rfc.index"><link rel="Chapter" title="1 Introduction" href="#rfc.section.1"><link rel="Chapter" title="2 Architecture" href="#rfc.section.2"><link rel="Chapter" title="3 Message Format" href="#rfc.section.3"><link rel="Chapter" title="4 Transfer Codings" href="#rfc.section.4"><link rel="Chapter" title="5 Message Routing" href="#rfc.section.5"><link rel="Chapter" title="6 Connection Management" href="#rfc.section.6"><link rel="Chapter" title="7 ABNF List Extension: #rule" href="#rfc.section.7"><link rel="Chapter" title="8 IANA Considerations" href="#rfc.section.8"><link rel="Chapter" title="9 Security Considerations" href="#rfc.section.9"><link rel="Chapter" title="10 Acknowledgments" href="#rfc.section.10"><link rel="Chapter" href="#rfc.section.11" title="11 References"><link rel="Appendix" title="A HTTP Version History" href="#rfc.section.A"><link rel="Appendix" title="B Collected ABNF" href="#rfc.section.B"><link href="rfc7231.html" rel="next"><link rel="Alternate" title="Authorative ASCII Version" href="http://www.ietf.org/rfc/rfc7230.txt"><link rel="Help" title="RFC-Editor's Status Page" href="http://www.rfc-editor.org/info/rfc7230"><link rel="Help" title="Additional Information on tools.ietf.org" href="http://tools.ietf.org/html/rfc7230"><meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1.662, 2014/07/19 09:19:17, XSLT vendor: SAXON 6.5.5 from Michael Kay http://saxon.sf.net/"><meta name="keywords" content="Hypertext Transfer Protocol, HTTP, HTTP message format"><link rel="schema.dct" href="http://purl.org/dc/terms/"><meta name="dct.creator" content="Fielding, R."><meta name="dct.creator" content="Reschke, J. F."><meta name="dct.identifier" content="urn:ietf:rfc:7230"><meta name="dct.issued" scheme="ISO8601" content="2014-06"><meta name="dct.replaces" content="urn:ietf:rfc:2145"><meta name="dct.replaces" content="urn:ietf:rfc:2616"><meta name="dct.abstract" content="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 &#34;http&#34; and &#34;https&#34; Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations."><meta name="dct.isPartOf" content="urn:issn:2070-1721"><meta name="description" content="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 &#34;http&#34; and &#34;https&#34; Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations."></head><body onload="getMeta(7230,&#34;rfc.meta&#34;);"><table class="header" id="rfc.headerblock"><tbody><tr><td class="left">Internet Engineering Task Force (IETF)</td><td class="right">R. Fielding, Editor</td></tr><tr><td class="left">Request for Comments: 7230</td><td class="right">Adobe</td></tr><tr><td class="left">Obsoletes: <a href="https://tools.ietf.org/html/rfc2145">2145</a>, <a href="https://tools.ietf.org/html/rfc2616">2616</a></td><td class="right">J. Reschke, Editor</td></tr><tr><td class="left">Updates: <a href="https://tools.ietf.org/html/rfc2817">2817</a>, <a href="https://tools.ietf.org/html/rfc2818">2818</a></td><td class="right">greenbytes</td></tr><tr><td class="left">Category: Standards Track</td><td class="right">June 2014</td></tr><tr><td class="left">ISSN: 2070-1721</td><td class="right"></td></tr></tbody></table><p class="title" id="rfc.title">Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</p><h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1><p>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 "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.</p><div id="rfc.meta" style="float: right; border: 1px solid black; margin: 2em; padding: 1em; display: none;"></div><div id="rfc.status"><h1><a href="#rfc.status">Status of This Memo</a></h1><p>This is an Internet Standards Track document.</p><p>This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.</p><p>Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at <a href="http://www.rfc-editor.org/info/rfc7230">http://www.rfc-editor.org/info/rfc7230</a>.</p></div><div id="rfc.copyrightnotice"><h1><a href="#rfc.copyrightnotice">Copyright Notice</a></h1><p>Copyright &copy; 2014 IETF Trust and the persons identified as the document authors. All rights reserved.</p><p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.</p><p>This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.</p></div><hr class="noprint"><div id="rfc.toc"><h1 class="np"><a href="#rfc.toc">Table of Contents</a></h1><ul class="toc"><li><a href="#rfc.section.1">1.</a>&nbsp;&nbsp;&nbsp;<a href="#introduction">Introduction</a><ul><li><a href="#rfc.section.1.1">1.1</a>&nbsp;&nbsp;&nbsp;<a href="#intro.requirements">Requirements Notation</a></li><li><a href="#rfc.section.1.2">1.2</a>&nbsp;&nbsp;&nbsp;<a href="#notation">Syntax Notation</a></li></ul></li><li><a href="#rfc.section.2">2.</a>&nbsp;&nbsp;&nbsp;<a href="#architecture">Architecture</a><ul><li><a href="#rfc.section.2.1">2.1</a>&nbsp;&nbsp;&nbsp;<a href="#operation">Client/Server Messaging</a></li><li><a href="#rfc.section.2.2">2.2</a>&nbsp;&nbsp;&nbsp;<a href="#implementation-diversity">Implementation Diversity</a></li><li><a href="#rfc.section.2.3">2.3</a>&nbsp;&nbsp;&nbsp;<a href="#intermediaries">Intermediaries</a></li><li><a href="#rfc.section.2.4">2.4</a>&nbsp;&nbsp;&nbsp;<a href="#caches">Caches</a></li><li><a href="#rfc.section.2.5">2.5</a>&nbsp;&nbsp;&nbsp;<a href="#conformance">Conformance and Error Handling</a></li><li><a href="#rfc.section.2.6">2.6</a>&nbsp;&nbsp;&nbsp;<a href="#http.version">Protocol Versioning</a></li><li><a href="#rfc.section.2.7">2.7</a>&nbsp;&nbsp;&nbsp;<a href="#uri">Uniform Resource Identifiers</a><ul><li><a href="#rfc.section.2.7.1">2.7.1</a>&nbsp;&nbsp;&nbsp;<a href="#http.uri">http URI Scheme</a></li><li><a href="#rfc.section.2.7.2">2.7.2</a>&nbsp;&nbsp;&nbsp;<a href="#https.uri">https URI Scheme</a></li><li><a href="#rfc.section.2.7.3">2.7.3</a>&nbsp;&nbsp;&nbsp;<a href="#uri.comparison">http and https URI Normalization and Comparison</a></li></ul></li></ul></li><li><a href="#rfc.section.3">3.</a>&nbsp;&nbsp;&nbsp;<a href="#http.message">Message Format</a><ul><li><a href="#rfc.section.3.1">3.1</a>&nbsp;&nbsp;&nbsp;<a href="#start.line">Start Line</a><ul><li><a href="#rfc.section.3.1.1">3.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#request.line">Request Line</a></li><li><a href="#rfc.section.3.1.2">3.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.line">Status Line</a></li></ul></li><li><a href="#rfc.section.3.2">3.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.fields">Header Fields</a><ul><li><a href="#rfc.section.3.2.1">3.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#field.extensibility">Field Extensibility</a></li><li><a href="#rfc.section.3.2.2">3.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#field.order">Field Order</a></li><li><a href="#rfc.section.3.2.3">3.2.3</a>&nbsp;&nbsp;&nbsp;<a href="#whitespace">Whitespace</a></li><li><a href="#rfc.section.3.2.4">3.2.4</a>&nbsp;&nbsp;&nbsp;<a href="#field.parsing">Field Parsing</a></li><li><a href="#rfc.section.3.2.5">3.2.5</a>&nbsp;&nbsp;&nbsp;<a href="#field.limits">Field Limits</a></li><li><a href="#rfc.section.3.2.6">3.2.6</a>&nbsp;&nbsp;&nbsp;<a href="#field.components">Field Value Components</a></li></ul></li><li><a href="#rfc.section.3.3">3.3</a>&nbsp;&nbsp;&nbsp;<a href="#message.body">Message Body</a><ul><li><a href="#rfc.section.3.3.1">3.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.transfer-encoding">Transfer-Encoding</a></li><li><a href="#rfc.section.3.3.2">3.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.content-length">Content-Length</a></li><li><a href="#rfc.section.3.3.3">3.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#message.body.length">Message Body Length</a></li></ul></li><li><a href="#rfc.section.3.4">3.4</a>&nbsp;&nbsp;&nbsp;<a href="#incomplete.messages">Handling Incomplete Messages</a></li><li><a href="#rfc.section.3.5">3.5</a>&nbsp;&nbsp;&nbsp;<a href="#message.robustness">Message Parsing Robustness</a></li></ul></li><li><a href="#rfc.section.4">4.</a>&nbsp;&nbsp;&nbsp;<a href="#transfer.codings">Transfer Codings</a><ul><li><a href="#rfc.section.4.1">4.1</a>&nbsp;&nbsp;&nbsp;<a href="#chunked.encoding">Chunked Transfer Coding</a><ul><li><a href="#rfc.section.4.1.1">4.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#chunked.extension">Chunk Extensions</a></li><li><a href="#rfc.section.4.1.2">4.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#chunked.trailer.part">Chunked Trailer Part</a></li><li><a href="#rfc.section.4.1.3">4.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#decoding.chunked">Decoding Chunked</a></li></ul></li><li><a href="#rfc.section.4.2">4.2</a>&nbsp;&nbsp;&nbsp;<a href="#compression.codings">Compression Codings</a><ul><li><a href="#rfc.section.4.2.1">4.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#compress.coding">Compress Coding</a></li><li><a href="#rfc.section.4.2.2">4.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#deflate.coding">Deflate Coding</a></li><li><a href="#rfc.section.4.2.3">4.2.3</a>&nbsp;&nbsp;&nbsp;<a href="#gzip.coding">Gzip Coding</a></li></ul></li><li><a href="#rfc.section.4.3">4.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.te">TE</a></li><li><a href="#rfc.section.4.4">4.4</a>&nbsp;&nbsp;&nbsp;<a href="#header.trailer">Trailer</a></li></ul></li><li><a href="#rfc.section.5">5.</a>&nbsp;&nbsp;&nbsp;<a href="#message.routing">Message Routing</a><ul><li><a href="#rfc.section.5.1">5.1</a>&nbsp;&nbsp;&nbsp;<a href="#target-resource">Identifying a Target Resource</a></li><li><a href="#rfc.section.5.2">5.2</a>&nbsp;&nbsp;&nbsp;<a href="#connecting.inbound">Connecting Inbound</a></li><li><a href="#rfc.section.5.3">5.3</a>&nbsp;&nbsp;&nbsp;<a href="#request-target">Request Target</a><ul><li><a href="#rfc.section.5.3.1">5.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#origin-form">origin-form</a></li><li><a href="#rfc.section.5.3.2">5.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#absolute-form">absolute-form</a></li><li><a href="#rfc.section.5.3.3">5.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#authority-form">authority-form</a></li><li><a href="#rfc.section.5.3.4">5.3.4</a>&nbsp;&nbsp;&nbsp;<a href="#asterisk-form">asterisk-form</a></li></ul></li><li><a href="#rfc.section.5.4">5.4</a>&nbsp;&nbsp;&nbsp;<a href="#header.host">Host</a></li><li><a href="#rfc.section.5.5">5.5</a>&nbsp;&nbsp;&nbsp;<a href="#effective.request.uri">Effective Request URI</a></li><li><a href="#rfc.section.5.6">5.6</a>&nbsp;&nbsp;&nbsp;<a href="#associating.response.to.request">Associating a Response to a Request</a></li><li><a href="#rfc.section.5.7">5.7</a>&nbsp;&nbsp;&nbsp;<a href="#message.forwarding">Message Forwarding</a><ul><li><a href="#rfc.section.5.7.1">5.7.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.via">Via</a></li><li><a href="#rfc.section.5.7.2">5.7.2</a>&nbsp;&nbsp;&nbsp;<a href="#message.transformations">Transformations</a></li></ul></li></ul></li><li><a href="#rfc.section.6">6.</a>&nbsp;&nbsp;&nbsp;<a href="#connection.management">Connection Management</a><ul><li><a href="#rfc.section.6.1">6.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.connection">Connection</a></li><li><a href="#rfc.section.6.2">6.2</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.establishment">Establishment</a></li><li><a href="#rfc.section.6.3">6.3</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.connections">Persistence</a><ul><li><a href="#rfc.section.6.3.1">6.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.retrying.requests">Retrying Requests</a></li><li><a href="#rfc.section.6.3.2">6.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#pipelining">Pipelining</a></li></ul></li><li><a href="#rfc.section.6.4">6.4</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.concurrency">Concurrency</a></li><li><a href="#rfc.section.6.5">6.5</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.failures">Failures and Timeouts</a></li><li><a href="#rfc.section.6.6">6.6</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.tear-down">Tear-down</a></li><li><a href="#rfc.section.6.7">6.7</a>&nbsp;&nbsp;&nbsp;<a href="#header.upgrade">Upgrade</a></li></ul></li><li><a href="#rfc.section.7">7.</a>&nbsp;&nbsp;&nbsp;<a href="#abnf.extension">ABNF List Extension: #rule</a></li><li><a href="#rfc.section.8">8.</a>&nbsp;&nbsp;&nbsp;<a href="#IANA.considerations">IANA Considerations</a><ul><li><a href="#rfc.section.8.1">8.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.field.registration">Header Field Registration</a></li><li><a href="#rfc.section.8.2">8.2</a>&nbsp;&nbsp;&nbsp;<a href="#uri.scheme.registration">URI Scheme Registration</a></li><li><a href="#rfc.section.8.3">8.3</a>&nbsp;&nbsp;&nbsp;<a href="#internet.media.type.http">Internet Media Type Registration</a><ul><li><a href="#rfc.section.8.3.1">8.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#internet.media.type.message.http">Internet Media Type message/http</a></li><li><a href="#rfc.section.8.3.2">8.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#internet.media.type.application.http">Internet Media Type application/http</a></li></ul></li><li><a href="#rfc.section.8.4">8.4</a>&nbsp;&nbsp;&nbsp;<a href="#transfer.coding.registry">Transfer Coding Registry</a><ul><li><a href="#rfc.section.8.4.1">8.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#transfer.coding.registry.procedure">Procedure</a></li><li><a href="#rfc.section.8.4.2">8.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#transfer.coding.registration">Registration</a></li></ul></li><li><a href="#rfc.section.8.5">8.5</a>&nbsp;&nbsp;&nbsp;<a href="#content.coding.registration">Content Coding Registration</a></li><li><a href="#rfc.section.8.6">8.6</a>&nbsp;&nbsp;&nbsp;<a href="#upgrade.token.registry">Upgrade Token Registry</a><ul><li><a href="#rfc.section.8.6.1">8.6.1</a>&nbsp;&nbsp;&nbsp;<a href="#upgrade.token.registry.procedure">Procedure</a></li><li><a href="#rfc.section.8.6.2">8.6.2</a>&nbsp;&nbsp;&nbsp;<a href="#upgrade.token.registration">Upgrade Token Registration</a></li></ul></li></ul></li><li><a href="#rfc.section.9">9.</a>&nbsp;&nbsp;&nbsp;<a href="#security.considerations">Security Considerations</a><ul><li><a href="#rfc.section.9.1">9.1</a>&nbsp;&nbsp;&nbsp;<a href="#establishing.authority">Establishing Authority</a></li><li><a href="#rfc.section.9.2">9.2</a>&nbsp;&nbsp;&nbsp;<a href="#risks.intermediaries">Risks of Intermediaries</a></li><li><a href="#rfc.section.9.3">9.3</a>&nbsp;&nbsp;&nbsp;<a href="#attack.protocol.element.length">Attacks via Protocol Element Length</a></li><li><a href="#rfc.section.9.4">9.4</a>&nbsp;&nbsp;&nbsp;<a href="#response.splitting">Response Splitting</a></li><li><a href="#rfc.section.9.5">9.5</a>&nbsp;&nbsp;&nbsp;<a href="#request.smuggling">Request Smuggling</a></li><li><a href="#rfc.section.9.6">9.6</a>&nbsp;&nbsp;&nbsp;<a href="#message.integrity">Message Integrity</a></li><li><a href="#rfc.section.9.7">9.7</a>&nbsp;&nbsp;&nbsp;<a href="#message.confidentiality">Message Confidentiality</a></li><li><a href="#rfc.section.9.8">9.8</a>&nbsp;&nbsp;&nbsp;<a href="#privacy.of.server.log.information">Privacy of Server Log Information</a></li></ul></li><li><a href="#rfc.section.10">10.</a>&nbsp;&nbsp;&nbsp;<a href="#acks">Acknowledgments</a></li><li><a href="#rfc.section.11">11.</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references">References</a><ul><li><a href="#rfc.section.11.1">11.1</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references.1">Normative References</a></li><li><a href="#rfc.section.11.2">11.2</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references.2">Informative References</a></li></ul></li><li><a href="#rfc.section.A">A.</a>&nbsp;&nbsp;&nbsp;<a href="#compatibility">HTTP Version History</a><ul><li><a href="#rfc.section.A.1">A.1</a>&nbsp;&nbsp;&nbsp;<a href="#changes.from.1.0">Changes from HTTP/1.0</a><ul><li><a href="#rfc.section.A.1.1">A.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#changes.to.simplify.multihomed.web.servers.and.conserve.ip.addresses">Multihomed Web Servers</a></li><li><a href="#rfc.section.A.1.2">A.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#compatibility.with.http.1.0.persistent.connections">Keep-Alive Connections</a></li><li><a href="#rfc.section.A.1.3">A.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#introduction.of.transfer-encoding">Introduction of Transfer-Encoding</a></li></ul></li><li><a href="#rfc.section.A.2">A.2</a>&nbsp;&nbsp;&nbsp;<a href="#changes.from.rfc.2616">Changes from RFC 2616</a></li></ul></li><li><a href="#rfc.section.B">B.</a>&nbsp;&nbsp;&nbsp;<a href="#collected.abnf">Collected ABNF</a></li><li><a href="#rfc.index">Index</a></li><li><a href="#rfc.authors">Authors' Addresses</a></li></ul></div><div id="introduction"><h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a>&nbsp;<a href="#introduction">Introduction</a></h1><p id="rfc.section.1.p.1">The Hypertext Transfer Protocol (HTTP) is a stateless application-level request/response protocol that uses extensible semantics and self-descriptive message payloads for flexible interaction with network-based hypertext information systems. This document is the first in a series of documents that collectively form the HTTP/1.1 specification: <a class="self" href="#rfc.section.1.p.1">&para;</a></p><ol><li>"Message Syntax and Routing" (this document)</li><li>"Semantics and Content" <a href="#RFC7231" id="rfc.xref.RFC7231.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a></li><li>"Conditional Requests" <a href="#RFC7232" id="rfc.xref.RFC7232.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a></li><li>"Range Requests" <a href="#RFC7233" id="rfc.xref.RFC7233.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[RFC7233]</cite></a></li><li>"Caching" <a href="#RFC7234" id="rfc.xref.RFC7234.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a></li><li>"Authentication" <a href="#RFC7235" id="rfc.xref.RFC7235.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Authentication">[RFC7235]</cite></a></li></ol><p id="rfc.section.1.p.2">This HTTP/1.1 specification obsoletes <cite title="Hypertext Transfer Protocol -- HTTP/1.1" id="rfc.xref.RFC2616.1">RFC 2616</cite> and <cite title="Use and Interpretation of HTTP Version Numbers" id="rfc.xref.RFC2145.1">RFC 2145</cite> (on HTTP versioning). This specification also updates the use of CONNECT to establish a tunnel, previously defined in <cite title="Upgrading to TLS Within HTTP/1.1" id="rfc.xref.RFC2817.1">RFC 2817</cite>, and defines the "https" URI scheme that was described informally in <cite title="HTTP Over TLS" id="rfc.xref.RFC2818.1">RFC 2818</cite>.<a class="self" href="#rfc.section.1.p.2">&para;</a></p><p id="rfc.section.1.p.3">HTTP is a generic interface protocol for information systems. It is designed to hide the details of how a service is implemented by presenting a uniform interface to clients that is independent of the types of resources provided. Likewise, servers do not need to be aware of each client's purpose: an HTTP request can be considered in isolation rather than being associated with a specific type of client or a predetermined sequence of application steps. The result is a protocol that can be used effectively in many different contexts and for which implementations can evolve independently over time.<a class="self" href="#rfc.section.1.p.3">&para;</a></p><p id="rfc.section.1.p.4">HTTP is also designed for use as an intermediation protocol for translating communication to and from non-HTTP information systems. HTTP proxies and gateways can provide access to alternative information services by translating their diverse protocols into a hypertext format that can be viewed and manipulated by clients in the same way as HTTP services.<a class="self" href="#rfc.section.1.p.4">&para;</a></p><p id="rfc.section.1.p.5">One consequence of this flexibility is that the protocol cannot be defined in terms of what occurs behind the interface. Instead, we are limited to defining the syntax of communication, the intent of received communication, and the expected behavior of recipients. If the communication is considered in isolation, then successful actions ought to be reflected in corresponding changes to the observable interface provided by servers. However, since multiple clients might act in parallel and perhaps at cross-purposes, we cannot require that such changes be observable beyond the scope of a single response.<a class="self" href="#rfc.section.1.p.5">&para;</a></p><p id="rfc.section.1.p.6">This document describes the architectural elements that are used or referred to in HTTP, defines the "http" and "https" URI schemes, describes overall network operation and connection management, and defines HTTP message framing and forwarding requirements. Our goal is to define all of the mechanisms necessary for HTTP message handling that are independent of message semantics, thereby defining the complete set of requirements for message parsers and message-forwarding intermediaries.<a class="self" href="#rfc.section.1.p.6">&para;</a></p><div id="intro.requirements"><h2 id="rfc.section.1.1"><a href="#rfc.section.1.1">1.1</a>&nbsp;<a href="#intro.requirements">Requirements Notation</a></h2><p id="rfc.section.1.1.p.1">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 <a href="#RFC2119" id="rfc.xref.RFC2119.1"><cite title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</cite></a>.<a class="self" href="#rfc.section.1.1.p.1">&para;</a></p><p id="rfc.section.1.1.p.2">Conformance criteria and considerations regarding error handling are defined in <a href="#conformance" title="Conformance and Error Handling">Section&nbsp;2.5</a>.<a class="self" href="#rfc.section.1.1.p.2">&para;</a></p></div><div id="notation"><h2 id="rfc.section.1.2"><a href="#rfc.section.1.2">1.2</a>&nbsp;<a href="#notation">Syntax Notation</a></h2><p id="rfc.section.1.2.p.1">This specification uses the Augmented Backus-Naur Form (ABNF) notation of <a href="#RFC5234" id="rfc.xref.RFC5234.1"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> with a list extension, defined in <a href="#abnf.extension" title="ABNF List Extension: #rule">Section&nbsp;7</a>, that allows for compact definition of comma-separated lists using a '#' operator (similar to how the '*' operator indicates repetition). <a href="#collected.abnf" title="Collected ABNF">Appendix&nbsp;B</a> shows the collected grammar with all list operators expanded to standard ABNF notation.<a class="self" href="#rfc.section.1.2.p.1">&para;</a></p><div id="core.rules"><p id="rfc.section.1.2.p.2">            The following core rules are included by reference, as defined in <a href="#RFC5234" id="rfc.xref.RFC5234.2"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a>, <a href="https://tools.ietf.org/html/rfc5234#appendix-B.1">Appendix B.1</a>: ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote), HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF (line feed), OCTET (any 8-bit sequence of data), SP (space), and VCHAR (any visible <a href="#USASCII" id="rfc.xref.USASCII.1"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a> character).<a class="self" href="#rfc.section.1.2.p.2">&para;</a></p></div><p id="rfc.section.1.2.p.3">As a convention, ABNF rule names prefixed with "obs-" denote "obsolete" grammar rules that appear for historical reasons.<a class="self" href="#rfc.section.1.2.p.3">&para;</a></p></div></div><div id="architecture"><h1 id="rfc.section.2"><a href="#rfc.section.2">2.</a>&nbsp;<a href="#architecture">Architecture</a></h1><p id="rfc.section.2.p.1">HTTP was created for the World Wide Web (WWW) architecture and has evolved over time to support the scalability needs of a worldwide hypertext system. Much of that architecture is reflected in the terminology and syntax productions used to define HTTP.<a class="self" href="#rfc.section.2.p.1">&para;</a></p><div id="operation"><h2 id="rfc.section.2.1"><a href="#rfc.section.2.1">2.1</a>&nbsp;<a href="#operation">Client/Server Messaging</a></h2><p id="rfc.section.2.1.p.1">HTTP is a stateless request/response protocol that operates by exchanging <dfn>messages</dfn> (<a href="#http.message" title="Message Format">Section&nbsp;3</a>) across a reliable transport- or session-layer "<dfn>connection</dfn>" (<a href="#connection.management" title="Connection Management">Section&nbsp;6</a>). An HTTP "<dfn>client</dfn>" is a program that establishes a connection to a server for the purpose of sending one or more HTTP requests. An HTTP "<dfn>server</dfn>" is a program that accepts connections in order to service HTTP requests by sending HTTP responses.<a class="self" href="#rfc.section.2.1.p.1">&para;</a></p><div id="rfc.iref.u.1"></div><div id="rfc.iref.o.1"></div><div id="rfc.iref.b.1"></div><div id="rfc.iref.s.1"></div><div id="rfc.iref.s.2"></div><div id="rfc.iref.r.1"></div><p id="rfc.section.2.1.p.2">The terms "client" and "server" refer only to the roles that these programs perform for a particular connection. The same program might act as a client on some connections and a server on others. The term "<dfn>user agent</dfn>" refers to any of the various client programs that initiate a request, including (but not limited to) browsers, spiders (web-based robots), command-line tools, custom applications, and mobile apps. The term "<dfn>origin server</dfn>" refers to the program that can originate authoritative responses for a given target resource. The terms "<dfn>sender</dfn>" and "<dfn>recipient</dfn>" refer to any implementation that sends or receives a given message, respectively.<a class="self" href="#rfc.section.2.1.p.2">&para;</a></p><p id="rfc.section.2.1.p.3">HTTP relies upon the Uniform Resource Identifier (URI) standard <a href="#RFC3986" id="rfc.xref.RFC3986.1"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a> to indicate the target resource (<a href="#target-resource" title="Identifying a Target Resource">Section&nbsp;5.1</a>) and relationships between resources. Messages are passed in a format similar to that used by Internet mail <a href="#RFC5322" id="rfc.xref.RFC5322.1"><cite title="Internet Message Format">[RFC5322]</cite></a> and the Multipurpose Internet Mail Extensions (MIME) <a href="#RFC2045" id="rfc.xref.RFC2045.1"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a> (see <a href="rfc7231.html#differences.between.http.and.mime" title="Differences between HTTP and MIME">Appendix A</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a> for the differences between HTTP and MIME messages).<a class="self" href="#rfc.section.2.1.p.3">&para;</a></p><p id="rfc.section.2.1.p.4">Most HTTP communication consists of a retrieval request (GET) for a representation of some resource identified by a URI. In the simplest case, this might be accomplished via a single bidirectional connection (===) between the user agent (UA) and the origin server (O).<a class="self" href="#rfc.section.2.1.p.4">&para;</a></p><div id="rfc.figure.u.1"><pre class="drawing">         request   &gt; 
     511</style><link rel="Contents" href="#rfc.toc"><link rel="Author" href="#rfc.authors"><link rel="Copyright" href="#rfc.copyrightnotice"><link rel="Index" href="#rfc.index"><link rel="Chapter" title="1 Introduction" href="#rfc.section.1"><link rel="Chapter" title="2 Architecture" href="#rfc.section.2"><link rel="Chapter" title="3 Message Format" href="#rfc.section.3"><link rel="Chapter" title="4 Transfer Codings" href="#rfc.section.4"><link rel="Chapter" title="5 Message Routing" href="#rfc.section.5"><link rel="Chapter" title="6 Connection Management" href="#rfc.section.6"><link rel="Chapter" title="7 ABNF List Extension: #rule" href="#rfc.section.7"><link rel="Chapter" title="8 IANA Considerations" href="#rfc.section.8"><link rel="Chapter" title="9 Security Considerations" href="#rfc.section.9"><link rel="Chapter" title="10 Acknowledgments" href="#rfc.section.10"><link rel="Chapter" href="#rfc.section.11" title="11 References"><link rel="Appendix" title="A HTTP Version History" href="#rfc.section.A"><link rel="Appendix" title="B Collected ABNF" href="#rfc.section.B"><link href="rfc7231.html" rel="next"><link rel="Alternate" title="Authorative ASCII Version" href="http://www.ietf.org/rfc/rfc7230.txt"><link rel="Help" title="RFC-Editor's Status Page" href="http://www.rfc-editor.org/info/rfc7230"><link rel="Help" title="Additional Information on tools.ietf.org" href="http://tools.ietf.org/html/rfc7230"><meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1.669, 2014/09/04 09:19:16, XSLT vendor: SAXON 6.5.5 from Michael Kay http://saxon.sf.net/"><meta name="keywords" content="Hypertext Transfer Protocol, HTTP, HTTP message format"><link rel="schema.dct" href="http://purl.org/dc/terms/"><meta name="dct.creator" content="Fielding, R."><meta name="dct.creator" content="Reschke, J. F."><meta name="dct.identifier" content="urn:ietf:rfc:7230"><meta name="dct.issued" scheme="ISO8601" content="2014-06"><meta name="dct.replaces" content="urn:ietf:rfc:2145"><meta name="dct.replaces" content="urn:ietf:rfc:2616"><meta name="dct.abstract" content="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 &#34;http&#34; and &#34;https&#34; Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations."><meta name="dct.isPartOf" content="urn:issn:2070-1721"><meta name="description" content="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 &#34;http&#34; and &#34;https&#34; Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations."></head><body onload="getMeta(7230,&#34;rfc.meta&#34;);"><table class="header" id="rfc.headerblock"><tbody><tr><td class="left">Internet Engineering Task Force (IETF)</td><td class="right">R. Fielding, Editor</td></tr><tr><td class="left">Request for Comments: 7230</td><td class="right">Adobe</td></tr><tr><td class="left">Obsoletes: <a href="https://tools.ietf.org/html/rfc2145">2145</a>, <a href="https://tools.ietf.org/html/rfc2616">2616</a></td><td class="right">J. Reschke, Editor</td></tr><tr><td class="left">Updates: <a href="https://tools.ietf.org/html/rfc2817">2817</a>, <a href="https://tools.ietf.org/html/rfc2818">2818</a></td><td class="right">greenbytes</td></tr><tr><td class="left">Category: Standards Track</td><td class="right">June 2014</td></tr><tr><td class="left">ISSN: 2070-1721</td><td class="right"></td></tr></tbody></table><p class="title" id="rfc.title">Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</p><h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1><p>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 "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.</p><div id="rfc.meta" style="float: right; border: 1px solid black; margin: 2em; padding: 1em; display: none;"></div><div id="rfc.status"><h1><a href="#rfc.status">Status of This Memo</a></h1><p>This is an Internet Standards Track document.</p><p>This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.</p><p>Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at <a href="http://www.rfc-editor.org/info/rfc7230">http://www.rfc-editor.org/info/rfc7230</a>.</p></div><div id="rfc.copyrightnotice"><h1><a href="#rfc.copyrightnotice">Copyright Notice</a></h1><p>Copyright &copy; 2014 IETF Trust and the persons identified as the document authors. All rights reserved.</p><p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.</p><p>This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.</p></div><hr class="noprint"><div id="rfc.toc"><h1 class="np"><a href="#rfc.toc">Table of Contents</a></h1><ul class="toc"><li><a href="#rfc.section.1">1.</a>&nbsp;&nbsp;&nbsp;<a href="#introduction">Introduction</a><ul><li><a href="#rfc.section.1.1">1.1</a>&nbsp;&nbsp;&nbsp;<a href="#intro.requirements">Requirements Notation</a></li><li><a href="#rfc.section.1.2">1.2</a>&nbsp;&nbsp;&nbsp;<a href="#notation">Syntax Notation</a></li></ul></li><li><a href="#rfc.section.2">2.</a>&nbsp;&nbsp;&nbsp;<a href="#architecture">Architecture</a><ul><li><a href="#rfc.section.2.1">2.1</a>&nbsp;&nbsp;&nbsp;<a href="#operation">Client/Server Messaging</a></li><li><a href="#rfc.section.2.2">2.2</a>&nbsp;&nbsp;&nbsp;<a href="#implementation-diversity">Implementation Diversity</a></li><li><a href="#rfc.section.2.3">2.3</a>&nbsp;&nbsp;&nbsp;<a href="#intermediaries">Intermediaries</a></li><li><a href="#rfc.section.2.4">2.4</a>&nbsp;&nbsp;&nbsp;<a href="#caches">Caches</a></li><li><a href="#rfc.section.2.5">2.5</a>&nbsp;&nbsp;&nbsp;<a href="#conformance">Conformance and Error Handling</a></li><li><a href="#rfc.section.2.6">2.6</a>&nbsp;&nbsp;&nbsp;<a href="#http.version">Protocol Versioning</a></li><li><a href="#rfc.section.2.7">2.7</a>&nbsp;&nbsp;&nbsp;<a href="#uri">Uniform Resource Identifiers</a><ul><li><a href="#rfc.section.2.7.1">2.7.1</a>&nbsp;&nbsp;&nbsp;<a href="#http.uri">http URI Scheme</a></li><li><a href="#rfc.section.2.7.2">2.7.2</a>&nbsp;&nbsp;&nbsp;<a href="#https.uri">https URI Scheme</a></li><li><a href="#rfc.section.2.7.3">2.7.3</a>&nbsp;&nbsp;&nbsp;<a href="#uri.comparison">http and https URI Normalization and Comparison</a></li></ul></li></ul></li><li><a href="#rfc.section.3">3.</a>&nbsp;&nbsp;&nbsp;<a href="#http.message">Message Format</a><ul><li><a href="#rfc.section.3.1">3.1</a>&nbsp;&nbsp;&nbsp;<a href="#start.line">Start Line</a><ul><li><a href="#rfc.section.3.1.1">3.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#request.line">Request Line</a></li><li><a href="#rfc.section.3.1.2">3.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.line">Status Line</a></li></ul></li><li><a href="#rfc.section.3.2">3.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.fields">Header Fields</a><ul><li><a href="#rfc.section.3.2.1">3.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#field.extensibility">Field Extensibility</a></li><li><a href="#rfc.section.3.2.2">3.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#field.order">Field Order</a></li><li><a href="#rfc.section.3.2.3">3.2.3</a>&nbsp;&nbsp;&nbsp;<a href="#whitespace">Whitespace</a></li><li><a href="#rfc.section.3.2.4">3.2.4</a>&nbsp;&nbsp;&nbsp;<a href="#field.parsing">Field Parsing</a></li><li><a href="#rfc.section.3.2.5">3.2.5</a>&nbsp;&nbsp;&nbsp;<a href="#field.limits">Field Limits</a></li><li><a href="#rfc.section.3.2.6">3.2.6</a>&nbsp;&nbsp;&nbsp;<a href="#field.components">Field Value Components</a></li></ul></li><li><a href="#rfc.section.3.3">3.3</a>&nbsp;&nbsp;&nbsp;<a href="#message.body">Message Body</a><ul><li><a href="#rfc.section.3.3.1">3.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.transfer-encoding">Transfer-Encoding</a></li><li><a href="#rfc.section.3.3.2">3.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.content-length">Content-Length</a></li><li><a href="#rfc.section.3.3.3">3.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#message.body.length">Message Body Length</a></li></ul></li><li><a href="#rfc.section.3.4">3.4</a>&nbsp;&nbsp;&nbsp;<a href="#incomplete.messages">Handling Incomplete Messages</a></li><li><a href="#rfc.section.3.5">3.5</a>&nbsp;&nbsp;&nbsp;<a href="#message.robustness">Message Parsing Robustness</a></li></ul></li><li><a href="#rfc.section.4">4.</a>&nbsp;&nbsp;&nbsp;<a href="#transfer.codings">Transfer Codings</a><ul><li><a href="#rfc.section.4.1">4.1</a>&nbsp;&nbsp;&nbsp;<a href="#chunked.encoding">Chunked Transfer Coding</a><ul><li><a href="#rfc.section.4.1.1">4.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#chunked.extension">Chunk Extensions</a></li><li><a href="#rfc.section.4.1.2">4.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#chunked.trailer.part">Chunked Trailer Part</a></li><li><a href="#rfc.section.4.1.3">4.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#decoding.chunked">Decoding Chunked</a></li></ul></li><li><a href="#rfc.section.4.2">4.2</a>&nbsp;&nbsp;&nbsp;<a href="#compression.codings">Compression Codings</a><ul><li><a href="#rfc.section.4.2.1">4.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#compress.coding">Compress Coding</a></li><li><a href="#rfc.section.4.2.2">4.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#deflate.coding">Deflate Coding</a></li><li><a href="#rfc.section.4.2.3">4.2.3</a>&nbsp;&nbsp;&nbsp;<a href="#gzip.coding">Gzip Coding</a></li></ul></li><li><a href="#rfc.section.4.3">4.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.te">TE</a></li><li><a href="#rfc.section.4.4">4.4</a>&nbsp;&nbsp;&nbsp;<a href="#header.trailer">Trailer</a></li></ul></li><li><a href="#rfc.section.5">5.</a>&nbsp;&nbsp;&nbsp;<a href="#message.routing">Message Routing</a><ul><li><a href="#rfc.section.5.1">5.1</a>&nbsp;&nbsp;&nbsp;<a href="#target-resource">Identifying a Target Resource</a></li><li><a href="#rfc.section.5.2">5.2</a>&nbsp;&nbsp;&nbsp;<a href="#connecting.inbound">Connecting Inbound</a></li><li><a href="#rfc.section.5.3">5.3</a>&nbsp;&nbsp;&nbsp;<a href="#request-target">Request Target</a><ul><li><a href="#rfc.section.5.3.1">5.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#origin-form">origin-form</a></li><li><a href="#rfc.section.5.3.2">5.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#absolute-form">absolute-form</a></li><li><a href="#rfc.section.5.3.3">5.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#authority-form">authority-form</a></li><li><a href="#rfc.section.5.3.4">5.3.4</a>&nbsp;&nbsp;&nbsp;<a href="#asterisk-form">asterisk-form</a></li></ul></li><li><a href="#rfc.section.5.4">5.4</a>&nbsp;&nbsp;&nbsp;<a href="#header.host">Host</a></li><li><a href="#rfc.section.5.5">5.5</a>&nbsp;&nbsp;&nbsp;<a href="#effective.request.uri">Effective Request URI</a></li><li><a href="#rfc.section.5.6">5.6</a>&nbsp;&nbsp;&nbsp;<a href="#associating.response.to.request">Associating a Response to a Request</a></li><li><a href="#rfc.section.5.7">5.7</a>&nbsp;&nbsp;&nbsp;<a href="#message.forwarding">Message Forwarding</a><ul><li><a href="#rfc.section.5.7.1">5.7.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.via">Via</a></li><li><a href="#rfc.section.5.7.2">5.7.2</a>&nbsp;&nbsp;&nbsp;<a href="#message.transformations">Transformations</a></li></ul></li></ul></li><li><a href="#rfc.section.6">6.</a>&nbsp;&nbsp;&nbsp;<a href="#connection.management">Connection Management</a><ul><li><a href="#rfc.section.6.1">6.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.connection">Connection</a></li><li><a href="#rfc.section.6.2">6.2</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.establishment">Establishment</a></li><li><a href="#rfc.section.6.3">6.3</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.connections">Persistence</a><ul><li><a href="#rfc.section.6.3.1">6.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.retrying.requests">Retrying Requests</a></li><li><a href="#rfc.section.6.3.2">6.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#pipelining">Pipelining</a></li></ul></li><li><a href="#rfc.section.6.4">6.4</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.concurrency">Concurrency</a></li><li><a href="#rfc.section.6.5">6.5</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.failures">Failures and Timeouts</a></li><li><a href="#rfc.section.6.6">6.6</a>&nbsp;&nbsp;&nbsp;<a href="#persistent.tear-down">Tear-down</a></li><li><a href="#rfc.section.6.7">6.7</a>&nbsp;&nbsp;&nbsp;<a href="#header.upgrade">Upgrade</a></li></ul></li><li><a href="#rfc.section.7">7.</a>&nbsp;&nbsp;&nbsp;<a href="#abnf.extension">ABNF List Extension: #rule</a></li><li><a href="#rfc.section.8">8.</a>&nbsp;&nbsp;&nbsp;<a href="#IANA.considerations">IANA Considerations</a><ul><li><a href="#rfc.section.8.1">8.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.field.registration">Header Field Registration</a></li><li><a href="#rfc.section.8.2">8.2</a>&nbsp;&nbsp;&nbsp;<a href="#uri.scheme.registration">URI Scheme Registration</a></li><li><a href="#rfc.section.8.3">8.3</a>&nbsp;&nbsp;&nbsp;<a href="#internet.media.type.http">Internet Media Type Registration</a><ul><li><a href="#rfc.section.8.3.1">8.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#internet.media.type.message.http">Internet Media Type message/http</a></li><li><a href="#rfc.section.8.3.2">8.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#internet.media.type.application.http">Internet Media Type application/http</a></li></ul></li><li><a href="#rfc.section.8.4">8.4</a>&nbsp;&nbsp;&nbsp;<a href="#transfer.coding.registry">Transfer Coding Registry</a><ul><li><a href="#rfc.section.8.4.1">8.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#transfer.coding.registry.procedure">Procedure</a></li><li><a href="#rfc.section.8.4.2">8.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#transfer.coding.registration">Registration</a></li></ul></li><li><a href="#rfc.section.8.5">8.5</a>&nbsp;&nbsp;&nbsp;<a href="#content.coding.registration">Content Coding Registration</a></li><li><a href="#rfc.section.8.6">8.6</a>&nbsp;&nbsp;&nbsp;<a href="#upgrade.token.registry">Upgrade Token Registry</a><ul><li><a href="#rfc.section.8.6.1">8.6.1</a>&nbsp;&nbsp;&nbsp;<a href="#upgrade.token.registry.procedure">Procedure</a></li><li><a href="#rfc.section.8.6.2">8.6.2</a>&nbsp;&nbsp;&nbsp;<a href="#upgrade.token.registration">Upgrade Token Registration</a></li></ul></li></ul></li><li><a href="#rfc.section.9">9.</a>&nbsp;&nbsp;&nbsp;<a href="#security.considerations">Security Considerations</a><ul><li><a href="#rfc.section.9.1">9.1</a>&nbsp;&nbsp;&nbsp;<a href="#establishing.authority">Establishing Authority</a></li><li><a href="#rfc.section.9.2">9.2</a>&nbsp;&nbsp;&nbsp;<a href="#risks.intermediaries">Risks of Intermediaries</a></li><li><a href="#rfc.section.9.3">9.3</a>&nbsp;&nbsp;&nbsp;<a href="#attack.protocol.element.length">Attacks via Protocol Element Length</a></li><li><a href="#rfc.section.9.4">9.4</a>&nbsp;&nbsp;&nbsp;<a href="#response.splitting">Response Splitting</a></li><li><a href="#rfc.section.9.5">9.5</a>&nbsp;&nbsp;&nbsp;<a href="#request.smuggling">Request Smuggling</a></li><li><a href="#rfc.section.9.6">9.6</a>&nbsp;&nbsp;&nbsp;<a href="#message.integrity">Message Integrity</a></li><li><a href="#rfc.section.9.7">9.7</a>&nbsp;&nbsp;&nbsp;<a href="#message.confidentiality">Message Confidentiality</a></li><li><a href="#rfc.section.9.8">9.8</a>&nbsp;&nbsp;&nbsp;<a href="#privacy.of.server.log.information">Privacy of Server Log Information</a></li></ul></li><li><a href="#rfc.section.10">10.</a>&nbsp;&nbsp;&nbsp;<a href="#acks">Acknowledgments</a></li><li><a href="#rfc.section.11">11.</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references">References</a><ul><li><a href="#rfc.section.11.1">11.1</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references.1">Normative References</a></li><li><a href="#rfc.section.11.2">11.2</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references.2">Informative References</a></li></ul></li><li><a href="#rfc.section.A">A.</a>&nbsp;&nbsp;&nbsp;<a href="#compatibility">HTTP Version History</a><ul><li><a href="#rfc.section.A.1">A.1</a>&nbsp;&nbsp;&nbsp;<a href="#changes.from.1.0">Changes from HTTP/1.0</a><ul><li><a href="#rfc.section.A.1.1">A.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#changes.to.simplify.multihomed.web.servers.and.conserve.ip.addresses">Multihomed Web Servers</a></li><li><a href="#rfc.section.A.1.2">A.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#compatibility.with.http.1.0.persistent.connections">Keep-Alive Connections</a></li><li><a href="#rfc.section.A.1.3">A.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#introduction.of.transfer-encoding">Introduction of Transfer-Encoding</a></li></ul></li><li><a href="#rfc.section.A.2">A.2</a>&nbsp;&nbsp;&nbsp;<a href="#changes.from.rfc.2616">Changes from RFC 2616</a></li></ul></li><li><a href="#rfc.section.B">B.</a>&nbsp;&nbsp;&nbsp;<a href="#collected.abnf">Collected ABNF</a></li><li><a href="#rfc.index">Index</a></li><li><a href="#rfc.authors">Authors' Addresses</a></li></ul></div><div id="introduction"><h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a>&nbsp;<a href="#introduction">Introduction</a></h1><div id="rfc.section.1.p.1"><p>The Hypertext Transfer Protocol (HTTP) is a stateless application-level request/response protocol that uses extensible semantics and self-descriptive message payloads for flexible interaction with network-based hypertext information systems. This document is the first in a series of documents that collectively form the HTTP/1.1 specification: <a class="self" href="#rfc.section.1.p.1">&para;</a></p><ol><li>"Message Syntax and Routing" (this document)</li><li>"Semantics and Content" <a href="#RFC7231" id="rfc.xref.RFC7231.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a></li><li>"Conditional Requests" <a href="#RFC7232" id="rfc.xref.RFC7232.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a></li><li>"Range Requests" <a href="#RFC7233" id="rfc.xref.RFC7233.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[RFC7233]</cite></a></li><li>"Caching" <a href="#RFC7234" id="rfc.xref.RFC7234.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a></li><li>"Authentication" <a href="#RFC7235" id="rfc.xref.RFC7235.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Authentication">[RFC7235]</cite></a></li></ol></div><div id="rfc.section.1.p.2"><p>This HTTP/1.1 specification obsoletes <cite title="Hypertext Transfer Protocol -- HTTP/1.1" id="rfc.xref.RFC2616.1">RFC 2616</cite> and <cite title="Use and Interpretation of HTTP Version Numbers" id="rfc.xref.RFC2145.1">RFC 2145</cite> (on HTTP versioning). This specification also updates the use of CONNECT to establish a tunnel, previously defined in <cite title="Upgrading to TLS Within HTTP/1.1" id="rfc.xref.RFC2817.1">RFC 2817</cite>, and defines the "https" URI scheme that was described informally in <cite title="HTTP Over TLS" id="rfc.xref.RFC2818.1">RFC 2818</cite>.<a class="self" href="#rfc.section.1.p.2">&para;</a></p></div><div id="rfc.section.1.p.3"><p>HTTP is a generic interface protocol for information systems. It is designed to hide the details of how a service is implemented by presenting a uniform interface to clients that is independent of the types of resources provided. Likewise, servers do not need to be aware of each client's purpose: an HTTP request can be considered in isolation rather than being associated with a specific type of client or a predetermined sequence of application steps. The result is a protocol that can be used effectively in many different contexts and for which implementations can evolve independently over time.<a class="self" href="#rfc.section.1.p.3">&para;</a></p></div><div id="rfc.section.1.p.4"><p>HTTP is also designed for use as an intermediation protocol for translating communication to and from non-HTTP information systems. HTTP proxies and gateways can provide access to alternative information services by translating their diverse protocols into a hypertext format that can be viewed and manipulated by clients in the same way as HTTP services.<a class="self" href="#rfc.section.1.p.4">&para;</a></p></div><div id="rfc.section.1.p.5"><p>One consequence of this flexibility is that the protocol cannot be defined in terms of what occurs behind the interface. Instead, we are limited to defining the syntax of communication, the intent of received communication, and the expected behavior of recipients. If the communication is considered in isolation, then successful actions ought to be reflected in corresponding changes to the observable interface provided by servers. However, since multiple clients might act in parallel and perhaps at cross-purposes, we cannot require that such changes be observable beyond the scope of a single response.<a class="self" href="#rfc.section.1.p.5">&para;</a></p></div><div id="rfc.section.1.p.6"><p>This document describes the architectural elements that are used or referred to in HTTP, defines the "http" and "https" URI schemes, describes overall network operation and connection management, and defines HTTP message framing and forwarding requirements. Our goal is to define all of the mechanisms necessary for HTTP message handling that are independent of message semantics, thereby defining the complete set of requirements for message parsers and message-forwarding intermediaries.<a class="self" href="#rfc.section.1.p.6">&para;</a></p></div><div id="intro.requirements"><h2 id="rfc.section.1.1"><a href="#rfc.section.1.1">1.1</a>&nbsp;<a href="#intro.requirements">Requirements Notation</a></h2><div id="rfc.section.1.1.p.1"><p>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 <a href="#RFC2119" id="rfc.xref.RFC2119.1"><cite title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</cite></a>.<a class="self" href="#rfc.section.1.1.p.1">&para;</a></p></div><div id="rfc.section.1.1.p.2"><p>Conformance criteria and considerations regarding error handling are defined in <a href="#conformance" title="Conformance and Error Handling">Section&nbsp;2.5</a>.<a class="self" href="#rfc.section.1.1.p.2">&para;</a></p></div></div><div id="notation"><h2 id="rfc.section.1.2"><a href="#rfc.section.1.2">1.2</a>&nbsp;<a href="#notation">Syntax Notation</a></h2><div id="rfc.section.1.2.p.1"><p>This specification uses the Augmented Backus-Naur Form (ABNF) notation of <a href="#RFC5234" id="rfc.xref.RFC5234.1"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> with a list extension, defined in <a href="#abnf.extension" title="ABNF List Extension: #rule">Section&nbsp;7</a>, that allows for compact definition of comma-separated lists using a '#' operator (similar to how the '*' operator indicates repetition). <a href="#collected.abnf" title="Collected ABNF">Appendix&nbsp;B</a> shows the collected grammar with all list operators expanded to standard ABNF notation.<a class="self" href="#rfc.section.1.2.p.1">&para;</a></p></div><div id="core.rules"><div id="rfc.section.1.2.p.2"><p>            The following core rules are included by reference, as defined in <a href="#RFC5234" id="rfc.xref.RFC5234.2"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a>, <a href="https://tools.ietf.org/html/rfc5234#appendix-B.1">Appendix B.1</a>: ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote), HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF (line feed), OCTET (any 8-bit sequence of data), SP (space), and VCHAR (any visible <a href="#USASCII" id="rfc.xref.USASCII.1"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a> character).<a class="self" href="#rfc.section.1.2.p.2">&para;</a></p></div></div><div id="rfc.section.1.2.p.3"><p>As a convention, ABNF rule names prefixed with "obs-" denote "obsolete" grammar rules that appear for historical reasons.<a class="self" href="#rfc.section.1.2.p.3">&para;</a></p></div></div></div><div id="architecture"><h1 id="rfc.section.2"><a href="#rfc.section.2">2.</a>&nbsp;<a href="#architecture">Architecture</a></h1><div id="rfc.section.2.p.1"><p>HTTP was created for the World Wide Web (WWW) architecture and has evolved over time to support the scalability needs of a worldwide hypertext system. Much of that architecture is reflected in the terminology and syntax productions used to define HTTP.<a class="self" href="#rfc.section.2.p.1">&para;</a></p></div><div id="operation"><h2 id="rfc.section.2.1"><a href="#rfc.section.2.1">2.1</a>&nbsp;<a href="#operation">Client/Server Messaging</a></h2><div id="rfc.section.2.1.p.1"><p>HTTP is a stateless request/response protocol that operates by exchanging <dfn>messages</dfn> (<a href="#http.message" title="Message Format">Section&nbsp;3</a>) across a reliable transport- or session-layer "<dfn>connection</dfn>" (<a href="#connection.management" title="Connection Management">Section&nbsp;6</a>). An HTTP "<dfn>client</dfn>" is a program that establishes a connection to a server for the purpose of sending one or more HTTP requests. An HTTP "<dfn>server</dfn>" is a program that accepts connections in order to service HTTP requests by sending HTTP responses.<a class="self" href="#rfc.section.2.1.p.1">&para;</a></p></div><div id="rfc.iref.u.1"></div><div id="rfc.iref.o.1"></div><div id="rfc.iref.b.1"></div><div id="rfc.iref.s.1"></div><div id="rfc.iref.s.2"></div><div id="rfc.iref.r.1"></div><div id="rfc.section.2.1.p.2"><p>The terms "client" and "server" refer only to the roles that these programs perform for a particular connection. The same program might act as a client on some connections and a server on others. The term "<dfn>user agent</dfn>" refers to any of the various client programs that initiate a request, including (but not limited to) browsers, spiders (web-based robots), command-line tools, custom applications, and mobile apps. The term "<dfn>origin server</dfn>" refers to the program that can originate authoritative responses for a given target resource. The terms "<dfn>sender</dfn>" and "<dfn>recipient</dfn>" refer to any implementation that sends or receives a given message, respectively.<a class="self" href="#rfc.section.2.1.p.2">&para;</a></p></div><div id="rfc.section.2.1.p.3"><p>HTTP relies upon the Uniform Resource Identifier (URI) standard <a href="#RFC3986" id="rfc.xref.RFC3986.1"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a> to indicate the target resource (<a href="#target-resource" title="Identifying a Target Resource">Section&nbsp;5.1</a>) and relationships between resources. Messages are passed in a format similar to that used by Internet mail <a href="#RFC5322" id="rfc.xref.RFC5322.1"><cite title="Internet Message Format">[RFC5322]</cite></a> and the Multipurpose Internet Mail Extensions (MIME) <a href="#RFC2045" id="rfc.xref.RFC2045.1"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a> (see <a href="rfc7231.html#differences.between.http.and.mime" title="Differences between HTTP and MIME">Appendix A</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a> for the differences between HTTP and MIME messages).<a class="self" href="#rfc.section.2.1.p.3">&para;</a></p></div><div id="rfc.section.2.1.p.4"><p>Most HTTP communication consists of a retrieval request (GET) for a representation of some resource identified by a URI. In the simplest case, this might be accomplished via a single bidirectional connection (===) between the user agent (UA) and the origin server (O).<a class="self" href="#rfc.section.2.1.p.4">&para;</a></p></div><div id="rfc.figure.u.1"><pre class="drawing">         request   &gt; 
    532512    <b>UA</b> ======================================= <b>O</b> 
    533513                                &lt;   response 
    534 </pre></div><div id="rfc.iref.m.1"></div><div id="rfc.iref.r.2"></div><div id="rfc.iref.r.3"></div><p id="rfc.section.2.1.p.5">A client sends an HTTP request to a server in the form of a <dfn>request</dfn> message, beginning with a request-line that includes a method, URI, and protocol version (<a href="#request.line" title="Request Line">Section&nbsp;3.1.1</a>), followed by header fields containing request modifiers, client information, and representation metadata (<a href="#header.fields" title="Header Fields">Section&nbsp;3.2</a>), an empty line to indicate the end of the header section, and finally a message body containing the payload body (if any, <a href="#message.body" title="Message Body">Section&nbsp;3.3</a>).<a class="self" href="#rfc.section.2.1.p.5">&para;</a></p><p id="rfc.section.2.1.p.6">A server responds to a client's request by sending one or more HTTP <dfn>response</dfn> messages, each beginning with a status line that includes the protocol version, a success or error code, and textual reason phrase (<a href="#status.line" title="Status Line">Section&nbsp;3.1.2</a>), possibly followed by header fields containing server information, resource metadata, and representation metadata (<a href="#header.fields" title="Header Fields">Section&nbsp;3.2</a>), an empty line to indicate the end of the header section, and finally a message body containing the payload body (if any, <a href="#message.body" title="Message Body">Section&nbsp;3.3</a>).<a class="self" href="#rfc.section.2.1.p.6">&para;</a></p><p id="rfc.section.2.1.p.7">A connection might be used for multiple request/response exchanges, as defined in <a href="#persistent.connections" title="Persistence">Section&nbsp;6.3</a>.<a class="self" href="#rfc.section.2.1.p.7">&para;</a></p><p id="rfc.section.2.1.p.8">The following example illustrates a typical message exchange for a GET request (<a href="rfc7231.html#GET" title="GET">Section 4.3.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) on the URI "http://www.example.com/hello.txt":<a class="self" href="#rfc.section.2.1.p.8">&para;</a></p><div id="rfc.figure.u.2"><p>Client request:</p><pre class="text2">GET /hello.txt HTTP/1.1 
     514</pre></div><div id="rfc.iref.m.1"></div><div id="rfc.iref.r.2"></div><div id="rfc.iref.r.3"></div><div id="rfc.section.2.1.p.5"><p>A client sends an HTTP request to a server in the form of a <dfn>request</dfn> message, beginning with a request-line that includes a method, URI, and protocol version (<a href="#request.line" title="Request Line">Section&nbsp;3.1.1</a>), followed by header fields containing request modifiers, client information, and representation metadata (<a href="#header.fields" title="Header Fields">Section&nbsp;3.2</a>), an empty line to indicate the end of the header section, and finally a message body containing the payload body (if any, <a href="#message.body" title="Message Body">Section&nbsp;3.3</a>).<a class="self" href="#rfc.section.2.1.p.5">&para;</a></p></div><div id="rfc.section.2.1.p.6"><p>A server responds to a client's request by sending one or more HTTP <dfn>response</dfn> messages, each beginning with a status line that includes the protocol version, a success or error code, and textual reason phrase (<a href="#status.line" title="Status Line">Section&nbsp;3.1.2</a>), possibly followed by header fields containing server information, resource metadata, and representation metadata (<a href="#header.fields" title="Header Fields">Section&nbsp;3.2</a>), an empty line to indicate the end of the header section, and finally a message body containing the payload body (if any, <a href="#message.body" title="Message Body">Section&nbsp;3.3</a>).<a class="self" href="#rfc.section.2.1.p.6">&para;</a></p></div><div id="rfc.section.2.1.p.7"><p>A connection might be used for multiple request/response exchanges, as defined in <a href="#persistent.connections" title="Persistence">Section&nbsp;6.3</a>.<a class="self" href="#rfc.section.2.1.p.7">&para;</a></p></div><div id="rfc.section.2.1.p.8"><p>The following example illustrates a typical message exchange for a GET request (<a href="rfc7231.html#GET" title="GET">Section 4.3.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) on the URI "http://www.example.com/hello.txt":<a class="self" href="#rfc.section.2.1.p.8">&para;</a></p></div><div id="rfc.figure.u.2"><p>Client request:</p><pre class="text2">GET /hello.txt HTTP/1.1 
    535515User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 
    536516Host: www.example.com 
     
    548528 
    549529<span id="exbody">Hello World! My payload includes a trailing CRLF. 
    550 </span></pre></div></div><div id="implementation-diversity"><h2 id="rfc.section.2.2"><a href="#rfc.section.2.2">2.2</a>&nbsp;<a href="#implementation-diversity">Implementation Diversity</a></h2><p id="rfc.section.2.2.p.1">When considering the design of HTTP, it is easy to fall into a trap of thinking that all user agents are general-purpose browsers and all origin servers are large public websites. That is not the case in practice. Common HTTP user agents include household appliances, stereos, scales, firmware update scripts, command-line programs, mobile apps, and communication devices in a multitude of shapes and sizes. Likewise, common HTTP origin servers include home automation units, configurable networking components, office machines, autonomous robots, news feeds, traffic cameras, ad selectors, and video-delivery platforms.<a class="self" href="#rfc.section.2.2.p.1">&para;</a></p><p id="rfc.section.2.2.p.2">The term "user agent" does not imply that there is a human user directly interacting with the software agent at the time of a request. In many cases, a user agent is installed or configured to run in the background and save its results for later inspection (or save only a subset of those results that might be interesting or erroneous). Spiders, for example, are typically given a start URI and configured to follow certain behavior while crawling the Web as a hypertext graph.<a class="self" href="#rfc.section.2.2.p.2">&para;</a></p><p id="rfc.section.2.2.p.3">The implementation diversity of HTTP means that not all user agents can make interactive suggestions to their user or provide adequate warning for security or privacy concerns. In the few cases where this specification requires reporting of errors to the user, it is acceptable for such reporting to only be observable in an error console or log file. Likewise, requirements that an automated action be confirmed by the user before proceeding might be met via advance configuration choices, run-time options, or simple avoidance of the unsafe action; confirmation does not imply any specific user interface or interruption of normal processing if the user has already made that choice.<a class="self" href="#rfc.section.2.2.p.3">&para;</a></p></div><div id="intermediaries"><h2 id="rfc.section.2.3"><a href="#rfc.section.2.3">2.3</a>&nbsp;<a href="#intermediaries">Intermediaries</a></h2><p id="rfc.section.2.3.p.1">HTTP enables the use of intermediaries to satisfy requests through a chain of connections. There are three common forms of HTTP <dfn>intermediary</dfn>: proxy, gateway, and tunnel. In some cases, a single intermediary might act as an origin server, proxy, gateway, or tunnel, switching behavior based on the nature of each request.<a class="self" href="#rfc.section.2.3.p.1">&para;</a></p><div id="rfc.figure.u.4"><pre class="drawing">         &gt;             &gt;             &gt;             &gt; 
     530</span></pre></div></div><div id="implementation-diversity"><h2 id="rfc.section.2.2"><a href="#rfc.section.2.2">2.2</a>&nbsp;<a href="#implementation-diversity">Implementation Diversity</a></h2><div id="rfc.section.2.2.p.1"><p>When considering the design of HTTP, it is easy to fall into a trap of thinking that all user agents are general-purpose browsers and all origin servers are large public websites. That is not the case in practice. Common HTTP user agents include household appliances, stereos, scales, firmware update scripts, command-line programs, mobile apps, and communication devices in a multitude of shapes and sizes. Likewise, common HTTP origin servers include home automation units, configurable networking components, office machines, autonomous robots, news feeds, traffic cameras, ad selectors, and video-delivery platforms.<a class="self" href="#rfc.section.2.2.p.1">&para;</a></p></div><div id="rfc.section.2.2.p.2"><p>The term "user agent" does not imply that there is a human user directly interacting with the software agent at the time of a request. In many cases, a user agent is installed or configured to run in the background and save its results for later inspection (or save only a subset of those results that might be interesting or erroneous). Spiders, for example, are typically given a start URI and configured to follow certain behavior while crawling the Web as a hypertext graph.<a class="self" href="#rfc.section.2.2.p.2">&para;</a></p></div><div id="rfc.section.2.2.p.3"><p>The implementation diversity of HTTP means that not all user agents can make interactive suggestions to their user or provide adequate warning for security or privacy concerns. In the few cases where this specification requires reporting of errors to the user, it is acceptable for such reporting to only be observable in an error console or log file. Likewise, requirements that an automated action be confirmed by the user before proceeding might be met via advance configuration choices, run-time options, or simple avoidance of the unsafe action; confirmation does not imply any specific user interface or interruption of normal processing if the user has already made that choice.<a class="self" href="#rfc.section.2.2.p.3">&para;</a></p></div></div><div id="intermediaries"><h2 id="rfc.section.2.3"><a href="#rfc.section.2.3">2.3</a>&nbsp;<a href="#intermediaries">Intermediaries</a></h2><div id="rfc.section.2.3.p.1"><p>HTTP enables the use of intermediaries to satisfy requests through a chain of connections. There are three common forms of HTTP <dfn>intermediary</dfn>: proxy, gateway, and tunnel. In some cases, a single intermediary might act as an origin server, proxy, gateway, or tunnel, switching behavior based on the nature of each request.<a class="self" href="#rfc.section.2.3.p.1">&para;</a></p></div><div id="rfc.figure.u.4"><pre class="drawing">         &gt;             &gt;             &gt;             &gt; 
    551531    <b>UA</b> =========== <b>A</b> =========== <b>B</b> =========== <b>C</b> =========== <b>O</b> 
    552532               &lt;             &lt;             &lt;             &lt; 
    553 </pre></div><p id="rfc.section.2.3.p.2">The figure above shows three intermediaries (A, B, and C) between the user agent and origin server. A request or response message that travels the whole chain will pass through four separate connections. Some HTTP communication options might apply only to the connection with the nearest, non-tunnel neighbor, only to the endpoints of the chain, or to all connections along the chain. Although the diagram is linear, each participant might be engaged in multiple, simultaneous communications. For example, B might be receiving requests from many clients other than A, and/or forwarding requests to servers other than C, at the same time that it is handling A's request. Likewise, later requests might be sent through a different path of connections, often based on dynamic configuration for load balancing.<a class="self" href="#rfc.section.2.3.p.2">&para;</a></p><p id="rfc.section.2.3.p.3"><span id="rfc.iref.u.2"></span><span id="rfc.iref.d.1"></span> <span id="rfc.iref.i.1"></span><span id="rfc.iref.o.2"></span> The terms "<dfn>upstream</dfn>" and "<dfn>downstream</dfn>" are used to describe directional requirements in relation to the message flow: all messages flow from upstream to downstream. The terms "inbound" and "outbound" are used to describe directional requirements in relation to the request route: "<dfn>inbound</dfn>" means toward the origin server and "<dfn>outbound</dfn>" means toward the user agent.<a class="self" href="#rfc.section.2.3.p.3">&para;</a></p><p id="rfc.section.2.3.p.4"><span id="rfc.iref.p.1"></span> A "<dfn>proxy</dfn>" is a message-forwarding agent that is selected by the client, usually via local configuration rules, to receive requests for some type(s) of absolute URI and attempt to satisfy those requests via translation through the HTTP interface. Some translations are minimal, such as for proxy requests for "http" URIs, whereas other requests might require translation to and from entirely different application-level protocols. Proxies are often used to group an organization's HTTP requests through a common intermediary for the sake of security, annotation services, or shared caching. Some proxies are designed to apply transformations to selected messages or payloads while they are being forwarded, as described in <a href="#message.transformations" title="Transformations">Section&nbsp;5.7.2</a>.<a class="self" href="#rfc.section.2.3.p.4">&para;</a></p><p id="rfc.section.2.3.p.5"><span id="rfc.iref.g.1"></span><span id="rfc.iref.r.4"></span> <span id="rfc.iref.a.1"></span> A "<dfn>gateway</dfn>" (a.k.a. "<dfn>reverse proxy</dfn>") is an intermediary that acts as an origin server for the outbound connection but translates received requests and forwards them inbound to another server or servers. Gateways are often used to encapsulate legacy or untrusted information services, to improve server performance through "<dfn>accelerator</dfn>" caching, and to enable partitioning or load balancing of HTTP services across multiple machines.<a class="self" href="#rfc.section.2.3.p.5">&para;</a></p><p id="rfc.section.2.3.p.6">All HTTP requirements applicable to an origin server also apply to the outbound communication of a gateway. A gateway communicates with inbound servers using any protocol that it desires, including private extensions to HTTP that are outside the scope of this specification. However, an HTTP-to-HTTP gateway that wishes to interoperate with third-party HTTP servers ought to conform to user agent requirements on the gateway's inbound connection.<a class="self" href="#rfc.section.2.3.p.6">&para;</a></p><p id="rfc.section.2.3.p.7"><span id="rfc.iref.t.1"></span> A "<dfn>tunnel</dfn>" acts as a blind relay between two connections without changing the messages. Once active, a tunnel is not considered a party to the HTTP communication, though the tunnel might have been initiated by an HTTP request. A tunnel ceases to exist when both ends of the relayed connection are closed. Tunnels are used to extend a virtual connection through an intermediary, such as when Transport Layer Security (TLS, <a href="#RFC5246" id="rfc.xref.RFC5246.1"><cite title="The Transport Layer Security (TLS) Protocol Version 1.2">[RFC5246]</cite></a>) is used to establish confidential communication through a shared firewall proxy.<a class="self" href="#rfc.section.2.3.p.7">&para;</a></p><p id="rfc.section.2.3.p.8">The above categories for intermediary only consider those acting as participants in the HTTP communication. There are also intermediaries that can act on lower layers of the network protocol stack, filtering or redirecting HTTP traffic without the knowledge or permission of message senders. Network intermediaries are indistinguishable (at a protocol level) from a man-in-the-middle attack, often introducing security flaws or interoperability problems due to mistakenly violating HTTP semantics.<a class="self" href="#rfc.section.2.3.p.8">&para;</a></p><p id="rfc.section.2.3.p.9"><span id="rfc.iref.i.2"></span> <span id="rfc.iref.t.2"></span> <span id="rfc.iref.c.1"></span> For example, an "<dfn>interception proxy</dfn>" <a href="#RFC3040" id="rfc.xref.RFC3040.1"><cite title="Internet Web Replication and Caching Taxonomy">[RFC3040]</cite></a> (also commonly known as a "<dfn>transparent proxy</dfn>" <a href="#RFC1919" id="rfc.xref.RFC1919.1"><cite title="Classical versus Transparent IP Proxies">[RFC1919]</cite></a> or "<dfn>captive portal</dfn>") differs from an HTTP proxy because it is not selected by the client. Instead, an interception proxy filters or redirects outgoing TCP port 80 packets (and occasionally other common port traffic). Interception proxies are commonly found on public network access points, as a means of enforcing account subscription prior to allowing use of non-local Internet services, and within corporate firewalls to enforce network usage policies.<a class="self" href="#rfc.section.2.3.p.9">&para;</a></p><p id="rfc.section.2.3.p.10">HTTP is defined as a stateless protocol, meaning that each request message can be understood in isolation. Many implementations depend on HTTP's stateless design in order to reuse proxied connections or dynamically load balance requests across multiple servers. Hence, a server <em class="bcp14">MUST NOT</em> assume that two requests on the same connection are from the same user agent unless the connection is secured and specific to that agent. Some non-standard HTTP extensions (e.g., <a href="#RFC4559" id="rfc.xref.RFC4559.1"><cite title="SPNEGO-based Kerberos and NTLM HTTP Authentication in Microsoft Windows">[RFC4559]</cite></a>) have been known to violate this requirement, resulting in security and interoperability problems.<a class="self" href="#rfc.section.2.3.p.10">&para;</a></p></div><div id="caches"><h2 id="rfc.section.2.4"><a href="#rfc.section.2.4">2.4</a>&nbsp;<a href="#caches">Caches</a></h2><p id="rfc.section.2.4.p.1">A "<dfn>cache</dfn>" is a local store of previous response messages and the subsystem that controls its message storage, retrieval, and deletion. A cache stores cacheable responses in order to reduce the response time and network bandwidth consumption on future, equivalent requests. Any client or server <em class="bcp14">MAY</em> employ a cache, though a cache cannot be used by a server while it is acting as a tunnel.<a class="self" href="#rfc.section.2.4.p.1">&para;</a></p><p id="rfc.section.2.4.p.2">The effect of a cache is that the request/response chain is shortened if one of the participants along the chain has a cached response applicable to that request. The following illustrates the resulting chain if B has a cached copy of an earlier response from O (via C) for a request that has not been cached by UA or A.<a class="self" href="#rfc.section.2.4.p.2">&para;</a></p><div id="rfc.figure.u.5"><pre class="drawing">            &gt;             &gt; 
     533</pre></div><div id="rfc.section.2.3.p.2"><p>The figure above shows three intermediaries (A, B, and C) between the user agent and origin server. A request or response message that travels the whole chain will pass through four separate connections. Some HTTP communication options might apply only to the connection with the nearest, non-tunnel neighbor, only to the endpoints of the chain, or to all connections along the chain. Although the diagram is linear, each participant might be engaged in multiple, simultaneous communications. For example, B might be receiving requests from many clients other than A, and/or forwarding requests to servers other than C, at the same time that it is handling A's request. Likewise, later requests might be sent through a different path of connections, often based on dynamic configuration for load balancing.<a class="self" href="#rfc.section.2.3.p.2">&para;</a></p></div><div id="rfc.section.2.3.p.3"><p><span id="rfc.iref.u.2"></span><span id="rfc.iref.d.1"></span> <span id="rfc.iref.i.1"></span><span id="rfc.iref.o.2"></span> The terms "<dfn>upstream</dfn>" and "<dfn>downstream</dfn>" are used to describe directional requirements in relation to the message flow: all messages flow from upstream to downstream. The terms "inbound" and "outbound" are used to describe directional requirements in relation to the request route: "<dfn>inbound</dfn>" means toward the origin server and "<dfn>outbound</dfn>" means toward the user agent.<a class="self" href="#rfc.section.2.3.p.3">&para;</a></p></div><div id="rfc.section.2.3.p.4"><p><span id="rfc.iref.p.1"></span> A "<dfn>proxy</dfn>" is a message-forwarding agent that is selected by the client, usually via local configuration rules, to receive requests for some type(s) of absolute URI and attempt to satisfy those requests via translation through the HTTP interface. Some translations are minimal, such as for proxy requests for "http" URIs, whereas other requests might require translation to and from entirely different application-level protocols. Proxies are often used to group an organization's HTTP requests through a common intermediary for the sake of security, annotation services, or shared caching. Some proxies are designed to apply transformations to selected messages or payloads while they are being forwarded, as described in <a href="#message.transformations" title="Transformations">Section&nbsp;5.7.2</a>.<a class="self" href="#rfc.section.2.3.p.4">&para;</a></p></div><div id="rfc.section.2.3.p.5"><p><span id="rfc.iref.g.1"></span><span id="rfc.iref.r.4"></span> <span id="rfc.iref.a.1"></span> A "<dfn>gateway</dfn>" (a.k.a. "<dfn>reverse proxy</dfn>") is an intermediary that acts as an origin server for the outbound connection but translates received requests and forwards them inbound to another server or servers. Gateways are often used to encapsulate legacy or untrusted information services, to improve server performance through "<dfn>accelerator</dfn>" caching, and to enable partitioning or load balancing of HTTP services across multiple machines.<a class="self" href="#rfc.section.2.3.p.5">&para;</a></p></div><div id="rfc.section.2.3.p.6"><p>All HTTP requirements applicable to an origin server also apply to the outbound communication of a gateway. A gateway communicates with inbound servers using any protocol that it desires, including private extensions to HTTP that are outside the scope of this specification. However, an HTTP-to-HTTP gateway that wishes to interoperate with third-party HTTP servers ought to conform to user agent requirements on the gateway's inbound connection.<a class="self" href="#rfc.section.2.3.p.6">&para;</a></p></div><div id="rfc.section.2.3.p.7"><p><span id="rfc.iref.t.1"></span> A "<dfn>tunnel</dfn>" acts as a blind relay between two connections without changing the messages. Once active, a tunnel is not considered a party to the HTTP communication, though the tunnel might have been initiated by an HTTP request. A tunnel ceases to exist when both ends of the relayed connection are closed. Tunnels are used to extend a virtual connection through an intermediary, such as when Transport Layer Security (TLS, <a href="#RFC5246" id="rfc.xref.RFC5246.1"><cite title="The Transport Layer Security (TLS) Protocol Version 1.2">[RFC5246]</cite></a>) is used to establish confidential communication through a shared firewall proxy.<a class="self" href="#rfc.section.2.3.p.7">&para;</a></p></div><div id="rfc.section.2.3.p.8"><p>The above categories for intermediary only consider those acting as participants in the HTTP communication. There are also intermediaries that can act on lower layers of the network protocol stack, filtering or redirecting HTTP traffic without the knowledge or permission of message senders. Network intermediaries are indistinguishable (at a protocol level) from a man-in-the-middle attack, often introducing security flaws or interoperability problems due to mistakenly violating HTTP semantics.<a class="self" href="#rfc.section.2.3.p.8">&para;</a></p></div><div id="rfc.section.2.3.p.9"><p><span id="rfc.iref.i.2"></span> <span id="rfc.iref.t.2"></span> <span id="rfc.iref.c.1"></span> For example, an "<dfn>interception proxy</dfn>" <a href="#RFC3040" id="rfc.xref.RFC3040.1"><cite title="Internet Web Replication and Caching Taxonomy">[RFC3040]</cite></a> (also commonly known as a "<dfn>transparent proxy</dfn>" <a href="#RFC1919" id="rfc.xref.RFC1919.1"><cite title="Classical versus Transparent IP Proxies">[RFC1919]</cite></a> or "<dfn>captive portal</dfn>") differs from an HTTP proxy because it is not selected by the client. Instead, an interception proxy filters or redirects outgoing TCP port 80 packets (and occasionally other common port traffic). Interception proxies are commonly found on public network access points, as a means of enforcing account subscription prior to allowing use of non-local Internet services, and within corporate firewalls to enforce network usage policies.<a class="self" href="#rfc.section.2.3.p.9">&para;</a></p></div><div id="rfc.section.2.3.p.10"><p>HTTP is defined as a stateless protocol, meaning that each request message can be understood in isolation. Many implementations depend on HTTP's stateless design in order to reuse proxied connections or dynamically load balance requests across multiple servers. Hence, a server <em class="bcp14">MUST NOT</em> assume that two requests on the same connection are from the same user agent unless the connection is secured and specific to that agent. Some non-standard HTTP extensions (e.g., <a href="#RFC4559" id="rfc.xref.RFC4559.1"><cite title="SPNEGO-based Kerberos and NTLM HTTP Authentication in Microsoft Windows">[RFC4559]</cite></a>) have been known to violate this requirement, resulting in security and interoperability problems.<a class="self" href="#rfc.section.2.3.p.10">&para;</a></p></div></div><div id="caches"><h2 id="rfc.section.2.4"><a href="#rfc.section.2.4">2.4</a>&nbsp;<a href="#caches">Caches</a></h2><div id="rfc.section.2.4.p.1"><p>A "<dfn>cache</dfn>" is a local store of previous response messages and the subsystem that controls its message storage, retrieval, and deletion. A cache stores cacheable responses in order to reduce the response time and network bandwidth consumption on future, equivalent requests. Any client or server <em class="bcp14">MAY</em> employ a cache, though a cache cannot be used by a server while it is acting as a tunnel.<a class="self" href="#rfc.section.2.4.p.1">&para;</a></p></div><div id="rfc.section.2.4.p.2"><p>The effect of a cache is that the request/response chain is shortened if one of the participants along the chain has a cached response applicable to that request. The following illustrates the resulting chain if B has a cached copy of an earlier response from O (via C) for a request that has not been cached by UA or A.<a class="self" href="#rfc.section.2.4.p.2">&para;</a></p></div><div id="rfc.figure.u.5"><pre class="drawing">            &gt;             &gt; 
    554534       <b>UA</b> =========== <b>A</b> =========== <b>B</b> - - - - - - <b>C</b> - - - - - - <b>O</b> 
    555535                  &lt;             &lt; 
    556 </pre></div><p id="rfc.section.2.4.p.3"><span id="rfc.iref.c.2"></span> A response is "<dfn>cacheable</dfn>" if a cache is allowed to store a copy of the response message for use in answering subsequent requests. Even when a response is cacheable, there might be additional constraints placed by the client or by the origin server on when that cached response can be used for a particular request. HTTP requirements for cache behavior and cacheable responses are defined in <a href="rfc7234.html#caching.overview" title="Overview of Cache Operation">Section 2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>.<a class="self" href="#rfc.section.2.4.p.3">&para;</a></p><p id="rfc.section.2.4.p.4">There is a wide variety of architectures and configurations of caches deployed across the World Wide Web and inside large organizations. These include national hierarchies of proxy caches to save transoceanic bandwidth, collaborative systems that broadcast or multicast cache entries, archives of pre-fetched cache entries for use in off-line or high-latency environments, and so on.<a class="self" href="#rfc.section.2.4.p.4">&para;</a></p></div><div id="conformance"><h2 id="rfc.section.2.5"><a href="#rfc.section.2.5">2.5</a>&nbsp;<a href="#conformance">Conformance and Error Handling</a></h2><p id="rfc.section.2.5.p.1">This specification targets conformance criteria according to the role of a participant in HTTP communication. Hence, HTTP requirements are placed on senders, recipients, clients, servers, user agents, intermediaries, origin servers, proxies, gateways, or caches, depending on what behavior is being constrained by the requirement. Additional (social) requirements are placed on implementations, resource owners, and protocol element registrations when they apply beyond the scope of a single communication.<a class="self" href="#rfc.section.2.5.p.1">&para;</a></p><p id="rfc.section.2.5.p.2">The verb "generate" is used instead of "send" where a requirement differentiates between creating a protocol element and merely forwarding a received element downstream.<a class="self" href="#rfc.section.2.5.p.2">&para;</a></p><p id="rfc.section.2.5.p.3">An implementation is considered conformant if it complies with all of the requirements associated with the roles it partakes in HTTP.<a class="self" href="#rfc.section.2.5.p.3">&para;</a></p><p id="rfc.section.2.5.p.4">Conformance includes both the syntax and semantics of protocol elements. A sender <em class="bcp14">MUST NOT</em> generate protocol elements that convey a meaning that is known by that sender to be false. A sender <em class="bcp14">MUST NOT</em> generate protocol elements that do not match the grammar defined by the corresponding ABNF rules. Within a given message, a sender <em class="bcp14">MUST NOT</em> generate protocol elements or syntax alternatives that are only allowed to be generated by participants in other roles (i.e., a role that the sender does not have for that message).<a class="self" href="#rfc.section.2.5.p.4">&para;</a></p><p id="rfc.section.2.5.p.5">When a received protocol element is parsed, the recipient <em class="bcp14">MUST</em> be able to parse any value of reasonable length that is applicable to the recipient's role and that matches the grammar defined by the corresponding ABNF rules. Note, however, that some received protocol elements might not be parsed. For example, an intermediary forwarding a message might parse a header-field into generic field-name and field-value components, but then forward the header field without further parsing inside the field-value.<a class="self" href="#rfc.section.2.5.p.5">&para;</a></p><p id="rfc.section.2.5.p.6">HTTP does not have specific length limitations for many of its protocol elements because the lengths that might be appropriate will vary widely, depending on the deployment context and purpose of the implementation. Hence, interoperability between senders and recipients depends on shared expectations regarding what is a reasonable length for each protocol element. Furthermore, what is commonly understood to be a reasonable length for some protocol elements has changed over the course of the past two decades of HTTP use and is expected to continue changing in the future.<a class="self" href="#rfc.section.2.5.p.6">&para;</a></p><p id="rfc.section.2.5.p.7">At a minimum, a recipient <em class="bcp14">MUST</em> be able to parse and process protocol element lengths that are at least as long as the values that it generates for those same protocol elements in other messages. For example, an origin server that publishes very long URI references to its own resources needs to be able to parse and process those same references when received as a request target.<a class="self" href="#rfc.section.2.5.p.7">&para;</a></p><p id="rfc.section.2.5.p.8">A recipient <em class="bcp14">MUST</em> interpret a received protocol element according to the semantics defined for it by this specification, including extensions to this specification, unless the recipient has determined (through experience or configuration) that the sender incorrectly implements what is implied by those semantics. For example, an origin server might disregard the contents of a received <a href="rfc7231.html#header.accept-encoding" class="smpl">Accept-Encoding</a> header field if inspection of the <a href="rfc7231.html#header.user-agent" class="smpl">User-Agent</a> header field indicates a specific implementation version that is known to fail on receipt of certain content codings.<a class="self" href="#rfc.section.2.5.p.8">&para;</a></p><p id="rfc.section.2.5.p.9">Unless noted otherwise, a recipient <em class="bcp14">MAY</em> attempt to recover a usable protocol element from an invalid construct. HTTP does not define specific error handling mechanisms except when they have a direct impact on security, since different applications of the protocol require different error handling strategies. For example, a Web browser might wish to transparently recover from a response where the <a href="rfc7231.html#header.location" class="smpl">Location</a> header field doesn't parse according to the ABNF, whereas a systems control client might consider any form of error recovery to be dangerous.<a class="self" href="#rfc.section.2.5.p.9">&para;</a></p></div><div id="http.version"><h2 id="rfc.section.2.6"><a href="#rfc.section.2.6">2.6</a>&nbsp;<a href="#http.version">Protocol Versioning</a></h2><p id="rfc.section.2.6.p.1">HTTP uses a "&lt;major&gt;.&lt;minor&gt;" numbering scheme to indicate versions of the protocol. This specification defines version "1.1". The protocol version as a whole indicates the sender's conformance with the set of requirements laid out in that version's corresponding specification of HTTP.<a class="self" href="#rfc.section.2.6.p.1">&para;</a></p><p id="rfc.section.2.6.p.2">The version of an HTTP message is indicated by an HTTP-version field in the first line of the message. HTTP-version is case-sensitive.<a class="self" href="#rfc.section.2.6.p.2">&para;</a></p><div id="rfc.figure.u.6"><pre class="inline"><span id="rfc.iref.g.2"></span><span id="rfc.iref.g.3"></span>  <a href="#http.version" class="smpl">HTTP-version</a>  = <a href="#http.version" class="smpl">HTTP-name</a> "/" <a href="#core.rules" class="smpl">DIGIT</a> "." <a href="#core.rules" class="smpl">DIGIT</a> 
     536</pre></div><div id="rfc.section.2.4.p.3"><p><span id="rfc.iref.c.2"></span> A response is "<dfn>cacheable</dfn>" if a cache is allowed to store a copy of the response message for use in answering subsequent requests. Even when a response is cacheable, there might be additional constraints placed by the client or by the origin server on when that cached response can be used for a particular request. HTTP requirements for cache behavior and cacheable responses are defined in <a href="rfc7234.html#caching.overview" title="Overview of Cache Operation">Section 2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>.<a class="self" href="#rfc.section.2.4.p.3">&para;</a></p></div><div id="rfc.section.2.4.p.4"><p>There is a wide variety of architectures and configurations of caches deployed across the World Wide Web and inside large organizations. These include national hierarchies of proxy caches to save transoceanic bandwidth, collaborative systems that broadcast or multicast cache entries, archives of pre-fetched cache entries for use in off-line or high-latency environments, and so on.<a class="self" href="#rfc.section.2.4.p.4">&para;</a></p></div></div><div id="conformance"><h2 id="rfc.section.2.5"><a href="#rfc.section.2.5">2.5</a>&nbsp;<a href="#conformance">Conformance and Error Handling</a></h2><div id="rfc.section.2.5.p.1"><p>This specification targets conformance criteria according to the role of a participant in HTTP communication. Hence, HTTP requirements are placed on senders, recipients, clients, servers, user agents, intermediaries, origin servers, proxies, gateways, or caches, depending on what behavior is being constrained by the requirement. Additional (social) requirements are placed on implementations, resource owners, and protocol element registrations when they apply beyond the scope of a single communication.<a class="self" href="#rfc.section.2.5.p.1">&para;</a></p></div><div id="rfc.section.2.5.p.2"><p>The verb "generate" is used instead of "send" where a requirement differentiates between creating a protocol element and merely forwarding a received element downstream.<a class="self" href="#rfc.section.2.5.p.2">&para;</a></p></div><div id="rfc.section.2.5.p.3"><p>An implementation is considered conformant if it complies with all of the requirements associated with the roles it partakes in HTTP.<a class="self" href="#rfc.section.2.5.p.3">&para;</a></p></div><div id="rfc.section.2.5.p.4"><p>Conformance includes both the syntax and semantics of protocol elements. A sender <em class="bcp14">MUST NOT</em> generate protocol elements that convey a meaning that is known by that sender to be false. A sender <em class="bcp14">MUST NOT</em> generate protocol elements that do not match the grammar defined by the corresponding ABNF rules. Within a given message, a sender <em class="bcp14">MUST NOT</em> generate protocol elements or syntax alternatives that are only allowed to be generated by participants in other roles (i.e., a role that the sender does not have for that message).<a class="self" href="#rfc.section.2.5.p.4">&para;</a></p></div><div id="rfc.section.2.5.p.5"><p>When a received protocol element is parsed, the recipient <em class="bcp14">MUST</em> be able to parse any value of reasonable length that is applicable to the recipient's role and that matches the grammar defined by the corresponding ABNF rules. Note, however, that some received protocol elements might not be parsed. For example, an intermediary forwarding a message might parse a header-field into generic field-name and field-value components, but then forward the header field without further parsing inside the field-value.<a class="self" href="#rfc.section.2.5.p.5">&para;</a></p></div><div id="rfc.section.2.5.p.6"><p>HTTP does not have specific length limitations for many of its protocol elements because the lengths that might be appropriate will vary widely, depending on the deployment context and purpose of the implementation. Hence, interoperability between senders and recipients depends on shared expectations regarding what is a reasonable length for each protocol element. Furthermore, what is commonly understood to be a reasonable length for some protocol elements has changed over the course of the past two decades of HTTP use and is expected to continue changing in the future.<a class="self" href="#rfc.section.2.5.p.6">&para;</a></p></div><div id="rfc.section.2.5.p.7"><p>At a minimum, a recipient <em class="bcp14">MUST</em> be able to parse and process protocol element lengths that are at least as long as the values that it generates for those same protocol elements in other messages. For example, an origin server that publishes very long URI references to its own resources needs to be able to parse and process those same references when received as a request target.<a class="self" href="#rfc.section.2.5.p.7">&para;</a></p></div><div id="rfc.section.2.5.p.8"><p>A recipient <em class="bcp14">MUST</em> interpret a received protocol element according to the semantics defined for it by this specification, including extensions to this specification, unless the recipient has determined (through experience or configuration) that the sender incorrectly implements what is implied by those semantics. For example, an origin server might disregard the contents of a received <a href="rfc7231.html#header.accept-encoding" class="smpl">Accept-Encoding</a> header field if inspection of the <a href="rfc7231.html#header.user-agent" class="smpl">User-Agent</a> header field indicates a specific implementation version that is known to fail on receipt of certain content codings.<a class="self" href="#rfc.section.2.5.p.8">&para;</a></p></div><div id="rfc.section.2.5.p.9"><p>Unless noted otherwise, a recipient <em class="bcp14">MAY</em> attempt to recover a usable protocol element from an invalid construct. HTTP does not define specific error handling mechanisms except when they have a direct impact on security, since different applications of the protocol require different error handling strategies. For example, a Web browser might wish to transparently recover from a response where the <a href="rfc7231.html#header.location" class="smpl">Location</a> header field doesn't parse according to the ABNF, whereas a systems control client might consider any form of error recovery to be dangerous.<a class="self" href="#rfc.section.2.5.p.9">&para;</a></p></div></div><div id="http.version"><h2 id="rfc.section.2.6"><a href="#rfc.section.2.6">2.6</a>&nbsp;<a href="#http.version">Protocol Versioning</a></h2><div id="rfc.section.2.6.p.1"><p>HTTP uses a "&lt;major&gt;.&lt;minor&gt;" numbering scheme to indicate versions of the protocol. This specification defines version "1.1". The protocol version as a whole indicates the sender's conformance with the set of requirements laid out in that version's corresponding specification of HTTP.<a class="self" href="#rfc.section.2.6.p.1">&para;</a></p></div><div id="rfc.section.2.6.p.2"><p>The version of an HTTP message is indicated by an HTTP-version field in the first line of the message. HTTP-version is case-sensitive.<a class="self" href="#rfc.section.2.6.p.2">&para;</a></p></div><div id="rfc.figure.u.6"><pre class="inline"><span id="rfc.iref.g.2"></span><span id="rfc.iref.g.3"></span>  <a href="#http.version" class="smpl">HTTP-version</a>  = <a href="#http.version" class="smpl">HTTP-name</a> "/" <a href="#core.rules" class="smpl">DIGIT</a> "." <a href="#core.rules" class="smpl">DIGIT</a> 
    557537  <a href="#http.version" class="smpl">HTTP-name</a>     = %x48.54.54.50 ; "HTTP", case-sensitive  
    558 </pre></div><p id="rfc.section.2.6.p.3">The HTTP version number consists of two decimal digits separated by a "." (period or decimal point). The first digit ("major version") indicates the HTTP messaging syntax, whereas the second digit ("minor version") indicates the highest minor version within that major version to which the sender is conformant and able to understand for future communication. The minor version advertises the sender's communication capabilities even when the sender is only using a backwards-compatible subset of the protocol, thereby letting the recipient know that more advanced features can be used in response (by servers) or in future requests (by clients).<a class="self" href="#rfc.section.2.6.p.3">&para;</a></p><p id="rfc.section.2.6.p.4">When an HTTP/1.1 message is sent to an HTTP/1.0 recipient <a href="#RFC1945" id="rfc.xref.RFC1945.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.0">[RFC1945]</cite></a> or a recipient whose version is unknown, the HTTP/1.1 message is constructed such that it can be interpreted as a valid HTTP/1.0 message if all of the newer features are ignored. This specification places recipient-version requirements on some new features so that a conformant sender will only use compatible features until it has determined, through configuration or the receipt of a message, that the recipient supports HTTP/1.1.<a class="self" href="#rfc.section.2.6.p.4">&para;</a></p><p id="rfc.section.2.6.p.5">The interpretation of a header field does not change between minor versions of the same major HTTP version, though the default behavior of a recipient in the absence of such a field can change. Unless specified otherwise, header fields defined in HTTP/1.1 are defined for all versions of HTTP/1.x. In particular, the <a href="#header.host" class="smpl">Host</a> and <a href="#header.connection" class="smpl">Connection</a> header fields ought to be implemented by all HTTP/1.x implementations whether or not they advertise conformance with HTTP/1.1.<a class="self" href="#rfc.section.2.6.p.5">&para;</a></p><p id="rfc.section.2.6.p.6">New header fields can be introduced without changing the protocol version if their defined semantics allow them to be safely ignored by recipients that do not recognize them. Header field extensibility is discussed in <a href="#field.extensibility" title="Field Extensibility">Section&nbsp;3.2.1</a>.<a class="self" href="#rfc.section.2.6.p.6">&para;</a></p><p id="rfc.section.2.6.p.7">Intermediaries that process HTTP messages (i.e., all intermediaries other than those acting as tunnels) <em class="bcp14">MUST</em> send their own HTTP-version in forwarded messages. In other words, they are not allowed to blindly forward the first line of an HTTP message without ensuring that the protocol version in that message matches a version to which that intermediary is conformant for both the receiving and sending of messages. Forwarding an HTTP message without rewriting the HTTP-version might result in communication errors when downstream recipients use the message sender's version to determine what features are safe to use for later communication with that sender.<a class="self" href="#rfc.section.2.6.p.7">&para;</a></p><p id="rfc.section.2.6.p.8">A client <em class="bcp14">SHOULD</em> send a request version equal to the highest version to which the client is conformant and whose major version is no higher than the highest version supported by the server, if this is known. A client <em class="bcp14">MUST NOT</em> send a version to which it is not conformant.<a class="self" href="#rfc.section.2.6.p.8">&para;</a></p><p id="rfc.section.2.6.p.9">A client <em class="bcp14">MAY</em> send a lower request version if it is known that the server incorrectly implements the HTTP specification, but only after the client has attempted at least one normal request and determined from the response status code or header fields (e.g., <a href="rfc7231.html#header.server" class="smpl">Server</a>) that the server improperly handles higher request versions.<a class="self" href="#rfc.section.2.6.p.9">&para;</a></p><p id="rfc.section.2.6.p.10">A server <em class="bcp14">SHOULD</em> send a response version equal to the highest version to which the server is conformant that has a major version less than or equal to the one received in the request. A server <em class="bcp14">MUST NOT</em> send a version to which it is not conformant. A server can send a <a href="rfc7231.html#status.505" class="smpl">505 (HTTP Version Not Supported)</a> response if it wishes, for any reason, to refuse service of the client's major protocol version.<a class="self" href="#rfc.section.2.6.p.10">&para;</a></p><p id="rfc.section.2.6.p.11">A server <em class="bcp14">MAY</em> send an HTTP/1.0 response to a request if it is known or suspected that the client incorrectly implements the HTTP specification and is incapable of correctly processing later version responses, such as when a client fails to parse the version number correctly or when an intermediary is known to blindly forward the HTTP-version even when it doesn't conform to the given minor version of the protocol. Such protocol downgrades <em class="bcp14">SHOULD NOT</em> be performed unless triggered by specific client attributes, such as when one or more of the request header fields (e.g., <a href="rfc7231.html#header.user-agent" class="smpl">User-Agent</a>) uniquely match the values sent by a client known to be in error.<a class="self" href="#rfc.section.2.6.p.11">&para;</a></p><p id="rfc.section.2.6.p.12">The intention of HTTP's versioning design is that the major number will only be incremented if an incompatible message syntax is introduced, and that the minor number will only be incremented when changes made to the protocol have the effect of adding to the message semantics or implying additional capabilities of the sender. However, the minor version was not incremented for the changes introduced between <a href="#RFC2068" id="rfc.xref.RFC2068.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a> and <a href="#RFC2616" id="rfc.xref.RFC2616.2"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2616]</cite></a>, and this revision has specifically avoided any such changes to the protocol.<a class="self" href="#rfc.section.2.6.p.12">&para;</a></p><p id="rfc.section.2.6.p.13">When an HTTP message is received with a major version number that the recipient implements, but a higher minor version number than what the recipient implements, the recipient <em class="bcp14">SHOULD</em> process the message as if it were in the highest minor version within that major version to which the recipient is conformant. A recipient can assume that a message with a higher minor version, when sent to a recipient that has not yet indicated support for that higher version, is sufficiently backwards-compatible to be safely processed by any implementation of the same major version.<a class="self" href="#rfc.section.2.6.p.13">&para;</a></p></div><div id="uri"><h2 id="rfc.section.2.7"><a href="#rfc.section.2.7">2.7</a>&nbsp;<a href="#uri">Uniform Resource Identifiers</a></h2><p id="rfc.section.2.7.p.1">Uniform Resource Identifiers (URIs) <a href="#RFC3986" id="rfc.xref.RFC3986.2"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a> are used throughout HTTP as the means for identifying resources (<a href="rfc7231.html#resources" title="Resources">Section 2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). URI references are used to target requests, indicate redirects, and define relationships.<a class="self" href="#rfc.section.2.7.p.1">&para;</a></p><p id="rfc.section.2.7.p.2">The definitions of "URI-reference", "absolute-URI", "relative-part", "scheme", "authority", "port", "host", "path-abempty", "segment", "query", and "fragment" are adopted from the URI generic syntax. An "absolute-path" rule is defined for protocol elements that can contain a non-empty path component. (This rule differs slightly from the path-abempty rule of RFC 3986, which allows for an empty path to be used in references, and path-absolute rule, which does not allow paths that begin with "//".) A "partial-URI" rule is defined for protocol elements that can contain a relative URI but not a fragment component.<a class="self" href="#rfc.section.2.7.p.2">&para;</a></p><div id="rfc.figure.u.7"><pre class="inline"><span id="rfc.iref.g.4"></span><span id="rfc.iref.g.5"></span><span id="rfc.iref.g.6"></span><span id="rfc.iref.g.7"></span><span id="rfc.iref.g.8"></span><span id="rfc.iref.g.9"></span><span id="rfc.iref.g.10"></span><span id="rfc.iref.g.11"></span><span id="rfc.iref.g.12"></span><span id="rfc.iref.g.13"></span><span id="rfc.iref.g.14"></span>  <a href="#uri" class="smpl">URI-reference</a> = &lt;URI-reference, see <a href="#RFC3986" id="rfc.xref.RFC3986.3"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-4.1">Section 4.1</a>&gt; 
     538</pre></div><div id="rfc.section.2.6.p.3"><p>The HTTP version number consists of two decimal digits separated by a "." (period or decimal point). The first digit ("major version") indicates the HTTP messaging syntax, whereas the second digit ("minor version") indicates the highest minor version within that major version to which the sender is conformant and able to understand for future communication. The minor version advertises the sender's communication capabilities even when the sender is only using a backwards-compatible subset of the protocol, thereby letting the recipient know that more advanced features can be used in response (by servers) or in future requests (by clients).<a class="self" href="#rfc.section.2.6.p.3">&para;</a></p></div><div id="rfc.section.2.6.p.4"><p>When an HTTP/1.1 message is sent to an HTTP/1.0 recipient <a href="#RFC1945" id="rfc.xref.RFC1945.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.0">[RFC1945]</cite></a> or a recipient whose version is unknown, the HTTP/1.1 message is constructed such that it can be interpreted as a valid HTTP/1.0 message if all of the newer features are ignored. This specification places recipient-version requirements on some new features so that a conformant sender will only use compatible features until it has determined, through configuration or the receipt of a message, that the recipient supports HTTP/1.1.<a class="self" href="#rfc.section.2.6.p.4">&para;</a></p></div><div id="rfc.section.2.6.p.5"><p>The interpretation of a header field does not change between minor versions of the same major HTTP version, though the default behavior of a recipient in the absence of such a field can change. Unless specified otherwise, header fields defined in HTTP/1.1 are defined for all versions of HTTP/1.x. In particular, the <a href="#header.host" class="smpl">Host</a> and <a href="#header.connection" class="smpl">Connection</a> header fields ought to be implemented by all HTTP/1.x implementations whether or not they advertise conformance with HTTP/1.1.<a class="self" href="#rfc.section.2.6.p.5">&para;</a></p></div><div id="rfc.section.2.6.p.6"><p>New header fields can be introduced without changing the protocol version if their defined semantics allow them to be safely ignored by recipients that do not recognize them. Header field extensibility is discussed in <a href="#field.extensibility" title="Field Extensibility">Section&nbsp;3.2.1</a>.<a class="self" href="#rfc.section.2.6.p.6">&para;</a></p></div><div id="rfc.section.2.6.p.7"><p>Intermediaries that process HTTP messages (i.e., all intermediaries other than those acting as tunnels) <em class="bcp14">MUST</em> send their own HTTP-version in forwarded messages. In other words, they are not allowed to blindly forward the first line of an HTTP message without ensuring that the protocol version in that message matches a version to which that intermediary is conformant for both the receiving and sending of messages. Forwarding an HTTP message without rewriting the HTTP-version might result in communication errors when downstream recipients use the message sender's version to determine what features are safe to use for later communication with that sender.<a class="self" href="#rfc.section.2.6.p.7">&para;</a></p></div><div id="rfc.section.2.6.p.8"><p>A client <em class="bcp14">SHOULD</em> send a request version equal to the highest version to which the client is conformant and whose major version is no higher than the highest version supported by the server, if this is known. A client <em class="bcp14">MUST NOT</em> send a version to which it is not conformant.<a class="self" href="#rfc.section.2.6.p.8">&para;</a></p></div><div id="rfc.section.2.6.p.9"><p>A client <em class="bcp14">MAY</em> send a lower request version if it is known that the server incorrectly implements the HTTP specification, but only after the client has attempted at least one normal request and determined from the response status code or header fields (e.g., <a href="rfc7231.html#header.server" class="smpl">Server</a>) that the server improperly handles higher request versions.<a class="self" href="#rfc.section.2.6.p.9">&para;</a></p></div><div id="rfc.section.2.6.p.10"><p>A server <em class="bcp14">SHOULD</em> send a response version equal to the highest version to which the server is conformant that has a major version less than or equal to the one received in the request. A server <em class="bcp14">MUST NOT</em> send a version to which it is not conformant. A server can send a <a href="rfc7231.html#status.505" class="smpl">505 (HTTP Version Not Supported)</a> response if it wishes, for any reason, to refuse service of the client's major protocol version.<a class="self" href="#rfc.section.2.6.p.10">&para;</a></p></div><div id="rfc.section.2.6.p.11"><p>A server <em class="bcp14">MAY</em> send an HTTP/1.0 response to a request if it is known or suspected that the client incorrectly implements the HTTP specification and is incapable of correctly processing later version responses, such as when a client fails to parse the version number correctly or when an intermediary is known to blindly forward the HTTP-version even when it doesn't conform to the given minor version of the protocol. Such protocol downgrades <em class="bcp14">SHOULD NOT</em> be performed unless triggered by specific client attributes, such as when one or more of the request header fields (e.g., <a href="rfc7231.html#header.user-agent" class="smpl">User-Agent</a>) uniquely match the values sent by a client known to be in error.<a class="self" href="#rfc.section.2.6.p.11">&para;</a></p></div><div id="rfc.section.2.6.p.12"><p>The intention of HTTP's versioning design is that the major number will only be incremented if an incompatible message syntax is introduced, and that the minor number will only be incremented when changes made to the protocol have the effect of adding to the message semantics or implying additional capabilities of the sender. However, the minor version was not incremented for the changes introduced between <a href="#RFC2068" id="rfc.xref.RFC2068.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a> and <a href="#RFC2616" id="rfc.xref.RFC2616.2"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2616]</cite></a>, and this revision has specifically avoided any such changes to the protocol.<a class="self" href="#rfc.section.2.6.p.12">&para;</a></p></div><div id="rfc.section.2.6.p.13"><p>When an HTTP message is received with a major version number that the recipient implements, but a higher minor version number than what the recipient implements, the recipient <em class="bcp14">SHOULD</em> process the message as if it were in the highest minor version within that major version to which the recipient is conformant. A recipient can assume that a message with a higher minor version, when sent to a recipient that has not yet indicated support for that higher version, is sufficiently backwards-compatible to be safely processed by any implementation of the same major version.<a class="self" href="#rfc.section.2.6.p.13">&para;</a></p></div></div><div id="uri"><h2 id="rfc.section.2.7"><a href="#rfc.section.2.7">2.7</a>&nbsp;<a href="#uri">Uniform Resource Identifiers</a></h2><div id="rfc.section.2.7.p.1"><p>Uniform Resource Identifiers (URIs) <a href="#RFC3986" id="rfc.xref.RFC3986.2"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a> are used throughout HTTP as the means for identifying resources (<a href="rfc7231.html#resources" title="Resources">Section 2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). URI references are used to target requests, indicate redirects, and define relationships.<a class="self" href="#rfc.section.2.7.p.1">&para;</a></p></div><div id="rfc.section.2.7.p.2"><p>The definitions of "URI-reference", "absolute-URI", "relative-part", "scheme", "authority", "port", "host", "path-abempty", "segment", "query", and "fragment" are adopted from the URI generic syntax. An "absolute-path" rule is defined for protocol elements that can contain a non-empty path component. (This rule differs slightly from the path-abempty rule of RFC 3986, which allows for an empty path to be used in references, and path-absolute rule, which does not allow paths that begin with "//".) A "partial-URI" rule is defined for protocol elements that can contain a relative URI but not a fragment component.<a class="self" href="#rfc.section.2.7.p.2">&para;</a></p></div><div id="rfc.figure.u.7"><pre class="inline"><span id="rfc.iref.g.4"></span><span id="rfc.iref.g.5"></span><span id="rfc.iref.g.6"></span><span id="rfc.iref.g.7"></span><span id="rfc.iref.g.8"></span><span id="rfc.iref.g.9"></span><span id="rfc.iref.g.10"></span><span id="rfc.iref.g.11"></span><span id="rfc.iref.g.12"></span><span id="rfc.iref.g.13"></span><span id="rfc.iref.g.14"></span>  <a href="#uri" class="smpl">URI-reference</a> = &lt;URI-reference, see <a href="#RFC3986" id="rfc.xref.RFC3986.3"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-4.1">Section 4.1</a>&gt; 
    559539  <a href="#uri" class="smpl">absolute-URI</a>  = &lt;absolute-URI, see <a href="#RFC3986" id="rfc.xref.RFC3986.4"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-4.3">Section 4.3</a>&gt; 
    560540  <a href="#uri" class="smpl">relative-part</a> = &lt;relative-part, see <a href="#RFC3986" id="rfc.xref.RFC3986.5"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-4.2">Section 4.2</a>&gt; 
     
    570550  <a href="#uri" class="smpl">absolute-path</a> = 1*( "/" segment ) 
    571551  <a href="#uri" class="smpl">partial-URI</a>   = relative-part [ "?" query ] 
    572 </pre></div><p id="rfc.section.2.7.p.3">Each protocol element in HTTP that allows a URI reference will indicate in its ABNF production whether the element allows any form of reference (URI-reference), only a URI in absolute form (absolute-URI), only the path and optional query components, or some combination of the above. Unless otherwise indicated, URI references are parsed relative to the effective request URI (<a href="#effective.request.uri" title="Effective Request URI">Section&nbsp;5.5</a>).<a class="self" href="#rfc.section.2.7.p.3">&para;</a></p><div id="http.uri"><h3 id="rfc.section.2.7.1"><a href="#rfc.section.2.7.1">2.7.1</a>&nbsp;<a href="#http.uri">http URI Scheme</a></h3><p id="rfc.section.2.7.1.p.1">The "http" URI scheme is hereby defined for the purpose of minting identifiers according to their association with the hierarchical namespace governed by a potential HTTP origin server listening for TCP (<a href="#RFC0793" id="rfc.xref.RFC0793.1"><cite title="Transmission Control Protocol">[RFC0793]</cite></a>) connections on a given port.<a class="self" href="#rfc.section.2.7.1.p.1">&para;</a></p><div id="rfc.figure.u.8"><pre class="inline"><span id="rfc.iref.g.15"></span>  <a href="#http.uri" class="smpl">http-URI</a> = "http:" "//" <a href="#uri" class="smpl">authority</a> <a href="#uri" class="smpl">path-abempty</a> [ "?" <a href="#uri" class="smpl">query</a> ] 
     552</pre></div><div id="rfc.section.2.7.p.3"><p>Each protocol element in HTTP that allows a URI reference will indicate in its ABNF production whether the element allows any form of reference (URI-reference), only a URI in absolute form (absolute-URI), only the path and optional query components, or some combination of the above. Unless otherwise indicated, URI references are parsed relative to the effective request URI (<a href="#effective.request.uri" title="Effective Request URI">Section&nbsp;5.5</a>).<a class="self" href="#rfc.section.2.7.p.3">&para;</a></p></div><div id="http.uri"><h3 id="rfc.section.2.7.1"><a href="#rfc.section.2.7.1">2.7.1</a>&nbsp;<a href="#http.uri">http URI Scheme</a></h3><div id="rfc.section.2.7.1.p.1"><p>The "http" URI scheme is hereby defined for the purpose of minting identifiers according to their association with the hierarchical namespace governed by a potential HTTP origin server listening for TCP (<a href="#RFC0793" id="rfc.xref.RFC0793.1"><cite title="Transmission Control Protocol">[RFC0793]</cite></a>) connections on a given port.<a class="self" href="#rfc.section.2.7.1.p.1">&para;</a></p></div><div id="rfc.figure.u.8"><pre class="inline"><span id="rfc.iref.g.15"></span>  <a href="#http.uri" class="smpl">http-URI</a> = "http:" "//" <a href="#uri" class="smpl">authority</a> <a href="#uri" class="smpl">path-abempty</a> [ "?" <a href="#uri" class="smpl">query</a> ] 
    573553             [ "#" <a href="#uri" class="smpl">fragment</a> ] 
    574 </pre></div><p id="rfc.section.2.7.1.p.2">The origin server for an "http" URI is identified by the <a href="#uri" class="smpl">authority</a> component, which includes a host identifier and optional TCP port (<a href="#RFC3986" id="rfc.xref.RFC3986.14"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.2.2">Section 3.2.2</a>). The hierarchical path component and optional query component serve as an identifier for a potential target resource within that origin server's name space. The optional fragment component allows for indirect identification of a secondary resource, independent of the URI scheme, as defined in <a href="https://tools.ietf.org/html/rfc3986#section-3.5">Section 3.5</a> of <a href="#RFC3986" id="rfc.xref.RFC3986.15"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>.<a class="self" href="#rfc.section.2.7.1.p.2">&para;</a></p><p id="rfc.section.2.7.1.p.3">A sender <em class="bcp14">MUST NOT</em> generate an "http" URI with an empty host identifier. A recipient that processes such a URI reference <em class="bcp14">MUST</em> reject it as invalid.<a class="self" href="#rfc.section.2.7.1.p.3">&para;</a></p><p id="rfc.section.2.7.1.p.4">If the host identifier is provided as an IP address, the origin server is the listener (if any) on the indicated TCP port at that IP address. If host is a registered name, the registered name is an indirect identifier for use with a name resolution service, such as DNS, to find an address for that origin server. If the port subcomponent is empty or not given, TCP port 80 (the reserved port for WWW services) is the default.<a class="self" href="#rfc.section.2.7.1.p.4">&para;</a></p><p id="rfc.section.2.7.1.p.5">Note that the presence of a URI with a given authority component does not imply that there is always an HTTP server listening for connections on that host and port. Anyone can mint a URI. What the authority component determines is who has the right to respond authoritatively to requests that target the identified resource. The delegated nature of registered names and IP addresses creates a federated namespace, based on control over the indicated host and port, whether or not an HTTP server is present. See <a href="#establishing.authority" title="Establishing Authority">Section&nbsp;9.1</a> for security considerations related to establishing authority.<a class="self" href="#rfc.section.2.7.1.p.5">&para;</a></p><p id="rfc.section.2.7.1.p.6">When an "http" URI is used within a context that calls for access to the indicated resource, a client <em class="bcp14">MAY</em> attempt access by resolving the host to an IP address, establishing a TCP connection to that address on the indicated port, and sending an HTTP request message (<a href="#http.message" title="Message Format">Section&nbsp;3</a>) containing the URI's identifying data (<a href="#message.routing" title="Message Routing">Section&nbsp;5</a>) to the server. If the server responds to that request with a non-interim HTTP response message, as described in <a href="rfc7231.html#status.codes" title="Response Status Codes">Section 6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>, then that response is considered an authoritative answer to the client's request.<a class="self" href="#rfc.section.2.7.1.p.6">&para;</a></p><p id="rfc.section.2.7.1.p.7">Although HTTP is independent of the transport protocol, the "http" scheme is specific to TCP-based services because the name delegation process depends on TCP for establishing authority. An HTTP service based on some other underlying connection protocol would presumably be identified using a different URI scheme, just as the "https" scheme (below) is used for resources that require an end-to-end secured connection. Other protocols might also be used to provide access to "http" identified resources &#8212; it is only the authoritative interface that is specific to TCP.<a class="self" href="#rfc.section.2.7.1.p.7">&para;</a></p><p id="rfc.section.2.7.1.p.8">The URI generic syntax for authority also includes a deprecated userinfo subcomponent (<a href="#RFC3986" id="rfc.xref.RFC3986.16"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.2.1">Section 3.2.1</a>) for including user authentication information in the URI. Some implementations make use of the userinfo component for internal configuration of authentication information, such as within command invocation options, configuration files, or bookmark lists, even though such usage might expose a user identifier or password. A sender <em class="bcp14">MUST NOT</em> generate the userinfo subcomponent (and its "@" delimiter) when an "http" URI reference is generated within a message as a request target or header field value. Before making use of an "http" URI reference received from an untrusted source, a recipient <em class="bcp14">SHOULD</em> parse for userinfo and treat its presence as an error; it is likely being used to obscure the authority for the sake of phishing attacks.<a class="self" href="#rfc.section.2.7.1.p.8">&para;</a></p></div><div id="https.uri"><h3 id="rfc.section.2.7.2"><a href="#rfc.section.2.7.2">2.7.2</a>&nbsp;<a href="#https.uri">https URI Scheme</a></h3><p id="rfc.section.2.7.2.p.1">The "https" URI scheme is hereby defined for the purpose of minting identifiers according to their association with the hierarchical namespace governed by a potential HTTP origin server listening to a given TCP port for TLS-secured connections (<a href="#RFC5246" id="rfc.xref.RFC5246.2"><cite title="The Transport Layer Security (TLS) Protocol Version 1.2">[RFC5246]</cite></a>).<a class="self" href="#rfc.section.2.7.2.p.1">&para;</a></p><p id="rfc.section.2.7.2.p.2">All of the requirements listed above for the "http" scheme are also requirements for the "https" scheme, except that TCP port 443 is the default if the port subcomponent is empty or not given, and the user agent <em class="bcp14">MUST</em> ensure that its connection to the origin server is secured through the use of strong encryption, end-to-end, prior to sending the first HTTP request.<a class="self" href="#rfc.section.2.7.2.p.2">&para;</a></p><div id="rfc.figure.u.9"><pre class="inline"><span id="rfc.iref.g.16"></span>  <a href="#https.uri" class="smpl">https-URI</a> = "https:" "//" <a href="#uri" class="smpl">authority</a> <a href="#uri" class="smpl">path-abempty</a> [ "?" <a href="#uri" class="smpl">query</a> ] 
     554</pre></div><div id="rfc.section.2.7.1.p.2"><p>The origin server for an "http" URI is identified by the <a href="#uri" class="smpl">authority</a> component, which includes a host identifier and optional TCP port (<a href="#RFC3986" id="rfc.xref.RFC3986.14"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.2.2">Section 3.2.2</a>). The hierarchical path component and optional query component serve as an identifier for a potential target resource within that origin server's name space. The optional fragment component allows for indirect identification of a secondary resource, independent of the URI scheme, as defined in <a href="https://tools.ietf.org/html/rfc3986#section-3.5">Section 3.5</a> of <a href="#RFC3986" id="rfc.xref.RFC3986.15"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>.<a class="self" href="#rfc.section.2.7.1.p.2">&para;</a></p></div><div id="rfc.section.2.7.1.p.3"><p>A sender <em class="bcp14">MUST NOT</em> generate an "http" URI with an empty host identifier. A recipient that processes such a URI reference <em class="bcp14">MUST</em> reject it as invalid.<a class="self" href="#rfc.section.2.7.1.p.3">&para;</a></p></div><div id="rfc.section.2.7.1.p.4"><p>If the host identifier is provided as an IP address, the origin server is the listener (if any) on the indicated TCP port at that IP address. If host is a registered name, the registered name is an indirect identifier for use with a name resolution service, such as DNS, to find an address for that origin server. If the port subcomponent is empty or not given, TCP port 80 (the reserved port for WWW services) is the default.<a class="self" href="#rfc.section.2.7.1.p.4">&para;</a></p></div><div id="rfc.section.2.7.1.p.5"><p>Note that the presence of a URI with a given authority component does not imply that there is always an HTTP server listening for connections on that host and port. Anyone can mint a URI. What the authority component determines is who has the right to respond authoritatively to requests that target the identified resource. The delegated nature of registered names and IP addresses creates a federated namespace, based on control over the indicated host and port, whether or not an HTTP server is present. See <a href="#establishing.authority" title="Establishing Authority">Section&nbsp;9.1</a> for security considerations related to establishing authority.<a class="self" href="#rfc.section.2.7.1.p.5">&para;</a></p></div><div id="rfc.section.2.7.1.p.6"><p>When an "http" URI is used within a context that calls for access to the indicated resource, a client <em class="bcp14">MAY</em> attempt access by resolving the host to an IP address, establishing a TCP connection to that address on the indicated port, and sending an HTTP request message (<a href="#http.message" title="Message Format">Section&nbsp;3</a>) containing the URI's identifying data (<a href="#message.routing" title="Message Routing">Section&nbsp;5</a>) to the server. If the server responds to that request with a non-interim HTTP response message, as described in <a href="rfc7231.html#status.codes" title="Response Status Codes">Section 6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>, then that response is considered an authoritative answer to the client's request.<a class="self" href="#rfc.section.2.7.1.p.6">&para;</a></p></div><div id="rfc.section.2.7.1.p.7"><p>Although HTTP is independent of the transport protocol, the "http" scheme is specific to TCP-based services because the name delegation process depends on TCP for establishing authority. An HTTP service based on some other underlying connection protocol would presumably be identified using a different URI scheme, just as the "https" scheme (below) is used for resources that require an end-to-end secured connection. Other protocols might also be used to provide access to "http" identified resources &#8212; it is only the authoritative interface that is specific to TCP.<a class="self" href="#rfc.section.2.7.1.p.7">&para;</a></p></div><div id="rfc.section.2.7.1.p.8"><p>The URI generic syntax for authority also includes a deprecated userinfo subcomponent (<a href="#RFC3986" id="rfc.xref.RFC3986.16"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.2.1">Section 3.2.1</a>) for including user authentication information in the URI. Some implementations make use of the userinfo component for internal configuration of authentication information, such as within command invocation options, configuration files, or bookmark lists, even though such usage might expose a user identifier or password. A sender <em class="bcp14">MUST NOT</em> generate the userinfo subcomponent (and its "@" delimiter) when an "http" URI reference is generated within a message as a request target or header field value. Before making use of an "http" URI reference received from an untrusted source, a recipient <em class="bcp14">SHOULD</em> parse for userinfo and treat its presence as an error; it is likely being used to obscure the authority for the sake of phishing attacks.<a class="self" href="#rfc.section.2.7.1.p.8">&para;</a></p></div></div><div id="https.uri"><h3 id="rfc.section.2.7.2"><a href="#rfc.section.2.7.2">2.7.2</a>&nbsp;<a href="#https.uri">https URI Scheme</a></h3><div id="rfc.section.2.7.2.p.1"><p>The "https" URI scheme is hereby defined for the purpose of minting identifiers according to their association with the hierarchical namespace governed by a potential HTTP origin server listening to a given TCP port for TLS-secured connections (<a href="#RFC5246" id="rfc.xref.RFC5246.2"><cite title="The Transport Layer Security (TLS) Protocol Version 1.2">[RFC5246]</cite></a>).<a class="self" href="#rfc.section.2.7.2.p.1">&para;</a></p></div><div id="rfc.section.2.7.2.p.2"><p>All of the requirements listed above for the "http" scheme are also requirements for the "https" scheme, except that TCP port 443 is the default if the port subcomponent is empty or not given, and the user agent <em class="bcp14">MUST</em> ensure that its connection to the origin server is secured through the use of strong encryption, end-to-end, prior to sending the first HTTP request.<a class="self" href="#rfc.section.2.7.2.p.2">&para;</a></p></div><div id="rfc.figure.u.9"><pre class="inline"><span id="rfc.iref.g.16"></span>  <a href="#https.uri" class="smpl">https-URI</a> = "https:" "//" <a href="#uri" class="smpl">authority</a> <a href="#uri" class="smpl">path-abempty</a> [ "?" <a href="#uri" class="smpl">query</a> ] 
    575555              [ "#" <a href="#uri" class="smpl">fragment</a> ] 
    576 </pre></div><p id="rfc.section.2.7.2.p.3">Note that the "https" URI scheme depends on both TLS and TCP for establishing authority. Resources made available via the "https" scheme have no shared identity with the "http" scheme even if their resource identifiers indicate the same authority (the same host listening to the same TCP port). They are distinct namespaces and are considered to be distinct origin servers. However, an extension to HTTP that is defined to apply to entire host domains, such as the Cookie protocol <a href="#RFC6265" id="rfc.xref.RFC6265.1"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>, can allow information set by one service to impact communication with other services within a matching group of host domains.<a class="self" href="#rfc.section.2.7.2.p.3">&para;</a></p><p id="rfc.section.2.7.2.p.4">The process for authoritative access to an "https" identified resource is defined in <a href="#RFC2818" id="rfc.xref.RFC2818.2"><cite title="HTTP Over TLS">[RFC2818]</cite></a>.<a class="self" href="#rfc.section.2.7.2.p.4">&para;</a></p></div><div id="uri.comparison"><h3 id="rfc.section.2.7.3"><a href="#rfc.section.2.7.3">2.7.3</a>&nbsp;<a href="#uri.comparison">http and https URI Normalization and Comparison</a></h3><p id="rfc.section.2.7.3.p.1">Since the "http" and "https" schemes conform to the URI generic syntax, such URIs are normalized and compared according to the algorithm defined in <a href="https://tools.ietf.org/html/rfc3986#section-6">Section 6</a> of <a href="#RFC3986" id="rfc.xref.RFC3986.17"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, using the defaults described above for each scheme.<a class="self" href="#rfc.section.2.7.3.p.1">&para;</a></p><p id="rfc.section.2.7.3.p.2">If the port is equal to the default port for a scheme, the normal form is to omit the port subcomponent. When not being used in absolute form as the request target of an OPTIONS request, an empty path component is equivalent to an absolute path of "/", so the normal form is to provide a path of "/" instead. The scheme and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner. Characters other than those in the "reserved" set are equivalent to their percent-encoded octets: the normal form is to not encode them (see Sections <a href="https://tools.ietf.org/html/rfc3986#section-2.1" id="rfc.xref.RFC3986.18">2.1</a> and <a href="https://tools.ietf.org/html/rfc3986#section-2.2" id="rfc.xref.RFC3986.19">2.2</a> of <a href="#RFC3986" id="rfc.xref.RFC3986.20"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>).<a class="self" href="#rfc.section.2.7.3.p.2">&para;</a></p><p id="rfc.section.2.7.3.p.3">For example, the following three URIs are equivalent:<a class="self" href="#rfc.section.2.7.3.p.3">&para;</a></p><div id="rfc.figure.u.10"><pre class="text">   http://example.com:80/~smith/home.html 
     556</pre></div><div id="rfc.section.2.7.2.p.3"><p>Note that the "https" URI scheme depends on both TLS and TCP for establishing authority. Resources made available via the "https" scheme have no shared identity with the "http" scheme even if their resource identifiers indicate the same authority (the same host listening to the same TCP port). They are distinct namespaces and are considered to be distinct origin servers. However, an extension to HTTP that is defined to apply to entire host domains, such as the Cookie protocol <a href="#RFC6265" id="rfc.xref.RFC6265.1"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>, can allow information set by one service to impact communication with other services within a matching group of host domains.<a class="self" href="#rfc.section.2.7.2.p.3">&para;</a></p></div><div id="rfc.section.2.7.2.p.4"><p>The process for authoritative access to an "https" identified resource is defined in <a href="#RFC2818" id="rfc.xref.RFC2818.2"><cite title="HTTP Over TLS">[RFC2818]</cite></a>.<a class="self" href="#rfc.section.2.7.2.p.4">&para;</a></p></div></div><div id="uri.comparison"><h3 id="rfc.section.2.7.3"><a href="#rfc.section.2.7.3">2.7.3</a>&nbsp;<a href="#uri.comparison">http and https URI Normalization and Comparison</a></h3><div id="rfc.section.2.7.3.p.1"><p>Since the "http" and "https" schemes conform to the URI generic syntax, such URIs are normalized and compared according to the algorithm defined in <a href="https://tools.ietf.org/html/rfc3986#section-6">Section 6</a> of <a href="#RFC3986" id="rfc.xref.RFC3986.17"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, using the defaults described above for each scheme.<a class="self" href="#rfc.section.2.7.3.p.1">&para;</a></p></div><div id="rfc.section.2.7.3.p.2"><p>If the port is equal to the default port for a scheme, the normal form is to omit the port subcomponent. When not being used in absolute form as the request target of an OPTIONS request, an empty path component is equivalent to an absolute path of "/", so the normal form is to provide a path of "/" instead. The scheme and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner. Characters other than those in the "reserved" set are equivalent to their percent-encoded octets: the normal form is to not encode them (see Sections <a href="https://tools.ietf.org/html/rfc3986#section-2.1" id="rfc.xref.RFC3986.18">2.1</a> and <a href="https://tools.ietf.org/html/rfc3986#section-2.2" id="rfc.xref.RFC3986.19">2.2</a> of <a href="#RFC3986" id="rfc.xref.RFC3986.20"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>).<a class="self" href="#rfc.section.2.7.3.p.2">&para;</a></p></div><div id="rfc.section.2.7.3.p.3"><p>For example, the following three URIs are equivalent:<a class="self" href="#rfc.section.2.7.3.p.3">&para;</a></p></div><div id="rfc.figure.u.10"><pre class="text">   http://example.com:80/~smith/home.html 
    577557   http://EXAMPLE.com/%7Esmith/home.html 
    578558   http://EXAMPLE.com:/%7esmith/home.html 
    579 </pre></div></div></div></div><div id="http.message"><h1 id="rfc.section.3"><a href="#rfc.section.3">3.</a>&nbsp;<a href="#http.message">Message Format</a></h1><p id="rfc.section.3.p.1">All HTTP/1.1 messages consist of a start-line followed by a sequence of octets in a format similar to the Internet Message Format <a href="#RFC5322" id="rfc.xref.RFC5322.2"><cite title="Internet Message Format">[RFC5322]</cite></a>: zero or more header fields (collectively referred to as the "headers" or the "header section"), an empty line indicating the end of the header section, and an optional message body.<a class="self" href="#rfc.section.3.p.1">&para;</a></p><div id="rfc.figure.u.11"><pre class="inline"><span id="rfc.iref.g.17"></span>  <a href="#http.message" class="smpl">HTTP-message</a>   = <a href="#http.message" class="smpl">start-line</a> 
     559</pre></div></div></div></div><div id="http.message"><h1 id="rfc.section.3"><a href="#rfc.section.3">3.</a>&nbsp;<a href="#http.message">Message Format</a></h1><div id="rfc.section.3.p.1"><p>All HTTP/1.1 messages consist of a start-line followed by a sequence of octets in a format similar to the Internet Message Format <a href="#RFC5322" id="rfc.xref.RFC5322.2"><cite title="Internet Message Format">[RFC5322]</cite></a>: zero or more header fields (collectively referred to as the "headers" or the "header section"), an empty line indicating the end of the header section, and an optional message body.<a class="self" href="#rfc.section.3.p.1">&para;</a></p></div><div id="rfc.figure.u.11"><pre class="inline"><span id="rfc.iref.g.17"></span>  <a href="#http.message" class="smpl">HTTP-message</a>   = <a href="#http.message" class="smpl">start-line</a> 
    580560                   *( <a href="#header.fields" class="smpl">header-field</a> <a href="#core.rules" class="smpl">CRLF</a> ) 
    581561                   <a href="#core.rules" class="smpl">CRLF</a> 
    582562                   [ <a href="#message.body" class="smpl">message-body</a> ] 
    583 </pre></div><p id="rfc.section.3.p.2">The normal procedure for parsing an HTTP message is to read the start-line into a structure, read each header field into a hash table by field name until the empty line, and then use the parsed data to determine if a message body is expected. If a message body has been indicated, then it is read as a stream until an amount of octets equal to the message body length is read or the connection is closed.<a class="self" href="#rfc.section.3.p.2">&para;</a></p><p id="rfc.section.3.p.3">A recipient <em class="bcp14">MUST</em> parse an HTTP message as a sequence of octets in an encoding that is a superset of US-ASCII <a href="#USASCII" id="rfc.xref.USASCII.2"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a>. Parsing an HTTP message as a stream of Unicode characters, without regard for the specific encoding, creates security vulnerabilities due to the varying ways that string processing libraries handle invalid multibyte character sequences that contain the octet LF (%x0A). String-based parsers can only be safely used within protocol elements after the element has been extracted from the message, such as within a header field-value after message parsing has delineated the individual fields.<a class="self" href="#rfc.section.3.p.3">&para;</a></p><p id="rfc.section.3.p.4">An HTTP message can be parsed as a stream for incremental processing or forwarding downstream. However, recipients cannot rely on incremental delivery of partial messages, since some implementations will buffer or delay message forwarding for the sake of network efficiency, security checks, or payload transformations.<a class="self" href="#rfc.section.3.p.4">&para;</a></p><p id="rfc.section.3.p.5">A sender <em class="bcp14">MUST NOT</em> send whitespace between the start-line and the first header field. A recipient that receives whitespace between the start-line and the first header field <em class="bcp14">MUST</em> either reject the message as invalid or consume each whitespace-preceded line without further processing of it (i.e., ignore the entire line, along with any subsequent lines preceded by whitespace, until a properly formed header field is received or the header section is terminated).<a class="self" href="#rfc.section.3.p.5">&para;</a></p><p id="rfc.section.3.p.6">The presence of such whitespace in a request might be an attempt to trick a server into ignoring that field or processing the line after it as a new request, either of which might result in a security vulnerability if other implementations within the request chain interpret the same message differently. Likewise, the presence of such whitespace in a response might be ignored by some clients or cause others to cease parsing.<a class="self" href="#rfc.section.3.p.6">&para;</a></p><div id="start.line"><h2 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1</a>&nbsp;<a href="#start.line">Start Line</a></h2><p id="rfc.section.3.1.p.1">An HTTP message can be either a request from client to server or a response from server to client. Syntactically, the two types of message differ only in the start-line, which is either a request-line (for requests) or a status-line (for responses), and in the algorithm for determining the length of the message body (<a href="#message.body" title="Message Body">Section&nbsp;3.3</a>).<a class="self" href="#rfc.section.3.1.p.1">&para;</a></p><p id="rfc.section.3.1.p.2">In theory, a client could receive requests and a server could receive responses, distinguishing them by their different start-line formats, but, in practice, servers are implemented to only expect a request (a response is interpreted as an unknown or invalid request method) and clients are implemented to only expect a response.<a class="self" href="#rfc.section.3.1.p.2">&para;</a></p><div id="rfc.figure.u.12"><pre class="inline"><span id="rfc.iref.g.18"></span>  <a href="#http.message" class="smpl">start-line</a>     = <a href="#request.line" class="smpl">request-line</a> / <a href="#status.line" class="smpl">status-line</a> 
    584 </pre></div><div id="request.line"><h3 id="rfc.section.3.1.1"><a href="#rfc.section.3.1.1">3.1.1</a>&nbsp;<a href="#request.line">Request Line</a></h3><p id="rfc.section.3.1.1.p.1">A request-line begins with a method token, followed by a single space (SP), the request-target, another single space (SP), the protocol version, and ends with CRLF.<a class="self" href="#rfc.section.3.1.1.p.1">&para;</a></p><div id="rfc.figure.u.13"><pre class="inline"><span id="rfc.iref.g.19"></span>  <a href="#request.line" class="smpl">request-line</a>   = <a href="#method" class="smpl">method</a> <a href="#core.rules" class="smpl">SP</a> <a href="#request-target" class="smpl">request-target</a> <a href="#core.rules" class="smpl">SP</a> <a href="#http.version" class="smpl">HTTP-version</a> <a href="#core.rules" class="smpl">CRLF</a> 
    585 </pre></div><div id="rfc.iref.m.2"></div><div id="method"><p id="rfc.section.3.1.1.p.2">The method token indicates the request method to be performed on the target resource. The request method is case-sensitive.<a class="self" href="#rfc.section.3.1.1.p.2">&para;</a></p></div><div id="rfc.figure.u.14"><pre class="inline"><span id="rfc.iref.g.20"></span>  <a href="#method" class="smpl">method</a>         = <a href="#rule.token.separators" class="smpl">token</a> 
    586 </pre></div><p id="rfc.section.3.1.1.p.3">The request methods defined by this specification can be found in <a href="rfc7231.html#methods" title="Request Methods">Section 4</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.6"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>, along with information regarding the HTTP method registry and considerations for defining new methods.<a class="self" href="#rfc.section.3.1.1.p.3">&para;</a></p><div id="rfc.iref.r.5"></div><p id="rfc.section.3.1.1.p.4">The request-target identifies the target resource upon which to apply the request, as defined in <a href="#request-target" title="Request Target">Section&nbsp;5.3</a>.<a class="self" href="#rfc.section.3.1.1.p.4">&para;</a></p><p id="rfc.section.3.1.1.p.5">Recipients typically parse the request-line into its component parts by splitting on whitespace (see <a href="#message.robustness" title="Message Parsing Robustness">Section&nbsp;3.5</a>), since no whitespace is allowed in the three components. Unfortunately, some user agents fail to properly encode or exclude whitespace found in hypertext references, resulting in those disallowed characters being sent in a request-target.<a class="self" href="#rfc.section.3.1.1.p.5">&para;</a></p><p id="rfc.section.3.1.1.p.6">Recipients of an invalid request-line <em class="bcp14">SHOULD</em> respond with either a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> error or a <a href="rfc7231.html#status.301" class="smpl">301 (Moved Permanently)</a> redirect with the request-target properly encoded. A recipient <em class="bcp14">SHOULD NOT</em> attempt to autocorrect and then process the request without a redirect, since the invalid request-line might be deliberately crafted to bypass security filters along the request chain.<a class="self" href="#rfc.section.3.1.1.p.6">&para;</a></p><p id="rfc.section.3.1.1.p.7">HTTP does not place a predefined limit on the length of a request-line, as described in <a href="#conformance" title="Conformance and Error Handling">Section&nbsp;2.5</a>. A server that receives a method longer than any that it implements <em class="bcp14">SHOULD</em> respond with a <a href="rfc7231.html#status.501" class="smpl">501 (Not Implemented)</a> status code. A server that receives a request-target longer than any URI it wishes to parse <em class="bcp14">MUST</em> respond with a <a href="rfc7231.html#status.414" class="smpl">414 (URI Too Long)</a> status code (see <a href="rfc7231.html#status.414" title="414 URI Too Long">Section 6.5.12</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.7"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.3.1.1.p.7">&para;</a></p><p id="rfc.section.3.1.1.p.8">Various ad hoc limitations on request-line length are found in practice. It is <em class="bcp14">RECOMMENDED</em> that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets.<a class="self" href="#rfc.section.3.1.1.p.8">&para;</a></p></div><div id="status.line"><h3 id="rfc.section.3.1.2"><a href="#rfc.section.3.1.2">3.1.2</a>&nbsp;<a href="#status.line">Status Line</a></h3><p id="rfc.section.3.1.2.p.1">The first line of a response message is the status-line, consisting of the protocol version, a space (SP), the status code, another space, a possibly empty textual phrase describing the status code, and ending with CRLF.<a class="self" href="#rfc.section.3.1.2.p.1">&para;</a></p><div id="rfc.figure.u.15"><pre class="inline"><span id="rfc.iref.g.21"></span>  <a href="#status.line" class="smpl">status-line</a> = <a href="#http.version" class="smpl">HTTP-version</a> <a href="#core.rules" class="smpl">SP</a> <a href="#status.line" class="smpl">status-code</a> <a href="#core.rules" class="smpl">SP</a> <a href="#status.line" class="smpl">reason-phrase</a> <a href="#core.rules" class="smpl">CRLF</a> 
    587 </pre></div><p id="rfc.section.3.1.2.p.2">The status-code element is a 3-digit integer code describing the result of the server's attempt to understand and satisfy the client's corresponding request. The rest of the response message is to be interpreted in light of the semantics defined for that status code. See <a href="rfc7231.html#status.codes" title="Response Status Codes">Section 6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.8"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a> for information about the semantics of status codes, including the classes of status code (indicated by the first digit), the status codes defined by this specification, considerations for the definition of new status codes, and the IANA registry.<a class="self" href="#rfc.section.3.1.2.p.2">&para;</a></p><div id="rfc.figure.u.16"><pre class="inline"><span id="rfc.iref.g.22"></span>  <a href="#status.line" class="smpl">status-code</a>    = 3<a href="#core.rules" class="smpl">DIGIT</a> 
    588 </pre></div><p id="rfc.section.3.1.2.p.3">The reason-phrase element exists for the sole purpose of providing a textual description associated with the numeric status code, mostly out of deference to earlier Internet application protocols that were more frequently used with interactive text clients. A client <em class="bcp14">SHOULD</em> ignore the reason-phrase content.<a class="self" href="#rfc.section.3.1.2.p.3">&para;</a></p><div id="rfc.figure.u.17"><pre class="inline"><span id="rfc.iref.g.23"></span>  <a href="#status.line" class="smpl">reason-phrase</a>  = *( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> ) 
    589 </pre></div></div></div><div id="header.fields"><h2 id="rfc.section.3.2"><a href="#rfc.section.3.2">3.2</a>&nbsp;<a href="#header.fields">Header Fields</a></h2><p id="rfc.section.3.2.p.1">Each header field consists of a case-insensitive field name followed by a colon (":"), optional leading whitespace, the field value, and optional trailing whitespace.<a class="self" href="#rfc.section.3.2.p.1">&para;</a></p><div id="rfc.figure.u.18"><pre class="inline"><span id="rfc.iref.g.24"></span><span id="rfc.iref.g.25"></span><span id="rfc.iref.g.26"></span><span id="rfc.iref.g.27"></span><span id="rfc.iref.g.28"></span><span id="rfc.iref.g.29"></span>  <a href="#header.fields" class="smpl">header-field</a>   = <a href="#header.fields" class="smpl">field-name</a> ":" <a href="#rule.whitespace" class="smpl">OWS</a> <a href="#header.fields" class="smpl">field-value</a> <a href="#rule.whitespace" class="smpl">OWS</a> 
     563</pre></div><div id="rfc.section.3.p.2"><p>The normal procedure for parsing an HTTP message is to read the start-line into a structure, read each header field into a hash table by field name until the empty line, and then use the parsed data to determine if a message body is expected. If a message body has been indicated, then it is read as a stream until an amount of octets equal to the message body length is read or the connection is closed.<a class="self" href="#rfc.section.3.p.2">&para;</a></p></div><div id="rfc.section.3.p.3"><p>A recipient <em class="bcp14">MUST</em> parse an HTTP message as a sequence of octets in an encoding that is a superset of US-ASCII <a href="#USASCII" id="rfc.xref.USASCII.2"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a>. Parsing an HTTP message as a stream of Unicode characters, without regard for the specific encoding, creates security vulnerabilities due to the varying ways that string processing libraries handle invalid multibyte character sequences that contain the octet LF (%x0A). String-based parsers can only be safely used within protocol elements after the element has been extracted from the message, such as within a header field-value after message parsing has delineated the individual fields.<a class="self" href="#rfc.section.3.p.3">&para;</a></p></div><div id="rfc.section.3.p.4"><p>An HTTP message can be parsed as a stream for incremental processing or forwarding downstream. However, recipients cannot rely on incremental delivery of partial messages, since some implementations will buffer or delay message forwarding for the sake of network efficiency, security checks, or payload transformations.<a class="self" href="#rfc.section.3.p.4">&para;</a></p></div><div id="rfc.section.3.p.5"><p>A sender <em class="bcp14">MUST NOT</em> send whitespace between the start-line and the first header field. A recipient that receives whitespace between the start-line and the first header field <em class="bcp14">MUST</em> either reject the message as invalid or consume each whitespace-preceded line without further processing of it (i.e., ignore the entire line, along with any subsequent lines preceded by whitespace, until a properly formed header field is received or the header section is terminated).<a class="self" href="#rfc.section.3.p.5">&para;</a></p></div><div id="rfc.section.3.p.6"><p>The presence of such whitespace in a request might be an attempt to trick a server into ignoring that field or processing the line after it as a new request, either of which might result in a security vulnerability if other implementations within the request chain interpret the same message differently. Likewise, the presence of such whitespace in a response might be ignored by some clients or cause others to cease parsing.<a class="self" href="#rfc.section.3.p.6">&para;</a></p></div><div id="start.line"><h2 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1</a>&nbsp;<a href="#start.line">Start Line</a></h2><div id="rfc.section.3.1.p.1"><p>An HTTP message can be either a request from client to server or a response from server to client. Syntactically, the two types of message differ only in the start-line, which is either a request-line (for requests) or a status-line (for responses), and in the algorithm for determining the length of the message body (<a href="#message.body" title="Message Body">Section&nbsp;3.3</a>).<a class="self" href="#rfc.section.3.1.p.1">&para;</a></p></div><div id="rfc.section.3.1.p.2"><p>In theory, a client could receive requests and a server could receive responses, distinguishing them by their different start-line formats, but, in practice, servers are implemented to only expect a request (a response is interpreted as an unknown or invalid request method) and clients are implemented to only expect a response.<a class="self" href="#rfc.section.3.1.p.2">&para;</a></p></div><div id="rfc.figure.u.12"><pre class="inline"><span id="rfc.iref.g.18"></span>  <a href="#http.message" class="smpl">start-line</a>     = <a href="#request.line" class="smpl">request-line</a> / <a href="#status.line" class="smpl">status-line</a> 
     564</pre></div><div id="request.line"><h3 id="rfc.section.3.1.1"><a href="#rfc.section.3.1.1">3.1.1</a>&nbsp;<a href="#request.line">Request Line</a></h3><div id="rfc.section.3.1.1.p.1"><p>A request-line begins with a method token, followed by a single space (SP), the request-target, another single space (SP), the protocol version, and ends with CRLF.<a class="self" href="#rfc.section.3.1.1.p.1">&para;</a></p></div><div id="rfc.figure.u.13"><pre class="inline"><span id="rfc.iref.g.19"></span>  <a href="#request.line" class="smpl">request-line</a>   = <a href="#method" class="smpl">method</a> <a href="#core.rules" class="smpl">SP</a> <a href="#request-target" class="smpl">request-target</a> <a href="#core.rules" class="smpl">SP</a> <a href="#http.version" class="smpl">HTTP-version</a> <a href="#core.rules" class="smpl">CRLF</a> 
     565</pre></div><div id="rfc.iref.m.2"></div><div id="method"><div id="rfc.section.3.1.1.p.2"><p>The method token indicates the request method to be performed on the target resource. The request method is case-sensitive.<a class="self" href="#rfc.section.3.1.1.p.2">&para;</a></p></div></div><div id="rfc.figure.u.14"><pre class="inline"><span id="rfc.iref.g.20"></span>  <a href="#method" class="smpl">method</a>         = <a href="#rule.token.separators" class="smpl">token</a> 
     566</pre></div><div id="rfc.section.3.1.1.p.3"><p>The request methods defined by this specification can be found in <a href="rfc7231.html#methods" title="Request Methods">Section 4</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.6"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>, along with information regarding the HTTP method registry and considerations for defining new methods.<a class="self" href="#rfc.section.3.1.1.p.3">&para;</a></p></div><div id="rfc.iref.r.5"></div><div id="rfc.section.3.1.1.p.4"><p>The request-target identifies the target resource upon which to apply the request, as defined in <a href="#request-target" title="Request Target">Section&nbsp;5.3</a>.<a class="self" href="#rfc.section.3.1.1.p.4">&para;</a></p></div><div id="rfc.section.3.1.1.p.5"><p>Recipients typically parse the request-line into its component parts by splitting on whitespace (see <a href="#message.robustness" title="Message Parsing Robustness">Section&nbsp;3.5</a>), since no whitespace is allowed in the three components. Unfortunately, some user agents fail to properly encode or exclude whitespace found in hypertext references, resulting in those disallowed characters being sent in a request-target.<a class="self" href="#rfc.section.3.1.1.p.5">&para;</a></p></div><div id="rfc.section.3.1.1.p.6"><p>Recipients of an invalid request-line <em class="bcp14">SHOULD</em> respond with either a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> error or a <a href="rfc7231.html#status.301" class="smpl">301 (Moved Permanently)</a> redirect with the request-target properly encoded. A recipient <em class="bcp14">SHOULD NOT</em> attempt to autocorrect and then process the request without a redirect, since the invalid request-line might be deliberately crafted to bypass security filters along the request chain.<a class="self" href="#rfc.section.3.1.1.p.6">&para;</a></p></div><div id="rfc.section.3.1.1.p.7"><p>HTTP does not place a predefined limit on the length of a request-line, as described in <a href="#conformance" title="Conformance and Error Handling">Section&nbsp;2.5</a>. A server that receives a method longer than any that it implements <em class="bcp14">SHOULD</em> respond with a <a href="rfc7231.html#status.501" class="smpl">501 (Not Implemented)</a> status code. A server that receives a request-target longer than any URI it wishes to parse <em class="bcp14">MUST</em> respond with a <a href="rfc7231.html#status.414" class="smpl">414 (URI Too Long)</a> status code (see <a href="rfc7231.html#status.414" title="414 URI Too Long">Section 6.5.12</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.7"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.3.1.1.p.7">&para;</a></p></div><div id="rfc.section.3.1.1.p.8"><p>Various ad hoc limitations on request-line length are found in practice. It is <em class="bcp14">RECOMMENDED</em> that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets.<a class="self" href="#rfc.section.3.1.1.p.8">&para;</a></p></div></div><div id="status.line"><h3 id="rfc.section.3.1.2"><a href="#rfc.section.3.1.2">3.1.2</a>&nbsp;<a href="#status.line">Status Line</a></h3><div id="rfc.section.3.1.2.p.1"><p>The first line of a response message is the status-line, consisting of the protocol version, a space (SP), the status code, another space, a possibly empty textual phrase describing the status code, and ending with CRLF.<a class="self" href="#rfc.section.3.1.2.p.1">&para;</a></p></div><div id="rfc.figure.u.15"><pre class="inline"><span id="rfc.iref.g.21"></span>  <a href="#status.line" class="smpl">status-line</a> = <a href="#http.version" class="smpl">HTTP-version</a> <a href="#core.rules" class="smpl">SP</a> <a href="#status.line" class="smpl">status-code</a> <a href="#core.rules" class="smpl">SP</a> <a href="#status.line" class="smpl">reason-phrase</a> <a href="#core.rules" class="smpl">CRLF</a> 
     567</pre></div><div id="rfc.section.3.1.2.p.2"><p>The status-code element is a 3-digit integer code describing the result of the server's attempt to understand and satisfy the client's corresponding request. The rest of the response message is to be interpreted in light of the semantics defined for that status code. See <a href="rfc7231.html#status.codes" title="Response Status Codes">Section 6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.8"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a> for information about the semantics of status codes, including the classes of status code (indicated by the first digit), the status codes defined by this specification, considerations for the definition of new status codes, and the IANA registry.<a class="self" href="#rfc.section.3.1.2.p.2">&para;</a></p></div><div id="rfc.figure.u.16"><pre class="inline"><span id="rfc.iref.g.22"></span>  <a href="#status.line" class="smpl">status-code</a>    = 3<a href="#core.rules" class="smpl">DIGIT</a> 
     568</pre></div><div id="rfc.section.3.1.2.p.3"><p>The reason-phrase element exists for the sole purpose of providing a textual description associated with the numeric status code, mostly out of deference to earlier Internet application protocols that were more frequently used with interactive text clients. A client <em class="bcp14">SHOULD</em> ignore the reason-phrase content.<a class="self" href="#rfc.section.3.1.2.p.3">&para;</a></p></div><div id="rfc.figure.u.17"><pre class="inline"><span id="rfc.iref.g.23"></span>  <a href="#status.line" class="smpl">reason-phrase</a>  = *( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> ) 
     569</pre></div></div></div><div id="header.fields"><h2 id="rfc.section.3.2"><a href="#rfc.section.3.2">3.2</a>&nbsp;<a href="#header.fields">Header Fields</a></h2><div id="rfc.section.3.2.p.1"><p>Each header field consists of a case-insensitive field name followed by a colon (":"), optional leading whitespace, the field value, and optional trailing whitespace.<a class="self" href="#rfc.section.3.2.p.1">&para;</a></p></div><div id="rfc.figure.u.18"><pre class="inline"><span id="rfc.iref.g.24"></span><span id="rfc.iref.g.25"></span><span id="rfc.iref.g.26"></span><span id="rfc.iref.g.27"></span><span id="rfc.iref.g.28"></span><span id="rfc.iref.g.29"></span>  <a href="#header.fields" class="smpl">header-field</a>   = <a href="#header.fields" class="smpl">field-name</a> ":" <a href="#rule.whitespace" class="smpl">OWS</a> <a href="#header.fields" class="smpl">field-value</a> <a href="#rule.whitespace" class="smpl">OWS</a> 
    590570 
    591571  <a href="#header.fields" class="smpl">field-name</a>     = <a href="#rule.token.separators" class="smpl">token</a> 
     
    597577                 ; obsolete line folding 
    598578                 ; see <a href="#field.parsing" title="Field Parsing">Section&nbsp;3.2.4</a> 
    599 </pre></div><p id="rfc.section.3.2.p.2">The field-name token labels the corresponding field-value as having the semantics defined by that header field. For example, the <a href="rfc7231.html#header.date" class="smpl">Date</a> header field is defined in <a href="rfc7231.html#header.date" title="Date">Section 7.1.1.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.9"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a> as containing the origination timestamp for the message in which it appears.<a class="self" href="#rfc.section.3.2.p.2">&para;</a></p><div id="field.extensibility"><h3 id="rfc.section.3.2.1"><a href="#rfc.section.3.2.1">3.2.1</a>&nbsp;<a href="#field.extensibility">Field Extensibility</a></h3><p id="rfc.section.3.2.1.p.1">Header fields are fully extensible: there is no limit on the introduction of new field names, each presumably defining new semantics, nor on the number of header fields used in a given message. Existing fields are defined in each part of this specification and in many other specifications outside this document set.<a class="self" href="#rfc.section.3.2.1.p.1">&para;</a></p><p id="rfc.section.3.2.1.p.2">New header fields can be defined such that, when they are understood by a recipient, they might override or enhance the interpretation of previously defined header fields, define preconditions on request evaluation, or refine the meaning of responses.<a class="self" href="#rfc.section.3.2.1.p.2">&para;</a></p><p id="rfc.section.3.2.1.p.3">A proxy <em class="bcp14">MUST</em> forward unrecognized header fields unless the field-name is listed in the <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.1" title="Connection">Section&nbsp;6.1</a>) or the proxy is specifically configured to block, or otherwise transform, such fields. Other recipients <em class="bcp14">SHOULD</em> ignore unrecognized header fields. These requirements allow HTTP's functionality to be enhanced without requiring prior update of deployed intermediaries.<a class="self" href="#rfc.section.3.2.1.p.3">&para;</a></p><p id="rfc.section.3.2.1.p.4">All defined header fields ought to be registered with IANA in the "Message Headers" registry, as described in <a href="rfc7231.html#header.field.registry" title="Header Field Registry">Section 8.3</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.10"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>.<a class="self" href="#rfc.section.3.2.1.p.4">&para;</a></p></div><div id="field.order"><h3 id="rfc.section.3.2.2"><a href="#rfc.section.3.2.2">3.2.2</a>&nbsp;<a href="#field.order">Field Order</a></h3><p id="rfc.section.3.2.2.p.1">The order in which header fields with differing field names are received is not significant. However, it is good practice to send header fields that contain control data first, such as <a href="#header.host" class="smpl">Host</a> on requests and <a href="rfc7231.html#header.date" class="smpl">Date</a> on responses, so that implementations can decide when not to handle a message as early as possible. A server <em class="bcp14">MUST NOT</em> apply a request to the target resource until the entire request header section is received, since later header fields might include conditionals, authentication credentials, or deliberately misleading duplicate header fields that would impact request processing.<a class="self" href="#rfc.section.3.2.2.p.1">&para;</a></p><p id="rfc.section.3.2.2.p.2">A sender <em class="bcp14">MUST NOT</em> generate multiple header fields with the same field name in a message unless either the entire field value for that header field is defined as a comma-separated list [i.e., #(values)] or the header field is a well-known exception (as noted below).<a class="self" href="#rfc.section.3.2.2.p.2">&para;</a></p><p id="rfc.section.3.2.2.p.3">A recipient <em class="bcp14">MAY</em> combine multiple header fields with the same field name into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma. The order in which header fields with the same field name are received is therefore significant to the interpretation of the combined field value; a proxy <em class="bcp14">MUST NOT</em> change the order of these field values when forwarding a message.<a class="self" href="#rfc.section.3.2.2.p.3">&para;</a></p><div class="note" id="rfc.section.3.2.2.p.4"><p><b>Note:</b> In practice, the "Set-Cookie" header field (<a href="#RFC6265" id="rfc.xref.RFC6265.2"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>) often appears multiple times in a response message and does not use the list syntax, violating the above requirements on multiple header fields with the same name. Since it cannot be combined into a single field-value, recipients ought to handle "Set-Cookie" as a special case while processing header fields. (See Appendix A.2.3 of <a href="#Kri2001" id="rfc.xref.Kri2001.1"><cite title="HTTP Cookies: Standards, Privacy, and Politics">[Kri2001]</cite></a> for details.)</p> </div></div><div id="whitespace"><h3 id="rfc.section.3.2.3"><a href="#rfc.section.3.2.3">3.2.3</a>&nbsp;<a href="#whitespace">Whitespace</a></h3><div id="rule.LWS"><p id="rfc.section.3.2.3.p.1">This specification uses three rules to denote the use of linear whitespace: OWS (optional whitespace), RWS (required whitespace), and BWS ("bad" whitespace).<a class="self" href="#rfc.section.3.2.3.p.1">&para;</a></p></div><div id="rule.OWS"><p id="rfc.section.3.2.3.p.2">The OWS rule is used where zero or more linear whitespace octets might appear. For protocol elements where optional whitespace is preferred to improve readability, a sender <em class="bcp14">SHOULD</em> generate the optional whitespace as a single SP; otherwise, a sender <em class="bcp14">SHOULD NOT</em> generate optional whitespace except as needed to white out invalid or unwanted protocol elements during in-place message filtering.<a class="self" href="#rfc.section.3.2.3.p.2">&para;</a></p></div><div id="rule.RWS"><p id="rfc.section.3.2.3.p.3">The RWS rule is used when at least one linear whitespace octet is required to separate field tokens. A sender <em class="bcp14">SHOULD</em> generate RWS as a single SP.<a class="self" href="#rfc.section.3.2.3.p.3">&para;</a></p></div><div id="rule.BWS"><p id="rfc.section.3.2.3.p.4">The BWS rule is used where the grammar allows optional whitespace only for historical reasons. A sender <em class="bcp14">MUST NOT</em> generate BWS in messages. A recipient <em class="bcp14">MUST</em> parse for such bad whitespace and remove it before interpreting the protocol element.<a class="self" href="#rfc.section.3.2.3.p.4">&para;</a></p></div><div id="rule.whitespace"></div><div id="rfc.figure.u.19"><pre class="inline"><span id="rfc.iref.g.30"></span><span id="rfc.iref.g.31"></span><span id="rfc.iref.g.32"></span>  <a href="#rule.whitespace" class="smpl">OWS</a>            = *( <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">HTAB</a> ) 
     579</pre></div><div id="rfc.section.3.2.p.2"><p>The field-name token labels the corresponding field-value as having the semantics defined by that header field. For example, the <a href="rfc7231.html#header.date" class="smpl">Date</a> header field is defined in <a href="rfc7231.html#header.date" title="Date">Section 7.1.1.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.9"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a> as containing the origination timestamp for the message in which it appears.<a class="self" href="#rfc.section.3.2.p.2">&para;</a></p></div><div id="field.extensibility"><h3 id="rfc.section.3.2.1"><a href="#rfc.section.3.2.1">3.2.1</a>&nbsp;<a href="#field.extensibility">Field Extensibility</a></h3><div id="rfc.section.3.2.1.p.1"><p>Header fields are fully extensible: there is no limit on the introduction of new field names, each presumably defining new semantics, nor on the number of header fields used in a given message. Existing fields are defined in each part of this specification and in many other specifications outside this document set.<a class="self" href="#rfc.section.3.2.1.p.1">&para;</a></p></div><div id="rfc.section.3.2.1.p.2"><p>New header fields can be defined such that, when they are understood by a recipient, they might override or enhance the interpretation of previously defined header fields, define preconditions on request evaluation, or refine the meaning of responses.<a class="self" href="#rfc.section.3.2.1.p.2">&para;</a></p></div><div id="rfc.section.3.2.1.p.3"><p>A proxy <em class="bcp14">MUST</em> forward unrecognized header fields unless the field-name is listed in the <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.1" title="Connection">Section&nbsp;6.1</a>) or the proxy is specifically configured to block, or otherwise transform, such fields. Other recipients <em class="bcp14">SHOULD</em> ignore unrecognized header fields. These requirements allow HTTP's functionality to be enhanced without requiring prior update of deployed intermediaries.<a class="self" href="#rfc.section.3.2.1.p.3">&para;</a></p></div><div id="rfc.section.3.2.1.p.4"><p>All defined header fields ought to be registered with IANA in the "Message Headers" registry, as described in <a href="rfc7231.html#header.field.registry" title="Header Field Registry">Section 8.3</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.10"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>.<a class="self" href="#rfc.section.3.2.1.p.4">&para;</a></p></div></div><div id="field.order"><h3 id="rfc.section.3.2.2"><a href="#rfc.section.3.2.2">3.2.2</a>&nbsp;<a href="#field.order">Field Order</a></h3><div id="rfc.section.3.2.2.p.1"><p>The order in which header fields with differing field names are received is not significant. However, it is good practice to send header fields that contain control data first, such as <a href="#header.host" class="smpl">Host</a> on requests and <a href="rfc7231.html#header.date" class="smpl">Date</a> on responses, so that implementations can decide when not to handle a message as early as possible. A server <em class="bcp14">MUST NOT</em> apply a request to the target resource until the entire request header section is received, since later header fields might include conditionals, authentication credentials, or deliberately misleading duplicate header fields that would impact request processing.<a class="self" href="#rfc.section.3.2.2.p.1">&para;</a></p></div><div id="rfc.section.3.2.2.p.2"><p>A sender <em class="bcp14">MUST NOT</em> generate multiple header fields with the same field name in a message unless either the entire field value for that header field is defined as a comma-separated list [i.e., #(values)] or the header field is a well-known exception (as noted below).<a class="self" href="#rfc.section.3.2.2.p.2">&para;</a></p></div><div id="rfc.section.3.2.2.p.3"><p>A recipient <em class="bcp14">MAY</em> combine multiple header fields with the same field name into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma. The order in which header fields with the same field name are received is therefore significant to the interpretation of the combined field value; a proxy <em class="bcp14">MUST NOT</em> change the order of these field values when forwarding a message.<a class="self" href="#rfc.section.3.2.2.p.3">&para;</a></p></div><div class="note" id="rfc.section.3.2.2.p.4"><p><b>Note:</b> In practice, the "Set-Cookie" header field (<a href="#RFC6265" id="rfc.xref.RFC6265.2"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>) often appears multiple times in a response message and does not use the list syntax, violating the above requirements on multiple header fields with the same name. Since it cannot be combined into a single field-value, recipients ought to handle "Set-Cookie" as a special case while processing header fields. (See Appendix A.2.3 of <a href="#Kri2001" id="rfc.xref.Kri2001.1"><cite title="HTTP Cookies: Standards, Privacy, and Politics">[Kri2001]</cite></a> for details.)<a class="self" href="#rfc.section.3.2.2.p.4">&para;</a></p></div></div><div id="whitespace"><h3 id="rfc.section.3.2.3"><a href="#rfc.section.3.2.3">3.2.3</a>&nbsp;<a href="#whitespace">Whitespace</a></h3><div id="rule.LWS"><div id="rfc.section.3.2.3.p.1"><p>This specification uses three rules to denote the use of linear whitespace: OWS (optional whitespace), RWS (required whitespace), and BWS ("bad" whitespace).<a class="self" href="#rfc.section.3.2.3.p.1">&para;</a></p></div></div><div id="rule.OWS"><div id="rfc.section.3.2.3.p.2"><p>The OWS rule is used where zero or more linear whitespace octets might appear. For protocol elements where optional whitespace is preferred to improve readability, a sender <em class="bcp14">SHOULD</em> generate the optional whitespace as a single SP; otherwise, a sender <em class="bcp14">SHOULD NOT</em> generate optional whitespace except as needed to white out invalid or unwanted protocol elements during in-place message filtering.<a class="self" href="#rfc.section.3.2.3.p.2">&para;</a></p></div></div><div id="rule.RWS"><div id="rfc.section.3.2.3.p.3"><p>The RWS rule is used when at least one linear whitespace octet is required to separate field tokens. A sender <em class="bcp14">SHOULD</em> generate RWS as a single SP.<a class="self" href="#rfc.section.3.2.3.p.3">&para;</a></p></div></div><div id="rule.BWS"><div id="rfc.section.3.2.3.p.4"><p>The BWS rule is used where the grammar allows optional whitespace only for historical reasons. A sender <em class="bcp14">MUST NOT</em> generate BWS in messages. A recipient <em class="bcp14">MUST</em> parse for such bad whitespace and remove it before interpreting the protocol element.<a class="self" href="#rfc.section.3.2.3.p.4">&para;</a></p></div></div><div id="rule.whitespace"><div id="rfc.section.3.2.3.p.5"></div></div><div id="rfc.figure.u.19"><pre class="inline"><span id="rfc.iref.g.30"></span><span id="rfc.iref.g.31"></span><span id="rfc.iref.g.32"></span>  <a href="#rule.whitespace" class="smpl">OWS</a>            = *( <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">HTAB</a> ) 
    600580                 ; optional whitespace 
    601581  <a href="#rule.whitespace" class="smpl">RWS</a>            = 1*( <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">HTAB</a> ) 
     
    603583  <a href="#rule.whitespace" class="smpl">BWS</a>            = <a href="#rule.whitespace" class="smpl">OWS</a> 
    604584                 ; "bad" whitespace 
    605 </pre></div></div><div id="field.parsing"><h3 id="rfc.section.3.2.4"><a href="#rfc.section.3.2.4">3.2.4</a>&nbsp;<a href="#field.parsing">Field Parsing</a></h3><p id="rfc.section.3.2.4.p.1">Messages are parsed using a generic algorithm, independent of the individual header field names. The contents within a given field value are not parsed until a later stage of message interpretation (usually after the message's entire header section has been processed). Consequently, this specification does not use ABNF rules to define each "Field-Name: Field Value" pair, as was done in previous editions. Instead, this specification uses ABNF rules that are named according to each registered field name, wherein the rule defines the valid grammar for that field's corresponding field values (i.e., after the field-value has been extracted from the header section by a generic field parser).<a class="self" href="#rfc.section.3.2.4.p.1">&para;</a></p><p id="rfc.section.3.2.4.p.2">No whitespace is allowed between the header field-name and colon. In the past, differences in the handling of such whitespace have led to security vulnerabilities in request routing and response handling. A server <em class="bcp14">MUST</em> reject any received request message that contains whitespace between a header field-name and colon with a response code of <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a>. A proxy <em class="bcp14">MUST</em> remove any such whitespace from a response message before forwarding the message downstream.<a class="self" href="#rfc.section.3.2.4.p.2">&para;</a></p><p id="rfc.section.3.2.4.p.3">A field value might be preceded and/or followed by optional whitespace (OWS); a single SP preceding the field-value is preferred for consistent readability by humans. The field value does not include any leading or trailing whitespace: OWS occurring before the first non-whitespace octet of the field value or after the last non-whitespace octet of the field value ought to be excluded by parsers when extracting the field value from a header field.<a class="self" href="#rfc.section.3.2.4.p.3">&para;</a></p><p id="rfc.section.3.2.4.p.4">Historically, HTTP header field values could be extended over multiple lines by preceding each extra line with at least one space or horizontal tab (obs-fold). This specification deprecates such line folding except within the message/http media type (<a href="#internet.media.type.message.http" title="Internet Media Type message/http">Section&nbsp;8.3.1</a>). A sender <em class="bcp14">MUST NOT</em> generate a message that includes line folding (i.e., that has any field-value that contains a match to the <a href="#header.fields" class="smpl">obs-fold</a> rule) unless the message is intended for packaging within the message/http media type.<a class="self" href="#rfc.section.3.2.4.p.4">&para;</a></p><p id="rfc.section.3.2.4.p.5">A server that receives an <a href="#header.fields" class="smpl">obs-fold</a> in a request message that is not within a message/http container <em class="bcp14">MUST</em> either reject the message by sending a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a>, preferably with a representation explaining that obsolete line folding is unacceptable, or replace each received <a href="#header.fields" class="smpl">obs-fold</a> with one or more <a href="#core.rules" class="smpl">SP</a> octets prior to interpreting the field value or forwarding the message downstream.<a class="self" href="#rfc.section.3.2.4.p.5">&para;</a></p><p id="rfc.section.3.2.4.p.6">A proxy or gateway that receives an <a href="#header.fields" class="smpl">obs-fold</a> in a response message that is not within a message/http container <em class="bcp14">MUST</em> either discard the message and replace it with a <a href="rfc7231.html#status.502" class="smpl">502 (Bad Gateway)</a> response, preferably with a representation explaining that unacceptable line folding was received, or replace each received <a href="#header.fields" class="smpl">obs-fold</a> with one or more <a href="#core.rules" class="smpl">SP</a> octets prior to interpreting the field value or forwarding the message downstream.<a class="self" href="#rfc.section.3.2.4.p.6">&para;</a></p><p id="rfc.section.3.2.4.p.7">A user agent that receives an <a href="#header.fields" class="smpl">obs-fold</a> in a response message that is not within a message/http container <em class="bcp14">MUST</em> replace each received <a href="#header.fields" class="smpl">obs-fold</a> with one or more <a href="#core.rules" class="smpl">SP</a> octets prior to interpreting the field value.<a class="self" href="#rfc.section.3.2.4.p.7">&para;</a></p><p id="rfc.section.3.2.4.p.8">Historically, HTTP has allowed field content with text in the ISO&#8209;8859&#8209;1 charset <a href="#ISO-8859-1" id="rfc.xref.ISO-8859-1.1"><cite title="Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1">[ISO-8859-1]</cite></a>, supporting other charsets only through use of <a href="#RFC2047" id="rfc.xref.RFC2047.1"><cite title="MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text">[RFC2047]</cite></a> encoding. In practice, most HTTP header field values use only a subset of the US-ASCII charset <a href="#USASCII" id="rfc.xref.USASCII.3"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a>. Newly defined header fields <em class="bcp14">SHOULD</em> limit their field values to US&#8209;ASCII octets. A recipient <em class="bcp14">SHOULD</em> treat other octets in field content (obs&#8209;text) as opaque data.<a class="self" href="#rfc.section.3.2.4.p.8">&para;</a></p></div><div id="field.limits"><h3 id="rfc.section.3.2.5"><a href="#rfc.section.3.2.5">3.2.5</a>&nbsp;<a href="#field.limits">Field Limits</a></h3><p id="rfc.section.3.2.5.p.1">HTTP does not place a predefined limit on the length of each header field or on the length of the header section as a whole, as described in <a href="#conformance" title="Conformance and Error Handling">Section&nbsp;2.5</a>. Various ad hoc limitations on individual header field length are found in practice, often depending on the specific field semantics.<a class="self" href="#rfc.section.3.2.5.p.1">&para;</a></p><p id="rfc.section.3.2.5.p.2">A server that receives a request header field, or set of fields, larger than it wishes to process <em class="bcp14">MUST</em> respond with an appropriate <a href="rfc7231.html#status.4xx" class="smpl">4xx (Client Error)</a> status code. Ignoring such header fields would increase the server's vulnerability to request smuggling attacks (<a href="#request.smuggling" title="Request Smuggling">Section&nbsp;9.5</a>).<a class="self" href="#rfc.section.3.2.5.p.2">&para;</a></p><p id="rfc.section.3.2.5.p.3">A client <em class="bcp14">MAY</em> discard or truncate received header fields that are larger than the client wishes to process if the field semantics are such that the dropped value(s) can be safely ignored without changing the message framing or response semantics.<a class="self" href="#rfc.section.3.2.5.p.3">&para;</a></p></div><div id="field.components"><h3 id="rfc.section.3.2.6"><a href="#rfc.section.3.2.6">3.2.6</a>&nbsp;<a href="#field.components">Field Value Components</a></h3><div id="rule.token.separators"><p id="rfc.section.3.2.6.p.1">  <span id="rfc.iref.d.2"></span> Most HTTP header field values are defined using common syntax components (token, quoted-string, and comment) separated by whitespace or specific delimiting characters. Delimiters are chosen from the set of US-ASCII visual characters not allowed in a <a href="#rule.token.separators" class="smpl">token</a> (DQUOTE and "(),/:;&lt;=&gt;?@[\]{}").<a class="self" href="#rfc.section.3.2.6.p.1">&para;</a></p></div><div id="rfc.figure.u.20"><pre class="inline"><span id="rfc.iref.g.33"></span><span id="rfc.iref.g.34"></span>  <a href="#rule.token.separators" class="smpl">token</a>          = 1*<a href="#rule.token.separators" class="smpl">tchar</a> 
     585</pre></div></div><div id="field.parsing"><h3 id="rfc.section.3.2.4"><a href="#rfc.section.3.2.4">3.2.4</a>&nbsp;<a href="#field.parsing">Field Parsing</a></h3><div id="rfc.section.3.2.4.p.1"><p>Messages are parsed using a generic algorithm, independent of the individual header field names. The contents within a given field value are not parsed until a later stage of message interpretation (usually after the message's entire header section has been processed). Consequently, this specification does not use ABNF rules to define each "Field-Name: Field Value" pair, as was done in previous editions. Instead, this specification uses ABNF rules that are named according to each registered field name, wherein the rule defines the valid grammar for that field's corresponding field values (i.e., after the field-value has been extracted from the header section by a generic field parser).<a class="self" href="#rfc.section.3.2.4.p.1">&para;</a></p></div><div id="rfc.section.3.2.4.p.2"><p>No whitespace is allowed between the header field-name and colon. In the past, differences in the handling of such whitespace have led to security vulnerabilities in request routing and response handling. A server <em class="bcp14">MUST</em> reject any received request message that contains whitespace between a header field-name and colon with a response code of <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a>. A proxy <em class="bcp14">MUST</em> remove any such whitespace from a response message before forwarding the message downstream.<a class="self" href="#rfc.section.3.2.4.p.2">&para;</a></p></div><div id="rfc.section.3.2.4.p.3"><p>A field value might be preceded and/or followed by optional whitespace (OWS); a single SP preceding the field-value is preferred for consistent readability by humans. The field value does not include any leading or trailing whitespace: OWS occurring before the first non-whitespace octet of the field value or after the last non-whitespace octet of the field value ought to be excluded by parsers when extracting the field value from a header field.<a class="self" href="#rfc.section.3.2.4.p.3">&para;</a></p></div><div id="rfc.section.3.2.4.p.4"><p>Historically, HTTP header field values could be extended over multiple lines by preceding each extra line with at least one space or horizontal tab (obs-fold). This specification deprecates such line folding except within the message/http media type (<a href="#internet.media.type.message.http" title="Internet Media Type message/http">Section&nbsp;8.3.1</a>). A sender <em class="bcp14">MUST NOT</em> generate a message that includes line folding (i.e., that has any field-value that contains a match to the <a href="#header.fields" class="smpl">obs-fold</a> rule) unless the message is intended for packaging within the message/http media type.<a class="self" href="#rfc.section.3.2.4.p.4">&para;</a></p></div><div id="rfc.section.3.2.4.p.5"><p>A server that receives an <a href="#header.fields" class="smpl">obs-fold</a> in a request message that is not within a message/http container <em class="bcp14">MUST</em> either reject the message by sending a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a>, preferably with a representation explaining that obsolete line folding is unacceptable, or replace each received <a href="#header.fields" class="smpl">obs-fold</a> with one or more <a href="#core.rules" class="smpl">SP</a> octets prior to interpreting the field value or forwarding the message downstream.<a class="self" href="#rfc.section.3.2.4.p.5">&para;</a></p></div><div id="rfc.section.3.2.4.p.6"><p>A proxy or gateway that receives an <a href="#header.fields" class="smpl">obs-fold</a> in a response message that is not within a message/http container <em class="bcp14">MUST</em> either discard the message and replace it with a <a href="rfc7231.html#status.502" class="smpl">502 (Bad Gateway)</a> response, preferably with a representation explaining that unacceptable line folding was received, or replace each received <a href="#header.fields" class="smpl">obs-fold</a> with one or more <a href="#core.rules" class="smpl">SP</a> octets prior to interpreting the field value or forwarding the message downstream.<a class="self" href="#rfc.section.3.2.4.p.6">&para;</a></p></div><div id="rfc.section.3.2.4.p.7"><p>A user agent that receives an <a href="#header.fields" class="smpl">obs-fold</a> in a response message that is not within a message/http container <em class="bcp14">MUST</em> replace each received <a href="#header.fields" class="smpl">obs-fold</a> with one or more <a href="#core.rules" class="smpl">SP</a> octets prior to interpreting the field value.<a class="self" href="#rfc.section.3.2.4.p.7">&para;</a></p></div><div id="rfc.section.3.2.4.p.8"><p>Historically, HTTP has allowed field content with text in the ISO&#8209;8859&#8209;1 charset <a href="#ISO-8859-1" id="rfc.xref.ISO-8859-1.1"><cite title="Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1">[ISO-8859-1]</cite></a>, supporting other charsets only through use of <a href="#RFC2047" id="rfc.xref.RFC2047.1"><cite title="MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text">[RFC2047]</cite></a> encoding. In practice, most HTTP header field values use only a subset of the US-ASCII charset <a href="#USASCII" id="rfc.xref.USASCII.3"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a>. Newly defined header fields <em class="bcp14">SHOULD</em> limit their field values to US&#8209;ASCII octets. A recipient <em class="bcp14">SHOULD</em> treat other octets in field content (obs&#8209;text) as opaque data.<a class="self" href="#rfc.section.3.2.4.p.8">&para;</a></p></div></div><div id="field.limits"><h3 id="rfc.section.3.2.5"><a href="#rfc.section.3.2.5">3.2.5</a>&nbsp;<a href="#field.limits">Field Limits</a></h3><div id="rfc.section.3.2.5.p.1"><p>HTTP does not place a predefined limit on the length of each header field or on the length of the header section as a whole, as described in <a href="#conformance" title="Conformance and Error Handling">Section&nbsp;2.5</a>. Various ad hoc limitations on individual header field length are found in practice, often depending on the specific field semantics.<a class="self" href="#rfc.section.3.2.5.p.1">&para;</a></p></div><div id="rfc.section.3.2.5.p.2"><p>A server that receives a request header field, or set of fields, larger than it wishes to process <em class="bcp14">MUST</em> respond with an appropriate <a href="rfc7231.html#status.4xx" class="smpl">4xx (Client Error)</a> status code. Ignoring such header fields would increase the server's vulnerability to request smuggling attacks (<a href="#request.smuggling" title="Request Smuggling">Section&nbsp;9.5</a>).<a class="self" href="#rfc.section.3.2.5.p.2">&para;</a></p></div><div id="rfc.section.3.2.5.p.3"><p>A client <em class="bcp14">MAY</em> discard or truncate received header fields that are larger than the client wishes to process if the field semantics are such that the dropped value(s) can be safely ignored without changing the message framing or response semantics.<a class="self" href="#rfc.section.3.2.5.p.3">&para;</a></p></div></div><div id="field.components"><h3 id="rfc.section.3.2.6"><a href="#rfc.section.3.2.6">3.2.6</a>&nbsp;<a href="#field.components">Field Value Components</a></h3><div id="rule.token.separators"><div id="rfc.section.3.2.6.p.1"><p>  <span id="rfc.iref.d.2"></span> Most HTTP header field values are defined using common syntax components (token, quoted-string, and comment) separated by whitespace or specific delimiting characters. Delimiters are chosen from the set of US-ASCII visual characters not allowed in a <a href="#rule.token.separators" class="smpl">token</a> (DQUOTE and "(),/:;&lt;=&gt;?@[\]{}").<a class="self" href="#rfc.section.3.2.6.p.1">&para;</a></p></div></div><div id="rfc.figure.u.20"><pre class="inline"><span id="rfc.iref.g.33"></span><span id="rfc.iref.g.34"></span>  <a href="#rule.token.separators" class="smpl">token</a>          = 1*<a href="#rule.token.separators" class="smpl">tchar</a> 
    606586 
    607587  <a href="#rule.token.separators" class="smpl">tchar</a>          = "!" / "#" / "$" / "%" / "&amp;" / "'" / "*" 
     
    609589                 / <a href="#core.rules" class="smpl">DIGIT</a> / <a href="#core.rules" class="smpl">ALPHA</a> 
    610590                 ; any <a href="#core.rules" class="smpl">VCHAR</a>, except delimiters 
    611 </pre></div><div id="rule.quoted-string"><p id="rfc.section.3.2.6.p.2">   A string of text is parsed as a single value if it is quoted using double-quote marks.<a class="self" href="#rfc.section.3.2.6.p.2">&para;</a></p></div><div id="rfc.figure.u.21"><pre class="inline"><span id="rfc.iref.g.35"></span><span id="rfc.iref.g.36"></span><span id="rfc.iref.g.37"></span>  <a href="#rule.quoted-string" class="smpl">quoted-string</a>  = <a href="#core.rules" class="smpl">DQUOTE</a> *( <a href="#rule.quoted-string" class="smpl">qdtext</a> / <a href="#rule.quoted-pair" class="smpl">quoted-pair</a> ) <a href="#core.rules" class="smpl">DQUOTE</a> 
     591</pre></div><div id="rule.quoted-string"><div id="rfc.section.3.2.6.p.2"><p>   A string of text is parsed as a single value if it is quoted using double-quote marks.<a class="self" href="#rfc.section.3.2.6.p.2">&para;</a></p></div></div><div id="rfc.figure.u.21"><pre class="inline"><span id="rfc.iref.g.35"></span><span id="rfc.iref.g.36"></span><span id="rfc.iref.g.37"></span>  <a href="#rule.quoted-string" class="smpl">quoted-string</a>  = <a href="#core.rules" class="smpl">DQUOTE</a> *( <a href="#rule.quoted-string" class="smpl">qdtext</a> / <a href="#rule.quoted-pair" class="smpl">quoted-pair</a> ) <a href="#core.rules" class="smpl">DQUOTE</a> 
    612592  <a href="#rule.quoted-string" class="smpl">qdtext</a>         = <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> /%x21 / %x23-5B / %x5D-7E / <a href="#rule.quoted-string" class="smpl">obs-text</a> 
    613593  <a href="#rule.quoted-string" class="smpl">obs-text</a>       = %x80-FF 
    614 </pre></div><div id="rule.comment"><p id="rfc.section.3.2.6.p.3">  Comments can be included in some HTTP header fields by surrounding the comment text with parentheses. Comments are only allowed in fields containing "comment" as part of their field value definition.<a class="self" href="#rfc.section.3.2.6.p.3">&para;</a></p></div><div id="rfc.figure.u.22"><pre class="inline"><span id="rfc.iref.g.38"></span><span id="rfc.iref.g.39"></span>  <a href="#rule.comment" class="smpl">comment</a>        = "(" *( <a href="#rule.comment" class="smpl">ctext</a> / <a href="#rule.quoted-pair" class="smpl">quoted-pair</a> / <a href="#rule.comment" class="smpl">comment</a> ) ")" 
     594</pre></div><div id="rule.comment"><div id="rfc.section.3.2.6.p.3"><p>  Comments can be included in some HTTP header fields by surrounding the comment text with parentheses. Comments are only allowed in fields containing "comment" as part of their field value definition.<a class="self" href="#rfc.section.3.2.6.p.3">&para;</a></p></div></div><div id="rfc.figure.u.22"><pre class="inline"><span id="rfc.iref.g.38"></span><span id="rfc.iref.g.39"></span>  <a href="#rule.comment" class="smpl">comment</a>        = "(" *( <a href="#rule.comment" class="smpl">ctext</a> / <a href="#rule.quoted-pair" class="smpl">quoted-pair</a> / <a href="#rule.comment" class="smpl">comment</a> ) ")" 
    615595  <a href="#rule.comment" class="smpl">ctext</a>          = <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / %x21-27 / %x2A-5B / %x5D-7E / <a href="#rule.quoted-string" class="smpl">obs-text</a> 
    616 </pre></div><div id="rule.quoted-pair"><p id="rfc.section.3.2.6.p.4"> The backslash octet ("\") can be used as a single-octet quoting mechanism within quoted-string and comment constructs. Recipients that process the value of a quoted-string <em class="bcp14">MUST</em> handle a quoted-pair as if it were replaced by the octet following the backslash.<a class="self" href="#rfc.section.3.2.6.p.4">&para;</a></p></div><div id="rfc.figure.u.23"><pre class="inline"><span id="rfc.iref.g.40"></span>  <a href="#rule.quoted-pair" class="smpl">quoted-pair</a>    = "\" ( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> )  
    617 </pre></div><p id="rfc.section.3.2.6.p.5">A sender <em class="bcp14">SHOULD NOT</em> generate a quoted-pair in a quoted-string except where necessary to quote DQUOTE and backslash octets occurring within that string. A sender <em class="bcp14">SHOULD NOT</em> generate a quoted-pair in a comment except where necessary to quote parentheses ["(" and ")"] and backslash octets occurring within that comment.<a class="self" href="#rfc.section.3.2.6.p.5">&para;</a></p></div></div><div id="message.body"><h2 id="rfc.section.3.3"><a href="#rfc.section.3.3">3.3</a>&nbsp;<a href="#message.body">Message Body</a></h2><p id="rfc.section.3.3.p.1">The message body (if any) of an HTTP message is used to carry the payload body of that request or response. The message body is identical to the payload body unless a transfer coding has been applied, as described in <a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.1" title="Transfer-Encoding">Section&nbsp;3.3.1</a>.<a class="self" href="#rfc.section.3.3.p.1">&para;</a></p><div id="rfc.figure.u.24"><pre class="inline"><span id="rfc.iref.g.41"></span>  <a href="#message.body" class="smpl">message-body</a> = *OCTET 
    618 </pre></div><p id="rfc.section.3.3.p.2">The rules for when a message body is allowed in a message differ for requests and responses.<a class="self" href="#rfc.section.3.3.p.2">&para;</a></p><p id="rfc.section.3.3.p.3">The presence of a message body in a request is signaled by a <a href="#header.content-length" class="smpl">Content-Length</a> or <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field. Request message framing is independent of method semantics, even if the method does not define any use for a message body.<a class="self" href="#rfc.section.3.3.p.3">&para;</a></p><p id="rfc.section.3.3.p.4">The presence of a message body in a response depends on both the request method to which it is responding and the response status code (<a href="#status.line" title="Status Line">Section&nbsp;3.1.2</a>). Responses to the HEAD request method (<a href="rfc7231.html#HEAD" title="HEAD">Section 4.3.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.11"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) never include a message body because the associated response header fields (e.g., <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a>, <a href="#header.content-length" class="smpl">Content-Length</a>, etc.), if present, indicate only what their values would have been if the request method had been GET (<a href="rfc7231.html#GET" title="GET">Section 4.3.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.12"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). <a href="rfc7231.html#status.2xx" class="smpl">2xx (Successful)</a> responses to a CONNECT request method (<a href="rfc7231.html#CONNECT" title="CONNECT">Section 4.3.6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.13"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) switch to tunnel mode instead of having a message body. All <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a>, <a href="rfc7231.html#status.204" class="smpl">204 (No Content)</a>, and <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> responses do not include a message body. All other responses do include a message body, although the body might be of zero length.<a class="self" href="#rfc.section.3.3.p.4">&para;</a></p><div id="header.transfer-encoding"><h3 id="rfc.section.3.3.1"><a href="#rfc.section.3.3.1">3.3.1</a>&nbsp;<a href="#header.transfer-encoding">Transfer-Encoding</a></h3><p id="rfc.section.3.3.1.p.1">The Transfer-Encoding header field lists the transfer coding names corresponding to the sequence of transfer codings that have been (or will be) applied to the payload body in order to form the message body. Transfer codings are defined in <a href="#transfer.codings" title="Transfer Codings">Section&nbsp;4</a>.<a class="self" href="#rfc.section.3.3.1.p.1">&para;</a></p><div id="rfc.figure.u.25"><pre class="inline"><span id="rfc.iref.g.42"></span>  <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> = 1#<a href="#transfer.codings" class="smpl">transfer-coding</a> 
    619 </pre></div><p id="rfc.section.3.3.1.p.2">Transfer-Encoding is analogous to the Content-Transfer-Encoding field of MIME, which was designed to enable safe transport of binary data over a 7-bit transport service (<a href="#RFC2045" id="rfc.xref.RFC2045.2"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a>, <a href="https://tools.ietf.org/html/rfc2045#section-6">Section 6</a>). However, safe transport has a different focus for an 8bit-clean transfer protocol. In HTTP's case, Transfer-Encoding is primarily intended to accurately delimit a dynamically generated payload and to distinguish payload encodings that are only applied for transport efficiency or security from those that are characteristics of the selected resource.<a class="self" href="#rfc.section.3.3.1.p.2">&para;</a></p><p id="rfc.section.3.3.1.p.3">A recipient <em class="bcp14">MUST</em> be able to parse the chunked transfer coding (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a>) because it plays a crucial role in framing messages when the payload body size is not known in advance. A sender <em class="bcp14">MUST NOT</em> apply chunked more than once to a message body (i.e., chunking an already chunked message is not allowed). If any transfer coding other than chunked is applied to a request payload body, the sender <em class="bcp14">MUST</em> apply chunked as the final transfer coding to ensure that the message is properly framed. If any transfer coding other than chunked is applied to a response payload body, the sender <em class="bcp14">MUST</em> either apply chunked as the final transfer coding or terminate the message by closing the connection.<a class="self" href="#rfc.section.3.3.1.p.3">&para;</a></p><div id="rfc.figure.u.26"><p>For example,</p><pre class="text">  Transfer-Encoding: gzip, chunked 
    620 </pre><p>indicates that the payload body has been compressed using the gzip coding and then chunked using the chunked coding while forming the message body.</p></div><p id="rfc.section.3.3.1.p.4">Unlike <a href="rfc7231.html#header.content-encoding" class="smpl">Content-Encoding</a> (<a href="rfc7231.html#content.codings" title="Content Codings">Section 3.1.2.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.14"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), Transfer-Encoding is a property of the message, not of the representation, and any recipient along the request/response chain <em class="bcp14">MAY</em> decode the received transfer coding(s) or apply additional transfer coding(s) to the message body, assuming that corresponding changes are made to the Transfer-Encoding field-value. Additional information about the encoding parameters can be provided by other header fields not defined by this specification.<a class="self" href="#rfc.section.3.3.1.p.4">&para;</a></p><p id="rfc.section.3.3.1.p.5">Transfer-Encoding <em class="bcp14">MAY</em> be sent in a response to a HEAD request or in a <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> response (<a href="rfc7232.html#status.304" title="304 Not Modified">Section 4.1</a> of <a href="#RFC7232" id="rfc.xref.RFC7232.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a>) to a GET request, neither of which includes a message body, to indicate that the origin server would have applied a transfer coding to the message body if the request had been an unconditional GET. This indication is not required, however, because any recipient on the response chain (including the origin server) can remove transfer codings when they are not needed.<a class="self" href="#rfc.section.3.3.1.p.5">&para;</a></p><p id="rfc.section.3.3.1.p.6">A server <em class="bcp14">MUST NOT</em> send a Transfer-Encoding header field in any response with a status code of <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a> or <a href="rfc7231.html#status.204" class="smpl">204 (No Content)</a>. A server <em class="bcp14">MUST NOT</em> send a Transfer-Encoding header field in any <a href="rfc7231.html#status.2xx" class="smpl">2xx (Successful)</a> response to a CONNECT request (<a href="rfc7231.html#CONNECT" title="CONNECT">Section 4.3.6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.15"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.3.3.1.p.6">&para;</a></p><p id="rfc.section.3.3.1.p.7">Transfer-Encoding was added in HTTP/1.1. It is generally assumed that implementations advertising only HTTP/1.0 support will not understand how to process a transfer-encoded payload. A client <em class="bcp14">MUST NOT</em> send a request containing Transfer-Encoding unless it knows the server will handle HTTP/1.1 (or later) requests; such knowledge might be in the form of specific user configuration or by remembering the version of a prior received response. A server <em class="bcp14">MUST NOT</em> send a response containing Transfer-Encoding unless the corresponding request indicates HTTP/1.1 (or later).<a class="self" href="#rfc.section.3.3.1.p.7">&para;</a></p><p id="rfc.section.3.3.1.p.8">A server that receives a request message with a transfer coding it does not understand <em class="bcp14">SHOULD</em> respond with <a href="rfc7231.html#status.501" class="smpl">501 (Not Implemented)</a>.<a class="self" href="#rfc.section.3.3.1.p.8">&para;</a></p></div><div id="header.content-length"><h3 id="rfc.section.3.3.2"><a href="#rfc.section.3.3.2">3.3.2</a>&nbsp;<a href="#header.content-length">Content-Length</a></h3><p id="rfc.section.3.3.2.p.1">When a message does not have a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field, a Content-Length header field can provide the anticipated size, as a decimal number of octets, for a potential payload body. For messages that do include a payload body, the Content-Length field-value provides the framing information necessary for determining where the body (and message) ends. For messages that do not include a payload body, the Content-Length indicates the size of the selected representation (<a href="rfc7231.html#representations" title="Representations">Section 3</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.16"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.3.3.2.p.1">&para;</a></p><div id="rfc.figure.u.27"><pre class="inline"><span id="rfc.iref.g.43"></span>  <a href="#header.content-length" class="smpl">Content-Length</a> = 1*<a href="#core.rules" class="smpl">DIGIT</a> 
    621 </pre></div><p id="rfc.section.3.3.2.p.2">An example is<a class="self" href="#rfc.section.3.3.2.p.2">&para;</a></p><div id="rfc.figure.u.28"><pre class="text">  Content-Length: 3495 
    622 </pre></div><p id="rfc.section.3.3.2.p.3">A sender <em class="bcp14">MUST NOT</em> send a Content-Length header field in any message that contains a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field.<a class="self" href="#rfc.section.3.3.2.p.3">&para;</a></p><p id="rfc.section.3.3.2.p.4">A user agent <em class="bcp14">SHOULD</em> send a Content-Length in a request message when no <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> is sent and the request method defines a meaning for an enclosed payload body. For example, a Content-Length header field is normally sent in a POST request even when the value is 0 (indicating an empty payload body). A user agent <em class="bcp14">SHOULD NOT</em> send a Content-Length header field when the request message does not contain a payload body and the method semantics do not anticipate such a body.<a class="self" href="#rfc.section.3.3.2.p.4">&para;</a></p><p id="rfc.section.3.3.2.p.5">A server <em class="bcp14">MAY</em> send a Content-Length header field in a response to a HEAD request (<a href="rfc7231.html#HEAD" title="HEAD">Section 4.3.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.17"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>); a server <em class="bcp14">MUST NOT</em> send Content-Length in such a response unless its field-value equals the decimal number of octets that would have been sent in the payload body of a response if the same request had used the GET method.<a class="self" href="#rfc.section.3.3.2.p.5">&para;</a></p><p id="rfc.section.3.3.2.p.6">A server <em class="bcp14">MAY</em> send a Content-Length header field in a <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> response to a conditional GET request (<a href="rfc7232.html#status.304" title="304 Not Modified">Section 4.1</a> of <a href="#RFC7232" id="rfc.xref.RFC7232.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a>); a server <em class="bcp14">MUST NOT</em> send Content-Length in such a response unless its field-value equals the decimal number of octets that would have been sent in the payload body of a <a href="rfc7231.html#status.200" class="smpl">200 (OK)</a> response to the same request.<a class="self" href="#rfc.section.3.3.2.p.6">&para;</a></p><p id="rfc.section.3.3.2.p.7">A server <em class="bcp14">MUST NOT</em> send a Content-Length header field in any response with a status code of <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a> or <a href="rfc7231.html#status.204" class="smpl">204 (No Content)</a>. A server <em class="bcp14">MUST NOT</em> send a Content-Length header field in any <a href="rfc7231.html#status.2xx" class="smpl">2xx (Successful)</a> response to a CONNECT request (<a href="rfc7231.html#CONNECT" title="CONNECT">Section 4.3.6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.18"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.3.3.2.p.7">&para;</a></p><p id="rfc.section.3.3.2.p.8">Aside from the cases defined above, in the absence of Transfer-Encoding, an origin server <em class="bcp14">SHOULD</em> send a Content-Length header field when the payload body size is known prior to sending the complete header section. This will allow downstream recipients to measure transfer progress, know when a received message is complete, and potentially reuse the connection for additional requests.<a class="self" href="#rfc.section.3.3.2.p.8">&para;</a></p><p id="rfc.section.3.3.2.p.9">Any Content-Length field value greater than or equal to zero is valid. Since there is no predefined limit to the length of a payload, a recipient <em class="bcp14">MUST</em> anticipate potentially large decimal numerals and prevent parsing errors due to integer conversion overflows (<a href="#attack.protocol.element.length" title="Attacks via Protocol Element Length">Section&nbsp;9.3</a>).<a class="self" href="#rfc.section.3.3.2.p.9">&para;</a></p><p id="rfc.section.3.3.2.p.10">If a message is received that has multiple Content-Length header fields with field-values consisting of the same decimal value, or a single Content-Length header field with a field value containing a list of identical decimal values (e.g., "Content-Length: 42, 42"), indicating that duplicate Content-Length header fields have been generated or combined by an upstream message processor, then the recipient <em class="bcp14">MUST</em> either reject the message as invalid or replace the duplicated field-values with a single valid Content-Length field containing that decimal value prior to determining the message body length or forwarding the message.<a class="self" href="#rfc.section.3.3.2.p.10">&para;</a></p><div class="note" id="rfc.section.3.3.2.p.11"><p><b>Note:</b> HTTP's use of Content-Length for message framing differs significantly from the same field's use in MIME, where it is an optional field used only within the "message/external-body" media-type.</p> </div></div><div id="message.body.length"><h3 id="rfc.section.3.3.3"><a href="#rfc.section.3.3.3">3.3.3</a>&nbsp;<a href="#message.body.length">Message Body Length</a></h3><p id="rfc.section.3.3.3.p.1">The length of a message body is determined by one of the following (in order of precedence):<a class="self" href="#rfc.section.3.3.3.p.1">&para;</a></p><ol><li><p>Any response to a HEAD request and any response with a <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a>, <a href="rfc7231.html#status.204" class="smpl">204 (No Content)</a>, or <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> status code is always terminated by the first empty line after the header fields, regardless of the header fields present in the message, and thus cannot contain a message body.</p></li><li><p>Any <a href="rfc7231.html#status.2xx" class="smpl">2xx (Successful)</a> response to a CONNECT request implies that the connection will become a tunnel immediately after the empty line that concludes the header fields. A client <em class="bcp14">MUST</em> ignore any <a href="#header.content-length" class="smpl">Content-Length</a> or <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header fields received in such a message.</p></li><li><p>If a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field is present and the chunked transfer coding (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a>) is the final encoding, the message body length is determined by reading and decoding the chunked data until the transfer coding indicates the data is complete.</p><p>If a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field is present in a response and the chunked transfer coding is not the final encoding, the message body length is determined by reading the connection until it is closed by the server. If a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field is present in a request and the chunked transfer coding is not the final encoding, the message body length cannot be determined reliably; the server <em class="bcp14">MUST</em> respond with the <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> status code and then close the connection.</p><p>If a message is received with both a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> and a <a href="#header.content-length" class="smpl">Content-Length</a> header field, the Transfer-Encoding overrides the Content-Length. Such a message might indicate an attempt to perform request smuggling (<a href="#request.smuggling" title="Request Smuggling">Section&nbsp;9.5</a>) or response splitting (<a href="#response.splitting" title="Response Splitting">Section&nbsp;9.4</a>) and ought to be handled as an error. A sender <em class="bcp14">MUST</em> remove the received Content-Length field prior to forwarding such a message downstream.</p></li><li><p>If a message is received without <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> and with either multiple <a href="#header.content-length" class="smpl">Content-Length</a> header fields having differing field-values or a single Content-Length header field having an invalid value, then the message framing is invalid and the recipient <em class="bcp14">MUST</em> treat it as an unrecoverable error. If this is a request message, the server <em class="bcp14">MUST</em> respond with a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> status code and then close the connection. If this is a response message received by a proxy, the proxy <em class="bcp14">MUST</em> close the connection to the server, discard the received response, and send a <a href="rfc7231.html#status.502" class="smpl">502 (Bad Gateway)</a> response to the client. If this is a response message received by a user agent, the user agent <em class="bcp14">MUST</em> close the connection to the server and discard the received response.</p></li><li><p>If a valid <a href="#header.content-length" class="smpl">Content-Length</a> header field is present without <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a>, its decimal value defines the expected message body length in octets. If the sender closes the connection or the recipient times out before the indicated number of octets are received, the recipient <em class="bcp14">MUST</em> consider the message to be incomplete and close the connection.</p></li><li><p>If this is a request message and none of the above are true, then the message body length is zero (no message body is present).</p></li><li><p>Otherwise, this is a response message without a declared message body length, so the message body length is determined by the number of octets received prior to the server closing the connection.</p></li></ol><p id="rfc.section.3.3.3.p.3">Since there is no way to distinguish a successfully completed, close-delimited message from a partially received message interrupted by network failure, a server <em class="bcp14">SHOULD</em> generate encoding or length-delimited messages whenever possible. The close-delimiting feature exists primarily for backwards compatibility with HTTP/1.0.<a class="self" href="#rfc.section.3.3.3.p.3">&para;</a></p><p id="rfc.section.3.3.3.p.4">A server <em class="bcp14">MAY</em> reject a request that contains a message body but not a <a href="#header.content-length" class="smpl">Content-Length</a> by responding with <a href="rfc7231.html#status.411" class="smpl">411 (Length Required)</a>.<a class="self" href="#rfc.section.3.3.3.p.4">&para;</a></p><p id="rfc.section.3.3.3.p.5">Unless a transfer coding other than chunked has been applied, a client that sends a request containing a message body <em class="bcp14">SHOULD</em> use a valid <a href="#header.content-length" class="smpl">Content-Length</a> header field if the message body length is known in advance, rather than the chunked transfer coding, since some existing services respond to chunked with a <a href="rfc7231.html#status.411" class="smpl">411 (Length Required)</a> status code even though they understand the chunked transfer coding. This is typically because such services are implemented via a gateway that requires a content-length in advance of being called and the server is unable or unwilling to buffer the entire request before processing.<a class="self" href="#rfc.section.3.3.3.p.5">&para;</a></p><p id="rfc.section.3.3.3.p.6">A user agent that sends a request containing a message body <em class="bcp14">MUST</em> send a valid <a href="#header.content-length" class="smpl">Content-Length</a> header field if it does not know the server will handle HTTP/1.1 (or later) requests; such knowledge can be in the form of specific user configuration or by remembering the version of a prior received response.<a class="self" href="#rfc.section.3.3.3.p.6">&para;</a></p><p id="rfc.section.3.3.3.p.7">If the final response to the last request on a connection has been completely received and there remains additional data to read, a user agent <em class="bcp14">MAY</em> discard the remaining data or attempt to determine if that data belongs as part of the prior response body, which might be the case if the prior message's Content-Length value is incorrect. A client <em class="bcp14">MUST NOT</em> process, cache, or forward such extra data as a separate response, since such behavior would be vulnerable to cache poisoning.<a class="self" href="#rfc.section.3.3.3.p.7">&para;</a></p></div></div><div id="incomplete.messages"><h2 id="rfc.section.3.4"><a href="#rfc.section.3.4">3.4</a>&nbsp;<a href="#incomplete.messages">Handling Incomplete Messages</a></h2><p id="rfc.section.3.4.p.1">A server that receives an incomplete request message, usually due to a canceled request or a triggered timeout exception, <em class="bcp14">MAY</em> send an error response prior to closing the connection.<a class="self" href="#rfc.section.3.4.p.1">&para;</a></p><p id="rfc.section.3.4.p.2">A client that receives an incomplete response message, which can occur when a connection is closed prematurely or when decoding a supposedly chunked transfer coding fails, <em class="bcp14">MUST</em> record the message as incomplete. Cache requirements for incomplete responses are defined in <a href="rfc7234.html#response.cacheability" title="Storing Responses in Caches">Section 3</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>.<a class="self" href="#rfc.section.3.4.p.2">&para;</a></p><p id="rfc.section.3.4.p.3">If a response terminates in the middle of the header section (before the empty line is received) and the status code might rely on header fields to convey the full meaning of the response, then the client cannot assume that meaning has been conveyed; the client might need to repeat the request in order to determine what action to take next.<a class="self" href="#rfc.section.3.4.p.3">&para;</a></p><p id="rfc.section.3.4.p.4">A message body that uses the chunked transfer coding is incomplete if the zero-sized chunk that terminates the encoding has not been received. A message that uses a valid <a href="#header.content-length" class="smpl">Content-Length</a> is incomplete if the size of the message body received (in octets) is less than the value given by Content-Length. A response that has neither chunked transfer coding nor Content-Length is terminated by closure of the connection and, thus, is considered complete regardless of the number of message body octets received, provided that the header section was received intact.<a class="self" href="#rfc.section.3.4.p.4">&para;</a></p></div><div id="message.robustness"><h2 id="rfc.section.3.5"><a href="#rfc.section.3.5">3.5</a>&nbsp;<a href="#message.robustness">Message Parsing Robustness</a></h2><p id="rfc.section.3.5.p.1">Older HTTP/1.0 user agent implementations might send an extra CRLF after a POST request as a workaround for some early server applications that failed to read message body content that was not terminated by a line-ending. An HTTP/1.1 user agent <em class="bcp14">MUST NOT</em> preface or follow a request with an extra CRLF. If terminating the request message body with a line-ending is desired, then the user agent <em class="bcp14">MUST</em> count the terminating CRLF octets as part of the message body length.<a class="self" href="#rfc.section.3.5.p.1">&para;</a></p><p id="rfc.section.3.5.p.2">In the interest of robustness, a server that is expecting to receive and parse a request-line <em class="bcp14">SHOULD</em> ignore at least one empty line (CRLF) received prior to the request-line.<a class="self" href="#rfc.section.3.5.p.2">&para;</a></p><p id="rfc.section.3.5.p.3">Although the line terminator for the start-line and header fields is the sequence CRLF, a recipient <em class="bcp14">MAY</em> recognize a single LF as a line terminator and ignore any preceding CR.<a class="self" href="#rfc.section.3.5.p.3">&para;</a></p><p id="rfc.section.3.5.p.4">Although the request-line and status-line grammar rules require that each of the component elements be separated by a single SP octet, recipients <em class="bcp14">MAY</em> instead parse on whitespace-delimited word boundaries and, aside from the CRLF terminator, treat any form of whitespace as the SP separator while ignoring preceding or trailing whitespace; such whitespace includes one or more of the following octets: SP, HTAB, VT (%x0B), FF (%x0C), or bare CR. However, lenient parsing can result in security vulnerabilities if there are multiple recipients of the message and each has its own unique interpretation of robustness (see <a href="#request.smuggling" title="Request Smuggling">Section&nbsp;9.5</a>).<a class="self" href="#rfc.section.3.5.p.4">&para;</a></p><p id="rfc.section.3.5.p.5">When a server listening only for HTTP request messages, or processing what appears from the start-line to be an HTTP request message, receives a sequence of octets that does not match the HTTP-message grammar aside from the robustness exceptions listed above, the server <em class="bcp14">SHOULD</em> respond with a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> response.<a class="self" href="#rfc.section.3.5.p.5">&para;</a></p></div></div><div id="transfer.codings"><h1 id="rfc.section.4"><a href="#rfc.section.4">4.</a>&nbsp;<a href="#transfer.codings">Transfer Codings</a></h1><p id="rfc.section.4.p.1">Transfer coding names are used to indicate an encoding transformation that has been, can be, or might need to be applied to a payload body in order to ensure "safe transport" through the network. This differs from a content coding in that the transfer coding is a property of the message rather than a property of the representation that is being transferred.<a class="self" href="#rfc.section.4.p.1">&para;</a></p><div id="rfc.figure.u.29"><pre class="inline"><span id="rfc.iref.g.44"></span><span id="rfc.iref.g.45"></span>  <a href="#transfer.codings" class="smpl">transfer-coding</a>    = "chunked" ; <a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a> 
     596</pre></div><div id="rule.quoted-pair"><div id="rfc.section.3.2.6.p.4"><p> The backslash octet ("\") can be used as a single-octet quoting mechanism within quoted-string and comment constructs. Recipients that process the value of a quoted-string <em class="bcp14">MUST</em> handle a quoted-pair as if it were replaced by the octet following the backslash.<a class="self" href="#rfc.section.3.2.6.p.4">&para;</a></p></div></div><div id="rfc.figure.u.23"><pre class="inline"><span id="rfc.iref.g.40"></span>  <a href="#rule.quoted-pair" class="smpl">quoted-pair</a>    = "\" ( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> )  
     597</pre></div><div id="rfc.section.3.2.6.p.5"><p>A sender <em class="bcp14">SHOULD NOT</em> generate a quoted-pair in a quoted-string except where necessary to quote DQUOTE and backslash octets occurring within that string. A sender <em class="bcp14">SHOULD NOT</em> generate a quoted-pair in a comment except where necessary to quote parentheses ["(" and ")"] and backslash octets occurring within that comment.<a class="self" href="#rfc.section.3.2.6.p.5">&para;</a></p></div></div></div><div id="message.body"><h2 id="rfc.section.3.3"><a href="#rfc.section.3.3">3.3</a>&nbsp;<a href="#message.body">Message Body</a></h2><div id="rfc.section.3.3.p.1"><p>The message body (if any) of an HTTP message is used to carry the payload body of that request or response. The message body is identical to the payload body unless a transfer coding has been applied, as described in <a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.1" title="Transfer-Encoding">Section&nbsp;3.3.1</a>.<a class="self" href="#rfc.section.3.3.p.1">&para;</a></p></div><div id="rfc.figure.u.24"><pre class="inline"><span id="rfc.iref.g.41"></span>  <a href="#message.body" class="smpl">message-body</a> = *OCTET 
     598</pre></div><div id="rfc.section.3.3.p.2"><p>The rules for when a message body is allowed in a message differ for requests and responses.<a class="self" href="#rfc.section.3.3.p.2">&para;</a></p></div><div id="rfc.section.3.3.p.3"><p>The presence of a message body in a request is signaled by a <a href="#header.content-length" class="smpl">Content-Length</a> or <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field. Request message framing is independent of method semantics, even if the method does not define any use for a message body.<a class="self" href="#rfc.section.3.3.p.3">&para;</a></p></div><div id="rfc.section.3.3.p.4"><p>The presence of a message body in a response depends on both the request method to which it is responding and the response status code (<a href="#status.line" title="Status Line">Section&nbsp;3.1.2</a>). Responses to the HEAD request method (<a href="rfc7231.html#HEAD" title="HEAD">Section 4.3.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.11"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) never include a message body because the associated response header fields (e.g., <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a>, <a href="#header.content-length" class="smpl">Content-Length</a>, etc.), if present, indicate only what their values would have been if the request method had been GET (<a href="rfc7231.html#GET" title="GET">Section 4.3.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.12"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). <a href="rfc7231.html#status.2xx" class="smpl">2xx (Successful)</a> responses to a CONNECT request method (<a href="rfc7231.html#CONNECT" title="CONNECT">Section 4.3.6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.13"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) switch to tunnel mode instead of having a message body. All <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a>, <a href="rfc7231.html#status.204" class="smpl">204 (No Content)</a>, and <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> responses do not include a message body. All other responses do include a message body, although the body might be of zero length.<a class="self" href="#rfc.section.3.3.p.4">&para;</a></p></div><div id="header.transfer-encoding"><h3 id="rfc.section.3.3.1"><a href="#rfc.section.3.3.1">3.3.1</a>&nbsp;<a href="#header.transfer-encoding">Transfer-Encoding</a></h3><div id="rfc.section.3.3.1.p.1"><p>The Transfer-Encoding header field lists the transfer coding names corresponding to the sequence of transfer codings that have been (or will be) applied to the payload body in order to form the message body. Transfer codings are defined in <a href="#transfer.codings" title="Transfer Codings">Section&nbsp;4</a>.<a class="self" href="#rfc.section.3.3.1.p.1">&para;</a></p></div><div id="rfc.figure.u.25"><pre class="inline"><span id="rfc.iref.g.42"></span>  <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> = 1#<a href="#transfer.codings" class="smpl">transfer-coding</a> 
     599</pre></div><div id="rfc.section.3.3.1.p.2"><p>Transfer-Encoding is analogous to the Content-Transfer-Encoding field of MIME, which was designed to enable safe transport of binary data over a 7-bit transport service (<a href="#RFC2045" id="rfc.xref.RFC2045.2"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a>, <a href="https://tools.ietf.org/html/rfc2045#section-6">Section 6</a>). However, safe transport has a different focus for an 8bit-clean transfer protocol. In HTTP's case, Transfer-Encoding is primarily intended to accurately delimit a dynamically generated payload and to distinguish payload encodings that are only applied for transport efficiency or security from those that are characteristics of the selected resource.<a class="self" href="#rfc.section.3.3.1.p.2">&para;</a></p></div><div id="rfc.section.3.3.1.p.3"><p>A recipient <em class="bcp14">MUST</em> be able to parse the chunked transfer coding (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a>) because it plays a crucial role in framing messages when the payload body size is not known in advance. A sender <em class="bcp14">MUST NOT</em> apply chunked more than once to a message body (i.e., chunking an already chunked message is not allowed). If any transfer coding other than chunked is applied to a request payload body, the sender <em class="bcp14">MUST</em> apply chunked as the final transfer coding to ensure that the message is properly framed. If any transfer coding other than chunked is applied to a response payload body, the sender <em class="bcp14">MUST</em> either apply chunked as the final transfer coding or terminate the message by closing the connection.<a class="self" href="#rfc.section.3.3.1.p.3">&para;</a></p></div><div id="rfc.figure.u.26"><p>For example,</p><pre class="text">  Transfer-Encoding: gzip, chunked 
     600</pre><p>indicates that the payload body has been compressed using the gzip coding and then chunked using the chunked coding while forming the message body.</p></div><div id="rfc.section.3.3.1.p.4"><p>Unlike <a href="rfc7231.html#header.content-encoding" class="smpl">Content-Encoding</a> (<a href="rfc7231.html#content.codings" title="Content Codings">Section 3.1.2.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.14"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), Transfer-Encoding is a property of the message, not of the representation, and any recipient along the request/response chain <em class="bcp14">MAY</em> decode the received transfer coding(s) or apply additional transfer coding(s) to the message body, assuming that corresponding changes are made to the Transfer-Encoding field-value. Additional information about the encoding parameters can be provided by other header fields not defined by this specification.<a class="self" href="#rfc.section.3.3.1.p.4">&para;</a></p></div><div id="rfc.section.3.3.1.p.5"><p>Transfer-Encoding <em class="bcp14">MAY</em> be sent in a response to a HEAD request or in a <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> response (<a href="rfc7232.html#status.304" title="304 Not Modified">Section 4.1</a> of <a href="#RFC7232" id="rfc.xref.RFC7232.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a>) to a GET request, neither of which includes a message body, to indicate that the origin server would have applied a transfer coding to the message body if the request had been an unconditional GET. This indication is not required, however, because any recipient on the response chain (including the origin server) can remove transfer codings when they are not needed.<a class="self" href="#rfc.section.3.3.1.p.5">&para;</a></p></div><div id="rfc.section.3.3.1.p.6"><p>A server <em class="bcp14">MUST NOT</em> send a Transfer-Encoding header field in any response with a status code of <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a> or <a href="rfc7231.html#status.204" class="smpl">204 (No Content)</a>. A server <em class="bcp14">MUST NOT</em> send a Transfer-Encoding header field in any <a href="rfc7231.html#status.2xx" class="smpl">2xx (Successful)</a> response to a CONNECT request (<a href="rfc7231.html#CONNECT" title="CONNECT">Section 4.3.6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.15"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.3.3.1.p.6">&para;</a></p></div><div id="rfc.section.3.3.1.p.7"><p>Transfer-Encoding was added in HTTP/1.1. It is generally assumed that implementations advertising only HTTP/1.0 support will not understand how to process a transfer-encoded payload. A client <em class="bcp14">MUST NOT</em> send a request containing Transfer-Encoding unless it knows the server will handle HTTP/1.1 (or later) requests; such knowledge might be in the form of specific user configuration or by remembering the version of a prior received response. A server <em class="bcp14">MUST NOT</em> send a response containing Transfer-Encoding unless the corresponding request indicates HTTP/1.1 (or later).<a class="self" href="#rfc.section.3.3.1.p.7">&para;</a></p></div><div id="rfc.section.3.3.1.p.8"><p>A server that receives a request message with a transfer coding it does not understand <em class="bcp14">SHOULD</em> respond with <a href="rfc7231.html#status.501" class="smpl">501 (Not Implemented)</a>.<a class="self" href="#rfc.section.3.3.1.p.8">&para;</a></p></div></div><div id="header.content-length"><h3 id="rfc.section.3.3.2"><a href="#rfc.section.3.3.2">3.3.2</a>&nbsp;<a href="#header.content-length">Content-Length</a></h3><div id="rfc.section.3.3.2.p.1"><p>When a message does not have a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field, a Content-Length header field can provide the anticipated size, as a decimal number of octets, for a potential payload body. For messages that do include a payload body, the Content-Length field-value provides the framing information necessary for determining where the body (and message) ends. For messages that do not include a payload body, the Content-Length indicates the size of the selected representation (<a href="rfc7231.html#representations" title="Representations">Section 3</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.16"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.3.3.2.p.1">&para;</a></p></div><div id="rfc.figure.u.27"><pre class="inline"><span id="rfc.iref.g.43"></span>  <a href="#header.content-length" class="smpl">Content-Length</a> = 1*<a href="#core.rules" class="smpl">DIGIT</a> 
     601</pre></div><div id="rfc.section.3.3.2.p.2"><p>An example is<a class="self" href="#rfc.section.3.3.2.p.2">&para;</a></p></div><div id="rfc.figure.u.28"><pre class="text">  Content-Length: 3495 
     602</pre></div><div id="rfc.section.3.3.2.p.3"><p>A sender <em class="bcp14">MUST NOT</em> send a Content-Length header field in any message that contains a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field.<a class="self" href="#rfc.section.3.3.2.p.3">&para;</a></p></div><div id="rfc.section.3.3.2.p.4"><p>A user agent <em class="bcp14">SHOULD</em> send a Content-Length in a request message when no <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> is sent and the request method defines a meaning for an enclosed payload body. For example, a Content-Length header field is normally sent in a POST request even when the value is 0 (indicating an empty payload body). A user agent <em class="bcp14">SHOULD NOT</em> send a Content-Length header field when the request message does not contain a payload body and the method semantics do not anticipate such a body.<a class="self" href="#rfc.section.3.3.2.p.4">&para;</a></p></div><div id="rfc.section.3.3.2.p.5"><p>A server <em class="bcp14">MAY</em> send a Content-Length header field in a response to a HEAD request (<a href="rfc7231.html#HEAD" title="HEAD">Section 4.3.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.17"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>); a server <em class="bcp14">MUST NOT</em> send Content-Length in such a response unless its field-value equals the decimal number of octets that would have been sent in the payload body of a response if the same request had used the GET method.<a class="self" href="#rfc.section.3.3.2.p.5">&para;</a></p></div><div id="rfc.section.3.3.2.p.6"><p>A server <em class="bcp14">MAY</em> send a Content-Length header field in a <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> response to a conditional GET request (<a href="rfc7232.html#status.304" title="304 Not Modified">Section 4.1</a> of <a href="#RFC7232" id="rfc.xref.RFC7232.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a>); a server <em class="bcp14">MUST NOT</em> send Content-Length in such a response unless its field-value equals the decimal number of octets that would have been sent in the payload body of a <a href="rfc7231.html#status.200" class="smpl">200 (OK)</a> response to the same request.<a class="self" href="#rfc.section.3.3.2.p.6">&para;</a></p></div><div id="rfc.section.3.3.2.p.7"><p>A server <em class="bcp14">MUST NOT</em> send a Content-Length header field in any response with a status code of <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a> or <a href="rfc7231.html#status.204" class="smpl">204 (No Content)</a>. A server <em class="bcp14">MUST NOT</em> send a Content-Length header field in any <a href="rfc7231.html#status.2xx" class="smpl">2xx (Successful)</a> response to a CONNECT request (<a href="rfc7231.html#CONNECT" title="CONNECT">Section 4.3.6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.18"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.3.3.2.p.7">&para;</a></p></div><div id="rfc.section.3.3.2.p.8"><p>Aside from the cases defined above, in the absence of Transfer-Encoding, an origin server <em class="bcp14">SHOULD</em> send a Content-Length header field when the payload body size is known prior to sending the complete header section. This will allow downstream recipients to measure transfer progress, know when a received message is complete, and potentially reuse the connection for additional requests.<a class="self" href="#rfc.section.3.3.2.p.8">&para;</a></p></div><div id="rfc.section.3.3.2.p.9"><p>Any Content-Length field value greater than or equal to zero is valid. Since there is no predefined limit to the length of a payload, a recipient <em class="bcp14">MUST</em> anticipate potentially large decimal numerals and prevent parsing errors due to integer conversion overflows (<a href="#attack.protocol.element.length" title="Attacks via Protocol Element Length">Section&nbsp;9.3</a>).<a class="self" href="#rfc.section.3.3.2.p.9">&para;</a></p></div><div id="rfc.section.3.3.2.p.10"><p>If a message is received that has multiple Content-Length header fields with field-values consisting of the same decimal value, or a single Content-Length header field with a field value containing a list of identical decimal values (e.g., "Content-Length: 42, 42"), indicating that duplicate Content-Length header fields have been generated or combined by an upstream message processor, then the recipient <em class="bcp14">MUST</em> either reject the message as invalid or replace the duplicated field-values with a single valid Content-Length field containing that decimal value prior to determining the message body length or forwarding the message.<a class="self" href="#rfc.section.3.3.2.p.10">&para;</a></p></div><div class="note" id="rfc.section.3.3.2.p.11"><p><b>Note:</b> HTTP's use of Content-Length for message framing differs significantly from the same field's use in MIME, where it is an optional field used only within the "message/external-body" media-type.<a class="self" href="#rfc.section.3.3.2.p.11">&para;</a></p></div></div><div id="message.body.length"><h3 id="rfc.section.3.3.3"><a href="#rfc.section.3.3.3">3.3.3</a>&nbsp;<a href="#message.body.length">Message Body Length</a></h3><div id="rfc.section.3.3.3.p.1"><p>The length of a message body is determined by one of the following (in order of precedence):<a class="self" href="#rfc.section.3.3.3.p.1">&para;</a></p></div><div id="rfc.section.3.3.3.p.2"><ol><li><p>Any response to a HEAD request and any response with a <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a>, <a href="rfc7231.html#status.204" class="smpl">204 (No Content)</a>, or <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> status code is always terminated by the first empty line after the header fields, regardless of the header fields present in the message, and thus cannot contain a message body.</p></li><li><p>Any <a href="rfc7231.html#status.2xx" class="smpl">2xx (Successful)</a> response to a CONNECT request implies that the connection will become a tunnel immediately after the empty line that concludes the header fields. A client <em class="bcp14">MUST</em> ignore any <a href="#header.content-length" class="smpl">Content-Length</a> or <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header fields received in such a message.</p></li><li><p>If a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field is present and the chunked transfer coding (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a>) is the final encoding, the message body length is determined by reading and decoding the chunked data until the transfer coding indicates the data is complete.</p><p>If a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field is present in a response and the chunked transfer coding is not the final encoding, the message body length is determined by reading the connection until it is closed by the server. If a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field is present in a request and the chunked transfer coding is not the final encoding, the message body length cannot be determined reliably; the server <em class="bcp14">MUST</em> respond with the <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> status code and then close the connection.</p><p>If a message is received with both a <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> and a <a href="#header.content-length" class="smpl">Content-Length</a> header field, the Transfer-Encoding overrides the Content-Length. Such a message might indicate an attempt to perform request smuggling (<a href="#request.smuggling" title="Request Smuggling">Section&nbsp;9.5</a>) or response splitting (<a href="#response.splitting" title="Response Splitting">Section&nbsp;9.4</a>) and ought to be handled as an error. A sender <em class="bcp14">MUST</em> remove the received Content-Length field prior to forwarding such a message downstream.</p></li><li><p>If a message is received without <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> and with either multiple <a href="#header.content-length" class="smpl">Content-Length</a> header fields having differing field-values or a single Content-Length header field having an invalid value, then the message framing is invalid and the recipient <em class="bcp14">MUST</em> treat it as an unrecoverable error. If this is a request message, the server <em class="bcp14">MUST</em> respond with a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> status code and then close the connection. If this is a response message received by a proxy, the proxy <em class="bcp14">MUST</em> close the connection to the server, discard the received response, and send a <a href="rfc7231.html#status.502" class="smpl">502 (Bad Gateway)</a> response to the client. If this is a response message received by a user agent, the user agent <em class="bcp14">MUST</em> close the connection to the server and discard the received response.</p></li><li><p>If a valid <a href="#header.content-length" class="smpl">Content-Length</a> header field is present without <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a>, its decimal value defines the expected message body length in octets. If the sender closes the connection or the recipient times out before the indicated number of octets are received, the recipient <em class="bcp14">MUST</em> consider the message to be incomplete and close the connection.</p></li><li><p>If this is a request message and none of the above are true, then the message body length is zero (no message body is present).</p></li><li><p>Otherwise, this is a response message without a declared message body length, so the message body length is determined by the number of octets received prior to the server closing the connection.</p></li></ol></div><div id="rfc.section.3.3.3.p.3"><p>Since there is no way to distinguish a successfully completed, close-delimited message from a partially received message interrupted by network failure, a server <em class="bcp14">SHOULD</em> generate encoding or length-delimited messages whenever possible. The close-delimiting feature exists primarily for backwards compatibility with HTTP/1.0.<a class="self" href="#rfc.section.3.3.3.p.3">&para;</a></p></div><div id="rfc.section.3.3.3.p.4"><p>A server <em class="bcp14">MAY</em> reject a request that contains a message body but not a <a href="#header.content-length" class="smpl">Content-Length</a> by responding with <a href="rfc7231.html#status.411" class="smpl">411 (Length Required)</a>.<a class="self" href="#rfc.section.3.3.3.p.4">&para;</a></p></div><div id="rfc.section.3.3.3.p.5"><p>Unless a transfer coding other than chunked has been applied, a client that sends a request containing a message body <em class="bcp14">SHOULD</em> use a valid <a href="#header.content-length" class="smpl">Content-Length</a> header field if the message body length is known in advance, rather than the chunked transfer coding, since some existing services respond to chunked with a <a href="rfc7231.html#status.411" class="smpl">411 (Length Required)</a> status code even though they understand the chunked transfer coding. This is typically because such services are implemented via a gateway that requires a content-length in advance of being called and the server is unable or unwilling to buffer the entire request before processing.<a class="self" href="#rfc.section.3.3.3.p.5">&para;</a></p></div><div id="rfc.section.3.3.3.p.6"><p>A user agent that sends a request containing a message body <em class="bcp14">MUST</em> send a valid <a href="#header.content-length" class="smpl">Content-Length</a> header field if it does not know the server will handle HTTP/1.1 (or later) requests; such knowledge can be in the form of specific user configuration or by remembering the version of a prior received response.<a class="self" href="#rfc.section.3.3.3.p.6">&para;</a></p></div><div id="rfc.section.3.3.3.p.7"><p>If the final response to the last request on a connection has been completely received and there remains additional data to read, a user agent <em class="bcp14">MAY</em> discard the remaining data or attempt to determine if that data belongs as part of the prior response body, which might be the case if the prior message's Content-Length value is incorrect. A client <em class="bcp14">MUST NOT</em> process, cache, or forward such extra data as a separate response, since such behavior would be vulnerable to cache poisoning.<a class="self" href="#rfc.section.3.3.3.p.7">&para;</a></p></div></div></div><div id="incomplete.messages"><h2 id="rfc.section.3.4"><a href="#rfc.section.3.4">3.4</a>&nbsp;<a href="#incomplete.messages">Handling Incomplete Messages</a></h2><div id="rfc.section.3.4.p.1"><p>A server that receives an incomplete request message, usually due to a canceled request or a triggered timeout exception, <em class="bcp14">MAY</em> send an error response prior to closing the connection.<a class="self" href="#rfc.section.3.4.p.1">&para;</a></p></div><div id="rfc.section.3.4.p.2"><p>A client that receives an incomplete response message, which can occur when a connection is closed prematurely or when decoding a supposedly chunked transfer coding fails, <em class="bcp14">MUST</em> record the message as incomplete. Cache requirements for incomplete responses are defined in <a href="rfc7234.html#response.cacheability" title="Storing Responses in Caches">Section 3</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>.<a class="self" href="#rfc.section.3.4.p.2">&para;</a></p></div><div id="rfc.section.3.4.p.3"><p>If a response terminates in the middle of the header section (before the empty line is received) and the status code might rely on header fields to convey the full meaning of the response, then the client cannot assume that meaning has been conveyed; the client might need to repeat the request in order to determine what action to take next.<a class="self" href="#rfc.section.3.4.p.3">&para;</a></p></div><div id="rfc.section.3.4.p.4"><p>A message body that uses the chunked transfer coding is incomplete if the zero-sized chunk that terminates the encoding has not been received. A message that uses a valid <a href="#header.content-length" class="smpl">Content-Length</a> is incomplete if the size of the message body received (in octets) is less than the value given by Content-Length. A response that has neither chunked transfer coding nor Content-Length is terminated by closure of the connection and, thus, is considered complete regardless of the number of message body octets received, provided that the header section was received intact.<a class="self" href="#rfc.section.3.4.p.4">&para;</a></p></div></div><div id="message.robustness"><h2 id="rfc.section.3.5"><a href="#rfc.section.3.5">3.5</a>&nbsp;<a href="#message.robustness">Message Parsing Robustness</a></h2><div id="rfc.section.3.5.p.1"><p>Older HTTP/1.0 user agent implementations might send an extra CRLF after a POST request as a workaround for some early server applications that failed to read message body content that was not terminated by a line-ending. An HTTP/1.1 user agent <em class="bcp14">MUST NOT</em> preface or follow a request with an extra CRLF. If terminating the request message body with a line-ending is desired, then the user agent <em class="bcp14">MUST</em> count the terminating CRLF octets as part of the message body length.<a class="self" href="#rfc.section.3.5.p.1">&para;</a></p></div><div id="rfc.section.3.5.p.2"><p>In the interest of robustness, a server that is expecting to receive and parse a request-line <em class="bcp14">SHOULD</em> ignore at least one empty line (CRLF) received prior to the request-line.<a class="self" href="#rfc.section.3.5.p.2">&para;</a></p></div><div id="rfc.section.3.5.p.3"><p>Although the line terminator for the start-line and header fields is the sequence CRLF, a recipient <em class="bcp14">MAY</em> recognize a single LF as a line terminator and ignore any preceding CR.<a class="self" href="#rfc.section.3.5.p.3">&para;</a></p></div><div id="rfc.section.3.5.p.4"><p>Although the request-line and status-line grammar rules require that each of the component elements be separated by a single SP octet, recipients <em class="bcp14">MAY</em> instead parse on whitespace-delimited word boundaries and, aside from the CRLF terminator, treat any form of whitespace as the SP separator while ignoring preceding or trailing whitespace; such whitespace includes one or more of the following octets: SP, HTAB, VT (%x0B), FF (%x0C), or bare CR. However, lenient parsing can result in security vulnerabilities if there are multiple recipients of the message and each has its own unique interpretation of robustness (see <a href="#request.smuggling" title="Request Smuggling">Section&nbsp;9.5</a>).<a class="self" href="#rfc.section.3.5.p.4">&para;</a></p></div><div id="rfc.section.3.5.p.5"><p>When a server listening only for HTTP request messages, or processing what appears from the start-line to be an HTTP request message, receives a sequence of octets that does not match the HTTP-message grammar aside from the robustness exceptions listed above, the server <em class="bcp14">SHOULD</em> respond with a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> response.<a class="self" href="#rfc.section.3.5.p.5">&para;</a></p></div></div></div><div id="transfer.codings"><h1 id="rfc.section.4"><a href="#rfc.section.4">4.</a>&nbsp;<a href="#transfer.codings">Transfer Codings</a></h1><div id="rfc.section.4.p.1"><p>Transfer coding names are used to indicate an encoding transformation that has been, can be, or might need to be applied to a payload body in order to ensure "safe transport" through the network. This differs from a content coding in that the transfer coding is a property of the message rather than a property of the representation that is being transferred.<a class="self" href="#rfc.section.4.p.1">&para;</a></p></div><div id="rfc.figure.u.29"><pre class="inline"><span id="rfc.iref.g.44"></span><span id="rfc.iref.g.45"></span>  <a href="#transfer.codings" class="smpl">transfer-coding</a>    = "chunked" ; <a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a> 
    623603                     / "compress" ; <a href="#compress.coding" title="Compress Coding">Section&nbsp;4.2.1</a> 
    624604                     / "deflate" ; <a href="#deflate.coding" title="Deflate Coding">Section&nbsp;4.2.2</a> 
     
    626606                     / <a href="#transfer.codings" class="smpl">transfer-extension</a> 
    627607  <a href="#transfer.codings" class="smpl">transfer-extension</a> = <a href="#rule.token.separators" class="smpl">token</a> *( <a href="#rule.whitespace" class="smpl">OWS</a> ";" <a href="#rule.whitespace" class="smpl">OWS</a> <a href="#rule.parameter" class="smpl">transfer-parameter</a> ) 
    628 </pre></div><div id="rule.parameter"><p id="rfc.section.4.p.2"> Parameters are in the form of a name or name=value pair.<a class="self" href="#rfc.section.4.p.2">&para;</a></p></div><div id="rfc.figure.u.30"><pre class="inline"><span id="rfc.iref.g.46"></span>  <a href="#rule.parameter" class="smpl">transfer-parameter</a> = <a href="#rule.token.separators" class="smpl">token</a> <a href="#rule.whitespace" class="smpl">BWS</a> "=" <a href="#rule.whitespace" class="smpl">BWS</a> ( <a href="#rule.token.separators" class="smpl">token</a> / <a href="#rule.quoted-string" class="smpl">quoted-string</a> ) 
    629 </pre></div><p id="rfc.section.4.p.3">All transfer-coding names are case-insensitive and ought to be registered within the HTTP Transfer Coding registry, as defined in <a href="#transfer.coding.registry" title="Transfer Coding Registry">Section&nbsp;8.4</a>. They are used in the <a href="#header.te" class="smpl">TE</a> (<a href="#header.te" id="rfc.xref.header.te.1" title="TE">Section&nbsp;4.3</a>) and <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> (<a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.2" title="Transfer-Encoding">Section&nbsp;3.3.1</a>) header fields.<a class="self" href="#rfc.section.4.p.3">&para;</a></p><div id="chunked.encoding"><h2 id="rfc.section.4.1"><a href="#rfc.section.4.1">4.1</a>&nbsp;<a href="#chunked.encoding">Chunked Transfer Coding</a></h2><p id="rfc.section.4.1.p.1">The chunked transfer coding wraps the payload body in order to transfer it as a series of chunks, each with its own size indicator, followed by an <em class="bcp14">OPTIONAL</em> trailer containing header fields. Chunked enables content streams of unknown size to be transferred as a sequence of length-delimited buffers, which enables the sender to retain connection persistence and the recipient to know when it has received the entire message.<a class="self" href="#rfc.section.4.1.p.1">&para;</a></p><div id="rfc.figure.u.31"><pre class="inline"><span id="rfc.iref.g.47"></span><span id="rfc.iref.g.48"></span><span id="rfc.iref.g.49"></span><span id="rfc.iref.g.50"></span><span id="rfc.iref.g.51"></span><span id="rfc.iref.g.52"></span><span id="rfc.iref.g.53"></span>  <a href="#chunked.encoding" class="smpl">chunked-body</a>   = *<a href="#chunked.encoding" class="smpl">chunk</a> 
     608</pre></div><div id="rule.parameter"><div id="rfc.section.4.p.2"><p> Parameters are in the form of a name or name=value pair.<a class="self" href="#rfc.section.4.p.2">&para;</a></p></div></div><div id="rfc.figure.u.30"><pre class="inline"><span id="rfc.iref.g.46"></span>  <a href="#rule.parameter" class="smpl">transfer-parameter</a> = <a href="#rule.token.separators" class="smpl">token</a> <a href="#rule.whitespace" class="smpl">BWS</a> "=" <a href="#rule.whitespace" class="smpl">BWS</a> ( <a href="#rule.token.separators" class="smpl">token</a> / <a href="#rule.quoted-string" class="smpl">quoted-string</a> ) 
     609</pre></div><div id="rfc.section.4.p.3"><p>All transfer-coding names are case-insensitive and ought to be registered within the HTTP Transfer Coding registry, as defined in <a href="#transfer.coding.registry" title="Transfer Coding Registry">Section&nbsp;8.4</a>. They are used in the <a href="#header.te" class="smpl">TE</a> (<a href="#header.te" id="rfc.xref.header.te.1" title="TE">Section&nbsp;4.3</a>) and <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> (<a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.2" title="Transfer-Encoding">Section&nbsp;3.3.1</a>) header fields.<a class="self" href="#rfc.section.4.p.3">&para;</a></p></div><div id="chunked.encoding"><h2 id="rfc.section.4.1"><a href="#rfc.section.4.1">4.1</a>&nbsp;<a href="#chunked.encoding">Chunked Transfer Coding</a></h2><div id="rfc.section.4.1.p.1"><p>The chunked transfer coding wraps the payload body in order to transfer it as a series of chunks, each with its own size indicator, followed by an <em class="bcp14">OPTIONAL</em> trailer containing header fields. Chunked enables content streams of unknown size to be transferred as a sequence of length-delimited buffers, which enables the sender to retain connection persistence and the recipient to know when it has received the entire message.<a class="self" href="#rfc.section.4.1.p.1">&para;</a></p></div><div id="rfc.figure.u.31"><pre class="inline"><span id="rfc.iref.g.47"></span><span id="rfc.iref.g.48"></span><span id="rfc.iref.g.49"></span><span id="rfc.iref.g.50"></span><span id="rfc.iref.g.51"></span><span id="rfc.iref.g.52"></span><span id="rfc.iref.g.53"></span>  <a href="#chunked.encoding" class="smpl">chunked-body</a>   = *<a href="#chunked.encoding" class="smpl">chunk</a> 
    630610                   <a href="#chunked.encoding" class="smpl">last-chunk</a> 
    631611                   <a href="#chunked.trailer.part" class="smpl">trailer-part</a> 
     
    638618   
    639619  <a href="#chunked.encoding" class="smpl">chunk-data</a>     = 1*<a href="#core.rules" class="smpl">OCTET</a> ; a sequence of chunk-size octets 
    640 </pre></div><p id="rfc.section.4.1.p.2">The chunk-size field is a string of hex digits indicating the size of the chunk-data in octets. The chunked transfer coding is complete when a chunk with a chunk-size of zero is received, possibly followed by a trailer, and finally terminated by an empty line.<a class="self" href="#rfc.section.4.1.p.2">&para;</a></p><p id="rfc.section.4.1.p.3">A recipient <em class="bcp14">MUST</em> be able to parse and decode the chunked transfer coding.<a class="self" href="#rfc.section.4.1.p.3">&para;</a></p><div id="chunked.extension"><h3 id="rfc.section.4.1.1"><a href="#rfc.section.4.1.1">4.1.1</a>&nbsp;<a href="#chunked.extension">Chunk Extensions</a></h3><p id="rfc.section.4.1.1.p.1">The chunked encoding allows each chunk to include zero or more chunk extensions, immediately following the <a href="#chunked.encoding" class="smpl">chunk-size</a>, for the sake of supplying per-chunk metadata (such as a signature or hash), mid-message control information, or randomization of message body size.<a class="self" href="#rfc.section.4.1.1.p.1">&para;</a></p><div id="rfc.figure.u.32"><pre class="inline"><span id="rfc.iref.g.54"></span><span id="rfc.iref.g.55"></span><span id="rfc.iref.g.56"></span><span id="rfc.iref.g.57"></span>  <a href="#chunked.extension" class="smpl">chunk-ext</a>      = *( ";" <a href="#chunked.extension" class="smpl">chunk-ext-name</a> [ "=" <a href="#chunked.extension" class="smpl">chunk-ext-val</a> ] ) 
     620</pre></div><div id="rfc.section.4.1.p.2"><p>The chunk-size field is a string of hex digits indicating the size of the chunk-data in octets. The chunked transfer coding is complete when a chunk with a chunk-size of zero is received, possibly followed by a trailer, and finally terminated by an empty line.<a class="self" href="#rfc.section.4.1.p.2">&para;</a></p></div><div id="rfc.section.4.1.p.3"><p>A recipient <em class="bcp14">MUST</em> be able to parse and decode the chunked transfer coding.<a class="self" href="#rfc.section.4.1.p.3">&para;</a></p></div><div id="chunked.extension"><h3 id="rfc.section.4.1.1"><a href="#rfc.section.4.1.1">4.1.1</a>&nbsp;<a href="#chunked.extension">Chunk Extensions</a></h3><div id="rfc.section.4.1.1.p.1"><p>The chunked encoding allows each chunk to include zero or more chunk extensions, immediately following the <a href="#chunked.encoding" class="smpl">chunk-size</a>, for the sake of supplying per-chunk metadata (such as a signature or hash), mid-message control information, or randomization of message body size.<a class="self" href="#rfc.section.4.1.1.p.1">&para;</a></p></div><div id="rfc.figure.u.32"><pre class="inline"><span id="rfc.iref.g.54"></span><span id="rfc.iref.g.55"></span><span id="rfc.iref.g.56"></span><span id="rfc.iref.g.57"></span>  <a href="#chunked.extension" class="smpl">chunk-ext</a>      = *( ";" <a href="#chunked.extension" class="smpl">chunk-ext-name</a> [ "=" <a href="#chunked.extension" class="smpl">chunk-ext-val</a> ] ) 
    641621 
    642622  <a href="#chunked.extension" class="smpl">chunk-ext-name</a> = <a href="#rule.token.separators" class="smpl">token</a> 
    643623  <a href="#chunked.extension" class="smpl">chunk-ext-val</a>  = <a href="#rule.token.separators" class="smpl">token</a> / <a href="#rule.quoted-string" class="smpl">quoted-string</a> 
    644 </pre></div><p id="rfc.section.4.1.1.p.2">The chunked encoding is specific to each connection and is likely to be removed or recoded by each recipient (including intermediaries) before any higher-level application would have a chance to inspect the extensions. Hence, use of chunk extensions is generally limited to specialized HTTP services such as "long polling" (where client and server can have shared expectations regarding the use of chunk extensions) or for padding within an end-to-end secured connection.<a class="self" href="#rfc.section.4.1.1.p.2">&para;</a></p><p id="rfc.section.4.1.1.p.3">A recipient <em class="bcp14">MUST</em> ignore unrecognized chunk extensions. A server ought to limit the total length of chunk extensions received in a request to an amount reasonable for the services provided, in the same way that it applies length limitations and timeouts for other parts of a message, and generate an appropriate <a href="rfc7231.html#status.4xx" class="smpl">4xx (Client Error)</a> response if that amount is exceeded.<a class="self" href="#rfc.section.4.1.1.p.3">&para;</a></p></div><div id="chunked.trailer.part"><h3 id="rfc.section.4.1.2"><a href="#rfc.section.4.1.2">4.1.2</a>&nbsp;<a href="#chunked.trailer.part">Chunked Trailer Part</a></h3><p id="rfc.section.4.1.2.p.1">A trailer allows the sender to include additional fields at the end of a chunked message in order to supply metadata that might be dynamically generated while the message body is sent, such as a message integrity check, digital signature, or post-processing status. The trailer fields are identical to header fields, except they are sent in a chunked trailer instead of the message's header section.<a class="self" href="#rfc.section.4.1.2.p.1">&para;</a></p><div id="rfc.figure.u.33"><pre class="inline"><span id="rfc.iref.g.58"></span><span id="rfc.iref.g.59"></span>  <a href="#chunked.trailer.part" class="smpl">trailer-part</a>   = *( <a href="#header.fields" class="smpl">header-field</a> <a href="#core.rules" class="smpl">CRLF</a> ) 
    645 </pre></div><p id="rfc.section.4.1.2.p.2">A sender <em class="bcp14">MUST NOT</em> generate a trailer that contains a field necessary for message framing (e.g., <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> and <a href="#header.content-length" class="smpl">Content-Length</a>), routing (e.g., <a href="#header.host" class="smpl">Host</a>), request modifiers (e.g., controls and conditionals in <a href="rfc7231.html#request.header.fields" title="Request Header Fields">Section 5</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.19"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), authentication (e.g., see <a href="#RFC7235" id="rfc.xref.RFC7235.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Authentication">[RFC7235]</cite></a> and <a href="#RFC6265" id="rfc.xref.RFC6265.3"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>), response control data (e.g., see <a href="rfc7231.html#response.control.data" title="Control Data">Section 7.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.20"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), or determining how to process the payload (e.g., <a href="rfc7231.html#header.content-encoding" class="smpl">Content-Encoding</a>, <a href="rfc7231.html#header.content-type" class="smpl">Content-Type</a>, <a href="rfc7233.html#header.content-range" class="smpl">Content-Range</a>, and <a href="#header.trailer" class="smpl">Trailer</a>).<a class="self" href="#rfc.section.4.1.2.p.2">&para;</a></p><p id="rfc.section.4.1.2.p.3">When a chunked message containing a non-empty trailer is received, the recipient <em class="bcp14">MAY</em> process the fields (aside from those forbidden above) as if they were appended to the message's header section. A recipient <em class="bcp14">MUST</em> ignore (or consider as an error) any fields that are forbidden to be sent in a trailer, since processing them as if they were present in the header section might bypass external security filters.<a class="self" href="#rfc.section.4.1.2.p.3">&para;</a></p><p id="rfc.section.4.1.2.p.4">Unless the request includes a <a href="#header.te" class="smpl">TE</a> header field indicating "trailers" is acceptable, as described in <a href="#header.te" id="rfc.xref.header.te.2" title="TE">Section&nbsp;4.3</a>, a server <em class="bcp14">SHOULD NOT</em> generate trailer fields that it believes are necessary for the user agent to receive. Without a TE containing "trailers", the server ought to assume that the trailer fields might be silently discarded along the path to the user agent. This requirement allows intermediaries to forward a de-chunked message to an HTTP/1.0 recipient without buffering the entire response.<a class="self" href="#rfc.section.4.1.2.p.4">&para;</a></p></div><div id="decoding.chunked"><h3 id="rfc.section.4.1.3"><a href="#rfc.section.4.1.3">4.1.3</a>&nbsp;<a href="#decoding.chunked">Decoding Chunked</a></h3><p id="rfc.section.4.1.3.p.1">A process for decoding the chunked transfer coding can be represented in pseudo-code as:<a class="self" href="#rfc.section.4.1.3.p.1">&para;</a></p><div id="rfc.figure.u.34"><pre class="text">  length := 0 
     624</pre></div><div id="rfc.section.4.1.1.p.2"><p>The chunked encoding is specific to each connection and is likely to be removed or recoded by each recipient (including intermediaries) before any higher-level application would have a chance to inspect the extensions. Hence, use of chunk extensions is generally limited to specialized HTTP services such as "long polling" (where client and server can have shared expectations regarding the use of chunk extensions) or for padding within an end-to-end secured connection.<a class="self" href="#rfc.section.4.1.1.p.2">&para;</a></p></div><div id="rfc.section.4.1.1.p.3"><p>A recipient <em class="bcp14">MUST</em> ignore unrecognized chunk extensions. A server ought to limit the total length of chunk extensions received in a request to an amount reasonable for the services provided, in the same way that it applies length limitations and timeouts for other parts of a message, and generate an appropriate <a href="rfc7231.html#status.4xx" class="smpl">4xx (Client Error)</a> response if that amount is exceeded.<a class="self" href="#rfc.section.4.1.1.p.3">&para;</a></p></div></div><div id="chunked.trailer.part"><h3 id="rfc.section.4.1.2"><a href="#rfc.section.4.1.2">4.1.2</a>&nbsp;<a href="#chunked.trailer.part">Chunked Trailer Part</a></h3><div id="rfc.section.4.1.2.p.1"><p>A trailer allows the sender to include additional fields at the end of a chunked message in order to supply metadata that might be dynamically generated while the message body is sent, such as a message integrity check, digital signature, or post-processing status. The trailer fields are identical to header fields, except they are sent in a chunked trailer instead of the message's header section.<a class="self" href="#rfc.section.4.1.2.p.1">&para;</a></p></div><div id="rfc.figure.u.33"><pre class="inline"><span id="rfc.iref.g.58"></span><span id="rfc.iref.g.59"></span>  <a href="#chunked.trailer.part" class="smpl">trailer-part</a>   = *( <a href="#header.fields" class="smpl">header-field</a> <a href="#core.rules" class="smpl">CRLF</a> ) 
     625</pre></div><div id="rfc.section.4.1.2.p.2"><p>A sender <em class="bcp14">MUST NOT</em> generate a trailer that contains a field necessary for message framing (e.g., <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> and <a href="#header.content-length" class="smpl">Content-Length</a>), routing (e.g., <a href="#header.host" class="smpl">Host</a>), request modifiers (e.g., controls and conditionals in <a href="rfc7231.html#request.header.fields" title="Request Header Fields">Section 5</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.19"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), authentication (e.g., see <a href="#RFC7235" id="rfc.xref.RFC7235.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Authentication">[RFC7235]</cite></a> and <a href="#RFC6265" id="rfc.xref.RFC6265.3"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>), response control data (e.g., see <a href="rfc7231.html#response.control.data" title="Control Data">Section 7.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.20"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), or determining how to process the payload (e.g., <a href="rfc7231.html#header.content-encoding" class="smpl">Content-Encoding</a>, <a href="rfc7231.html#header.content-type" class="smpl">Content-Type</a>, <a href="rfc7233.html#header.content-range" class="smpl">Content-Range</a>, and <a href="#header.trailer" class="smpl">Trailer</a>).<a class="self" href="#rfc.section.4.1.2.p.2">&para;</a></p></div><div id="rfc.section.4.1.2.p.3"><p>When a chunked message containing a non-empty trailer is received, the recipient <em class="bcp14">MAY</em> process the fields (aside from those forbidden above) as if they were appended to the message's header section. A recipient <em class="bcp14">MUST</em> ignore (or consider as an error) any fields that are forbidden to be sent in a trailer, since processing them as if they were present in the header section might bypass external security filters.<a class="self" href="#rfc.section.4.1.2.p.3">&para;</a></p></div><div id="rfc.section.4.1.2.p.4"><p>Unless the request includes a <a href="#header.te" class="smpl">TE</a> header field indicating "trailers" is acceptable, as described in <a href="#header.te" id="rfc.xref.header.te.2" title="TE">Section&nbsp;4.3</a>, a server <em class="bcp14">SHOULD NOT</em> generate trailer fields that it believes are necessary for the user agent to receive. Without a TE containing "trailers", the server ought to assume that the trailer fields might be silently discarded along the path to the user agent. This requirement allows intermediaries to forward a de-chunked message to an HTTP/1.0 recipient without buffering the entire response.<a class="self" href="#rfc.section.4.1.2.p.4">&para;</a></p></div></div><div id="decoding.chunked"><h3 id="rfc.section.4.1.3"><a href="#rfc.section.4.1.3">4.1.3</a>&nbsp;<a href="#decoding.chunked">Decoding Chunked</a></h3><div id="rfc.section.4.1.3.p.1"><p>A process for decoding the chunked transfer coding can be represented in pseudo-code as:<a class="self" href="#rfc.section.4.1.3.p.1">&para;</a></p></div><div id="rfc.figure.u.34"><pre class="text">  length := 0 
    646626  read chunk-size, chunk-ext (if any), and CRLF 
    647627  while (chunk-size &gt; 0) { 
     
    661641  Remove "chunked" from Transfer-Encoding 
    662642  Remove Trailer from existing header fields 
    663 </pre></div></div></div><div id="compression.codings"><h2 id="rfc.section.4.2"><a href="#rfc.section.4.2">4.2</a>&nbsp;<a href="#compression.codings">Compression Codings</a></h2><p id="rfc.section.4.2.p.1">The codings defined below can be used to compress the payload of a message.<a class="self" href="#rfc.section.4.2.p.1">&para;</a></p><div id="compress.coding"><h3 id="rfc.section.4.2.1"><a href="#rfc.section.4.2.1">4.2.1</a>&nbsp;<a href="#compress.coding">Compress Coding</a></h3><p id="rfc.section.4.2.1.p.1">The "compress" coding is an adaptive Lempel-Ziv-Welch (LZW) coding <a href="#Welch" id="rfc.xref.Welch.1"><cite title="A Technique for High-Performance Data Compression">[Welch]</cite></a> that is commonly produced by the UNIX file compression program "compress". A recipient <em class="bcp14">SHOULD</em> consider "x-compress" to be equivalent to "compress".<a class="self" href="#rfc.section.4.2.1.p.1">&para;</a></p></div><div id="deflate.coding"><h3 id="rfc.section.4.2.2"><a href="#rfc.section.4.2.2">4.2.2</a>&nbsp;<a href="#deflate.coding">Deflate Coding</a></h3><p id="rfc.section.4.2.2.p.1">The "deflate" coding is a "zlib" data format <a href="#RFC1950" id="rfc.xref.RFC1950.1"><cite title="ZLIB Compressed Data Format Specification version 3.3">[RFC1950]</cite></a> containing a "deflate" compressed data stream <a href="#RFC1951" id="rfc.xref.RFC1951.1"><cite title="DEFLATE Compressed Data Format Specification version 1.3">[RFC1951]</cite></a> that uses a combination of the Lempel-Ziv (LZ77) compression algorithm and Huffman coding.<a class="self" href="#rfc.section.4.2.2.p.1">&para;</a></p><div class="note" id="rfc.section.4.2.2.p.2"><p><b>Note:</b> Some non-conformant implementations send the "deflate" compressed data without the zlib wrapper.</p> </div></div><div id="gzip.coding"><h3 id="rfc.section.4.2.3"><a href="#rfc.section.4.2.3">4.2.3</a>&nbsp;<a href="#gzip.coding">Gzip Coding</a></h3><p id="rfc.section.4.2.3.p.1">The "gzip" coding is an LZ77 coding with a 32-bit Cyclic Redundancy Check (CRC) that is commonly produced by the gzip file compression program <a href="#RFC1952" id="rfc.xref.RFC1952.1"><cite title="GZIP file format specification version 4.3">[RFC1952]</cite></a>. A recipient <em class="bcp14">SHOULD</em> consider "x-gzip" to be equivalent to "gzip".<a class="self" href="#rfc.section.4.2.3.p.1">&para;</a></p></div></div><div id="header.te"><h2 id="rfc.section.4.3"><a href="#rfc.section.4.3">4.3</a>&nbsp;<a href="#header.te">TE</a></h2><p id="rfc.section.4.3.p.1">The "TE" header field in a request indicates what transfer codings, besides chunked, the client is willing to accept in response, and whether or not the client is willing to accept trailer fields in a chunked transfer coding.<a class="self" href="#rfc.section.4.3.p.1">&para;</a></p><p id="rfc.section.4.3.p.2">The TE field-value consists of a comma-separated list of transfer coding names, each allowing for optional parameters (as described in <a href="#transfer.codings" title="Transfer Codings">Section&nbsp;4</a>), and/or the keyword "trailers". A client <em class="bcp14">MUST NOT</em> send the chunked transfer coding name in TE; chunked is always acceptable for HTTP/1.1 recipients.<a class="self" href="#rfc.section.4.3.p.2">&para;</a></p><div id="rfc.figure.u.35"><pre class="inline"><span id="rfc.iref.g.60"></span><span id="rfc.iref.g.61"></span><span id="rfc.iref.g.62"></span><span id="rfc.iref.g.63"></span>  <a href="#header.te" class="smpl">TE</a>        = #<a href="#header.te" class="smpl">t-codings</a> 
     643</pre></div></div></div><div id="compression.codings"><h2 id="rfc.section.4.2"><a href="#rfc.section.4.2">4.2</a>&nbsp;<a href="#compression.codings">Compression Codings</a></h2><div id="rfc.section.4.2.p.1"><p>The codings defined below can be used to compress the payload of a message.<a class="self" href="#rfc.section.4.2.p.1">&para;</a></p></div><div id="compress.coding"><h3 id="rfc.section.4.2.1"><a href="#rfc.section.4.2.1">4.2.1</a>&nbsp;<a href="#compress.coding">Compress Coding</a></h3><div id="rfc.section.4.2.1.p.1"><p>The "compress" coding is an adaptive Lempel-Ziv-Welch (LZW) coding <a href="#Welch" id="rfc.xref.Welch.1"><cite title="A Technique for High-Performance Data Compression">[Welch]</cite></a> that is commonly produced by the UNIX file compression program "compress". A recipient <em class="bcp14">SHOULD</em> consider "x-compress" to be equivalent to "compress".<a class="self" href="#rfc.section.4.2.1.p.1">&para;</a></p></div></div><div id="deflate.coding"><h3 id="rfc.section.4.2.2"><a href="#rfc.section.4.2.2">4.2.2</a>&nbsp;<a href="#deflate.coding">Deflate Coding</a></h3><div id="rfc.section.4.2.2.p.1"><p>The "deflate" coding is a "zlib" data format <a href="#RFC1950" id="rfc.xref.RFC1950.1"><cite title="ZLIB Compressed Data Format Specification version 3.3">[RFC1950]</cite></a> containing a "deflate" compressed data stream <a href="#RFC1951" id="rfc.xref.RFC1951.1"><cite title="DEFLATE Compressed Data Format Specification version 1.3">[RFC1951]</cite></a> that uses a combination of the Lempel-Ziv (LZ77) compression algorithm and Huffman coding.<a class="self" href="#rfc.section.4.2.2.p.1">&para;</a></p></div><div class="note" id="rfc.section.4.2.2.p.2"><p><b>Note:</b> Some non-conformant implementations send the "deflate" compressed data without the zlib wrapper.<a class="self" href="#rfc.section.4.2.2.p.2">&para;</a></p></div></div><div id="gzip.coding"><h3 id="rfc.section.4.2.3"><a href="#rfc.section.4.2.3">4.2.3</a>&nbsp;<a href="#gzip.coding">Gzip Coding</a></h3><div id="rfc.section.4.2.3.p.1"><p>The "gzip" coding is an LZ77 coding with a 32-bit Cyclic Redundancy Check (CRC) that is commonly produced by the gzip file compression program <a href="#RFC1952" id="rfc.xref.RFC1952.1"><cite title="GZIP file format specification version 4.3">[RFC1952]</cite></a>. A recipient <em class="bcp14">SHOULD</em> consider "x-gzip" to be equivalent to "gzip".<a class="self" href="#rfc.section.4.2.3.p.1">&para;</a></p></div></div></div><div id="header.te"><h2 id="rfc.section.4.3"><a href="#rfc.section.4.3">4.3</a>&nbsp;<a href="#header.te">TE</a></h2><div id="rfc.section.4.3.p.1"><p>The "TE" header field in a request indicates what transfer codings, besides chunked, the client is willing to accept in response, and whether or not the client is willing to accept trailer fields in a chunked transfer coding.<a class="self" href="#rfc.section.4.3.p.1">&para;</a></p></div><div id="rfc.section.4.3.p.2"><p>The TE field-value consists of a comma-separated list of transfer coding names, each allowing for optional parameters (as described in <a href="#transfer.codings" title="Transfer Codings">Section&nbsp;4</a>), and/or the keyword "trailers". A client <em class="bcp14">MUST NOT</em> send the chunked transfer coding name in TE; chunked is always acceptable for HTTP/1.1 recipients.<a class="self" href="#rfc.section.4.3.p.2">&para;</a></p></div><div id="rfc.figure.u.35"><pre class="inline"><span id="rfc.iref.g.60"></span><span id="rfc.iref.g.61"></span><span id="rfc.iref.g.62"></span><span id="rfc.iref.g.63"></span>  <a href="#header.te" class="smpl">TE</a>        = #<a href="#header.te" class="smpl">t-codings</a> 
    664644  <a href="#header.te" class="smpl">t-codings</a> = "trailers" / ( <a href="#transfer.codings" class="smpl">transfer-coding</a> [ <a href="#header.te" class="smpl">t-ranking</a> ] ) 
    665645  <a href="#header.te" class="smpl">t-ranking</a> = <a href="#rule.whitespace" class="smpl">OWS</a> ";" <a href="#rule.whitespace" class="smpl">OWS</a> "q=" <a href="#header.te" class="smpl">rank</a> 
    666646  <a href="#header.te" class="smpl">rank</a>      = ( "0" [ "." 0*3<a href="#core.rules" class="smpl">DIGIT</a> ] ) 
    667647             / ( "1" [ "." 0*3("0") ] ) 
    668 </pre></div><p id="rfc.section.4.3.p.3">Three examples of TE use are below.<a class="self" href="#rfc.section.4.3.p.3">&para;</a></p><div id="rfc.figure.u.36"><pre class="text">  TE: deflate 
     648</pre></div><div id="rfc.section.4.3.p.3"><p>Three examples of TE use are below.<a class="self" href="#rfc.section.4.3.p.3">&para;</a></p></div><div id="rfc.figure.u.36"><pre class="text">  TE: deflate 
    669649  TE: 
    670650  TE: trailers, deflate;q=0.5 
    671 </pre></div><p id="rfc.section.4.3.p.4">The presence of the keyword "trailers" indicates that the client is willing to accept trailer fields in a chunked transfer coding, as defined in <a href="#chunked.trailer.part" title="Chunked Trailer Part">Section&nbsp;4.1.2</a>, on behalf of itself and any downstream clients. For requests from an intermediary, this implies that either: (a) all downstream clients are willing to accept trailer fields in the forwarded response; or, (b) the intermediary will attempt to buffer the response on behalf of downstream recipients. Note that HTTP/1.1 does not define any means to limit the size of a chunked response such that an intermediary can be assured of buffering the entire response.<a class="self" href="#rfc.section.4.3.p.4">&para;</a></p><p id="rfc.section.4.3.p.5">When multiple transfer codings are acceptable, the client <em class="bcp14">MAY</em> rank the codings by preference using a case-insensitive "q" parameter (similar to the qvalues used in content negotiation fields, <a href="rfc7231.html#quality.values" title="Quality Values">Section 5.3.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.21"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). The rank value is a real number in the range 0 through 1, where 0.001 is the least preferred and 1 is the most preferred; a value of 0 means "not acceptable".<a class="self" href="#rfc.section.4.3.p.5">&para;</a></p><p id="rfc.section.4.3.p.6">If the TE field-value is empty or if no TE field is present, the only acceptable transfer coding is chunked. A message with no transfer coding is always acceptable.<a class="self" href="#rfc.section.4.3.p.6">&para;</a></p><p id="rfc.section.4.3.p.7">Since the TE header field only applies to the immediate connection, a sender of TE <em class="bcp14">MUST</em> also send a "TE" connection option within the <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.2" title="Connection">Section&nbsp;6.1</a>) in order to prevent the TE field from being forwarded by intermediaries that do not support its semantics.<a class="self" href="#rfc.section.4.3.p.7">&para;</a></p></div><div id="header.trailer"><h2 id="rfc.section.4.4"><a href="#rfc.section.4.4">4.4</a>&nbsp;<a href="#header.trailer">Trailer</a></h2><p id="rfc.section.4.4.p.1">When a message includes a message body encoded with the chunked transfer coding and the sender desires to send metadata in the form of trailer fields at the end of the message, the sender <em class="bcp14">SHOULD</em> generate a <a href="#header.trailer" class="smpl">Trailer</a> header field before the message body to indicate which fields will be present in the trailers. This allows the recipient to prepare for receipt of that metadata before it starts processing the body, which is useful if the message is being streamed and the recipient wishes to confirm an integrity check on the fly.<a class="self" href="#rfc.section.4.4.p.1">&para;</a></p><div id="rfc.figure.u.37"><pre class="inline"><span id="rfc.iref.g.64"></span><span id="rfc.iref.g.65"></span>  <a href="#header.trailer" class="smpl">Trailer</a> = 1#<a href="#header.fields" class="smpl">field-name</a> 
    672 </pre></div></div></div><div id="message.routing"><h1 id="rfc.section.5"><a href="#rfc.section.5">5.</a>&nbsp;<a href="#message.routing">Message Routing</a></h1><p id="rfc.section.5.p.1">HTTP request message routing is determined by each client based on the target resource, the client's proxy configuration, and establishment or reuse of an inbound connection. The corresponding response routing follows the same connection chain back to the client.<a class="self" href="#rfc.section.5.p.1">&para;</a></p><div id="target-resource"><h2 id="rfc.section.5.1"><a href="#rfc.section.5.1">5.1</a>&nbsp;<a href="#target-resource">Identifying a Target Resource</a></h2><p id="rfc.section.5.1.p.1">HTTP is used in a wide variety of applications, ranging from general-purpose computers to home appliances. In some cases, communication options are hard-coded in a client's configuration. However, most HTTP clients rely on the same resource identification mechanism and configuration techniques as general-purpose Web browsers.<a class="self" href="#rfc.section.5.1.p.1">&para;</a></p><p id="rfc.section.5.1.p.2">HTTP communication is initiated by a user agent for some purpose. The purpose is a combination of request semantics, which are defined in <a href="#RFC7231" id="rfc.xref.RFC7231.22"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>, and a target resource upon which to apply those semantics. A URI reference (<a href="#uri" title="Uniform Resource Identifiers">Section&nbsp;2.7</a>) is typically used as an identifier for the "<dfn>target resource</dfn>", which a user agent would resolve to its absolute form in order to obtain the "<dfn>target URI</dfn>". The target URI excludes the reference's fragment component, if any, since fragment identifiers are reserved for client-side processing (<a href="#RFC3986" id="rfc.xref.RFC3986.21"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.5">Section 3.5</a>).<a class="self" href="#rfc.section.5.1.p.2">&para;</a></p></div><div id="connecting.inbound"><h2 id="rfc.section.5.2"><a href="#rfc.section.5.2">5.2</a>&nbsp;<a href="#connecting.inbound">Connecting Inbound</a></h2><p id="rfc.section.5.2.p.1">Once the target URI is determined, a client needs to decide whether a network request is necessary to accomplish the desired semantics and, if so, where that request is to be directed.<a class="self" href="#rfc.section.5.2.p.1">&para;</a></p><p id="rfc.section.5.2.p.2">If the client has a cache <a href="#RFC7234" id="rfc.xref.RFC7234.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a> and the request can be satisfied by it, then the request is usually directed there first.<a class="self" href="#rfc.section.5.2.p.2">&para;</a></p><p id="rfc.section.5.2.p.3">If the request is not satisfied by a cache, then a typical client will check its configuration to determine whether a proxy is to be used to satisfy the request. Proxy configuration is implementation-dependent, but is often based on URI prefix matching, selective authority matching, or both, and the proxy itself is usually identified by an "http" or "https" URI. If a proxy is applicable, the client connects inbound by establishing (or reusing) a connection to that proxy.<a class="self" href="#rfc.section.5.2.p.3">&para;</a></p><p id="rfc.section.5.2.p.4">If no proxy is applicable, a typical client will invoke a handler routine, usually specific to the target URI's scheme, to connect directly to an authority for the target resource. How that is accomplished is dependent on the target URI scheme and defined by its associated specification, similar to how this specification defines origin server access for resolution of the "http" (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>) and "https" (<a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a>) schemes.<a class="self" href="#rfc.section.5.2.p.4">&para;</a></p><p id="rfc.section.5.2.p.5">HTTP requirements regarding connection management are defined in <a href="#connection.management" title="Connection Management">Section&nbsp;6</a>.<a class="self" href="#rfc.section.5.2.p.5">&para;</a></p></div><div id="request-target"><h2 id="rfc.section.5.3"><a href="#rfc.section.5.3">5.3</a>&nbsp;<a href="#request-target">Request Target</a></h2><p id="rfc.section.5.3.p.1">Once an inbound connection is obtained, the client sends an HTTP request message (<a href="#http.message" title="Message Format">Section&nbsp;3</a>) with a request-target derived from the target URI. There are four distinct formats for the request-target, depending on both the method being requested and whether the request is to a proxy.<a class="self" href="#rfc.section.5.3.p.1">&para;</a></p><div id="rfc.figure.u.38"><pre class="inline"><span id="rfc.iref.g.66"></span><span id="rfc.iref.g.67"></span><span id="rfc.iref.g.68"></span><span id="rfc.iref.g.69"></span><span id="rfc.iref.g.70"></span>  <a href="#request-target" class="smpl">request-target</a> = <a href="#origin-form" class="smpl">origin-form</a> 
     651</pre></div><div id="rfc.section.4.3.p.4"><p>The presence of the keyword "trailers" indicates that the client is willing to accept trailer fields in a chunked transfer coding, as defined in <a href="#chunked.trailer.part" title="Chunked Trailer Part">Section&nbsp;4.1.2</a>, on behalf of itself and any downstream clients. For requests from an intermediary, this implies that either: (a) all downstream clients are willing to accept trailer fields in the forwarded response; or, (b) the intermediary will attempt to buffer the response on behalf of downstream recipients. Note that HTTP/1.1 does not define any means to limit the size of a chunked response such that an intermediary can be assured of buffering the entire response.<a class="self" href="#rfc.section.4.3.p.4">&para;</a></p></div><div id="rfc.section.4.3.p.5"><p>When multiple transfer codings are acceptable, the client <em class="bcp14">MAY</em> rank the codings by preference using a case-insensitive "q" parameter (similar to the qvalues used in content negotiation fields, <a href="rfc7231.html#quality.values" title="Quality Values">Section 5.3.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.21"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). The rank value is a real number in the range 0 through 1, where 0.001 is the least preferred and 1 is the most preferred; a value of 0 means "not acceptable".<a class="self" href="#rfc.section.4.3.p.5">&para;</a></p></div><div id="rfc.section.4.3.p.6"><p>If the TE field-value is empty or if no TE field is present, the only acceptable transfer coding is chunked. A message with no transfer coding is always acceptable.<a class="self" href="#rfc.section.4.3.p.6">&para;</a></p></div><div id="rfc.section.4.3.p.7"><p>Since the TE header field only applies to the immediate connection, a sender of TE <em class="bcp14">MUST</em> also send a "TE" connection option within the <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.2" title="Connection">Section&nbsp;6.1</a>) in order to prevent the TE field from being forwarded by intermediaries that do not support its semantics.<a class="self" href="#rfc.section.4.3.p.7">&para;</a></p></div></div><div id="header.trailer"><h2 id="rfc.section.4.4"><a href="#rfc.section.4.4">4.4</a>&nbsp;<a href="#header.trailer">Trailer</a></h2><div id="rfc.section.4.4.p.1"><p>When a message includes a message body encoded with the chunked transfer coding and the sender desires to send metadata in the form of trailer fields at the end of the message, the sender <em class="bcp14">SHOULD</em> generate a <a href="#header.trailer" class="smpl">Trailer</a> header field before the message body to indicate which fields will be present in the trailers. This allows the recipient to prepare for receipt of that metadata before it starts processing the body, which is useful if the message is being streamed and the recipient wishes to confirm an integrity check on the fly.<a class="self" href="#rfc.section.4.4.p.1">&para;</a></p></div><div id="rfc.figure.u.37"><pre class="inline"><span id="rfc.iref.g.64"></span><span id="rfc.iref.g.65"></span>  <a href="#header.trailer" class="smpl">Trailer</a> = 1#<a href="#header.fields" class="smpl">field-name</a> 
     652</pre></div></div></div><div id="message.routing"><h1 id="rfc.section.5"><a href="#rfc.section.5">5.</a>&nbsp;<a href="#message.routing">Message Routing</a></h1><div id="rfc.section.5.p.1"><p>HTTP request message routing is determined by each client based on the target resource, the client's proxy configuration, and establishment or reuse of an inbound connection. The corresponding response routing follows the same connection chain back to the client.<a class="self" href="#rfc.section.5.p.1">&para;</a></p></div><div id="target-resource"><h2 id="rfc.section.5.1"><a href="#rfc.section.5.1">5.1</a>&nbsp;<a href="#target-resource">Identifying a Target Resource</a></h2><div id="rfc.section.5.1.p.1"><p>HTTP is used in a wide variety of applications, ranging from general-purpose computers to home appliances. In some cases, communication options are hard-coded in a client's configuration. However, most HTTP clients rely on the same resource identification mechanism and configuration techniques as general-purpose Web browsers.<a class="self" href="#rfc.section.5.1.p.1">&para;</a></p></div><div id="rfc.section.5.1.p.2"><p>HTTP communication is initiated by a user agent for some purpose. The purpose is a combination of request semantics, which are defined in <a href="#RFC7231" id="rfc.xref.RFC7231.22"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>, and a target resource upon which to apply those semantics. A URI reference (<a href="#uri" title="Uniform Resource Identifiers">Section&nbsp;2.7</a>) is typically used as an identifier for the "<dfn>target resource</dfn>", which a user agent would resolve to its absolute form in order to obtain the "<dfn>target URI</dfn>". The target URI excludes the reference's fragment component, if any, since fragment identifiers are reserved for client-side processing (<a href="#RFC3986" id="rfc.xref.RFC3986.21"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.5">Section 3.5</a>).<a class="self" href="#rfc.section.5.1.p.2">&para;</a></p></div></div><div id="connecting.inbound"><h2 id="rfc.section.5.2"><a href="#rfc.section.5.2">5.2</a>&nbsp;<a href="#connecting.inbound">Connecting Inbound</a></h2><div id="rfc.section.5.2.p.1"><p>Once the target URI is determined, a client needs to decide whether a network request is necessary to accomplish the desired semantics and, if so, where that request is to be directed.<a class="self" href="#rfc.section.5.2.p.1">&para;</a></p></div><div id="rfc.section.5.2.p.2"><p>If the client has a cache <a href="#RFC7234" id="rfc.xref.RFC7234.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a> and the request can be satisfied by it, then the request is usually directed there first.<a class="self" href="#rfc.section.5.2.p.2">&para;</a></p></div><div id="rfc.section.5.2.p.3"><p>If the request is not satisfied by a cache, then a typical client will check its configuration to determine whether a proxy is to be used to satisfy the request. Proxy configuration is implementation-dependent, but is often based on URI prefix matching, selective authority matching, or both, and the proxy itself is usually identified by an "http" or "https" URI. If a proxy is applicable, the client connects inbound by establishing (or reusing) a connection to that proxy.<a class="self" href="#rfc.section.5.2.p.3">&para;</a></p></div><div id="rfc.section.5.2.p.4"><p>If no proxy is applicable, a typical client will invoke a handler routine, usually specific to the target URI's scheme, to connect directly to an authority for the target resource. How that is accomplished is dependent on the target URI scheme and defined by its associated specification, similar to how this specification defines origin server access for resolution of the "http" (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>) and "https" (<a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a>) schemes.<a class="self" href="#rfc.section.5.2.p.4">&para;</a></p></div><div id="rfc.section.5.2.p.5"><p>HTTP requirements regarding connection management are defined in <a href="#connection.management" title="Connection Management">Section&nbsp;6</a>.<a class="self" href="#rfc.section.5.2.p.5">&para;</a></p></div></div><div id="request-target"><h2 id="rfc.section.5.3"><a href="#rfc.section.5.3">5.3</a>&nbsp;<a href="#request-target">Request Target</a></h2><div id="rfc.section.5.3.p.1"><p>Once an inbound connection is obtained, the client sends an HTTP request message (<a href="#http.message" title="Message Format">Section&nbsp;3</a>) with a request-target derived from the target URI. There are four distinct formats for the request-target, depending on both the method being requested and whether the request is to a proxy.<a class="self" href="#rfc.section.5.3.p.1">&para;</a></p></div><div id="rfc.figure.u.38"><pre class="inline"><span id="rfc.iref.g.66"></span><span id="rfc.iref.g.67"></span><span id="rfc.iref.g.68"></span><span id="rfc.iref.g.69"></span><span id="rfc.iref.g.70"></span>  <a href="#request-target" class="smpl">request-target</a> = <a href="#origin-form" class="smpl">origin-form</a> 
    673653                 / <a href="#absolute-form" class="smpl">absolute-form</a> 
    674654                 / <a href="#authority-form" class="smpl">authority-form</a> 
    675655                 / <a href="#asterisk-form" class="smpl">asterisk-form</a> 
    676 </pre></div><div id="origin-form"><h3 id="rfc.section.5.3.1"><a href="#rfc.section.5.3.1">5.3.1</a>&nbsp;<a href="#origin-form">origin-form</a></h3><p id="rfc.section.5.3.1.p.1">The most common form of request-target is the <dfn>origin-form</dfn>.<a class="self" href="#rfc.section.5.3.1.p.1">&para;</a></p><div id="rfc.figure.u.39"><pre class="inline"><span id="rfc.iref.g.71"></span>  <a href="#origin-form" class="smpl">origin-form</a>    = <a href="#uri" class="smpl">absolute-path</a> [ "?" <a href="#uri" class="smpl">query</a> ] 
    677 </pre></div><p id="rfc.section.5.3.1.p.2">When making a request directly to an origin server, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client <em class="bcp14">MUST</em> send only the absolute path and query components of the target URI as the request-target. If the target URI's path component is empty, the client <em class="bcp14">MUST</em> send "/" as the path within the origin-form of request-target. A <a href="#header.host" class="smpl">Host</a> header field is also sent, as defined in <a href="#header.host" id="rfc.xref.header.host.1" title="Host">Section&nbsp;5.4</a>.<a class="self" href="#rfc.section.5.3.1.p.2">&para;</a></p><p id="rfc.section.5.3.1.p.3">For example, a client wishing to retrieve a representation of the resource identified as<a class="self" href="#rfc.section.5.3.1.p.3">&para;</a></p><div id="rfc.figure.u.40"><pre class="text">http://www.example.org/where?q=now 
    678 </pre></div><p id="rfc.section.5.3.1.p.4">directly from the origin server would open (or reuse) a TCP connection to port 80 of the host "www.example.org" and send the lines:<a class="self" href="#rfc.section.5.3.1.p.4">&para;</a></p><div id="rfc.figure.u.41"><pre class="text2">GET /where?q=now HTTP/1.1 
     656</pre></div><div id="origin-form"><h3 id="rfc.section.5.3.1"><a href="#rfc.section.5.3.1">5.3.1</a>&nbsp;<a href="#origin-form">origin-form</a></h3><div id="rfc.section.5.3.1.p.1"><p>The most common form of request-target is the <dfn>origin-form</dfn>.<a class="self" href="#rfc.section.5.3.1.p.1">&para;</a></p></div><div id="rfc.figure.u.39"><pre class="inline"><span id="rfc.iref.g.71"></span>  <a href="#origin-form" class="smpl">origin-form</a>    = <a href="#uri" class="smpl">absolute-path</a> [ "?" <a href="#uri" class="smpl">query</a> ] 
     657</pre></div><div id="rfc.section.5.3.1.p.2"><p>When making a request directly to an origin server, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client <em class="bcp14">MUST</em> send only the absolute path and query components of the target URI as the request-target. If the target URI's path component is empty, the client <em class="bcp14">MUST</em> send "/" as the path within the origin-form of request-target. A <a href="#header.host" class="smpl">Host</a> header field is also sent, as defined in <a href="#header.host" id="rfc.xref.header.host.1" title="Host">Section&nbsp;5.4</a>.<a class="self" href="#rfc.section.5.3.1.p.2">&para;</a></p></div><div id="rfc.section.5.3.1.p.3"><p>For example, a client wishing to retrieve a representation of the resource identified as<a class="self" href="#rfc.section.5.3.1.p.3">&para;</a></p></div><div id="rfc.figure.u.40"><pre class="text">http://www.example.org/where?q=now 
     658</pre></div><div id="rfc.section.5.3.1.p.4"><p>directly from the origin server would open (or reuse) a TCP connection to port 80 of the host "www.example.org" and send the lines:<a class="self" href="#rfc.section.5.3.1.p.4">&para;</a></p></div><div id="rfc.figure.u.41"><pre class="text2">GET /where?q=now HTTP/1.1 
    679659Host: www.example.org 
    680 </pre></div><p id="rfc.section.5.3.1.p.5">followed by the remainder of the request message.<a class="self" href="#rfc.section.5.3.1.p.5">&para;</a></p></div><div id="absolute-form"><h3 id="rfc.section.5.3.2"><a href="#rfc.section.5.3.2">5.3.2</a>&nbsp;<a href="#absolute-form">absolute-form</a></h3><p id="rfc.section.5.3.2.p.1">When making a request to a proxy, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client <em class="bcp14">MUST</em> send the target URI in <dfn>absolute-form</dfn> as the request-target.<a class="self" href="#rfc.section.5.3.2.p.1">&para;</a></p><div id="rfc.figure.u.42"><pre class="inline"><span id="rfc.iref.g.72"></span>  <a href="#absolute-form" class="smpl">absolute-form</a>  = <a href="#uri" class="smpl">absolute-URI</a> 
    681 </pre></div><p id="rfc.section.5.3.2.p.2">The proxy is requested to either service that request from a valid cache, if possible, or make the same request on the client's behalf to either the next inbound proxy server or directly to the origin server indicated by the request-target. Requirements on such "forwarding" of messages are defined in <a href="#message.forwarding" title="Message Forwarding">Section&nbsp;5.7</a>.<a class="self" href="#rfc.section.5.3.2.p.2">&para;</a></p><p id="rfc.section.5.3.2.p.3">An example absolute-form of request-line would be:<a class="self" href="#rfc.section.5.3.2.p.3">&para;</a></p><div id="rfc.figure.u.43"><pre class="text2">GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1 
    682 </pre></div><p id="rfc.section.5.3.2.p.4">To allow for transition to the absolute-form for all requests in some future version of HTTP, a server <em class="bcp14">MUST</em> accept the absolute-form in requests, even though HTTP/1.1 clients will only send them in requests to proxies.<a class="self" href="#rfc.section.5.3.2.p.4">&para;</a></p></div><div id="authority-form"><h3 id="rfc.section.5.3.3"><a href="#rfc.section.5.3.3">5.3.3</a>&nbsp;<a href="#authority-form">authority-form</a></h3><p id="rfc.section.5.3.3.p.1">The <dfn>authority-form</dfn> of request-target is only used for CONNECT requests (<a href="rfc7231.html#CONNECT" title="CONNECT">Section 4.3.6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.23"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.5.3.3.p.1">&para;</a></p><div id="rfc.figure.u.44"><pre class="inline"><span id="rfc.iref.g.73"></span>  <a href="#authority-form" class="smpl">authority-form</a> = <a href="#uri" class="smpl">authority</a> 
    683 </pre></div><p id="rfc.section.5.3.3.p.2">When making a CONNECT request to establish a tunnel through one or more proxies, a client <em class="bcp14">MUST</em> send only the target URI's authority component (excluding any userinfo and its "@" delimiter) as the request-target. For example,<a class="self" href="#rfc.section.5.3.3.p.2">&para;</a></p><div id="rfc.figure.u.45"><pre class="text2">CONNECT www.example.com:80 HTTP/1.1 
    684 </pre></div></div><div id="asterisk-form"><h3 id="rfc.section.5.3.4"><a href="#rfc.section.5.3.4">5.3.4</a>&nbsp;<a href="#asterisk-form">asterisk-form</a></h3><p id="rfc.section.5.3.4.p.1">The <dfn>asterisk-form</dfn> of request-target is only used for a server-wide OPTIONS request (<a href="rfc7231.html#OPTIONS" title="OPTIONS">Section 4.3.7</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.24"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.5.3.4.p.1">&para;</a></p><div id="rfc.figure.u.46"><pre class="inline"><span id="rfc.iref.g.74"></span>  <a href="#asterisk-form" class="smpl">asterisk-form</a>  = "*" 
    685 </pre></div><p id="rfc.section.5.3.4.p.2">When a client wishes to request OPTIONS for the server as a whole, as opposed to a specific named resource of that server, the client <em class="bcp14">MUST</em> send only "*" (%x2A) as the request-target. For example,<a class="self" href="#rfc.section.5.3.4.p.2">&para;</a></p><div id="rfc.figure.u.47"><pre class="text2">OPTIONS * HTTP/1.1 
    686 </pre></div><p id="rfc.section.5.3.4.p.3">If a proxy receives an OPTIONS request with an absolute-form of request-target in which the URI has an empty path and no query component, then the last proxy on the request chain <em class="bcp14">MUST</em> send a request-target of "*" when it forwards the request to the indicated origin server.<a class="self" href="#rfc.section.5.3.4.p.3">&para;</a></p><div id="rfc.figure.u.48"><p>For example, the request</p><pre class="text2">OPTIONS http://www.example.org:8001 HTTP/1.1 
     660</pre></div><div id="rfc.section.5.3.1.p.5"><p>followed by the remainder of the request message.<a class="self" href="#rfc.section.5.3.1.p.5">&para;</a></p></div></div><div id="absolute-form"><h3 id="rfc.section.5.3.2"><a href="#rfc.section.5.3.2">5.3.2</a>&nbsp;<a href="#absolute-form">absolute-form</a></h3><div id="rfc.section.5.3.2.p.1"><p>When making a request to a proxy, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client <em class="bcp14">MUST</em> send the target URI in <dfn>absolute-form</dfn> as the request-target.<a class="self" href="#rfc.section.5.3.2.p.1">&para;</a></p></div><div id="rfc.figure.u.42"><pre class="inline"><span id="rfc.iref.g.72"></span>  <a href="#absolute-form" class="smpl">absolute-form</a>  = <a href="#uri" class="smpl">absolute-URI</a> 
     661</pre></div><div id="rfc.section.5.3.2.p.2"><p>The proxy is requested to either service that request from a valid cache, if possible, or make the same request on the client's behalf to either the next inbound proxy server or directly to the origin server indicated by the request-target. Requirements on such "forwarding" of messages are defined in <a href="#message.forwarding" title="Message Forwarding">Section&nbsp;5.7</a>.<a class="self" href="#rfc.section.5.3.2.p.2">&para;</a></p></div><div id="rfc.section.5.3.2.p.3"><p>An example absolute-form of request-line would be:<a class="self" href="#rfc.section.5.3.2.p.3">&para;</a></p></div><div id="rfc.figure.u.43"><pre class="text2">GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1 
     662</pre></div><div id="rfc.section.5.3.2.p.4"><p>To allow for transition to the absolute-form for all requests in some future version of HTTP, a server <em class="bcp14">MUST</em> accept the absolute-form in requests, even though HTTP/1.1 clients will only send them in requests to proxies.<a class="self" href="#rfc.section.5.3.2.p.4">&para;</a></p></div></div><div id="authority-form"><h3 id="rfc.section.5.3.3"><a href="#rfc.section.5.3.3">5.3.3</a>&nbsp;<a href="#authority-form">authority-form</a></h3><div id="rfc.section.5.3.3.p.1"><p>The <dfn>authority-form</dfn> of request-target is only used for CONNECT requests (<a href="rfc7231.html#CONNECT" title="CONNECT">Section 4.3.6</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.23"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.5.3.3.p.1">&para;</a></p></div><div id="rfc.figure.u.44"><pre class="inline"><span id="rfc.iref.g.73"></span>  <a href="#authority-form" class="smpl">authority-form</a> = <a href="#uri" class="smpl">authority</a> 
     663</pre></div><div id="rfc.section.5.3.3.p.2"><p>When making a CONNECT request to establish a tunnel through one or more proxies, a client <em class="bcp14">MUST</em> send only the target URI's authority component (excluding any userinfo and its "@" delimiter) as the request-target. For example,<a class="self" href="#rfc.section.5.3.3.p.2">&para;</a></p></div><div id="rfc.figure.u.45"><pre class="text2">CONNECT www.example.com:80 HTTP/1.1 
     664</pre></div></div><div id="asterisk-form"><h3 id="rfc.section.5.3.4"><a href="#rfc.section.5.3.4">5.3.4</a>&nbsp;<a href="#asterisk-form">asterisk-form</a></h3><div id="rfc.section.5.3.4.p.1"><p>The <dfn>asterisk-form</dfn> of request-target is only used for a server-wide OPTIONS request (<a href="rfc7231.html#OPTIONS" title="OPTIONS">Section 4.3.7</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.24"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.5.3.4.p.1">&para;</a></p></div><div id="rfc.figure.u.46"><pre class="inline"><span id="rfc.iref.g.74"></span>  <a href="#asterisk-form" class="smpl">asterisk-form</a>  = "*" 
     665</pre></div><div id="rfc.section.5.3.4.p.2"><p>When a client wishes to request OPTIONS for the server as a whole, as opposed to a specific named resource of that server, the client <em class="bcp14">MUST</em> send only "*" (%x2A) as the request-target. For example,<a class="self" href="#rfc.section.5.3.4.p.2">&para;</a></p></div><div id="rfc.figure.u.47"><pre class="text2">OPTIONS * HTTP/1.1 
     666</pre></div><div id="rfc.section.5.3.4.p.3"><p>If a proxy receives an OPTIONS request with an absolute-form of request-target in which the URI has an empty path and no query component, then the last proxy on the request chain <em class="bcp14">MUST</em> send a request-target of "*" when it forwards the request to the indicated origin server.<a class="self" href="#rfc.section.5.3.4.p.3">&para;</a></p></div><div id="rfc.figure.u.48"><p>For example, the request</p><pre class="text2">OPTIONS http://www.example.org:8001 HTTP/1.1 
    687667</pre></div><div id="rfc.figure.u.49"><p>would be forwarded by the final proxy as</p><pre class="text2">OPTIONS * HTTP/1.1 
    688668Host: www.example.org:8001 
    689 </pre><p>after connecting to port 8001 of host "www.example.org".</p></div></div></div><div id="header.host"><h2 id="rfc.section.5.4"><a href="#rfc.section.5.4">5.4</a>&nbsp;<a href="#header.host">Host</a></h2><p id="rfc.section.5.4.p.1">The "Host" header field in a request provides the host and port information from the target URI, enabling the origin server to distinguish among resources while servicing requests for multiple host names on a single IP address.<a class="self" href="#rfc.section.5.4.p.1">&para;</a></p><div id="rfc.figure.u.50"><pre class="inline"><span id="rfc.iref.g.75"></span>  <a href="#header.host" class="smpl">Host</a> = <a href="#uri" class="smpl">uri-host</a> [ ":" <a href="#uri" class="smpl">port</a> ] ; <a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a> 
    690 </pre></div><p id="rfc.section.5.4.p.2">A client <em class="bcp14">MUST</em> send a Host header field in all HTTP/1.1 request messages. If the target URI includes an authority component, then a client <em class="bcp14">MUST</em> send a field-value for Host that is identical to that authority component, excluding any userinfo subcomponent and its "@" delimiter (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>). If the authority component is missing or undefined for the target URI, then a client <em class="bcp14">MUST</em> send a Host header field with an empty field-value.<a class="self" href="#rfc.section.5.4.p.2">&para;</a></p><p id="rfc.section.5.4.p.3">Since the Host field-value is critical information for handling a request, a user agent <em class="bcp14">SHOULD</em> generate Host as the first header field following the request-line.<a class="self" href="#rfc.section.5.4.p.3">&para;</a></p><p id="rfc.section.5.4.p.4">For example, a GET request to the origin server for &lt;http://www.example.org/pub/WWW/&gt; would begin with:<a class="self" href="#rfc.section.5.4.p.4">&para;</a></p><div id="rfc.figure.u.51"><pre class="text2">GET /pub/WWW/ HTTP/1.1 
     669</pre><p>after connecting to port 8001 of host "www.example.org".</p></div></div></div><div id="header.host"><h2 id="rfc.section.5.4"><a href="#rfc.section.5.4">5.4</a>&nbsp;<a href="#header.host">Host</a></h2><div id="rfc.section.5.4.p.1"><p>The "Host" header field in a request provides the host and port information from the target URI, enabling the origin server to distinguish among resources while servicing requests for multiple host names on a single IP address.<a class="self" href="#rfc.section.5.4.p.1">&para;</a></p></div><div id="rfc.figure.u.50"><pre class="inline"><span id="rfc.iref.g.75"></span>  <a href="#header.host" class="smpl">Host</a> = <a href="#uri" class="smpl">uri-host</a> [ ":" <a href="#uri" class="smpl">port</a> ] ; <a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a> 
     670</pre></div><div id="rfc.section.5.4.p.2"><p>A client <em class="bcp14">MUST</em> send a Host header field in all HTTP/1.1 request messages. If the target URI includes an authority component, then a client <em class="bcp14">MUST</em> send a field-value for Host that is identical to that authority component, excluding any userinfo subcomponent and its "@" delimiter (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>). If the authority component is missing or undefined for the target URI, then a client <em class="bcp14">MUST</em> send a Host header field with an empty field-value.<a class="self" href="#rfc.section.5.4.p.2">&para;</a></p></div><div id="rfc.section.5.4.p.3"><p>Since the Host field-value is critical information for handling a request, a user agent <em class="bcp14">SHOULD</em> generate Host as the first header field following the request-line.<a class="self" href="#rfc.section.5.4.p.3">&para;</a></p></div><div id="rfc.section.5.4.p.4"><p>For example, a GET request to the origin server for &lt;http://www.example.org/pub/WWW/&gt; would begin with:<a class="self" href="#rfc.section.5.4.p.4">&para;</a></p></div><div id="rfc.figure.u.51"><pre class="text2">GET /pub/WWW/ HTTP/1.1 
    691671Host: www.example.org 
    692 </pre></div><p id="rfc.section.5.4.p.5">A client <em class="bcp14">MUST</em> send a Host header field in an HTTP/1.1 request even if the request-target is in the absolute-form, since this allows the Host information to be forwarded through ancient HTTP/1.0 proxies that might not have implemented Host.<a class="self" href="#rfc.section.5.4.p.5">&para;</a></p><p id="rfc.section.5.4.p.6">When a proxy receives a request with an absolute-form of request-target, the proxy <em class="bcp14">MUST</em> ignore the received Host header field (if any) and instead replace it with the host information of the request-target. A proxy that forwards such a request <em class="bcp14">MUST</em> generate a new Host field-value based on the received request-target rather than forward the received Host field-value.<a class="self" href="#rfc.section.5.4.p.6">&para;</a></p><p id="rfc.section.5.4.p.7">Since the Host header field acts as an application-level routing mechanism, it is a frequent target for malware seeking to poison a shared cache or redirect a request to an unintended server. An interception proxy is particularly vulnerable if it relies on the Host field-value for redirecting requests to internal servers, or for use as a cache key in a shared cache, without first verifying that the intercepted connection is targeting a valid IP address for that host.<a class="self" href="#rfc.section.5.4.p.7">&para;</a></p><p id="rfc.section.5.4.p.8">A server <em class="bcp14">MUST</em> respond with a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> status code to any HTTP/1.1 request message that lacks a Host header field and to any request message that contains more than one Host header field or a Host header field with an invalid field-value.<a class="self" href="#rfc.section.5.4.p.8">&para;</a></p></div><div id="effective.request.uri"><h2 id="rfc.section.5.5"><a href="#rfc.section.5.5">5.5</a>&nbsp;<a href="#effective.request.uri">Effective Request URI</a></h2><p id="rfc.section.5.5.p.1">Since the request-target often contains only part of the user agent's target URI, a server reconstructs the intended target as an "<dfn>effective request URI</dfn>" to properly service the request. This reconstruction involves both the server's local configuration and information communicated in the <a href="#request-target" class="smpl">request-target</a>, <a href="#header.host" class="smpl">Host</a> header field, and connection context.<a class="self" href="#rfc.section.5.5.p.1">&para;</a></p><p id="rfc.section.5.5.p.2">For a user agent, the effective request URI is the target URI.<a class="self" href="#rfc.section.5.5.p.2">&para;</a></p><p id="rfc.section.5.5.p.3">If the <a href="#request-target" class="smpl">request-target</a> is in <a href="#absolute-form" class="smpl">absolute-form</a>, the effective request URI is the same as the request-target. Otherwise, the effective request URI is constructed as follows: <a class="self" href="#rfc.section.5.5.p.3">&para;</a></p><ul class="empty"><li>If the server's configuration (or outbound gateway) provides a fixed URI <a href="#uri" class="smpl">scheme</a>, that scheme is used for the effective request URI. Otherwise, if the request is received over a TLS-secured TCP connection, the effective request URI's scheme is "https"; if not, the scheme is "http".</li><li>If the server's configuration (or outbound gateway) provides a fixed URI <a href="#uri" class="smpl">authority</a> component, that authority is used for the effective request URI. If not, then if the request-target is in <a href="#authority-form" class="smpl">authority-form</a>, the effective request URI's authority component is the same as the request-target. If not, then if a <a href="#header.host" class="smpl">Host</a> header field is supplied with a non-empty field-value, the authority component is the same as the Host field-value. Otherwise, the authority component is assigned the default name configured for the server and, if the connection's incoming TCP port number differs from the default port for the effective request URI's scheme, then a colon (":") and the incoming port number (in decimal form) are appended to the authority component.</li><li>If the request-target is in <a href="#authority-form" class="smpl">authority-form</a> or <a href="#asterisk-form" class="smpl">asterisk-form</a>, the effective request URI's combined <a href="#uri" class="smpl">path</a> and <a href="#uri" class="smpl">query</a> component is empty. Otherwise, the combined <a href="#uri" class="smpl">path</a> and <a href="#uri" class="smpl">query</a> component is the same as the request-target.</li><li>The components of the effective request URI, once determined as above, can be combined into <a href="#uri" class="smpl">absolute-URI</a> form by concatenating the scheme, "://", authority, and combined path and query component.</li></ul><div id="rfc.figure.u.52"><p>Example 1: the following message received over an insecure TCP connection</p><pre class="text">GET /pub/WWW/TheProject.html HTTP/1.1 
     672</pre></div><div id="rfc.section.5.4.p.5"><p>A client <em class="bcp14">MUST</em> send a Host header field in an HTTP/1.1 request even if the request-target is in the absolute-form, since this allows the Host information to be forwarded through ancient HTTP/1.0 proxies that might not have implemented Host.<a class="self" href="#rfc.section.5.4.p.5">&para;</a></p></div><div id="rfc.section.5.4.p.6"><p>When a proxy receives a request with an absolute-form of request-target, the proxy <em class="bcp14">MUST</em> ignore the received Host header field (if any) and instead replace it with the host information of the request-target. A proxy that forwards such a request <em class="bcp14">MUST</em> generate a new Host field-value based on the received request-target rather than forward the received Host field-value.<a class="self" href="#rfc.section.5.4.p.6">&para;</a></p></div><div id="rfc.section.5.4.p.7"><p>Since the Host header field acts as an application-level routing mechanism, it is a frequent target for malware seeking to poison a shared cache or redirect a request to an unintended server. An interception proxy is particularly vulnerable if it relies on the Host field-value for redirecting requests to internal servers, or for use as a cache key in a shared cache, without first verifying that the intercepted connection is targeting a valid IP address for that host.<a class="self" href="#rfc.section.5.4.p.7">&para;</a></p></div><div id="rfc.section.5.4.p.8"><p>A server <em class="bcp14">MUST</em> respond with a <a href="rfc7231.html#status.400" class="smpl">400 (Bad Request)</a> status code to any HTTP/1.1 request message that lacks a Host header field and to any request message that contains more than one Host header field or a Host header field with an invalid field-value.<a class="self" href="#rfc.section.5.4.p.8">&para;</a></p></div></div><div id="effective.request.uri"><h2 id="rfc.section.5.5"><a href="#rfc.section.5.5">5.5</a>&nbsp;<a href="#effective.request.uri">Effective Request URI</a></h2><div id="rfc.section.5.5.p.1"><p>Since the request-target often contains only part of the user agent's target URI, a server reconstructs the intended target as an "<dfn>effective request URI</dfn>" to properly service the request. This reconstruction involves both the server's local configuration and information communicated in the <a href="#request-target" class="smpl">request-target</a>, <a href="#header.host" class="smpl">Host</a> header field, and connection context.<a class="self" href="#rfc.section.5.5.p.1">&para;</a></p></div><div id="rfc.section.5.5.p.2"><p>For a user agent, the effective request URI is the target URI.<a class="self" href="#rfc.section.5.5.p.2">&para;</a></p></div><div id="rfc.section.5.5.p.3"><p>If the <a href="#request-target" class="smpl">request-target</a> is in <a href="#absolute-form" class="smpl">absolute-form</a>, the effective request URI is the same as the request-target. Otherwise, the effective request URI is constructed as follows: <a class="self" href="#rfc.section.5.5.p.3">&para;</a></p><ul class="empty"><li>If the server's configuration (or outbound gateway) provides a fixed URI <a href="#uri" class="smpl">scheme</a>, that scheme is used for the effective request URI. Otherwise, if the request is received over a TLS-secured TCP connection, the effective request URI's scheme is "https"; if not, the scheme is "http".</li><li>If the server's configuration (or outbound gateway) provides a fixed URI <a href="#uri" class="smpl">authority</a> component, that authority is used for the effective request URI. If not, then if the request-target is in <a href="#authority-form" class="smpl">authority-form</a>, the effective request URI's authority component is the same as the request-target. If not, then if a <a href="#header.host" class="smpl">Host</a> header field is supplied with a non-empty field-value, the authority component is the same as the Host field-value. Otherwise, the authority component is assigned the default name configured for the server and, if the connection's incoming TCP port number differs from the default port for the effective request URI's scheme, then a colon (":") and the incoming port number (in decimal form) are appended to the authority component.</li><li>If the request-target is in <a href="#authority-form" class="smpl">authority-form</a> or <a href="#asterisk-form" class="smpl">asterisk-form</a>, the effective request URI's combined <a href="#uri" class="smpl">path</a> and <a href="#uri" class="smpl">query</a> component is empty. Otherwise, the combined <a href="#uri" class="smpl">path</a> and <a href="#uri" class="smpl">query</a> component is the same as the request-target.</li><li>The components of the effective request URI, once determined as above, can be combined into <a href="#uri" class="smpl">absolute-URI</a> form by concatenating the scheme, "://", authority, and combined path and query component.</li></ul></div><div id="rfc.figure.u.52"><p>Example 1: the following message received over an insecure TCP connection</p><pre class="text">GET /pub/WWW/TheProject.html HTTP/1.1 
    693673Host: www.example.org:8080 
    694674</pre></div><div id="rfc.figure.u.53"><p>has an effective request URI of</p><pre class="text">http://www.example.org:8080/pub/WWW/TheProject.html 
     
    696676Host: www.example.org 
    697677</pre></div><div id="rfc.figure.u.55"><p>has an effective request URI of</p><pre class="text">https://www.example.org 
    698 </pre></div><p id="rfc.section.5.5.p.4">Recipients of an HTTP/1.0 request that lacks a <a href="#header.host" class="smpl">Host</a> header field might need to use heuristics (e.g., examination of the URI path for something unique to a particular host) in order to guess the effective request URI's authority component.<a class="self" href="#rfc.section.5.5.p.4">&para;</a></p><p id="rfc.section.5.5.p.5">Once the effective request URI has been constructed, an origin server needs to decide whether or not to provide service for that URI via the connection in which the request was received. For example, the request might have been misdirected, deliberately or accidentally, such that the information within a received <a href="#request-target" class="smpl">request-target</a> or <a href="#header.host" class="smpl">Host</a> header field differs from the host or port upon which the connection has been made. If the connection is from a trusted gateway, that inconsistency might be expected; otherwise, it might indicate an attempt to bypass security filters, trick the server into delivering non-public content, or poison a cache. See <a href="#security.considerations" title="Security Considerations">Section&nbsp;9</a> for security considerations regarding message routing.<a class="self" href="#rfc.section.5.5.p.5">&para;</a></p></div><div id="associating.response.to.request"><h2 id="rfc.section.5.6"><a href="#rfc.section.5.6">5.6</a>&nbsp;<a href="#associating.response.to.request">Associating a Response to a Request</a></h2><p id="rfc.section.5.6.p.1">HTTP does not include a request identifier for associating a given request message with its corresponding one or more response messages. Hence, it relies on the order of response arrival to correspond exactly to the order in which requests are made on the same connection. More than one response message per request only occurs when one or more informational responses (<a href="rfc7231.html#status.1xx" class="smpl">1xx</a>, see <a href="rfc7231.html#status.1xx" title="Informational 1xx">Section 6.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.25"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) precede a final response to the same request.<a class="self" href="#rfc.section.5.6.p.1">&para;</a></p><p id="rfc.section.5.6.p.2">A client that has more than one outstanding request on a connection <em class="bcp14">MUST</em> maintain a list of outstanding requests in the order sent and <em class="bcp14">MUST</em> associate each received response message on that connection to the highest ordered request that has not yet received a final (non-<a href="rfc7231.html#status.1xx" class="smpl">1xx</a>) response.<a class="self" href="#rfc.section.5.6.p.2">&para;</a></p></div><div id="message.forwarding"><h2 id="rfc.section.5.7"><a href="#rfc.section.5.7">5.7</a>&nbsp;<a href="#message.forwarding">Message Forwarding</a></h2><p id="rfc.section.5.7.p.1">As described in <a href="#intermediaries" title="Intermediaries">Section&nbsp;2.3</a>, intermediaries can serve a variety of roles in the processing of HTTP requests and responses. Some intermediaries are used to improve performance or availability. Others are used for access control or to filter content. Since an HTTP stream has characteristics similar to a pipe-and-filter architecture, there are no inherent limits to the extent an intermediary can enhance (or interfere) with either direction of the stream.<a class="self" href="#rfc.section.5.7.p.1">&para;</a></p><p id="rfc.section.5.7.p.2">An intermediary not acting as a tunnel <em class="bcp14">MUST</em> implement the <a href="#header.connection" class="smpl">Connection</a> header field, as specified in <a href="#header.connection" id="rfc.xref.header.connection.3" title="Connection">Section&nbsp;6.1</a>, and exclude fields from being forwarded that are only intended for the incoming connection.<a class="self" href="#rfc.section.5.7.p.2">&para;</a></p><p id="rfc.section.5.7.p.3">An intermediary <em class="bcp14">MUST NOT</em> forward a message to itself unless it is protected from an infinite request loop. In general, an intermediary ought to recognize its own server names, including any aliases, local variations, or literal IP addresses, and respond to such requests directly.<a class="self" href="#rfc.section.5.7.p.3">&para;</a></p><div id="header.via"><h3 id="rfc.section.5.7.1"><a href="#rfc.section.5.7.1">5.7.1</a>&nbsp;<a href="#header.via">Via</a></h3><p id="rfc.section.5.7.1.p.1">The "Via" header field indicates the presence of intermediate protocols and recipients between the user agent and the server (on requests) or between the origin server and the client (on responses), similar to the "Received" header field in email (<a href="https://tools.ietf.org/html/rfc5322#section-3.6.7">Section 3.6.7</a> of <a href="#RFC5322" id="rfc.xref.RFC5322.3"><cite title="Internet Message Format">[RFC5322]</cite></a>). Via can be used for tracking message forwards, avoiding request loops, and identifying the protocol capabilities of senders along the request/response chain.<a class="self" href="#rfc.section.5.7.1.p.1">&para;</a></p><div id="rfc.figure.u.56"><pre class="inline"><span id="rfc.iref.g.76"></span><span id="rfc.iref.g.77"></span><span id="rfc.iref.g.78"></span><span id="rfc.iref.g.79"></span><span id="rfc.iref.g.80"></span><span id="rfc.iref.g.81"></span>  <a href="#header.via" class="smpl">Via</a> = 1#( <a href="#header.via" class="smpl">received-protocol</a> <a href="#rule.whitespace" class="smpl">RWS</a> <a href="#header.via" class="smpl">received-by</a> [ <a href="#rule.whitespace" class="smpl">RWS</a> <a href="#rule.comment" class="smpl">comment</a> ] ) 
     678</pre></div><div id="rfc.section.5.5.p.4"><p>Recipients of an HTTP/1.0 request that lacks a <a href="#header.host" class="smpl">Host</a> header field might need to use heuristics (e.g., examination of the URI path for something unique to a particular host) in order to guess the effective request URI's authority component.<a class="self" href="#rfc.section.5.5.p.4">&para;</a></p></div><div id="rfc.section.5.5.p.5"><p>Once the effective request URI has been constructed, an origin server needs to decide whether or not to provide service for that URI via the connection in which the request was received. For example, the request might have been misdirected, deliberately or accidentally, such that the information within a received <a href="#request-target" class="smpl">request-target</a> or <a href="#header.host" class="smpl">Host</a> header field differs from the host or port upon which the connection has been made. If the connection is from a trusted gateway, that inconsistency might be expected; otherwise, it might indicate an attempt to bypass security filters, trick the server into delivering non-public content, or poison a cache. See <a href="#security.considerations" title="Security Considerations">Section&nbsp;9</a> for security considerations regarding message routing.<a class="self" href="#rfc.section.5.5.p.5">&para;</a></p></div></div><div id="associating.response.to.request"><h2 id="rfc.section.5.6"><a href="#rfc.section.5.6">5.6</a>&nbsp;<a href="#associating.response.to.request">Associating a Response to a Request</a></h2><div id="rfc.section.5.6.p.1"><p>HTTP does not include a request identifier for associating a given request message with its corresponding one or more response messages. Hence, it relies on the order of response arrival to correspond exactly to the order in which requests are made on the same connection. More than one response message per request only occurs when one or more informational responses (<a href="rfc7231.html#status.1xx" class="smpl">1xx</a>, see <a href="rfc7231.html#status.1xx" title="Informational 1xx">Section 6.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.25"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) precede a final response to the same request.<a class="self" href="#rfc.section.5.6.p.1">&para;</a></p></div><div id="rfc.section.5.6.p.2"><p>A client that has more than one outstanding request on a connection <em class="bcp14">MUST</em> maintain a list of outstanding requests in the order sent and <em class="bcp14">MUST</em> associate each received response message on that connection to the highest ordered request that has not yet received a final (non-<a href="rfc7231.html#status.1xx" class="smpl">1xx</a>) response.<a class="self" href="#rfc.section.5.6.p.2">&para;</a></p></div></div><div id="message.forwarding"><h2 id="rfc.section.5.7"><a href="#rfc.section.5.7">5.7</a>&nbsp;<a href="#message.forwarding">Message Forwarding</a></h2><div id="rfc.section.5.7.p.1"><p>As described in <a href="#intermediaries" title="Intermediaries">Section&nbsp;2.3</a>, intermediaries can serve a variety of roles in the processing of HTTP requests and responses. Some intermediaries are used to improve performance or availability. Others are used for access control or to filter content. Since an HTTP stream has characteristics similar to a pipe-and-filter architecture, there are no inherent limits to the extent an intermediary can enhance (or interfere) with either direction of the stream.<a class="self" href="#rfc.section.5.7.p.1">&para;</a></p></div><div id="rfc.section.5.7.p.2"><p>An intermediary not acting as a tunnel <em class="bcp14">MUST</em> implement the <a href="#header.connection" class="smpl">Connection</a> header field, as specified in <a href="#header.connection" id="rfc.xref.header.connection.3" title="Connection">Section&nbsp;6.1</a>, and exclude fields from being forwarded that are only intended for the incoming connection.<a class="self" href="#rfc.section.5.7.p.2">&para;</a></p></div><div id="rfc.section.5.7.p.3"><p>An intermediary <em class="bcp14">MUST NOT</em> forward a message to itself unless it is protected from an infinite request loop. In general, an intermediary ought to recognize its own server names, including any aliases, local variations, or literal IP addresses, and respond to such requests directly.<a class="self" href="#rfc.section.5.7.p.3">&para;</a></p></div><div id="header.via"><h3 id="rfc.section.5.7.1"><a href="#rfc.section.5.7.1">5.7.1</a>&nbsp;<a href="#header.via">Via</a></h3><div id="rfc.section.5.7.1.p.1"><p>The "Via" header field indicates the presence of intermediate protocols and recipients between the user agent and the server (on requests) or between the origin server and the client (on responses), similar to the "Received" header field in email (<a href="https://tools.ietf.org/html/rfc5322#section-3.6.7">Section 3.6.7</a> of <a href="#RFC5322" id="rfc.xref.RFC5322.3"><cite title="Internet Message Format">[RFC5322]</cite></a>). Via can be used for tracking message forwards, avoiding request loops, and identifying the protocol capabilities of senders along the request/response chain.<a class="self" href="#rfc.section.5.7.1.p.1">&para;</a></p></div><div id="rfc.figure.u.56"><pre class="inline"><span id="rfc.iref.g.76"></span><span id="rfc.iref.g.77"></span><span id="rfc.iref.g.78"></span><span id="rfc.iref.g.79"></span><span id="rfc.iref.g.80"></span><span id="rfc.iref.g.81"></span>  <a href="#header.via" class="smpl">Via</a> = 1#( <a href="#header.via" class="smpl">received-protocol</a> <a href="#rule.whitespace" class="smpl">RWS</a> <a href="#header.via" class="smpl">received-by</a> [ <a href="#rule.whitespace" class="smpl">RWS</a> <a href="#rule.comment" class="smpl">comment</a> ] ) 
    699679 
    700680  <a href="#header.via" class="smpl">received-protocol</a> = [ <a href="#header.upgrade" class="smpl">protocol-name</a> "/" ] <a href="#header.upgrade" class="smpl">protocol-version</a> 
     
    702682  <a href="#header.via" class="smpl">received-by</a>       = ( <a href="#uri" class="smpl">uri-host</a> [ ":" <a href="#uri" class="smpl">port</a> ] ) / <a href="#header.via" class="smpl">pseudonym</a> 
    703683  <a href="#header.via" class="smpl">pseudonym</a>         = <a href="#rule.token.separators" class="smpl">token</a> 
    704 </pre></div><p id="rfc.section.5.7.1.p.2">Multiple Via field values represent each proxy or gateway that has forwarded the message. Each intermediary appends its own information about how the message was received, such that the end result is ordered according to the sequence of forwarding recipients.<a class="self" href="#rfc.section.5.7.1.p.2">&para;</a></p><p id="rfc.section.5.7.1.p.3">A proxy <em class="bcp14">MUST</em> send an appropriate Via header field, as described below, in each message that it forwards. An HTTP-to-HTTP gateway <em class="bcp14">MUST</em> send an appropriate Via header field in each inbound request message and <em class="bcp14">MAY</em> send a Via header field in forwarded response messages.<a class="self" href="#rfc.section.5.7.1.p.3">&para;</a></p><p id="rfc.section.5.7.1.p.4">For each intermediary, the received-protocol indicates the protocol and protocol version used by the upstream sender of the message. Hence, the Via field value records the advertised protocol capabilities of the request/response chain such that they remain visible to downstream recipients; this can be useful for determining what backwards-incompatible features might be safe to use in response, or within a later request, as described in <a href="#http.version" title="Protocol Versioning">Section&nbsp;2.6</a>. For brevity, the protocol-name is omitted when the received protocol is HTTP.<a class="self" href="#rfc.section.5.7.1.p.4">&para;</a></p><p id="rfc.section.5.7.1.p.5">The received-by portion of the field value is normally the host and optional port number of a recipient server or client that subsequently forwarded the message. However, if the real host is considered to be sensitive information, a sender <em class="bcp14">MAY</em> replace it with a pseudonym. If a port is not provided, a recipient <em class="bcp14">MAY</em> interpret that as meaning it was received on the default TCP port, if any, for the received-protocol.<a class="self" href="#rfc.section.5.7.1.p.5">&para;</a></p><p id="rfc.section.5.7.1.p.6">A sender <em class="bcp14">MAY</em> generate comments in the Via header field to identify the software of each recipient, analogous to the <a href="rfc7231.html#header.user-agent" class="smpl">User-Agent</a> and <a href="rfc7231.html#header.server" class="smpl">Server</a> header fields. However, all comments in the Via field are optional, and a recipient <em class="bcp14">MAY</em> remove them prior to forwarding the message.<a class="self" href="#rfc.section.5.7.1.p.6">&para;</a></p><p id="rfc.section.5.7.1.p.7">For example, a request message could be sent from an HTTP/1.0 user agent to an internal proxy code-named "fred", which uses HTTP/1.1 to forward the request to a public proxy at p.example.net, which completes the request by forwarding it to the origin server at www.example.com. The request received by www.example.com would then have the following Via header field:<a class="self" href="#rfc.section.5.7.1.p.7">&para;</a></p><div id="rfc.figure.u.57"><pre class="text">  Via: 1.0 fred, 1.1 p.example.net 
    705 </pre></div><p id="rfc.section.5.7.1.p.8">An intermediary used as a portal through a network firewall <em class="bcp14">SHOULD NOT</em> forward the names and ports of hosts within the firewall region unless it is explicitly enabled to do so. If not enabled, such an intermediary <em class="bcp14">SHOULD</em> replace each received-by host of any host behind the firewall by an appropriate pseudonym for that host.<a class="self" href="#rfc.section.5.7.1.p.8">&para;</a></p><p id="rfc.section.5.7.1.p.9">An intermediary <em class="bcp14">MAY</em> combine an ordered subsequence of Via header field entries into a single such entry if the entries have identical received-protocol values. For example,<a class="self" href="#rfc.section.5.7.1.p.9">&para;</a></p><div id="rfc.figure.u.58"><pre class="text">  Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy 
    706 </pre></div><p id="rfc.section.5.7.1.p.10">could be collapsed to<a class="self" href="#rfc.section.5.7.1.p.10">&para;</a></p><div id="rfc.figure.u.59"><pre class="text">  Via: 1.0 ricky, 1.1 mertz, 1.0 lucy 
    707 </pre></div><p id="rfc.section.5.7.1.p.11">A sender <em class="bcp14">SHOULD NOT</em> combine multiple entries unless they are all under the same organizational control and the hosts have already been replaced by pseudonyms. A sender <em class="bcp14">MUST NOT</em> combine entries that have different received-protocol values.<a class="self" href="#rfc.section.5.7.1.p.11">&para;</a></p></div><div id="message.transformations"><h3 id="rfc.section.5.7.2"><a href="#rfc.section.5.7.2">5.7.2</a>&nbsp;<a href="#message.transformations">Transformations</a></h3><p id="rfc.section.5.7.2.p.1">Some intermediaries include features for transforming messages and their payloads. A proxy might, for example, convert between image formats in order to save cache space or to reduce the amount of traffic on a slow link. However, operational problems might occur when these transformations are applied to payloads intended for critical applications, such as medical imaging or scientific data analysis, particularly when integrity checks or digital signatures are used to ensure that the payload received is identical to the original.<a class="self" href="#rfc.section.5.7.2.p.1">&para;</a></p><p id="rfc.section.5.7.2.p.2">An HTTP-to-HTTP proxy is called a "<dfn>transforming proxy</dfn>" if it is designed or configured to modify messages in a semantically meaningful way (i.e., modifications, beyond those required by normal HTTP processing, that change the message in a way that would be significant to the original sender or potentially significant to downstream recipients). For example, a transforming proxy might be acting as a shared annotation server (modifying responses to include references to a local annotation database), a malware filter, a format transcoder, or a privacy filter. Such transformations are presumed to be desired by whichever client (or client organization) selected the proxy.<a class="self" href="#rfc.section.5.7.2.p.2">&para;</a></p><p id="rfc.section.5.7.2.p.3">If a proxy receives a request-target with a host name that is not a fully qualified domain name, it <em class="bcp14">MAY</em> add its own domain to the host name it received when forwarding the request. A proxy <em class="bcp14">MUST NOT</em> change the host name if the request-target contains a fully qualified domain name.<a class="self" href="#rfc.section.5.7.2.p.3">&para;</a></p><p id="rfc.section.5.7.2.p.4">A proxy <em class="bcp14">MUST NOT</em> modify the "absolute-path" and "query" parts of the received request-target when forwarding it to the next inbound server, except as noted above to replace an empty path with "/" or "*".<a class="self" href="#rfc.section.5.7.2.p.4">&para;</a></p><p id="rfc.section.5.7.2.p.5">A proxy <em class="bcp14">MAY</em> modify the message body through application or removal of a transfer coding (<a href="#transfer.codings" title="Transfer Codings">Section&nbsp;4</a>).<a class="self" href="#rfc.section.5.7.2.p.5">&para;</a></p><p id="rfc.section.5.7.2.p.6">A proxy <em class="bcp14">MUST NOT</em> transform the payload (<a href="rfc7231.html#payload" title="Payload Semantics">Section 3.3</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.26"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) of a message that contains a no-transform cache-control directive (<a href="rfc7234.html#header.cache-control" title="Cache-Control">Section 5.2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>).<a class="self" href="#rfc.section.5.7.2.p.6">&para;</a></p><p id="rfc.section.5.7.2.p.7">A proxy <em class="bcp14">MAY</em> transform the payload of a message that does not contain a no-transform cache-control directive. A proxy that transforms a payload <em class="bcp14">MUST</em> add a <a href="rfc7234.html#header.warning" class="smpl">Warning</a> header field with the warn-code of 214 ("Transformation Applied") if one is not already in the message (see <a href="rfc7234.html#header.warning" title="Warning">Section 5.5</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.6"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>). A proxy that transforms the payload of a <a href="rfc7231.html#status.200" class="smpl">200 (OK)</a> response can further inform downstream recipients that a transformation has been applied by changing the response status code to <a href="rfc7231.html#status.203" class="smpl">203 (Non-Authoritative Information)</a> (<a href="rfc7231.html#status.203" title="203 Non-Authoritative Information">Section 6.3.4</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.27"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.5.7.2.p.7">&para;</a></p><p id="rfc.section.5.7.2.p.8">A proxy <em class="bcp14">SHOULD NOT</em> modify header fields that provide information about the endpoints of the communication chain, the resource state, or the selected representation (other than the payload) unless the field's definition specifically allows such modification or the modification is deemed necessary for privacy or security.<a class="self" href="#rfc.section.5.7.2.p.8">&para;</a></p></div></div></div><div id="connection.management"><h1 id="rfc.section.6"><a href="#rfc.section.6">6.</a>&nbsp;<a href="#connection.management">Connection Management</a></h1><p id="rfc.section.6.p.1">HTTP messaging is independent of the underlying transport- or session-layer connection protocol(s). HTTP only presumes a reliable transport with in-order delivery of requests and the corresponding in-order delivery of responses. The mapping of HTTP request and response structures onto the data units of an underlying transport protocol is outside the scope of this specification.<a class="self" href="#rfc.section.6.p.1">&para;</a></p><p id="rfc.section.6.p.2">As described in <a href="#connecting.inbound" title="Connecting Inbound">Section&nbsp;5.2</a>, the specific connection protocols to be used for an HTTP interaction are determined by client configuration and the <a href="#target-resource" class="smpl">target URI</a>. For example, the "http" URI scheme (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>) indicates a default connection of TCP over IP, with a default TCP port of 80, but the client might be configured to use a proxy via some other connection, port, or protocol.<a class="self" href="#rfc.section.6.p.2">&para;</a></p><p id="rfc.section.6.p.3">HTTP implementations are expected to engage in connection management, which includes maintaining the state of current connections, establishing a new connection or reusing an existing connection, processing messages received on a connection, detecting connection failures, and closing each connection. Most clients maintain multiple connections in parallel, including more than one connection per server endpoint. Most servers are designed to maintain thousands of concurrent connections, while controlling request queues to enable fair use and detect denial-of-service attacks.<a class="self" href="#rfc.section.6.p.3">&para;</a></p><div id="header.connection"><h2 id="rfc.section.6.1"><a href="#rfc.section.6.1">6.1</a>&nbsp;<a href="#header.connection">Connection</a></h2><p id="rfc.section.6.1.p.1">The "Connection" header field allows the sender to indicate desired control options for the current connection. In order to avoid confusing downstream recipients, a proxy or gateway <em class="bcp14">MUST</em> remove or replace any received connection options before forwarding the message.<a class="self" href="#rfc.section.6.1.p.1">&para;</a></p><p id="rfc.section.6.1.p.2">When a header field aside from Connection is used to supply control information for or about the current connection, the sender <em class="bcp14">MUST</em> list the corresponding field-name within the Connection header field. A proxy or gateway <em class="bcp14">MUST</em> parse a received Connection header field before a message is forwarded and, for each connection-option in this field, remove any header field(s) from the message with the same name as the connection-option, and then remove the Connection header field itself (or replace it with the intermediary's own connection options for the forwarded message).<a class="self" href="#rfc.section.6.1.p.2">&para;</a></p><p id="rfc.section.6.1.p.3">Hence, the Connection header field provides a declarative way of distinguishing header fields that are only intended for the immediate recipient ("hop-by-hop") from those fields that are intended for all recipients on the chain ("end-to-end"), enabling the message to be self-descriptive and allowing future connection-specific extensions to be deployed without fear that they will be blindly forwarded by older intermediaries.<a class="self" href="#rfc.section.6.1.p.3">&para;</a></p><p id="rfc.section.6.1.p.4">The Connection header field's value has the following grammar:<a class="self" href="#rfc.section.6.1.p.4">&para;</a></p><div id="rfc.figure.u.60"><pre class="inline"><span id="rfc.iref.g.82"></span><span id="rfc.iref.g.83"></span>  <a href="#header.connection" class="smpl">Connection</a>        = 1#<a href="#header.connection" class="smpl">connection-option</a> 
     684</pre></div><div id="rfc.section.5.7.1.p.2"><p>Multiple Via field values represent each proxy or gateway that has forwarded the message. Each intermediary appends its own information about how the message was received, such that the end result is ordered according to the sequence of forwarding recipients.<a class="self" href="#rfc.section.5.7.1.p.2">&para;</a></p></div><div id="rfc.section.5.7.1.p.3"><p>A proxy <em class="bcp14">MUST</em> send an appropriate Via header field, as described below, in each message that it forwards. An HTTP-to-HTTP gateway <em class="bcp14">MUST</em> send an appropriate Via header field in each inbound request message and <em class="bcp14">MAY</em> send a Via header field in forwarded response messages.<a class="self" href="#rfc.section.5.7.1.p.3">&para;</a></p></div><div id="rfc.section.5.7.1.p.4"><p>For each intermediary, the received-protocol indicates the protocol and protocol version used by the upstream sender of the message. Hence, the Via field value records the advertised protocol capabilities of the request/response chain such that they remain visible to downstream recipients; this can be useful for determining what backwards-incompatible features might be safe to use in response, or within a later request, as described in <a href="#http.version" title="Protocol Versioning">Section&nbsp;2.6</a>. For brevity, the protocol-name is omitted when the received protocol is HTTP.<a class="self" href="#rfc.section.5.7.1.p.4">&para;</a></p></div><div id="rfc.section.5.7.1.p.5"><p>The received-by portion of the field value is normally the host and optional port number of a recipient server or client that subsequently forwarded the message. However, if the real host is considered to be sensitive information, a sender <em class="bcp14">MAY</em> replace it with a pseudonym. If a port is not provided, a recipient <em class="bcp14">MAY</em> interpret that as meaning it was received on the default TCP port, if any, for the received-protocol.<a class="self" href="#rfc.section.5.7.1.p.5">&para;</a></p></div><div id="rfc.section.5.7.1.p.6"><p>A sender <em class="bcp14">MAY</em> generate comments in the Via header field to identify the software of each recipient, analogous to the <a href="rfc7231.html#header.user-agent" class="smpl">User-Agent</a> and <a href="rfc7231.html#header.server" class="smpl">Server</a> header fields. However, all comments in the Via field are optional, and a recipient <em class="bcp14">MAY</em> remove them prior to forwarding the message.<a class="self" href="#rfc.section.5.7.1.p.6">&para;</a></p></div><div id="rfc.section.5.7.1.p.7"><p>For example, a request message could be sent from an HTTP/1.0 user agent to an internal proxy code-named "fred", which uses HTTP/1.1 to forward the request to a public proxy at p.example.net, which completes the request by forwarding it to the origin server at www.example.com. The request received by www.example.com would then have the following Via header field:<a class="self" href="#rfc.section.5.7.1.p.7">&para;</a></p></div><div id="rfc.figure.u.57"><pre class="text">  Via: 1.0 fred, 1.1 p.example.net 
     685</pre></div><div id="rfc.section.5.7.1.p.8"><p>An intermediary used as a portal through a network firewall <em class="bcp14">SHOULD NOT</em> forward the names and ports of hosts within the firewall region unless it is explicitly enabled to do so. If not enabled, such an intermediary <em class="bcp14">SHOULD</em> replace each received-by host of any host behind the firewall by an appropriate pseudonym for that host.<a class="self" href="#rfc.section.5.7.1.p.8">&para;</a></p></div><div id="rfc.section.5.7.1.p.9"><p>An intermediary <em class="bcp14">MAY</em> combine an ordered subsequence of Via header field entries into a single such entry if the entries have identical received-protocol values. For example,<a class="self" href="#rfc.section.5.7.1.p.9">&para;</a></p></div><div id="rfc.figure.u.58"><pre class="text">  Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy 
     686</pre></div><div id="rfc.section.5.7.1.p.10"><p>could be collapsed to<a class="self" href="#rfc.section.5.7.1.p.10">&para;</a></p></div><div id="rfc.figure.u.59"><pre class="text">  Via: 1.0 ricky, 1.1 mertz, 1.0 lucy 
     687</pre></div><div id="rfc.section.5.7.1.p.11"><p>A sender <em class="bcp14">SHOULD NOT</em> combine multiple entries unless they are all under the same organizational control and the hosts have already been replaced by pseudonyms. A sender <em class="bcp14">MUST NOT</em> combine entries that have different received-protocol values.<a class="self" href="#rfc.section.5.7.1.p.11">&para;</a></p></div></div><div id="message.transformations"><h3 id="rfc.section.5.7.2"><a href="#rfc.section.5.7.2">5.7.2</a>&nbsp;<a href="#message.transformations">Transformations</a></h3><div id="rfc.section.5.7.2.p.1"><p>Some intermediaries include features for transforming messages and their payloads. A proxy might, for example, convert between image formats in order to save cache space or to reduce the amount of traffic on a slow link. However, operational problems might occur when these transformations are applied to payloads intended for critical applications, such as medical imaging or scientific data analysis, particularly when integrity checks or digital signatures are used to ensure that the payload received is identical to the original.<a class="self" href="#rfc.section.5.7.2.p.1">&para;</a></p></div><div id="rfc.section.5.7.2.p.2"><p>An HTTP-to-HTTP proxy is called a "<dfn>transforming proxy</dfn>" if it is designed or configured to modify messages in a semantically meaningful way (i.e., modifications, beyond those required by normal HTTP processing, that change the message in a way that would be significant to the original sender or potentially significant to downstream recipients). For example, a transforming proxy might be acting as a shared annotation server (modifying responses to include references to a local annotation database), a malware filter, a format transcoder, or a privacy filter. Such transformations are presumed to be desired by whichever client (or client organization) selected the proxy.<a class="self" href="#rfc.section.5.7.2.p.2">&para;</a></p></div><div id="rfc.section.5.7.2.p.3"><p>If a proxy receives a request-target with a host name that is not a fully qualified domain name, it <em class="bcp14">MAY</em> add its own domain to the host name it received when forwarding the request. A proxy <em class="bcp14">MUST NOT</em> change the host name if the request-target contains a fully qualified domain name.<a class="self" href="#rfc.section.5.7.2.p.3">&para;</a></p></div><div id="rfc.section.5.7.2.p.4"><p>A proxy <em class="bcp14">MUST NOT</em> modify the "absolute-path" and "query" parts of the received request-target when forwarding it to the next inbound server, except as noted above to replace an empty path with "/" or "*".<a class="self" href="#rfc.section.5.7.2.p.4">&para;</a></p></div><div id="rfc.section.5.7.2.p.5"><p>A proxy <em class="bcp14">MAY</em> modify the message body through application or removal of a transfer coding (<a href="#transfer.codings" title="Transfer Codings">Section&nbsp;4</a>).<a class="self" href="#rfc.section.5.7.2.p.5">&para;</a></p></div><div id="rfc.section.5.7.2.p.6"><p>A proxy <em class="bcp14">MUST NOT</em> transform the payload (<a href="rfc7231.html#payload" title="Payload Semantics">Section 3.3</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.26"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) of a message that contains a no-transform cache-control directive (<a href="rfc7234.html#header.cache-control" title="Cache-Control">Section 5.2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>).<a class="self" href="#rfc.section.5.7.2.p.6">&para;</a></p></div><div id="rfc.section.5.7.2.p.7"><p>A proxy <em class="bcp14">MAY</em> transform the payload of a message that does not contain a no-transform cache-control directive. A proxy that transforms a payload <em class="bcp14">MUST</em> add a <a href="rfc7234.html#header.warning" class="smpl">Warning</a> header field with the warn-code of 214 ("Transformation Applied") if one is not already in the message (see <a href="rfc7234.html#header.warning" title="Warning">Section 5.5</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.6"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>). A proxy that transforms the payload of a <a href="rfc7231.html#status.200" class="smpl">200 (OK)</a> response can further inform downstream recipients that a transformation has been applied by changing the response status code to <a href="rfc7231.html#status.203" class="smpl">203 (Non-Authoritative Information)</a> (<a href="rfc7231.html#status.203" title="203 Non-Authoritative Information">Section 6.3.4</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.27"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.5.7.2.p.7">&para;</a></p></div><div id="rfc.section.5.7.2.p.8"><p>A proxy <em class="bcp14">SHOULD NOT</em> modify header fields that provide information about the endpoints of the communication chain, the resource state, or the selected representation (other than the payload) unless the field's definition specifically allows such modification or the modification is deemed necessary for privacy or security.<a class="self" href="#rfc.section.5.7.2.p.8">&para;</a></p></div></div></div></div><div id="connection.management"><h1 id="rfc.section.6"><a href="#rfc.section.6">6.</a>&nbsp;<a href="#connection.management">Connection Management</a></h1><div id="rfc.section.6.p.1"><p>HTTP messaging is independent of the underlying transport- or session-layer connection protocol(s). HTTP only presumes a reliable transport with in-order delivery of requests and the corresponding in-order delivery of responses. The mapping of HTTP request and response structures onto the data units of an underlying transport protocol is outside the scope of this specification.<a class="self" href="#rfc.section.6.p.1">&para;</a></p></div><div id="rfc.section.6.p.2"><p>As described in <a href="#connecting.inbound" title="Connecting Inbound">Section&nbsp;5.2</a>, the specific connection protocols to be used for an HTTP interaction are determined by client configuration and the <a href="#target-resource" class="smpl">target URI</a>. For example, the "http" URI scheme (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>) indicates a default connection of TCP over IP, with a default TCP port of 80, but the client might be configured to use a proxy via some other connection, port, or protocol.<a class="self" href="#rfc.section.6.p.2">&para;</a></p></div><div id="rfc.section.6.p.3"><p>HTTP implementations are expected to engage in connection management, which includes maintaining the state of current connections, establishing a new connection or reusing an existing connection, processing messages received on a connection, detecting connection failures, and closing each connection. Most clients maintain multiple connections in parallel, including more than one connection per server endpoint. Most servers are designed to maintain thousands of concurrent connections, while controlling request queues to enable fair use and detect denial-of-service attacks.<a class="self" href="#rfc.section.6.p.3">&para;</a></p></div><div id="header.connection"><h2 id="rfc.section.6.1"><a href="#rfc.section.6.1">6.1</a>&nbsp;<a href="#header.connection">Connection</a></h2><div id="rfc.section.6.1.p.1"><p>The "Connection" header field allows the sender to indicate desired control options for the current connection. In order to avoid confusing downstream recipients, a proxy or gateway <em class="bcp14">MUST</em> remove or replace any received connection options before forwarding the message.<a class="self" href="#rfc.section.6.1.p.1">&para;</a></p></div><div id="rfc.section.6.1.p.2"><p>When a header field aside from Connection is used to supply control information for or about the current connection, the sender <em class="bcp14">MUST</em> list the corresponding field-name within the Connection header field. A proxy or gateway <em class="bcp14">MUST</em> parse a received Connection header field before a message is forwarded and, for each connection-option in this field, remove any header field(s) from the message with the same name as the connection-option, and then remove the Connection header field itself (or replace it with the intermediary's own connection options for the forwarded message).<a class="self" href="#rfc.section.6.1.p.2">&para;</a></p></div><div id="rfc.section.6.1.p.3"><p>Hence, the Connection header field provides a declarative way of distinguishing header fields that are only intended for the immediate recipient ("hop-by-hop") from those fields that are intended for all recipients on the chain ("end-to-end"), enabling the message to be self-descriptive and allowing future connection-specific extensions to be deployed without fear that they will be blindly forwarded by older intermediaries.<a class="self" href="#rfc.section.6.1.p.3">&para;</a></p></div><div id="rfc.section.6.1.p.4"><p>The Connection header field's value has the following grammar:<a class="self" href="#rfc.section.6.1.p.4">&para;</a></p></div><div id="rfc.figure.u.60"><pre class="inline"><span id="rfc.iref.g.82"></span><span id="rfc.iref.g.83"></span>  <a href="#header.connection" class="smpl">Connection</a>        = 1#<a href="#header.connection" class="smpl">connection-option</a> 
    708688  <a href="#header.connection" class="smpl">connection-option</a> = <a href="#rule.token.separators" class="smpl">token</a> 
    709 </pre></div><p id="rfc.section.6.1.p.5">Connection options are case-insensitive.<a class="self" href="#rfc.section.6.1.p.5">&para;</a></p><p id="rfc.section.6.1.p.6">A sender <em class="bcp14">MUST NOT</em> send a connection option corresponding to a header field that is intended for all recipients of the payload. For example, <a href="rfc7234.html#header.cache-control" class="smpl">Cache-Control</a> is never appropriate as a connection option (<a href="rfc7234.html#header.cache-control" title="Cache-Control">Section 5.2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.7"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>).<a class="self" href="#rfc.section.6.1.p.6">&para;</a></p><p id="rfc.section.6.1.p.7">The connection options do not always correspond to a header field present in the message, since a connection-specific header field might not be needed if there are no parameters associated with a connection option. In contrast, a connection-specific header field that is received without a corresponding connection option usually indicates that the field has been improperly forwarded by an intermediary and ought to be ignored by the recipient.<a class="self" href="#rfc.section.6.1.p.7">&para;</a></p><p id="rfc.section.6.1.p.8">When defining new connection options, specification authors ought to survey existing header field names and ensure that the new connection option does not share the same name as an already deployed header field. Defining a new connection option essentially reserves that potential field-name for carrying additional information related to the connection option, since it would be unwise for senders to use that field-name for anything else.<a class="self" href="#rfc.section.6.1.p.8">&para;</a></p><p id="rfc.section.6.1.p.9">The "<dfn>close</dfn>" connection option is defined for a sender to signal that this connection will be closed after completion of the response. For example,<a class="self" href="#rfc.section.6.1.p.9">&para;</a></p><div id="rfc.figure.u.61"><pre class="text">  Connection: close 
    710 </pre></div><p id="rfc.section.6.1.p.10">in either the request or the response header fields indicates that the sender is going to close the connection after the current request/response is complete (<a href="#persistent.tear-down" id="rfc.xref.persistent.tear-down.1" title="Tear-down">Section&nbsp;6.6</a>).<a class="self" href="#rfc.section.6.1.p.10">&para;</a></p><p id="rfc.section.6.1.p.11">A client that does not support <a href="#persistent.connections" class="smpl">persistent connections</a> <em class="bcp14">MUST</em> send the "close" connection option in every request message.<a class="self" href="#rfc.section.6.1.p.11">&para;</a></p><p id="rfc.section.6.1.p.12">A server that does not support <a href="#persistent.connections" class="smpl">persistent connections</a> <em class="bcp14">MUST</em> send the "close" connection option in every response message that does not have a <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a> status code.<a class="self" href="#rfc.section.6.1.p.12">&para;</a></p></div><div id="persistent.establishment"><h2 id="rfc.section.6.2"><a href="#rfc.section.6.2">6.2</a>&nbsp;<a href="#persistent.establishment">Establishment</a></h2><p id="rfc.section.6.2.p.1">It is beyond the scope of this specification to describe how connections are established via various transport- or session-layer protocols. Each connection applies to only one transport link.<a class="self" href="#rfc.section.6.2.p.1">&para;</a></p></div><div id="persistent.connections"><h2 id="rfc.section.6.3"><a href="#rfc.section.6.3">6.3</a>&nbsp;<a href="#persistent.connections">Persistence</a></h2><p id="rfc.section.6.3.p.1">HTTP/1.1 defaults to the use of "<dfn>persistent connections</dfn>", allowing multiple requests and responses to be carried over a single connection. The "<a href="#header.connection" class="smpl">close</a>" connection option is used to signal that a connection will not persist after the current request/response. HTTP implementations <em class="bcp14">SHOULD</em> support persistent connections.<a class="self" href="#rfc.section.6.3.p.1">&para;</a></p><p id="rfc.section.6.3.p.2">A recipient determines whether a connection is persistent or not based on the most recently received message's protocol version and <a href="#header.connection" class="smpl">Connection</a> header field (if any): <a class="self" href="#rfc.section.6.3.p.2">&para;</a></p><ul><li>If the "<a href="#header.connection" class="smpl">close</a>" connection option is present, the connection will not persist after the current response; else,</li><li>If the received protocol is HTTP/1.1 (or later), the connection will persist after the current response; else,</li><li>If the received protocol is HTTP/1.0, the "keep-alive" connection option is present, the recipient is not a proxy, and the recipient wishes to honor the HTTP/1.0 "keep-alive" mechanism, the connection will persist after the current response; otherwise,</li><li>The connection will close after the current response.</li></ul><p id="rfc.section.6.3.p.3">A client <em class="bcp14">MAY</em> send additional requests on a persistent connection until it sends or receives a "<a href="#header.connection" class="smpl">close</a>" connection option or receives an HTTP/1.0 response without a "keep-alive" connection option.<a class="self" href="#rfc.section.6.3.p.3">&para;</a></p><p id="rfc.section.6.3.p.4">In order to remain persistent, all messages on a connection need to have a self-defined message length (i.e., one not defined by closure of the connection), as described in <a href="#message.body" title="Message Body">Section&nbsp;3.3</a>. A server <em class="bcp14">MUST</em> read the entire request message body or close the connection after sending its response, since otherwise the remaining data on a persistent connection would be misinterpreted as the next request. Likewise, a client <em class="bcp14">MUST</em> read the entire response message body if it intends to reuse the same connection for a subsequent request.<a class="self" href="#rfc.section.6.3.p.4">&para;</a></p><p id="rfc.section.6.3.p.5">A proxy server <em class="bcp14">MUST NOT</em> maintain a persistent connection with an HTTP/1.0 client (see <a href="https://tools.ietf.org/html/rfc2068#section-19.7.1">Section 19.7.1</a> of <a href="#RFC2068" id="rfc.xref.RFC2068.2"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a> for information and discussion of the problems with the Keep-Alive header field implemented by many HTTP/1.0 clients).<a class="self" href="#rfc.section.6.3.p.5">&para;</a></p><p id="rfc.section.6.3.p.6">See <a href="#compatibility.with.http.1.0.persistent.connections" title="Keep-Alive Connections">Appendix&nbsp;A.1.2</a> for more information on backwards compatibility with HTTP/1.0 clients.<a class="self" href="#rfc.section.6.3.p.6">&para;</a></p><div id="persistent.retrying.requests"><h3 id="rfc.section.6.3.1"><a href="#rfc.section.6.3.1">6.3.1</a>&nbsp;<a href="#persistent.retrying.requests">Retrying Requests</a></h3><p id="rfc.section.6.3.1.p.1">Connections can be closed at any time, with or without intention. Implementations ought to anticipate the need to recover from asynchronous close events.<a class="self" href="#rfc.section.6.3.1.p.1">&para;</a></p><p id="rfc.section.6.3.1.p.2">When an inbound connection is closed prematurely, a client <em class="bcp14">MAY</em> open a new connection and automatically retransmit an aborted sequence of requests if all of those requests have idempotent methods (<a href="rfc7231.html#idempotent.methods" title="Idempotent Methods">Section 4.2.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.28"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). A proxy <em class="bcp14">MUST NOT</em> automatically retry non-idempotent requests.<a class="self" href="#rfc.section.6.3.1.p.2">&para;</a></p><p id="rfc.section.6.3.1.p.3">A user agent <em class="bcp14">MUST NOT</em> automatically retry a request with a non-idempotent method unless it has some means to know that the request semantics are actually idempotent, regardless of the method, or some means to detect that the original request was never applied. For example, a user agent that knows (through design or configuration) that a POST request to a given resource is safe can repeat that request automatically. Likewise, a user agent designed specifically to operate on a version control repository might be able to recover from partial failure conditions by checking the target resource revision(s) after a failed connection, reverting or fixing any changes that were partially applied, and then automatically retrying the requests that failed.<a class="self" href="#rfc.section.6.3.1.p.3">&para;</a></p><p id="rfc.section.6.3.1.p.4">A client <em class="bcp14">SHOULD NOT</em> automatically retry a failed automatic retry.<a class="self" href="#rfc.section.6.3.1.p.4">&para;</a></p></div><div id="pipelining"><h3 id="rfc.section.6.3.2"><a href="#rfc.section.6.3.2">6.3.2</a>&nbsp;<a href="#pipelining">Pipelining</a></h3><p id="rfc.section.6.3.2.p.1">A client that supports persistent connections <em class="bcp14">MAY</em> "<dfn>pipeline</dfn>" its requests (i.e., send multiple requests without waiting for each response). A server <em class="bcp14">MAY</em> process a sequence of pipelined requests in parallel if they all have safe methods (<a href="rfc7231.html#safe.methods" title="Safe Methods">Section 4.2.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.29"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), but it <em class="bcp14">MUST</em> send the corresponding responses in the same order that the requests were received.<a class="self" href="#rfc.section.6.3.2.p.1">&para;</a></p><p id="rfc.section.6.3.2.p.2">A client that pipelines requests <em class="bcp14">SHOULD</em> retry unanswered requests if the connection closes before it receives all of the corresponding responses. When retrying pipelined requests after a failed connection (a connection not explicitly closed by the server in its last complete response), a client <em class="bcp14">MUST NOT</em> pipeline immediately after connection establishment, since the first remaining request in the prior pipeline might have caused an error response that can be lost again if multiple requests are sent on a prematurely closed connection (see the TCP reset problem described in <a href="#persistent.tear-down" id="rfc.xref.persistent.tear-down.2" title="Tear-down">Section&nbsp;6.6</a>).<a class="self" href="#rfc.section.6.3.2.p.2">&para;</a></p><p id="rfc.section.6.3.2.p.3">Idempotent methods (<a href="rfc7231.html#idempotent.methods" title="Idempotent Methods">Section 4.2.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.30"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) are significant to pipelining because they can be automatically retried after a connection failure. A user agent <em class="bcp14">SHOULD NOT</em> pipeline requests after a non-idempotent method, until the final response status code for that method has been received, unless the user agent has a means to detect and recover from partial failure conditions involving the pipelined sequence.<a class="self" href="#rfc.section.6.3.2.p.3">&para;</a></p><p id="rfc.section.6.3.2.p.4">An intermediary that receives pipelined requests <em class="bcp14">MAY</em> pipeline those requests when forwarding them inbound, since it can rely on the outbound user agent(s) to determine what requests can be safely pipelined. If the inbound connection fails before receiving a response, the pipelining intermediary <em class="bcp14">MAY</em> attempt to retry a sequence of requests that have yet to receive a response if the requests all have idempotent methods; otherwise, the pipelining intermediary <em class="bcp14">SHOULD</em> forward any received responses and then close the corresponding outbound connection(s) so that the outbound user agent(s) can recover accordingly.<a class="self" href="#rfc.section.6.3.2.p.4">&para;</a></p></div></div><div id="persistent.concurrency"><h2 id="rfc.section.6.4"><a href="#rfc.section.6.4">6.4</a>&nbsp;<a href="#persistent.concurrency">Concurrency</a></h2><p id="rfc.section.6.4.p.1">A client ought to limit the number of simultaneous open connections that it maintains to a given server.<a class="self" href="#rfc.section.6.4.p.1">&para;</a></p><p id="rfc.section.6.4.p.2">Previous revisions of HTTP gave a specific number of connections as a ceiling, but this was found to be impractical for many applications. As a result, this specification does not mandate a particular maximum number of connections but, instead, encourages clients to be conservative when opening multiple connections.<a class="self" href="#rfc.section.6.4.p.2">&para;</a></p><p id="rfc.section.6.4.p.3">Multiple connections are typically used to avoid the "head-of-line blocking" problem, wherein a request that takes significant server-side processing and/or has a large payload blocks subsequent requests on the same connection. However, each connection consumes server resources. Furthermore, using multiple connections can cause undesirable side effects in congested networks.<a class="self" href="#rfc.section.6.4.p.3">&para;</a></p><p id="rfc.section.6.4.p.4">Note that a server might reject traffic that it deems abusive or characteristic of a denial-of-service attack, such as an excessive number of open connections from a single client.<a class="self" href="#rfc.section.6.4.p.4">&para;</a></p></div><div id="persistent.failures"><h2 id="rfc.section.6.5"><a href="#rfc.section.6.5">6.5</a>&nbsp;<a href="#persistent.failures">Failures and Timeouts</a></h2><p id="rfc.section.6.5.p.1">Servers will usually have some timeout value beyond which they will no longer maintain an inactive connection. Proxy servers might make this a higher value since it is likely that the client will be making more connections through the same proxy server. The use of persistent connections places no requirements on the length (or existence) of this timeout for either the client or the server.<a class="self" href="#rfc.section.6.5.p.1">&para;</a></p><p id="rfc.section.6.5.p.2">A client or server that wishes to time out <em class="bcp14">SHOULD</em> issue a graceful close on the connection. Implementations <em class="bcp14">SHOULD</em> constantly monitor open connections for a received closure signal and respond to it as appropriate, since prompt closure of both sides of a connection enables allocated system resources to be reclaimed.<a class="self" href="#rfc.section.6.5.p.2">&para;</a></p><p id="rfc.section.6.5.p.3">A client, server, or proxy <em class="bcp14">MAY</em> close the transport connection at any time. For example, a client might have started to send a new request at the same time that the server has decided to close the "idle" connection. From the server's point of view, the connection is being closed while it was idle, but from the client's point of view, a request is in progress.<a class="self" href="#rfc.section.6.5.p.3">&para;</a></p><p id="rfc.section.6.5.p.4">A server <em class="bcp14">SHOULD</em> sustain persistent connections, when possible, and allow the underlying transport's flow-control mechanisms to resolve temporary overloads, rather than terminate connections with the expectation that clients will retry. The latter technique can exacerbate network congestion.<a class="self" href="#rfc.section.6.5.p.4">&para;</a></p><p id="rfc.section.6.5.p.5">A client sending a message body <em class="bcp14">SHOULD</em> monitor the network connection for an error response while it is transmitting the request. If the client sees a response that indicates the server does not wish to receive the message body and is closing the connection, the client <em class="bcp14">SHOULD</em> immediately cease transmitting the body and close its side of the connection.<a class="self" href="#rfc.section.6.5.p.5">&para;</a></p></div><div id="persistent.tear-down"><h2 id="rfc.section.6.6"><a href="#rfc.section.6.6">6.6</a>&nbsp;<a href="#persistent.tear-down">Tear-down</a></h2><p id="rfc.section.6.6.p.1">The <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.4" title="Connection">Section&nbsp;6.1</a>) provides a "<a href="#header.connection" class="smpl">close</a>" connection option that a sender <em class="bcp14">SHOULD</em> send when it wishes to close the connection after the current request/response pair.<a class="self" href="#rfc.section.6.6.p.1">&para;</a></p><p id="rfc.section.6.6.p.2">A client that sends a "<a href="#header.connection" class="smpl">close</a>" connection option <em class="bcp14">MUST NOT</em> send further requests on that connection (after the one containing "close") and <em class="bcp14">MUST</em> close the connection after reading the final response message corresponding to this request.<a class="self" href="#rfc.section.6.6.p.2">&para;</a></p><p id="rfc.section.6.6.p.3">A server that receives a "<a href="#header.connection" class="smpl">close</a>" connection option <em class="bcp14">MUST</em> initiate a close of the connection (see below) after it sends the final response to the request that contained "close". The server <em class="bcp14">SHOULD</em> send a "close" connection option in its final response on that connection. The server <em class="bcp14">MUST NOT</em> process any further requests received on that connection.<a class="self" href="#rfc.section.6.6.p.3">&para;</a></p><p id="rfc.section.6.6.p.4">A server that sends a "<a href="#header.connection" class="smpl">close</a>" connection option <em class="bcp14">MUST</em> initiate a close of the connection (see below) after it sends the response containing "close". The server <em class="bcp14">MUST NOT</em> process any further requests received on that connection.<a class="self" href="#rfc.section.6.6.p.4">&para;</a></p><p id="rfc.section.6.6.p.5">A client that receives a "<a href="#header.connection" class="smpl">close</a>" connection option <em class="bcp14">MUST</em> cease sending requests on that connection and close the connection after reading the response message containing the "close"; if additional pipelined requests had been sent on the connection, the client <em class="bcp14">SHOULD NOT</em> assume that they will be processed by the server.<a class="self" href="#rfc.section.6.6.p.5">&para;</a></p><p id="rfc.section.6.6.p.6">If a server performs an immediate close of a TCP connection, there is a significant risk that the client will not be able to read the last HTTP response. If the server receives additional data from the client on a fully closed connection, such as another request that was sent by the client before receiving the server's response, the server's TCP stack will send a reset packet to the client; unfortunately, the reset packet might erase the client's unacknowledged input buffers before they can be read and interpreted by the client's HTTP parser.<a class="self" href="#rfc.section.6.6.p.6">&para;</a></p><p id="rfc.section.6.6.p.7">To avoid the TCP reset problem, servers typically close a connection in stages. First, the server performs a half-close by closing only the write side of the read/write connection. The server then continues to read from the connection until it receives a corresponding close by the client, or until the server is reasonably certain that its own TCP stack has received the client's acknowledgement of the packet(s) containing the server's last response. Finally, the server fully closes the connection.<a class="self" href="#rfc.section.6.6.p.7">&para;</a></p><p id="rfc.section.6.6.p.8">It is unknown whether the reset problem is exclusive to TCP or might also be found in other transport connection protocols.<a class="self" href="#rfc.section.6.6.p.8">&para;</a></p></div><div id="header.upgrade"><h2 id="rfc.section.6.7"><a href="#rfc.section.6.7">6.7</a>&nbsp;<a href="#header.upgrade">Upgrade</a></h2><p id="rfc.section.6.7.p.1">The "Upgrade" header field is intended to provide a simple mechanism for transitioning from HTTP/1.1 to some other protocol on the same connection. A client <em class="bcp14">MAY</em> send a list of protocols in the Upgrade header field of a request to invite the server to switch to one or more of those protocols, in order of descending preference, before sending the final response. A server <em class="bcp14">MAY</em> ignore a received Upgrade header field if it wishes to continue using the current protocol on that connection. Upgrade cannot be used to insist on a protocol change.<a class="self" href="#rfc.section.6.7.p.1">&para;</a></p><div id="rfc.figure.u.62"><pre class="inline"><span id="rfc.iref.g.84"></span>  <a href="#header.upgrade" class="smpl">Upgrade</a>          = 1#<a href="#header.upgrade" class="smpl">protocol</a> 
     689</pre></div><div id="rfc.section.6.1.p.5"><p>Connection options are case-insensitive.<a class="self" href="#rfc.section.6.1.p.5">&para;</a></p></div><div id="rfc.section.6.1.p.6"><p>A sender <em class="bcp14">MUST NOT</em> send a connection option corresponding to a header field that is intended for all recipients of the payload. For example, <a href="rfc7234.html#header.cache-control" class="smpl">Cache-Control</a> is never appropriate as a connection option (<a href="rfc7234.html#header.cache-control" title="Cache-Control">Section 5.2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.7"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>).<a class="self" href="#rfc.section.6.1.p.6">&para;</a></p></div><div id="rfc.section.6.1.p.7"><p>The connection options do not always correspond to a header field present in the message, since a connection-specific header field might not be needed if there are no parameters associated with a connection option. In contrast, a connection-specific header field that is received without a corresponding connection option usually indicates that the field has been improperly forwarded by an intermediary and ought to be ignored by the recipient.<a class="self" href="#rfc.section.6.1.p.7">&para;</a></p></div><div id="rfc.section.6.1.p.8"><p>When defining new connection options, specification authors ought to survey existing header field names and ensure that the new connection option does not share the same name as an already deployed header field. Defining a new connection option essentially reserves that potential field-name for carrying additional information related to the connection option, since it would be unwise for senders to use that field-name for anything else.<a class="self" href="#rfc.section.6.1.p.8">&para;</a></p></div><div id="rfc.section.6.1.p.9"><p>The "<dfn>close</dfn>" connection option is defined for a sender to signal that this connection will be closed after completion of the response. For example,<a class="self" href="#rfc.section.6.1.p.9">&para;</a></p></div><div id="rfc.figure.u.61"><pre class="text">  Connection: close 
     690</pre></div><div id="rfc.section.6.1.p.10"><p>in either the request or the response header fields indicates that the sender is going to close the connection after the current request/response is complete (<a href="#persistent.tear-down" id="rfc.xref.persistent.tear-down.1" title="Tear-down">Section&nbsp;6.6</a>).<a class="self" href="#rfc.section.6.1.p.10">&para;</a></p></div><div id="rfc.section.6.1.p.11"><p>A client that does not support <a href="#persistent.connections" class="smpl">persistent connections</a> <em class="bcp14">MUST</em> send the "close" connection option in every request message.<a class="self" href="#rfc.section.6.1.p.11">&para;</a></p></div><div id="rfc.section.6.1.p.12"><p>A server that does not support <a href="#persistent.connections" class="smpl">persistent connections</a> <em class="bcp14">MUST</em> send the "close" connection option in every response message that does not have a <a href="rfc7231.html#status.1xx" class="smpl">1xx (Informational)</a> status code.<a class="self" href="#rfc.section.6.1.p.12">&para;</a></p></div></div><div id="persistent.establishment"><h2 id="rfc.section.6.2"><a href="#rfc.section.6.2">6.2</a>&nbsp;<a href="#persistent.establishment">Establishment</a></h2><div id="rfc.section.6.2.p.1"><p>It is beyond the scope of this specification to describe how connections are established via various transport- or session-layer protocols. Each connection applies to only one transport link.<a class="self" href="#rfc.section.6.2.p.1">&para;</a></p></div></div><div id="persistent.connections"><h2 id="rfc.section.6.3"><a href="#rfc.section.6.3">6.3</a>&nbsp;<a href="#persistent.connections">Persistence</a></h2><div id="rfc.section.6.3.p.1"><p>HTTP/1.1 defaults to the use of "<dfn>persistent connections</dfn>", allowing multiple requests and responses to be carried over a single connection. The "<a href="#header.connection" class="smpl">close</a>" connection option is used to signal that a connection will not persist after the current request/response. HTTP implementations <em class="bcp14">SHOULD</em> support persistent connections.<a class="self" href="#rfc.section.6.3.p.1">&para;</a></p></div><div id="rfc.section.6.3.p.2"><p>A recipient determines whether a connection is persistent or not based on the most recently received message's protocol version and <a href="#header.connection" class="smpl">Connection</a> header field (if any): <a class="self" href="#rfc.section.6.3.p.2">&para;</a></p><ul><li>If the "<a href="#header.connection" class="smpl">close</a>" connection option is present, the connection will not persist after the current response; else,</li><li>If the received protocol is HTTP/1.1 (or later), the connection will persist after the current response; else,</li><li>If the received protocol is HTTP/1.0, the "keep-alive" connection option is present, the recipient is not a proxy, and the recipient wishes to honor the HTTP/1.0 "keep-alive" mechanism, the connection will persist after the current response; otherwise,</li><li>The connection will close after the current response.</li></ul></div><div id="rfc.section.6.3.p.3"><p>A client <em class="bcp14">MAY</em> send additional requests on a persistent connection until it sends or receives a "<a href="#header.connection" class="smpl">close</a>" connection option or receives an HTTP/1.0 response without a "keep-alive" connection option.<a class="self" href="#rfc.section.6.3.p.3">&para;</a></p></div><div id="rfc.section.6.3.p.4"><p>In order to remain persistent, all messages on a connection need to have a self-defined message length (i.e., one not defined by closure of the connection), as described in <a href="#message.body" title="Message Body">Section&nbsp;3.3</a>. A server <em class="bcp14">MUST</em> read the entire request message body or close the connection after sending its response, since otherwise the remaining data on a persistent connection would be misinterpreted as the next request. Likewise, a client <em class="bcp14">MUST</em> read the entire response message body if it intends to reuse the same connection for a subsequent request.<a class="self" href="#rfc.section.6.3.p.4">&para;</a></p></div><div id="rfc.section.6.3.p.5"><p>A proxy server <em class="bcp14">MUST NOT</em> maintain a persistent connection with an HTTP/1.0 client (see <a href="https://tools.ietf.org/html/rfc2068#section-19.7.1">Section 19.7.1</a> of <a href="#RFC2068" id="rfc.xref.RFC2068.2"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a> for information and discussion of the problems with the Keep-Alive header field implemented by many HTTP/1.0 clients).<a class="self" href="#rfc.section.6.3.p.5">&para;</a></p></div><div id="rfc.section.6.3.p.6"><p>See <a href="#compatibility.with.http.1.0.persistent.connections" title="Keep-Alive Connections">Appendix&nbsp;A.1.2</a> for more information on backwards compatibility with HTTP/1.0 clients.<a class="self" href="#rfc.section.6.3.p.6">&para;</a></p></div><div id="persistent.retrying.requests"><h3 id="rfc.section.6.3.1"><a href="#rfc.section.6.3.1">6.3.1</a>&nbsp;<a href="#persistent.retrying.requests">Retrying Requests</a></h3><div id="rfc.section.6.3.1.p.1"><p>Connections can be closed at any time, with or without intention. Implementations ought to anticipate the need to recover from asynchronous close events.<a class="self" href="#rfc.section.6.3.1.p.1">&para;</a></p></div><div id="rfc.section.6.3.1.p.2"><p>When an inbound connection is closed prematurely, a client <em class="bcp14">MAY</em> open a new connection and automatically retransmit an aborted sequence of requests if all of those requests have idempotent methods (<a href="rfc7231.html#idempotent.methods" title="Idempotent Methods">Section 4.2.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.28"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). A proxy <em class="bcp14">MUST NOT</em> automatically retry non-idempotent requests.<a class="self" href="#rfc.section.6.3.1.p.2">&para;</a></p></div><div id="rfc.section.6.3.1.p.3"><p>A user agent <em class="bcp14">MUST NOT</em> automatically retry a request with a non-idempotent method unless it has some means to know that the request semantics are actually idempotent, regardless of the method, or some means to detect that the original request was never applied. For example, a user agent that knows (through design or configuration) that a POST request to a given resource is safe can repeat that request automatically. Likewise, a user agent designed specifically to operate on a version control repository might be able to recover from partial failure conditions by checking the target resource revision(s) after a failed connection, reverting or fixing any changes that were partially applied, and then automatically retrying the requests that failed.<a class="self" href="#rfc.section.6.3.1.p.3">&para;</a></p></div><div id="rfc.section.6.3.1.p.4"><p>A client <em class="bcp14">SHOULD NOT</em> automatically retry a failed automatic retry.<a class="self" href="#rfc.section.6.3.1.p.4">&para;</a></p></div></div><div id="pipelining"><h3 id="rfc.section.6.3.2"><a href="#rfc.section.6.3.2">6.3.2</a>&nbsp;<a href="#pipelining">Pipelining</a></h3><div id="rfc.section.6.3.2.p.1"><p>A client that supports persistent connections <em class="bcp14">MAY</em> "<dfn>pipeline</dfn>" its requests (i.e., send multiple requests without waiting for each response). A server <em class="bcp14">MAY</em> process a sequence of pipelined requests in parallel if they all have safe methods (<a href="rfc7231.html#safe.methods" title="Safe Methods">Section 4.2.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.29"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), but it <em class="bcp14">MUST</em> send the corresponding responses in the same order that the requests were received.<a class="self" href="#rfc.section.6.3.2.p.1">&para;</a></p></div><div id="rfc.section.6.3.2.p.2"><p>A client that pipelines requests <em class="bcp14">SHOULD</em> retry unanswered requests if the connection closes before it receives all of the corresponding responses. When retrying pipelined requests after a failed connection (a connection not explicitly closed by the server in its last complete response), a client <em class="bcp14">MUST NOT</em> pipeline immediately after connection establishment, since the first remaining request in the prior pipeline might have caused an error response that can be lost again if multiple requests are sent on a prematurely closed connection (see the TCP reset problem described in <a href="#persistent.tear-down" id="rfc.xref.persistent.tear-down.2" title="Tear-down">Section&nbsp;6.6</a>).<a class="self" href="#rfc.section.6.3.2.p.2">&para;</a></p></div><div id="rfc.section.6.3.2.p.3"><p>Idempotent methods (<a href="rfc7231.html#idempotent.methods" title="Idempotent Methods">Section 4.2.2</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.30"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) are significant to pipelining because they can be automatically retried after a connection failure. A user agent <em class="bcp14">SHOULD NOT</em> pipeline requests after a non-idempotent method, until the final response status code for that method has been received, unless the user agent has a means to detect and recover from partial failure conditions involving the pipelined sequence.<a class="self" href="#rfc.section.6.3.2.p.3">&para;</a></p></div><div id="rfc.section.6.3.2.p.4"><p>An intermediary that receives pipelined requests <em class="bcp14">MAY</em> pipeline those requests when forwarding them inbound, since it can rely on the outbound user agent(s) to determine what requests can be safely pipelined. If the inbound connection fails before receiving a response, the pipelining intermediary <em class="bcp14">MAY</em> attempt to retry a sequence of requests that have yet to receive a response if the requests all have idempotent methods; otherwise, the pipelining intermediary <em class="bcp14">SHOULD</em> forward any received responses and then close the corresponding outbound connection(s) so that the outbound user agent(s) can recover accordingly.<a class="self" href="#rfc.section.6.3.2.p.4">&para;</a></p></div></div></div><div id="persistent.concurrency"><h2 id="rfc.section.6.4"><a href="#rfc.section.6.4">6.4</a>&nbsp;<a href="#persistent.concurrency">Concurrency</a></h2><div id="rfc.section.6.4.p.1"><p>A client ought to limit the number of simultaneous open connections that it maintains to a given server.<a class="self" href="#rfc.section.6.4.p.1">&para;</a></p></div><div id="rfc.section.6.4.p.2"><p>Previous revisions of HTTP gave a specific number of connections as a ceiling, but this was found to be impractical for many applications. As a result, this specification does not mandate a particular maximum number of connections but, instead, encourages clients to be conservative when opening multiple connections.<a class="self" href="#rfc.section.6.4.p.2">&para;</a></p></div><div id="rfc.section.6.4.p.3"><p>Multiple connections are typically used to avoid the "head-of-line blocking" problem, wherein a request that takes significant server-side processing and/or has a large payload blocks subsequent requests on the same connection. However, each connection consumes server resources. Furthermore, using multiple connections can cause undesirable side effects in congested networks.<a class="self" href="#rfc.section.6.4.p.3">&para;</a></p></div><div id="rfc.section.6.4.p.4"><p>Note that a server might reject traffic that it deems abusive or characteristic of a denial-of-service attack, such as an excessive number of open connections from a single client.<a class="self" href="#rfc.section.6.4.p.4">&para;</a></p></div></div><div id="persistent.failures"><h2 id="rfc.section.6.5"><a href="#rfc.section.6.5">6.5</a>&nbsp;<a href="#persistent.failures">Failures and Timeouts</a></h2><div id="rfc.section.6.5.p.1"><p>Servers will usually have some timeout value beyond which they will no longer maintain an inactive connection. Proxy servers might make this a higher value since it is likely that the client will be making more connections through the same proxy server. The use of persistent connections places no requirements on the length (or existence) of this timeout for either the client or the server.<a class="self" href="#rfc.section.6.5.p.1">&para;</a></p></div><div id="rfc.section.6.5.p.2"><p>A client or server that wishes to time out <em class="bcp14">SHOULD</em> issue a graceful close on the connection. Implementations <em class="bcp14">SHOULD</em> constantly monitor open connections for a received closure signal and respond to it as appropriate, since prompt closure of both sides of a connection enables allocated system resources to be reclaimed.<a class="self" href="#rfc.section.6.5.p.2">&para;</a></p></div><div id="rfc.section.6.5.p.3"><p>A client, server, or proxy <em class="bcp14">MAY</em> close the transport connection at any time. For example, a client might have started to send a new request at the same time that the server has decided to close the "idle" connection. From the server's point of view, the connection is being closed while it was idle, but from the client's point of view, a request is in progress.<a class="self" href="#rfc.section.6.5.p.3">&para;</a></p></div><div id="rfc.section.6.5.p.4"><p>A server <em class="bcp14">SHOULD</em> sustain persistent connections, when possible, and allow the underlying transport's flow-control mechanisms to resolve temporary overloads, rather than terminate connections with the expectation that clients will retry. The latter technique can exacerbate network congestion.<a class="self" href="#rfc.section.6.5.p.4">&para;</a></p></div><div id="rfc.section.6.5.p.5"><p>A client sending a message body <em class="bcp14">SHOULD</em> monitor the network connection for an error response while it is transmitting the request. If the client sees a response that indicates the server does not wish to receive the message body and is closing the connection, the client <em class="bcp14">SHOULD</em> immediately cease transmitting the body and close its side of the connection.<a class="self" href="#rfc.section.6.5.p.5">&para;</a></p></div></div><div id="persistent.tear-down"><h2 id="rfc.section.6.6"><a href="#rfc.section.6.6">6.6</a>&nbsp;<a href="#persistent.tear-down">Tear-down</a></h2><div id="rfc.section.6.6.p.1"><p>The <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.4" title="Connection">Section&nbsp;6.1</a>) provides a "<a href="#header.connection" class="smpl">close</a>" connection option that a sender <em class="bcp14">SHOULD</em> send when it wishes to close the connection after the current request/response pair.<a class="self" href="#rfc.section.6.6.p.1">&para;</a></p></div><div id="rfc.section.6.6.p.2"><p>A client that sends a "<a href="#header.connection" class="smpl">close</a>" connection option <em class="bcp14">MUST NOT</em> send further requests on that connection (after the one containing "close") and <em class="bcp14">MUST</em> close the connection after reading the final response message corresponding to this request.<a class="self" href="#rfc.section.6.6.p.2">&para;</a></p></div><div id="rfc.section.6.6.p.3"><p>A server that receives a "<a href="#header.connection" class="smpl">close</a>" connection option <em class="bcp14">MUST</em> initiate a close of the connection (see below) after it sends the final response to the request that contained "close". The server <em class="bcp14">SHOULD</em> send a "close" connection option in its final response on that connection. The server <em class="bcp14">MUST NOT</em> process any further requests received on that connection.<a class="self" href="#rfc.section.6.6.p.3">&para;</a></p></div><div id="rfc.section.6.6.p.4"><p>A server that sends a "<a href="#header.connection" class="smpl">close</a>" connection option <em class="bcp14">MUST</em> initiate a close of the connection (see below) after it sends the response containing "close". The server <em class="bcp14">MUST NOT</em> process any further requests received on that connection.<a class="self" href="#rfc.section.6.6.p.4">&para;</a></p></div><div id="rfc.section.6.6.p.5"><p>A client that receives a "<a href="#header.connection" class="smpl">close</a>" connection option <em class="bcp14">MUST</em> cease sending requests on that connection and close the connection after reading the response message containing the "close"; if additional pipelined requests had been sent on the connection, the client <em class="bcp14">SHOULD NOT</em> assume that they will be processed by the server.<a class="self" href="#rfc.section.6.6.p.5">&para;</a></p></div><div id="rfc.section.6.6.p.6"><p>If a server performs an immediate close of a TCP connection, there is a significant risk that the client will not be able to read the last HTTP response. If the server receives additional data from the client on a fully closed connection, such as another request that was sent by the client before receiving the server's response, the server's TCP stack will send a reset packet to the client; unfortunately, the reset packet might erase the client's unacknowledged input buffers before they can be read and interpreted by the client's HTTP parser.<a class="self" href="#rfc.section.6.6.p.6">&para;</a></p></div><div id="rfc.section.6.6.p.7"><p>To avoid the TCP reset problem, servers typically close a connection in stages. First, the server performs a half-close by closing only the write side of the read/write connection. The server then continues to read from the connection until it receives a corresponding close by the client, or until the server is reasonably certain that its own TCP stack has received the client's acknowledgement of the packet(s) containing the server's last response. Finally, the server fully closes the connection.<a class="self" href="#rfc.section.6.6.p.7">&para;</a></p></div><div id="rfc.section.6.6.p.8"><p>It is unknown whether the reset problem is exclusive to TCP or might also be found in other transport connection protocols.<a class="self" href="#rfc.section.6.6.p.8">&para;</a></p></div></div><div id="header.upgrade"><h2 id="rfc.section.6.7"><a href="#rfc.section.6.7">6.7</a>&nbsp;<a href="#header.upgrade">Upgrade</a></h2><div id="rfc.section.6.7.p.1"><p>The "Upgrade" header field is intended to provide a simple mechanism for transitioning from HTTP/1.1 to some other protocol on the same connection. A client <em class="bcp14">MAY</em> send a list of protocols in the Upgrade header field of a request to invite the server to switch to one or more of those protocols, in order of descending preference, before sending the final response. A server <em class="bcp14">MAY</em> ignore a received Upgrade header field if it wishes to continue using the current protocol on that connection. Upgrade cannot be used to insist on a protocol change.<a class="self" href="#rfc.section.6.7.p.1">&para;</a></p></div><div id="rfc.figure.u.62"><pre class="inline"><span id="rfc.iref.g.84"></span>  <a href="#header.upgrade" class="smpl">Upgrade</a>          = 1#<a href="#header.upgrade" class="smpl">protocol</a> 
    711691 
    712692  <a href="#header.upgrade" class="smpl">protocol</a>         = <a href="#header.upgrade" class="smpl">protocol-name</a> ["/" <a href="#header.upgrade" class="smpl">protocol-version</a>] 
    713693  <a href="#header.upgrade" class="smpl">protocol-name</a>    = <a href="#rule.token.separators" class="smpl">token</a> 
    714694  <a href="#header.upgrade" class="smpl">protocol-version</a> = <a href="#rule.token.separators" class="smpl">token</a> 
    715 </pre></div><p id="rfc.section.6.7.p.2">A server that sends a <a href="rfc7231.html#status.101" class="smpl">101 (Switching Protocols)</a> response <em class="bcp14">MUST</em> send an Upgrade header field to indicate the new protocol(s) to which the connection is being switched; if multiple protocol layers are being switched, the sender <em class="bcp14">MUST</em> list the protocols in layer-ascending order. A server <em class="bcp14">MUST NOT</em> switch to a protocol that was not indicated by the client in the corresponding request's Upgrade header field. A server <em class="bcp14">MAY</em> choose to ignore the order of preference indicated by the client and select the new protocol(s) based on other factors, such as the nature of the request or the current load on the server.<a class="self" href="#rfc.section.6.7.p.2">&para;</a></p><p id="rfc.section.6.7.p.3">A server that sends a <a href="rfc7231.html#status.426" class="smpl">426 (Upgrade Required)</a> response <em class="bcp14">MUST</em> send an Upgrade header field to indicate the acceptable protocols, in order of descending preference.<a class="self" href="#rfc.section.6.7.p.3">&para;</a></p><p id="rfc.section.6.7.p.4">A server <em class="bcp14">MAY</em> send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request.<a class="self" href="#rfc.section.6.7.p.4">&para;</a></p><div id="rfc.figure.u.63"><p>The following is a hypothetical example sent by a client:</p><pre class="text2">GET /hello.txt HTTP/1.1 
     695</pre></div><div id="rfc.section.6.7.p.2"><p>A server that sends a <a href="rfc7231.html#status.101" class="smpl">101 (Switching Protocols)</a> response <em class="bcp14">MUST</em> send an Upgrade header field to indicate the new protocol(s) to which the connection is being switched; if multiple protocol layers are being switched, the sender <em class="bcp14">MUST</em> list the protocols in layer-ascending order. A server <em class="bcp14">MUST NOT</em> switch to a protocol that was not indicated by the client in the corresponding request's Upgrade header field. A server <em class="bcp14">MAY</em> choose to ignore the order of preference indicated by the client and select the new protocol(s) based on other factors, such as the nature of the request or the current load on the server.<a class="self" href="#rfc.section.6.7.p.2">&para;</a></p></div><div id="rfc.section.6.7.p.3"><p>A server that sends a <a href="rfc7231.html#status.426" class="smpl">426 (Upgrade Required)</a> response <em class="bcp14">MUST</em> send an Upgrade header field to indicate the acceptable protocols, in order of descending preference.<a class="self" href="#rfc.section.6.7.p.3">&para;</a></p></div><div id="rfc.section.6.7.p.4"><p>A server <em class="bcp14">MAY</em> send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request.<a class="self" href="#rfc.section.6.7.p.4">&para;</a></p></div><div id="rfc.figure.u.63"><p>The following is a hypothetical example sent by a client:</p><pre class="text2">GET /hello.txt HTTP/1.1 
    716696Host: www.example.com 
    717697Connection: upgrade 
    718698Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11 
    719699 
    720 </pre></div><p id="rfc.section.6.7.p.5">The capabilities and nature of the application-level communication after the protocol change is entirely dependent upon the new protocol(s) chosen. However, immediately after sending the <a href="rfc7231.html#status.101" class="smpl">101 (Switching Protocols)</a> response, the server is expected to continue responding to the original request as if it had received its equivalent within the new protocol (i.e., the server still has an outstanding request to satisfy after the protocol has been changed, and is expected to do so without requiring the request to be repeated).<a class="self" href="#rfc.section.6.7.p.5">&para;</a></p><p id="rfc.section.6.7.p.6">For example, if the Upgrade header field is received in a GET request and the server decides to switch protocols, it first responds with a <a href="rfc7231.html#status.101" class="smpl">101 (Switching Protocols)</a> message in HTTP/1.1 and then immediately follows that with the new protocol's equivalent of a response to a GET on the target resource. This allows a connection to be upgraded to protocols with the same semantics as HTTP without the latency cost of an additional round trip. A server <em class="bcp14">MUST NOT</em> switch protocols unless the received message semantics can be honored by the new protocol; an OPTIONS request can be honored by any protocol.<a class="self" href="#rfc.section.6.7.p.6">&para;</a></p><div id="rfc.figure.u.64"><p>The following is an example response to the above hypothetical request:</p><pre class="text">HTTP/1.1 101 Switching Protocols 
     700</pre></div><div id="rfc.section.6.7.p.5"><p>The capabilities and nature of the application-level communication after the protocol change is entirely dependent upon the new protocol(s) chosen. However, immediately after sending the <a href="rfc7231.html#status.101" class="smpl">101 (Switching Protocols)</a> response, the server is expected to continue responding to the original request as if it had received its equivalent within the new protocol (i.e., the server still has an outstanding request to satisfy after the protocol has been changed, and is expected to do so without requiring the request to be repeated).<a class="self" href="#rfc.section.6.7.p.5">&para;</a></p></div><div id="rfc.section.6.7.p.6"><p>For example, if the Upgrade header field is received in a GET request and the server decides to switch protocols, it first responds with a <a href="rfc7231.html#status.101" class="smpl">101 (Switching Protocols)</a> message in HTTP/1.1 and then immediately follows that with the new protocol's equivalent of a response to a GET on the target resource. This allows a connection to be upgraded to protocols with the same semantics as HTTP without the latency cost of an additional round trip. A server <em class="bcp14">MUST NOT</em> switch protocols unless the received message semantics can be honored by the new protocol; an OPTIONS request can be honored by any protocol.<a class="self" href="#rfc.section.6.7.p.6">&para;</a></p></div><div id="rfc.figure.u.64"><p>The following is an example response to the above hypothetical request:</p><pre class="text">HTTP/1.1 101 Switching Protocols 
    721701Connection: upgrade 
    722702Upgrade: HTTP/2.0 
     
    724704[... data stream switches to HTTP/2.0 with an appropriate response 
    725705(as defined by new protocol) to the "GET /hello.txt" request ...] 
    726 </pre></div><p id="rfc.section.6.7.p.7">When Upgrade is sent, the sender <em class="bcp14">MUST</em> also send a <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.5" title="Connection">Section&nbsp;6.1</a>) that contains an "upgrade" connection option, in order to prevent Upgrade from being accidentally forwarded by intermediaries that might not implement the listed protocols. A server <em class="bcp14">MUST</em> ignore an Upgrade header field that is received in an HTTP/1.0 request.<a class="self" href="#rfc.section.6.7.p.7">&para;</a></p><p id="rfc.section.6.7.p.8">A client cannot begin using an upgraded protocol on the connection until it has completely sent the request message (i.e., the client can't change the protocol it is sending in the middle of a message). If a server receives both an Upgrade and an <a href="rfc7231.html#header.expect" class="smpl">Expect</a> header field with the "100-continue" expectation (<a href="rfc7231.html#header.expect" title="Expect">Section 5.1.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.31"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), the server <em class="bcp14">MUST</em> send a <a href="rfc7231.html#status.100" class="smpl">100 (Continue)</a> response before sending a <a href="rfc7231.html#status.101" class="smpl">101 (Switching Protocols)</a> response.<a class="self" href="#rfc.section.6.7.p.8">&para;</a></p><p id="rfc.section.6.7.p.9">The Upgrade header field only applies to switching protocols on top of the existing connection; it cannot be used to switch the underlying connection (transport) protocol, nor to switch the existing communication to a different connection. For those purposes, it is more appropriate to use a <a href="rfc7231.html#status.3xx" class="smpl">3xx (Redirection)</a> response (<a href="rfc7231.html#status.3xx" title="Redirection 3xx">Section 6.4</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.32"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.6.7.p.9">&para;</a></p><p id="rfc.section.6.7.p.10">This specification only defines the protocol name "HTTP" for use by the family of Hypertext Transfer Protocols, as defined by the HTTP version rules of <a href="#http.version" title="Protocol Versioning">Section&nbsp;2.6</a> and future updates to this specification. Additional tokens ought to be registered with IANA using the registration procedure defined in <a href="#upgrade.token.registry" title="Upgrade Token Registry">Section&nbsp;8.6</a>.<a class="self" href="#rfc.section.6.7.p.10">&para;</a></p></div></div><div id="abnf.extension"><h1 id="rfc.section.7"><a href="#rfc.section.7">7.</a>&nbsp;<a href="#abnf.extension">ABNF List Extension: #rule</a></h1><p id="rfc.section.7.p.1">A #rule extension to the ABNF rules of <a href="#RFC5234" id="rfc.xref.RFC5234.3"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> is used to improve readability in the definitions of some header field values.<a class="self" href="#rfc.section.7.p.1">&para;</a></p><p id="rfc.section.7.p.2">A construct "#" is defined, similar to "*", for defining comma-delimited lists of elements. The full form is "&lt;n&gt;#&lt;m&gt;element" indicating at least &lt;n&gt; and at most &lt;m&gt; elements, each separated by a single comma (",") and optional whitespace (OWS).<a class="self" href="#rfc.section.7.p.2">&para;</a></p><div id="rfc.figure.u.65"><p>In any production that uses the list construct, a sender <em class="bcp14">MUST NOT</em> generate empty list elements. In other words, a sender <em class="bcp14">MUST</em> generate lists that satisfy the following syntax:</p><pre class="text">  1#element =&gt; element *( OWS "," OWS element ) 
     706</pre></div><div id="rfc.section.6.7.p.7"><p>When Upgrade is sent, the sender <em class="bcp14">MUST</em> also send a <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.5" title="Connection">Section&nbsp;6.1</a>) that contains an "upgrade" connection option, in order to prevent Upgrade from being accidentally forwarded by intermediaries that might not implement the listed protocols. A server <em class="bcp14">MUST</em> ignore an Upgrade header field that is received in an HTTP/1.0 request.<a class="self" href="#rfc.section.6.7.p.7">&para;</a></p></div><div id="rfc.section.6.7.p.8"><p>A client cannot begin using an upgraded protocol on the connection until it has completely sent the request message (i.e., the client can't change the protocol it is sending in the middle of a message). If a server receives both an Upgrade and an <a href="rfc7231.html#header.expect" class="smpl">Expect</a> header field with the "100-continue" expectation (<a href="rfc7231.html#header.expect" title="Expect">Section 5.1.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.31"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>), the server <em class="bcp14">MUST</em> send a <a href="rfc7231.html#status.100" class="smpl">100 (Continue)</a> response before sending a <a href="rfc7231.html#status.101" class="smpl">101 (Switching Protocols)</a> response.<a class="self" href="#rfc.section.6.7.p.8">&para;</a></p></div><div id="rfc.section.6.7.p.9"><p>The Upgrade header field only applies to switching protocols on top of the existing connection; it cannot be used to switch the underlying connection (transport) protocol, nor to switch the existing communication to a different connection. For those purposes, it is more appropriate to use a <a href="rfc7231.html#status.3xx" class="smpl">3xx (Redirection)</a> response (<a href="rfc7231.html#status.3xx" title="Redirection 3xx">Section 6.4</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.32"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>).<a class="self" href="#rfc.section.6.7.p.9">&para;</a></p></div><div id="rfc.section.6.7.p.10"><p>This specification only defines the protocol name "HTTP" for use by the family of Hypertext Transfer Protocols, as defined by the HTTP version rules of <a href="#http.version" title="Protocol Versioning">Section&nbsp;2.6</a> and future updates to this specification. Additional tokens ought to be registered with IANA using the registration procedure defined in <a href="#upgrade.token.registry" title="Upgrade Token Registry">Section&nbsp;8.6</a>.<a class="self" href="#rfc.section.6.7.p.10">&para;</a></p></div></div></div><div id="abnf.extension"><h1 id="rfc.section.7"><a href="#rfc.section.7">7.</a>&nbsp;<a href="#abnf.extension">ABNF List Extension: #rule</a></h1><div id="rfc.section.7.p.1"><p>A #rule extension to the ABNF rules of <a href="#RFC5234" id="rfc.xref.RFC5234.3"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> is used to improve readability in the definitions of some header field values.<a class="self" href="#rfc.section.7.p.1">&para;</a></p></div><div id="rfc.section.7.p.2"><p>A construct "#" is defined, similar to "*", for defining comma-delimited lists of elements. The full form is "&lt;n&gt;#&lt;m&gt;element" indicating at least &lt;n&gt; and at most &lt;m&gt; elements, each separated by a single comma (",") and optional whitespace (OWS).<a class="self" href="#rfc.section.7.p.2">&para;</a></p></div><div id="rfc.figure.u.65"><p>In any production that uses the list construct, a sender <em class="bcp14">MUST NOT</em> generate empty list elements. In other words, a sender <em class="bcp14">MUST</em> generate lists that satisfy the following syntax:</p><pre class="text">  1#element =&gt; element *( OWS "," OWS element ) 
    727707</pre></div><div id="rfc.figure.u.66"><p>and:</p><pre class="text">  #element =&gt; [ 1#element ] 
    728708</pre></div><div id="rfc.figure.u.67"><p>and for n &gt;= 1 and m &gt; 1:</p><pre class="text">  &lt;n&gt;#&lt;m&gt;element =&gt; element &lt;n-1&gt;*&lt;m-1&gt;( OWS "," OWS element ) 
    729 </pre></div><p id="rfc.section.7.p.3">For compatibility with legacy list rules, a recipient <em class="bcp14">MUST</em> parse and ignore a reasonable number of empty list elements: enough to handle common mistakes by senders that merge values, but not so much that they could be used as a denial-of-service mechanism. In other words, a recipient <em class="bcp14">MUST</em> accept lists that satisfy the following syntax:<a class="self" href="#rfc.section.7.p.3">&para;</a></p><div id="rfc.figure.u.68"><pre class="text">  #element =&gt; [ ( "," / element ) *( OWS "," [ OWS element ] ) ] 
     709</pre></div><div id="rfc.section.7.p.3"><p>For compatibility with legacy list rules, a recipient <em class="bcp14">MUST</em> parse and ignore a reasonable number of empty list elements: enough to handle common mistakes by senders that merge values, but not so much that they could be used as a denial-of-service mechanism. In other words, a recipient <em class="bcp14">MUST</em> accept lists that satisfy the following syntax:<a class="self" href="#rfc.section.7.p.3">&para;</a></p></div><div id="rfc.figure.u.68"><pre class="text">  #element =&gt; [ ( "," / element ) *( OWS "," [ OWS element ] ) ] 
    730710   
    731711  1#element =&gt; *( "," OWS ) element *( OWS "," [ OWS element ] ) 
    732 </pre></div><p id="rfc.section.7.p.4">Empty elements do not contribute to the count of elements present. For example, given these ABNF productions:<a class="self" href="#rfc.section.7.p.4">&para;</a></p><div id="rfc.figure.u.69"><pre class="text">  example-list      = 1#example-list-elmt 
     712</pre></div><div id="rfc.section.7.p.4"><p>Empty elements do not contribute to the count of elements present. For example, given these ABNF productions:<a class="self" href="#rfc.section.7.p.4">&para;</a></p></div><div id="rfc.figure.u.69"><pre class="text">  example-list      = 1#example-list-elmt 
    733713  example-list-elmt = token ; see <a href="#field.components" title="Field Value Components">Section&nbsp;3.2.6</a>  
    734 </pre></div><p id="rfc.section.7.p.5">Then the following are valid values for example-list (not including the double quotes, which are present for delimitation only):<a class="self" href="#rfc.section.7.p.5">&para;</a></p><div id="rfc.figure.u.70"><pre class="text">  "foo,bar" 
     714</pre></div><div id="rfc.section.7.p.5"><p>Then the following are valid values for example-list (not including the double quotes, which are present for delimitation only):<a class="self" href="#rfc.section.7.p.5">&para;</a></p></div><div id="rfc.figure.u.70"><pre class="text">  "foo,bar" 
    735715  "foo ,bar," 
    736716  "foo , ,bar,charlie   " 
    737 </pre></div><p id="rfc.section.7.p.6">In contrast, the following values would be invalid, since at least one non-empty element is required by the example-list production:<a class="self" href="#rfc.section.7.p.6">&para;</a></p><div id="rfc.figure.u.71"><pre class="text">  "" 
     717</pre></div><div id="rfc.section.7.p.6"><p>In contrast, the following values would be invalid, since at least one non-empty element is required by the example-list production:<a class="self" href="#rfc.section.7.p.6">&para;</a></p></div><div id="rfc.figure.u.71"><pre class="text">  "" 
    738718  "," 
    739719  ",   ," 
    740 </pre></div><p id="rfc.section.7.p.7"><a href="#collected.abnf" title="Collected ABNF">Appendix&nbsp;B</a> shows the collected ABNF for recipients after the list constructs have been expanded.<a class="self" href="#rfc.section.7.p.7">&para;</a></p></div><div id="IANA.considerations"><h1 id="rfc.section.8"><a href="#rfc.section.8">8.</a>&nbsp;<a href="#IANA.considerations">IANA Considerations</a></h1><div id="header.field.registration"><h2 id="rfc.section.8.1"><a href="#rfc.section.8.1">8.1</a>&nbsp;<a href="#header.field.registration">Header Field Registration</a></h2><p id="rfc.section.8.1.p.1">HTTP header fields are registered within the "Message Headers" registry maintained at &lt;<a href="http://www.iana.org/assignments/message-headers/">http://www.iana.org/assignments/message-headers/</a>&gt;.<a class="self" href="#rfc.section.8.1.p.1">&para;</a></p><p id="rfc.section.8.1.p.2">This document defines the following HTTP header fields, so the "Permanent Message Header Field Names" registry has been updated accordingly (see <a href="#BCP90" id="rfc.xref.BCP90.1"><cite title="Registration Procedures for Message Header Fields">[BCP90]</cite></a>).<a class="self" href="#rfc.section.8.1.p.2">&para;</a></p><div id="rfc.table.1"><div id="iana.header.registration.table"></div><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Header Field Name</th><th>Protocol</th><th>Status</th><th>Reference</th></tr></thead><tbody><tr><td class="left">Connection</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.connection" id="rfc.xref.header.connection.6" title="Connection">Section&nbsp;6.1</a> </td></tr><tr><td class="left">Content-Length</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.content-length" id="rfc.xref.header.content-length.1" title="Content-Length">Section&nbsp;3.3.2</a> </td></tr><tr><td class="left">Host</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.host" id="rfc.xref.header.host.2" title="Host">Section&nbsp;5.4</a> </td></tr><tr><td class="left">TE</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.te" id="rfc.xref.header.te.3" title="TE">Section&nbsp;4.3</a> </td></tr><tr><td class="left">Trailer</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.trailer" id="rfc.xref.header.trailer.1" title="Trailer">Section&nbsp;4.4</a> </td></tr><tr><td class="left">Transfer-Encoding</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.3" title="Transfer-Encoding">Section&nbsp;3.3.1</a> </td></tr><tr><td class="left">Upgrade</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.upgrade" id="rfc.xref.header.upgrade.2" title="Upgrade">Section&nbsp;6.7</a> </td></tr><tr><td class="left">Via</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.via" id="rfc.xref.header.via.1" title="Via">Section&nbsp;5.7.1</a> </td></tr></tbody></table></div><p id="rfc.section.8.1.p.3">Furthermore, the header field-name "Close" has been registered as "reserved", since using that name as an HTTP header field might conflict with the "close" connection option of the <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.7" title="Connection">Section&nbsp;6.1</a>).<a class="self" href="#rfc.section.8.1.p.3">&para;</a></p><div id="rfc.table.u.1"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Header Field Name</th><th>Protocol</th><th>Status</th><th>Reference</th></tr></thead><tbody><tr><td class="left">Close</td><td class="left">http</td><td class="left">reserved</td><td class="left"><a href="#header.field.registration" title="Header Field Registration">Section&nbsp;8.1</a> </td></tr></tbody></table></div><p id="rfc.section.8.1.p.4">The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".<a class="self" href="#rfc.section.8.1.p.4">&para;</a></p></div><div id="uri.scheme.registration"><h2 id="rfc.section.8.2"><a href="#rfc.section.8.2">8.2</a>&nbsp;<a href="#uri.scheme.registration">URI Scheme Registration</a></h2><p id="rfc.section.8.2.p.1">IANA maintains the registry of URI Schemes <a href="#BCP115" id="rfc.xref.BCP115.1"><cite title="Guidelines and Registration Procedures for New URI Schemes">[BCP115]</cite></a> at &lt;<a href="http://www.iana.org/assignments/uri-schemes/">http://www.iana.org/assignments/uri-schemes/</a>&gt;.<a class="self" href="#rfc.section.8.2.p.1">&para;</a></p><p id="rfc.section.8.2.p.2">This document defines the following URI schemes, so the "Permanent URI Schemes" registry has been updated accordingly.<a class="self" href="#rfc.section.8.2.p.2">&para;</a></p><div id="rfc.table.u.2"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>URI Scheme</th><th>Description</th><th>Reference</th></tr></thead><tbody><tr><td class="left">http</td><td class="left">Hypertext Transfer Protocol</td><td class="left"><a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a></td></tr><tr><td class="left">https</td><td class="left">Hypertext Transfer Protocol Secure</td><td class="left"><a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a></td></tr></tbody></table></div></div><div id="internet.media.type.http"><h2 id="rfc.section.8.3"><a href="#rfc.section.8.3">8.3</a>&nbsp;<a href="#internet.media.type.http">Internet Media Type Registration</a></h2><p id="rfc.section.8.3.p.1">IANA maintains the registry of Internet media types <a href="#BCP13" id="rfc.xref.BCP13.1"><cite title="Media Type Specifications and Registration Procedures">[BCP13]</cite></a> at &lt;<a href="http://www.iana.org/assignments/media-types">http://www.iana.org/assignments/media-types</a>&gt;.<a class="self" href="#rfc.section.8.3.p.1">&para;</a></p><p id="rfc.section.8.3.p.2">This document serves as the specification for the Internet media types "message/http" and "application/http". The following has been registered with IANA.<a class="self" href="#rfc.section.8.3.p.2">&para;</a></p><div id="internet.media.type.message.http"><h3 id="rfc.section.8.3.1"><a href="#rfc.section.8.3.1">8.3.1</a>&nbsp;<a href="#internet.media.type.message.http">Internet Media Type message/http</a></h3><p id="rfc.section.8.3.1.p.1">The message/http type can be used to enclose a single HTTP request or response message, provided that it obeys the MIME restrictions for all "message" types regarding line length and encodings.<a class="self" href="#rfc.section.8.3.1.p.1">&para;</a></p><dl><dt>Type name:</dt><dd>message</dd><dt>Subtype name:</dt><dd>http</dd><dt>Required parameters:</dt><dd>N/A</dd><dt>Optional parameters:</dt><dd>version, msgtype <dl><dt>version:</dt><dd>The HTTP-version number of the enclosed message (e.g., "1.1"). If not present, the version can be determined from the first line of the body.</dd><dt>msgtype:</dt><dd>The message type &#8212; "request" or "response". If not present, the type can be determined from the first line of the body.</dd></dl> </dd><dt>Encoding considerations:</dt><dd>only "7bit", "8bit", or "binary" are permitted</dd><dt>Security considerations:</dt><dd>see <a href="#security.considerations" title="Security Considerations">Section&nbsp;9</a> </dd><dt>Interoperability considerations:</dt><dd>N/A</dd><dt>Published specification:</dt><dd>This specification (see <a href="#internet.media.type.message.http" title="Internet Media Type message/http">Section&nbsp;8.3.1</a>).</dd><dt>Applications that use this media type:</dt><dd>N/A</dd><dt>Fragment identifier considerations:</dt><dd>N/A</dd><dt>Additional information:</dt><dd><dl><dt>Magic number(s):</dt><dd>N/A</dd><dt>Deprecated alias names for this type:</dt><dd>N/A</dd><dt>File extension(s):</dt><dd>N/A</dd><dt>Macintosh file type code(s):</dt><dd>N/A</dd></dl> </dd><dt>Person and email address to contact for further information:</dt><dd>See&nbsp;Authors'&nbsp;Addresses section.</dd><dt>Intended usage:</dt><dd>COMMON</dd><dt>Restrictions on usage:</dt><dd>N/A</dd><dt>Author:</dt><dd>See Authors' Addresses section.</dd><dt>Change controller:</dt><dd>IESG</dd></dl></div><div id="internet.media.type.application.http"><h3 id="rfc.section.8.3.2"><a href="#rfc.section.8.3.2">8.3.2</a>&nbsp;<a href="#internet.media.type.application.http">Internet Media Type application/http</a></h3><p id="rfc.section.8.3.2.p.1">The application/http type can be used to enclose a pipeline of one or more HTTP request or response messages (not intermixed).<a class="self" href="#rfc.section.8.3.2.p.1">&para;</a></p><dl><dt>Type name:</dt><dd>application</dd><dt>Subtype name:</dt><dd>http</dd><dt>Required parameters:</dt><dd>N/A</dd><dt>Optional parameters:</dt><dd>version, msgtype <dl><dt>version:</dt><dd>The HTTP-version number of the enclosed messages (e.g., "1.1"). If not present, the version can be determined from the first line of the body.</dd><dt>msgtype:</dt><dd>The message type &#8212; "request" or "response". If not present, the type can be determined from the first line of the body.</dd></dl> </dd><dt>Encoding considerations:</dt><dd>HTTP messages enclosed by this type are in "binary" format; use of an appropriate Content-Transfer-Encoding is required when transmitted via email.</dd><dt>Security considerations:</dt><dd>see <a href="#security.considerations" title="Security Considerations">Section&nbsp;9</a> </dd><dt>Interoperability considerations:</dt><dd>N/A</dd><dt>Published specification:</dt><dd>This specification (see <a href="#internet.media.type.application.http" title="Internet Media Type application/http">Section&nbsp;8.3.2</a>).</dd><dt>Applications that use this media type:</dt><dd>N/A</dd><dt>Fragment identifier considerations:</dt><dd>N/A</dd><dt>Additional information:</dt><dd><dl><dt>Deprecated alias names for this type:</dt><dd>N/A</dd><dt>Magic number(s):</dt><dd>N/A</dd><dt>File extension(s):</dt><dd>N/A</dd><dt>Macintosh file type code(s):</dt><dd>N/A</dd></dl> </dd><dt>Person and email address to contact for further information:</dt><dd>See&nbsp;Authors'&nbsp;Addresses section.</dd><dt>Intended usage:</dt><dd>COMMON</dd><dt>Restrictions on usage:</dt><dd>N/A</dd><dt>Author:</dt><dd>See Authors' Addresses section.</dd><dt>Change controller:</dt><dd>IESG</dd></dl></div></div><div id="transfer.coding.registry"><h2 id="rfc.section.8.4"><a href="#rfc.section.8.4">8.4</a>&nbsp;<a href="#transfer.coding.registry">Transfer Coding Registry</a></h2><p id="rfc.section.8.4.p.1">The "HTTP Transfer Coding Registry" defines the namespace for transfer coding names. It is maintained at &lt;<a href="http://www.iana.org/assignments/http-parameters">http://www.iana.org/assignments/http-parameters</a>&gt;.<a class="self" href="#rfc.section.8.4.p.1">&para;</a></p><div id="transfer.coding.registry.procedure"><h3 id="rfc.section.8.4.1"><a href="#rfc.section.8.4.1">8.4.1</a>&nbsp;<a href="#transfer.coding.registry.procedure">Procedure</a></h3><p id="rfc.section.8.4.1.p.1">Registrations <em class="bcp14">MUST</em> include the following fields: <a class="self" href="#rfc.section.8.4.1.p.1">&para;</a></p><ul><li>Name</li><li>Description</li><li>Pointer to specification text</li></ul><p id="rfc.section.8.4.1.p.2">Names of transfer codings <em class="bcp14">MUST NOT</em> overlap with names of content codings (<a href="rfc7231.html#content.codings" title="Content Codings">Section 3.1.2.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.33"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) unless the encoding transformation is identical, as is the case for the compression codings defined in <a href="#compression.codings" title="Compression Codings">Section&nbsp;4.2</a>.<a class="self" href="#rfc.section.8.4.1.p.2">&para;</a></p><p id="rfc.section.8.4.1.p.3">Values to be added to this namespace require IETF Review (see <a href="https://tools.ietf.org/html/rfc5226#section-4.1">Section 4.1</a> of <a href="#RFC5226" id="rfc.xref.RFC5226.1"><cite title="Guidelines for Writing an IANA Considerations Section in RFCs">[RFC5226]</cite></a>), and <em class="bcp14">MUST</em> conform to the purpose of transfer coding defined in this specification.<a class="self" href="#rfc.section.8.4.1.p.3">&para;</a></p><p id="rfc.section.8.4.1.p.4">Use of program names for the identification of encoding formats is not desirable and is discouraged for future encodings.<a class="self" href="#rfc.section.8.4.1.p.4">&para;</a></p></div><div id="transfer.coding.registration"><h3 id="rfc.section.8.4.2"><a href="#rfc.section.8.4.2">8.4.2</a>&nbsp;<a href="#transfer.coding.registration">Registration</a></h3><p id="rfc.section.8.4.2.p.1">The "HTTP Transfer Coding Registry" has been updated with the registrations below:<a class="self" href="#rfc.section.8.4.2.p.1">&para;</a></p><div id="rfc.table.2"><div id="iana.transfer.coding.registration.table"></div><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Name</th><th>Description</th><th>Reference</th></tr></thead><tbody><tr><td class="left">chunked</td><td class="left">Transfer in a series of chunks</td><td class="left"><a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a> </td></tr><tr><td class="left">compress</td><td class="left">UNIX "compress" data format <a href="#Welch" id="rfc.xref.Welch.2"><cite title="A Technique for High-Performance Data Compression">[Welch]</cite></a></td><td class="left"><a href="#compress.coding" title="Compress Coding">Section&nbsp;4.2.1</a> </td></tr><tr><td class="left">deflate</td><td class="left">"deflate" compressed data (<a href="#RFC1951" id="rfc.xref.RFC1951.2"><cite title="DEFLATE Compressed Data Format Specification version 1.3">[RFC1951]</cite></a>) inside the "zlib" data format (<a href="#RFC1950" id="rfc.xref.RFC1950.2"><cite title="ZLIB Compressed Data Format Specification version 3.3">[RFC1950]</cite></a>)</td><td class="left"><a href="#deflate.coding" title="Deflate Coding">Section&nbsp;4.2.2</a> </td></tr><tr><td class="left">gzip</td><td class="left">GZIP file format <a href="#RFC1952" id="rfc.xref.RFC1952.2"><cite title="GZIP file format specification version 4.3">[RFC1952]</cite></a></td><td class="left"><a href="#gzip.coding" title="Gzip Coding">Section&nbsp;4.2.3</a> </td></tr><tr><td class="left">x-compress</td><td class="left">Deprecated (alias for compress)</td><td class="left"><a href="#compress.coding" title="Compress Coding">Section&nbsp;4.2.1</a> </td></tr><tr><td class="left">x-gzip</td><td class="left">Deprecated (alias for gzip)</td><td class="left"><a href="#gzip.coding" title="Gzip Coding">Section&nbsp;4.2.3</a> </td></tr></tbody></table></div></div></div><div id="content.coding.registration"><h2 id="rfc.section.8.5"><a href="#rfc.section.8.5">8.5</a>&nbsp;<a href="#content.coding.registration">Content Coding Registration</a></h2><p id="rfc.section.8.5.p.1">IANA maintains the "HTTP Content Coding Registry" at &lt;<a href="http://www.iana.org/assignments/http-parameters">http://www.iana.org/assignments/http-parameters</a>&gt;.<a class="self" href="#rfc.section.8.5.p.1">&para;</a></p><p id="rfc.section.8.5.p.2">The "HTTP Content Coding Registry" has been updated with the registrations below:<a class="self" href="#rfc.section.8.5.p.2">&para;</a></p><div id="rfc.table.3"><div id="iana.content.coding.registration.table"></div><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Name</th><th>Description</th><th>Reference</th></tr></thead><tbody><tr><td class="left">compress</td><td class="left">UNIX "compress" data format <a href="#Welch" id="rfc.xref.Welch.3"><cite title="A Technique for High-Performance Data Compression">[Welch]</cite></a></td><td class="left"><a href="#compress.coding" title="Compress Coding">Section&nbsp;4.2.1</a> </td></tr><tr><td class="left">deflate</td><td class="left">"deflate" compressed data (<a href="#RFC1951" id="rfc.xref.RFC1951.3"><cite title="DEFLATE Compressed Data Format Specification version 1.3">[RFC1951]</cite></a>) inside the "zlib" data format (<a href="#RFC1950" id="rfc.xref.RFC1950.3"><cite title="ZLIB Compressed Data Format Specification version 3.3">[RFC1950]</cite></a>)</td><td class="left"><a href="#deflate.coding" title="Deflate Coding">Section&nbsp;4.2.2</a> </td></tr><tr><td class="left">gzip</td><td class="left">GZIP file format <a href="#RFC1952" id="rfc.xref.RFC1952.3"><cite title="GZIP file format specification version 4.3">[RFC1952]</cite></a></td><td class="left"><a href="#gzip.coding" title="Gzip Coding">Section&nbsp;4.2.3</a> </td></tr><tr><td class="left">x-compress</td><td class="left">Deprecated (alias for compress)</td><td class="left"><a href="#compress.coding" title="Compress Coding">Section&nbsp;4.2.1</a> </td></tr><tr><td class="left">x-gzip</td><td class="left">Deprecated (alias for gzip)</td><td class="left"><a href="#gzip.coding" title="Gzip Coding">Section&nbsp;4.2.3</a> </td></tr></tbody></table></div></div><div id="upgrade.token.registry"><h2 id="rfc.section.8.6"><a href="#rfc.section.8.6">8.6</a>&nbsp;<a href="#upgrade.token.registry">Upgrade Token Registry</a></h2><p id="rfc.section.8.6.p.1">The "Hypertext Transfer Protocol (HTTP) Upgrade Token Registry" defines the namespace for protocol-name tokens used to identify protocols in the <a href="#header.upgrade" class="smpl">Upgrade</a> header field. The registry is maintained at &lt;<a href="http://www.iana.org/assignments/http-upgrade-tokens">http://www.iana.org/assignments/http-upgrade-tokens</a>&gt;.<a class="self" href="#rfc.section.8.6.p.1">&para;</a></p><div id="upgrade.token.registry.procedure"><h3 id="rfc.section.8.6.1"><a href="#rfc.section.8.6.1">8.6.1</a>&nbsp;<a href="#upgrade.token.registry.procedure">Procedure</a></h3><p id="rfc.section.8.6.1.p.1">Each registered protocol name is associated with contact information and an optional set of specifications that details how the connection will be processed after it has been upgraded.<a class="self" href="#rfc.section.8.6.1.p.1">&para;</a></p><p id="rfc.section.8.6.1.p.2">Registrations happen on a "First Come First Served" basis (see <a href="https://tools.ietf.org/html/rfc5226#section-4.1">Section 4.1</a> of <a href="#RFC5226" id="rfc.xref.RFC5226.2"><cite title="Guidelines for Writing an IANA Considerations Section in RFCs">[RFC5226]</cite></a>) and are subject to the following rules: <a class="self" href="#rfc.section.8.6.1.p.2">&para;</a></p><ol><li>A protocol-name token, once registered, stays registered forever.</li><li>The registration <em class="bcp14">MUST</em> name a responsible party for the registration.</li><li>The registration <em class="bcp14">MUST</em> name a point of contact.</li><li>The registration <em class="bcp14">MAY</em> name a set of specifications associated with that token. Such specifications need not be publicly available.</li><li>The registration <em class="bcp14">SHOULD</em> name a set of expected "protocol-version" tokens associated with that token at the time of registration.</li><li>The responsible party <em class="bcp14">MAY</em> change the registration at any time. The IANA will keep a record of all such changes, and make them available upon request.</li><li>The IESG <em class="bcp14">MAY</em> reassign responsibility for a protocol token. This will normally only be used in the case when a responsible party cannot be contacted.</li></ol><p id="rfc.section.8.6.1.p.3">This registration procedure for HTTP Upgrade Tokens replaces that previously defined in <a href="https://tools.ietf.org/html/rfc2817#section-7.2">Section 7.2</a> of <a href="#RFC2817" id="rfc.xref.RFC2817.2"><cite title="Upgrading to TLS Within HTTP/1.1">[RFC2817]</cite></a>.<a class="self" href="#rfc.section.8.6.1.p.3">&para;</a></p></div><div id="upgrade.token.registration"><h3 id="rfc.section.8.6.2"><a href="#rfc.section.8.6.2">8.6.2</a>&nbsp;<a href="#upgrade.token.registration">Upgrade Token Registration</a></h3><p id="rfc.section.8.6.2.p.1">The "HTTP" entry in the upgrade token registry has been updated with the registration below:<a class="self" href="#rfc.section.8.6.2.p.1">&para;</a></p><div id="rfc.table.u.3"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Value</th><th>Description</th><th>Expected Version Tokens</th><th>Reference</th></tr></thead><tbody><tr><td class="left">HTTP</td><td class="left">Hypertext Transfer Protocol</td><td class="left">any DIGIT.DIGIT (e.g, "2.0")</td><td class="left"><a href="#http.version" title="Protocol Versioning">Section&nbsp;2.6</a></td></tr></tbody></table></div><p id="rfc.section.8.6.2.p.2">The responsible party is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".<a class="self" href="#rfc.section.8.6.2.p.2">&para;</a></p></div></div></div><div id="security.considerations"><h1 id="rfc.section.9"><a href="#rfc.section.9">9.</a>&nbsp;<a href="#security.considerations">Security Considerations</a></h1><p id="rfc.section.9.p.1">This section is meant to inform developers, information providers, and users of known security considerations relevant to HTTP message syntax, parsing, and routing. Security considerations about HTTP semantics and payloads are addressed in <a href="#RFC7231" id="rfc.xref.RFC7231.34"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>.<a class="self" href="#rfc.section.9.p.1">&para;</a></p><div id="establishing.authority"><h2 id="rfc.section.9.1"><a href="#rfc.section.9.1">9.1</a>&nbsp;<a href="#establishing.authority">Establishing Authority</a></h2><p id="rfc.section.9.1.p.1">HTTP relies on the notion of an <dfn>authoritative response</dfn>: a response that has been determined by (or at the direction of) the authority identified within the target URI to be the most appropriate response for that request given the state of the target resource at the time of response message origination. Providing a response from a non-authoritative source, such as a shared cache, is often useful to improve performance and availability, but only to the extent that the source can be trusted or the distrusted response can be safely used.<a class="self" href="#rfc.section.9.1.p.1">&para;</a></p><p id="rfc.section.9.1.p.2">Unfortunately, establishing authority can be difficult. For example, <dfn>phishing</dfn> is an attack on the user's perception of authority, where that perception can be misled by presenting similar branding in hypertext, possibly aided by userinfo obfuscating the authority component (see <a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>). User agents can reduce the impact of phishing attacks by enabling users to easily inspect a target URI prior to making an action, by prominently distinguishing (or rejecting) userinfo when present, and by not sending stored credentials and cookies when the referring document is from an unknown or untrusted source.<a class="self" href="#rfc.section.9.1.p.2">&para;</a></p><p id="rfc.section.9.1.p.3">When a registered name is used in the authority component, the "http" URI scheme (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>) relies on the user's local name resolution service to determine where it can find authoritative responses. This means that any attack on a user's network host table, cached names, or name resolution libraries becomes an avenue for attack on establishing authority. Likewise, the user's choice of server for Domain Name Service (DNS), and the hierarchy of servers from which it obtains resolution results, could impact the authenticity of address mappings; DNS Security Extensions (DNSSEC, <a href="#RFC4033" id="rfc.xref.RFC4033.1"><cite title="DNS Security Introduction and Requirements">[RFC4033]</cite></a>) are one way to improve authenticity.<a class="self" href="#rfc.section.9.1.p.3">&para;</a></p><p id="rfc.section.9.1.p.4">Furthermore, after an IP address is obtained, establishing authority for an "http" URI is vulnerable to attacks on Internet Protocol routing.<a class="self" href="#rfc.section.9.1.p.4">&para;</a></p><p id="rfc.section.9.1.p.5">The "https" scheme (<a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a>) is intended to prevent (or at least reveal) many of these potential attacks on establishing authority, provided that the negotiated TLS connection is secured and the client properly verifies that the communicating server's identity matches the target URI's authority component (see <a href="#RFC2818" id="rfc.xref.RFC2818.3"><cite title="HTTP Over TLS">[RFC2818]</cite></a>). Correctly implementing such verification can be difficult (see <a href="#Georgiev" id="rfc.xref.Georgiev.1"><cite title="The Most Dangerous Code in the World: Validating SSL Certificates in Non-browser Software">[Georgiev]</cite></a>).<a class="self" href="#rfc.section.9.1.p.5">&para;</a></p></div><div id="risks.intermediaries"><h2 id="rfc.section.9.2"><a href="#rfc.section.9.2">9.2</a>&nbsp;<a href="#risks.intermediaries">Risks of Intermediaries</a></h2><p id="rfc.section.9.2.p.1">By their very nature, HTTP intermediaries are men-in-the-middle and, thus, represent an opportunity for man-in-the-middle attacks. Compromise of the systems on which the intermediaries run can result in serious security and privacy problems. Intermediaries might have access to security-related information, personal information about individual users and organizations, and proprietary information belonging to users and content providers. A compromised intermediary, or an intermediary implemented or configured without regard to security and privacy considerations, might be used in the commission of a wide range of potential attacks.<a class="self" href="#rfc.section.9.2.p.1">&para;</a></p><p id="rfc.section.9.2.p.2">Intermediaries that contain a shared cache are especially vulnerable to cache poisoning attacks, as described in <a href="rfc7234.html#security.considerations" title="Security Considerations">Section 8</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.8"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>.<a class="self" href="#rfc.section.9.2.p.2">&para;</a></p><p id="rfc.section.9.2.p.3">Implementers need to consider the privacy and security implications of their design and coding decisions, and of the configuration options they provide to operators (especially the default configuration).<a class="self" href="#rfc.section.9.2.p.3">&para;</a></p><p id="rfc.section.9.2.p.4">Users need to be aware that intermediaries are no more trustworthy than the people who run them; HTTP itself cannot solve this problem.<a class="self" href="#rfc.section.9.2.p.4">&para;</a></p></div><div id="attack.protocol.element.length"><h2 id="rfc.section.9.3"><a href="#rfc.section.9.3">9.3</a>&nbsp;<a href="#attack.protocol.element.length">Attacks via Protocol Element Length</a></h2><p id="rfc.section.9.3.p.1">Because HTTP uses mostly textual, character-delimited fields, parsers are often vulnerable to attacks based on sending very long (or very slow) streams of data, particularly where an implementation is expecting a protocol element with no predefined length.<a class="self" href="#rfc.section.9.3.p.1">&para;</a></p><p id="rfc.section.9.3.p.2">To promote interoperability, specific recommendations are made for minimum size limits on request-line (<a href="#request.line" title="Request Line">Section&nbsp;3.1.1</a>) and header fields (<a href="#header.fields" title="Header Fields">Section&nbsp;3.2</a>). These are minimum recommendations, chosen to be supportable even by implementations with limited resources; it is expected that most implementations will choose substantially higher limits.<a class="self" href="#rfc.section.9.3.p.2">&para;</a></p><p id="rfc.section.9.3.p.3">A server can reject a message that has a request-target that is too long (<a href="rfc7231.html#status.414" title="414 URI Too Long">Section 6.5.12</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.35"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) or a request payload that is too large (<a href="rfc7231.html#status.413" title="413 Payload Too Large">Section 6.5.11</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.36"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). Additional status codes related to capacity limits have been defined by extensions to HTTP <a href="#RFC6585" id="rfc.xref.RFC6585.1"><cite title="Additional HTTP Status Codes">[RFC6585]</cite></a>.<a class="self" href="#rfc.section.9.3.p.3">&para;</a></p><p id="rfc.section.9.3.p.4">Recipients ought to carefully limit the extent to which they process other protocol elements, including (but not limited to) request methods, response status phrases, header field-names, numeric values, and body chunks. Failure to limit such processing can result in buffer overflows, arithmetic overflows, or increased vulnerability to denial-of-service attacks.<a class="self" href="#rfc.section.9.3.p.4">&para;</a></p></div><div id="response.splitting"><h2 id="rfc.section.9.4"><a href="#rfc.section.9.4">9.4</a>&nbsp;<a href="#response.splitting">Response Splitting</a></h2><p id="rfc.section.9.4.p.1">Response splitting (a.k.a, CRLF injection) is a common technique, used in various attacks on Web usage, that exploits the line-based nature of HTTP message framing and the ordered association of requests to responses on persistent connections <a href="#Klein" id="rfc.xref.Klein.1"><cite title="Divide and Conquer - HTTP Response Splitting, Web Cache Poisoning Attacks, and Related Topics">[Klein]</cite></a>. This technique can be particularly damaging when the requests pass through a shared cache.<a class="self" href="#rfc.section.9.4.p.1">&para;</a></p><p id="rfc.section.9.4.p.2">Response splitting exploits a vulnerability in servers (usually within an application server) where an attacker can send encoded data within some parameter of the request that is later decoded and echoed within any of the response header fields of the response. If the decoded data is crafted to look like the response has ended and a subsequent response has begun, the response has been split and the content within the apparent second response is controlled by the attacker. The attacker can then make any other request on the same persistent connection and trick the recipients (including intermediaries) into believing that the second half of the split is an authoritative answer to the second request.<a class="self" href="#rfc.section.9.4.p.2">&para;</a></p><p id="rfc.section.9.4.p.3">For example, a parameter within the request-target might be read by an application server and reused within a redirect, resulting in the same parameter being echoed in the <a href="rfc7231.html#header.location" class="smpl">Location</a> header field of the response. If the parameter is decoded by the application and not properly encoded when placed in the response field, the attacker can send encoded CRLF octets and other content that will make the application's single response look like two or more responses.<a class="self" href="#rfc.section.9.4.p.3">&para;</a></p><p id="rfc.section.9.4.p.4">A common defense against response splitting is to filter requests for data that looks like encoded CR and LF (e.g., "%0D" and "%0A"). However, that assumes the application server is only performing URI decoding, rather than more obscure data transformations like charset transcoding, XML entity translation, base64 decoding, sprintf reformatting, etc. A more effective mitigation is to prevent anything other than the server's core protocol libraries from sending a CR or LF within the header section, which means restricting the output of header fields to APIs that filter for bad octets and not allowing application servers to write directly to the protocol stream.<a class="self" href="#rfc.section.9.4.p.4">&para;</a></p></div><div id="request.smuggling"><h2 id="rfc.section.9.5"><a href="#rfc.section.9.5">9.5</a>&nbsp;<a href="#request.smuggling">Request Smuggling</a></h2><p id="rfc.section.9.5.p.1">Request smuggling (<a href="#Linhart" id="rfc.xref.Linhart.1"><cite title="HTTP Request Smuggling">[Linhart]</cite></a>) is a technique that exploits differences in protocol parsing among various recipients to hide additional requests (which might otherwise be blocked or disabled by policy) within an apparently harmless request. Like response splitting, request smuggling can lead to a variety of attacks on HTTP usage.<a class="self" href="#rfc.section.9.5.p.1">&para;</a></p><p id="rfc.section.9.5.p.2">This specification has introduced new requirements on request parsing, particularly with regard to message framing in <a href="#message.body.length" title="Message Body Length">Section&nbsp;3.3.3</a>, to reduce the effectiveness of request smuggling.<a class="self" href="#rfc.section.9.5.p.2">&para;</a></p></div><div id="message.integrity"><h2 id="rfc.section.9.6"><a href="#rfc.section.9.6">9.6</a>&nbsp;<a href="#message.integrity">Message Integrity</a></h2><p id="rfc.section.9.6.p.1">HTTP does not define a specific mechanism for ensuring message integrity, instead relying on the error-detection ability of underlying transport protocols and the use of length or chunk-delimited framing to detect completeness. Additional integrity mechanisms, such as hash functions or digital signatures applied to the content, can be selectively added to messages via extensible metadata header fields. Historically, the lack of a single integrity mechanism has been justified by the informal nature of most HTTP communication. However, the prevalence of HTTP as an information access mechanism has resulted in its increasing use within environments where verification of message integrity is crucial.<a class="self" href="#rfc.section.9.6.p.1">&para;</a></p><p id="rfc.section.9.6.p.2">User agents are encouraged to implement configurable means for detecting and reporting failures of message integrity such that those means can be enabled within environments for which integrity is necessary. For example, a browser being used to view medical history or drug interaction information needs to indicate to the user when such information is detected by the protocol to be incomplete, expired, or corrupted during transfer. Such mechanisms might be selectively enabled via user agent extensions or the presence of message integrity metadata in a response. At a minimum, user agents ought to provide some indication that allows a user to distinguish between a complete and incomplete response message (<a href="#incomplete.messages" title="Handling Incomplete Messages">Section&nbsp;3.4</a>) when such verification is desired.<a class="self" href="#rfc.section.9.6.p.2">&para;</a></p></div><div id="message.confidentiality"><h2 id="rfc.section.9.7"><a href="#rfc.section.9.7">9.7</a>&nbsp;<a href="#message.confidentiality">Message Confidentiality</a></h2><p id="rfc.section.9.7.p.1">HTTP relies on underlying transport protocols to provide message confidentiality when that is desired. HTTP has been specifically designed to be independent of the transport protocol, such that it can be used over many different forms of encrypted connection, with the selection of such transports being identified by the choice of URI scheme or within user agent configuration.<a class="self" href="#rfc.section.9.7.p.1">&para;</a></p><p id="rfc.section.9.7.p.2">The "https" scheme can be used to identify resources that require a confidential connection, as described in <a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a>.<a class="self" href="#rfc.section.9.7.p.2">&para;</a></p></div><div id="privacy.of.server.log.information"><h2 id="rfc.section.9.8"><a href="#rfc.section.9.8">9.8</a>&nbsp;<a href="#privacy.of.server.log.information">Privacy of Server Log Information</a></h2><p id="rfc.section.9.8.p.1">A server is in the position to save personal data about a user's requests over time, which might identify their reading patterns or subjects of interest. In particular, log information gathered at an intermediary often contains a history of user agent interaction, across a multitude of sites, that can be traced to individual users.<a class="self" href="#rfc.section.9.8.p.1">&para;</a></p><p id="rfc.section.9.8.p.2">HTTP log information is confidential in nature; its handling is often constrained by laws and regulations. Log information needs to be securely stored and appropriate guidelines followed for its analysis. Anonymization of personal information within individual entries helps, but it is generally not sufficient to prevent real log traces from being re-identified based on correlation with other access characteristics. As such, access traces that are keyed to a specific client are unsafe to publish even if the key is pseudonymous.<a class="self" href="#rfc.section.9.8.p.2">&para;</a></p><p id="rfc.section.9.8.p.3">To minimize the risk of theft or accidental publication, log information ought to be purged of personally identifiable information, including user identifiers, IP addresses, and user-provided query parameters, as soon as that information is no longer necessary to support operational needs for security, auditing, or fraud control.<a class="self" href="#rfc.section.9.8.p.3">&para;</a></p></div></div><div id="acks"><h1 id="rfc.section.10"><a href="#rfc.section.10">10.</a>&nbsp;<a href="#acks">Acknowledgments</a></h1><p id="rfc.section.10.p.1">This edition of HTTP/1.1 builds on the many contributions that went into <a href="#RFC1945" id="rfc.xref.RFC1945.2">RFC 1945</a>, <a href="#RFC2068" id="rfc.xref.RFC2068.3">RFC 2068</a>, <a href="#RFC2145" id="rfc.xref.RFC2145.2">RFC 2145</a>, and <a href="#RFC2616" id="rfc.xref.RFC2616.3">RFC 2616</a>, including substantial contributions made by the previous authors, editors, and Working Group Chairs: Tim Berners-Lee, Ari Luotonen, Roy T. Fielding, Henrik Frystyk Nielsen, Jim Gettys, Jeffrey C. Mogul, Larry Masinter, and Paul J. Leach. Mark Nottingham oversaw this effort as Working Group Chair.<a class="self" href="#rfc.section.10.p.1">&para;</a></p><p id="rfc.section.10.p.2">Since 1999, the following contributors have helped improve the HTTP specification by reporting bugs, asking smart questions, drafting or reviewing text, and evaluating open issues:<a class="self" href="#rfc.section.10.p.2">&para;</a></p><p id="rfc.section.10.p.3">Adam Barth, Adam Roach, Addison Phillips, Adrian Chadd, Adrian Cole, Adrien W. de Croy, Alan Ford, Alan Ruttenberg, Albert Lunde, Alek Storm, Alex Rousskov, Alexandre Morgaut, Alexey Melnikov, Alisha Smith, Amichai Rothman, Amit Klein, Amos Jeffries, Andreas Maier, Andreas Petersson, Andrei Popov, Anil Sharma, Anne van Kesteren, Anthony Bryan, Asbjorn Ulsberg, Ashok Kumar, Balachander Krishnamurthy, Barry Leiba, Ben Laurie, Benjamin Carlyle, Benjamin Niven-Jenkins, Benoit Claise, Bil Corry, Bill Burke, Bjoern Hoehrmann, Bob Scheifler, Boris Zbarsky, Brett Slatkin, Brian Kell, Brian McBarron, Brian Pane, Brian Raymor, Brian Smith, Bruce Perens, Bryce Nesbitt, Cameron Heavon-Jones, Carl Kugler, Carsten Bormann, Charles Fry, Chris Burdess, Chris Newman, Christian Huitema, Cyrus Daboo, Dale Robert Anderson, Dan Wing, Dan Winship, Daniel Stenberg, Darrel Miller, Dave Cridland, Dave Crocker, Dave Kristol, Dave Thaler, David Booth, David Singer, David W. Morris, Diwakar Shetty, Dmitry Kurochkin, Drummond Reed, Duane Wessels, Edward Lee, Eitan Adler, Eliot Lear, Emile Stephan, Eran Hammer-Lahav, Eric D. Williams, Eric J. Bowman, Eric Lawrence, Eric Rescorla, Erik Aronesty, EungJun Yi, Evan Prodromou, Felix Geisendoerfer, Florian Weimer, Frank Ellermann, Fred Akalin, Fred Bohle, Frederic Kayser, Gabor Molnar, Gabriel Montenegro, Geoffrey Sneddon, Gervase Markham, Gili Tzabari, Grahame Grieve, Greg Slepak, Greg Wilkins, Grzegorz Calkowski, Harald Tveit Alvestrand, Harry Halpin, Helge Hess, Henrik Nordstrom, Henry S. Thompson, Henry Story, Herbert van de Sompel, Herve Ruellan, Howard Melman, Hugo Haas, Ian Fette, Ian Hickson, Ido Safruti, Ilari Liusvaara, Ilya Grigorik, Ingo Struck, J. Ross Nicoll, James Cloos, James H. Manger, James Lacey, James M. Snell, Jamie Lokier, Jan Algermissen, Jari Arkko, Jeff Hodges (who came up with the term 'effective Request-URI'), Jeff Pinner, Jeff Walden, Jim Luther, Jitu Padhye, Joe D. Williams, Joe Gregorio, Joe Orton, Joel Jaeggli, John C. Klensin, John C. Mallery, John Cowan, John Kemp, John Panzer, John Schneider, John Stracke, John Sullivan, Jonas Sicking, Jonathan A. Rees, Jonathan Billington, Jonathan Moore, Jonathan Silvera, Jordi Ros, Joris Dobbelsteen, Josh Cohen, Julien Pierre, Jungshik Shin, Justin Chapweske, Justin Erenkrantz, Justin James, Kalvinder Singh, Karl Dubost, Kathleen Moriarty, Keith Hoffman, Keith Moore, Ken Murchison, Koen Holtman, Konstantin Voronkov, Kris Zyp, Leif Hedstrom, Lionel Morand, Lisa Dusseault, Maciej Stachowiak, Manu Sporny, Marc Schneider, Marc Slemko, Mark Baker, Mark Pauley, Mark Watson, Markus Isomaki, Markus Lanthaler, Martin J. Duerst, Martin Musatov, Martin Nilsson, Martin Thomson, Matt Lynch, Matthew Cox, Matthew Kerwin, Max Clark, Menachem Dodge, Meral Shirazipour, Michael Burrows, Michael Hausenblas, Michael Scharf, Michael Sweet, Michael Tuexen, Michael Welzl, Mike Amundsen, Mike Belshe, Mike Bishop, Mike Kelly, Mike Schinkel, Miles Sabin, Murray S. Kucherawy, Mykyta Yevstifeyev, Nathan Rixham, Nicholas Shanks, Nico Williams, Nicolas Alvarez, Nicolas Mailhot, Noah Slater, Osama Mazahir, Pablo Castro, Pat Hayes, Patrick R. McManus, Paul E. Jones, Paul Hoffman, Paul Marquess, Pete Resnick, Peter Lepeska, Peter Occil, Peter Saint-Andre, Peter Watkins, Phil Archer, Phil Hunt, Philippe Mougin, Phillip Hallam-Baker, Piotr Dobrogost, Poul-Henning Kamp, Preethi Natarajan, Rajeev Bector, Ray Polk, Reto Bachmann-Gmuer, Richard Barnes, Richard Cyganiak, Rob Trace, Robby Simpson, Robert Brewer, Robert Collins, Robert Mattson, Robert O'Callahan, Robert Olofsson, Robert Sayre, Robert Siemer, Robert de Wilde, Roberto Javier Godoy, Roberto Peon, Roland Zink, Ronny Widjaja, Ryan Hamilton, S. Mike Dierken, Salvatore Loreto, Sam Johnston, Sam Pullara, Sam Ruby, Saurabh Kulkarni, Scott Lawrence (who maintained the original issues list), Sean B. Palmer, Sean Turner, Sebastien Barnoud, Shane McCarron, Shigeki Ohtsu, Simon Yarde, Stefan Eissing, Stefan Tilkov, Stefanos Harhalakis, Stephane Bortzmeyer, Stephen Farrell, Stephen Kent, Stephen Ludin, Stuart Williams, Subbu Allamaraju, Subramanian Moonesamy, Susan Hares, Sylvain Hellegouarch, Tapan Divekar, Tatsuhiro Tsujikawa, Tatsuya Hayashi, Ted Hardie, Ted Lemon, Thomas Broyer, Thomas Fossati, Thomas Maslen, Thomas Nadeau, Thomas Nordin, Thomas Roessler, Tim Bray, Tim Morgan, Tim Olsen, Tom Zhou, Travis Snoozy, Tyler Close, Vincent Murphy, Wenbo Zhu, Werner Baumann, Wilbur Streett, Wilfredo Sanchez Vega, William A. Rowe Jr., William Chan, Willy Tarreau, Xiaoshu Wang, Yaron Goland, Yngve Nysaeter Pettersen, Yoav Nir, Yogesh Bang, Yuchung Cheng, Yutaka Oiwa, Yves Lafon (long-time member of the editor team), Zed A. Shaw, and Zhong Yu.<a class="self" href="#rfc.section.10.p.3">&para;</a></p><p id="rfc.section.10.p.4">See <a href="https://tools.ietf.org/html/rfc2616#section-16">Section 16</a> of <a href="#RFC2616" id="rfc.xref.RFC2616.4"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2616]</cite></a> for additional acknowledgements from prior revisions.<a class="self" href="#rfc.section.10.p.4">&para;</a></p></div><h1 id="rfc.references"><a id="rfc.section.11" href="#rfc.section.11">11.</a> References</h1><h2 id="rfc.references.1"><a href="#rfc.section.11.1" id="rfc.section.11.1">11.1</a> Normative References</h2><table><tr><td class="reference"><b id="RFC0793">[RFC0793]</b></td><td class="top">Postel, J., &#8220;<a href="https://tools.ietf.org/html/rfc793">Transmission Control Protocol</a>&#8221;, STD&nbsp;7, RFC&nbsp;793, September&nbsp;1981.</td></tr><tr><td class="reference"><b id="RFC1950">[RFC1950]</b></td><td class="top">Deutsch, L. and J-L. Gailly, &#8220;<a href="https://tools.ietf.org/html/rfc1950">ZLIB Compressed Data Format Specification version 3.3</a>&#8221;, RFC&nbsp;1950, May&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC1951">[RFC1951]</b></td><td class="top">Deutsch, P., &#8220;<a href="https://tools.ietf.org/html/rfc1951">DEFLATE Compressed Data Format Specification version 1.3</a>&#8221;, RFC&nbsp;1951, May&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC1952">[RFC1952]</b></td><td class="top">Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and G. Randers-Pehrson, &#8220;<a href="https://tools.ietf.org/html/rfc1952">GZIP file format specification version 4.3</a>&#8221;, RFC&nbsp;1952, May&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC2119">[RFC2119]</b></td><td class="top">Bradner, S., &#8220;<a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>&#8221;, BCP&nbsp;14, RFC&nbsp;2119, March&nbsp;1997.</td></tr><tr><td class="reference"><b id="RFC3986">[RFC3986]</b></td><td class="top">Berners-Lee, T., Fielding, R., and L. Masinter, &#8220;<a href="https://tools.ietf.org/html/rfc3986">Uniform Resource Identifier (URI): Generic Syntax</a>&#8221;, STD&nbsp;66, RFC&nbsp;3986, January&nbsp;2005.</td></tr><tr><td class="reference"><b id="RFC5234">[RFC5234]</b></td><td class="top">Crocker, D., Ed. and P. Overell, &#8220;<a href="https://tools.ietf.org/html/rfc5234">Augmented BNF for Syntax Specifications: ABNF</a>&#8221;, STD&nbsp;68, RFC&nbsp;5234, January&nbsp;2008.</td></tr><tr><td class="reference"><b id="RFC7231">[RFC7231]</b></td><td class="top">Fielding, R., Ed. and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7231">Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</a>&#8221;, RFC&nbsp;7231, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="RFC7232">[RFC7232]</b></td><td class="top">Fielding, R., Ed. and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7232">Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</a>&#8221;, RFC&nbsp;7232, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="RFC7233">[RFC7233]</b></td><td class="top">Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7233">Hypertext Transfer Protocol (HTTP/1.1): Range Requests</a>&#8221;, RFC&nbsp;7233, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="RFC7234">[RFC7234]</b></td><td class="top">Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7234">Hypertext Transfer Protocol (HTTP/1.1): Caching</a>&#8221;, RFC&nbsp;7234, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="RFC7235">[RFC7235]</b></td><td class="top">Fielding, R., Ed. and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7235">Hypertext Transfer Protocol (HTTP/1.1): Authentication</a>&#8221;, RFC&nbsp;7235, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="USASCII">[USASCII]</b></td><td class="top">American National Standards Institute, &#8220;Coded Character Set -- 7-bit American Standard Code for Information Interchange&#8221;, ANSI&nbsp;X3.4, 1986.</td></tr><tr><td class="reference"><b id="Welch">[Welch]</b></td><td class="top">Welch, T., &#8220;A Technique for High-Performance Data Compression&#8221;, IEEE Computer&nbsp;17(6), June&nbsp;1984.</td></tr></table><h2 id="rfc.references.2"><a href="#rfc.section.11.2" id="rfc.section.11.2">11.2</a> Informative References</h2><table><tr><td class="reference"><b id="BCP115">[BCP115]</b></td><td class="top">Hansen, T., Hardie, T., and L. Masinter, &#8220;<a href="https://tools.ietf.org/html/rfc4395">Guidelines and Registration Procedures for New URI Schemes</a>&#8221;, BCP&nbsp;115, RFC&nbsp;4395, February&nbsp;2006.</td></tr><tr><td class="reference"><b id="BCP13">[BCP13]</b></td><td class="top">Freed, N., Klensin, J., and T. Hansen, &#8220;<a href="https://tools.ietf.org/html/rfc6838">Media Type Specifications and Registration Procedures</a>&#8221;, BCP&nbsp;13, RFC&nbsp;6838, January&nbsp;2013.</td></tr><tr><td class="reference"><b id="BCP90">[BCP90]</b></td><td class="top">Klyne, G., Nottingham, M., and J. Mogul, &#8220;<a href="https://tools.ietf.org/html/rfc3864">Registration Procedures for Message Header Fields</a>&#8221;, BCP&nbsp;90, RFC&nbsp;3864, September&nbsp;2004.</td></tr><tr><td class="reference"><b id="Georgiev">[Georgiev]</b></td><td class="top">Georgiev, M., Iyengar, S., Jana, S., Anubhai, R., Boneh, D., and V. Shmatikov, &#8220;<a href="http://doi.acm.org/10.1145/2382196.2382204">The Most Dangerous Code in the World: Validating SSL Certificates in Non-browser Software</a>&#8221;, In Proceedings of the 2012 ACM Conference on Computer and Communications Security (CCS '12), pp. 38-49, October&nbsp;2012, &lt;<a href="http://doi.acm.org/10.1145/2382196.2382204">http://doi.acm.org/10.1145/2382196.2382204</a>&gt;.</td></tr><tr><td class="reference"><b id="ISO-8859-1">[ISO-8859-1]</b></td><td class="top">International Organization for Standardization, &#8220;Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1&#8221;, ISO/IEC&nbsp;8859-1:1998, 1998.</td></tr><tr><td class="reference"><b id="Klein">[Klein]</b></td><td class="top">Klein, A., &#8220;<a href="http://packetstormsecurity.com/papers/general/whitepaper_httpresponse.pdf">Divide and Conquer - HTTP Response Splitting, Web Cache Poisoning Attacks, and Related Topics</a>&#8221;, March&nbsp;2004, &lt;<a href="http://packetstormsecurity.com/papers/general/whitepaper_httpresponse.pdf">http://packetstormsecurity.com/papers/general/whitepaper_httpresponse.pdf</a>&gt;.</td></tr><tr><td class="reference"><b id="Kri2001">[Kri2001]</b></td><td class="top">Kristol, D., &#8220;<a href="http://arxiv.org/abs/cs.SE/0105018">HTTP Cookies: Standards, Privacy, and Politics</a>&#8221;, ACM Transactions on Internet Technology&nbsp;1(2), November&nbsp;2001, &lt;<a href="http://arxiv.org/abs/cs.SE/0105018">http://arxiv.org/abs/cs.SE/0105018</a>&gt;.</td></tr><tr><td class="reference"><b id="Linhart">[Linhart]</b></td><td class="top">Linhart, C., Klein, A., Heled, R., and S. Orrin, &#8220;<a href="http://www.watchfire.com/news/whitepapers.aspx">HTTP Request Smuggling</a>&#8221;, June&nbsp;2005, &lt;<a href="http://www.watchfire.com/news/whitepapers.aspx">http://www.watchfire.com/news/whitepapers.aspx</a>&gt;.</td></tr><tr><td class="reference"><b id="RFC1919">[RFC1919]</b></td><td class="top">Chatel, M., &#8220;<a href="https://tools.ietf.org/html/rfc1919">Classical versus Transparent IP Proxies</a>&#8221;, RFC&nbsp;1919, March&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC1945">[RFC1945]</b></td><td class="top">Berners-Lee, T., Fielding, R., and H. Nielsen, &#8220;<a href="https://tools.ietf.org/html/rfc1945">Hypertext Transfer Protocol -- HTTP/1.0</a>&#8221;, RFC&nbsp;1945, May&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC2045">[RFC2045]</b></td><td class="top">Freed, N. and N. Borenstein, &#8220;<a href="https://tools.ietf.org/html/rfc2045">Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies</a>&#8221;, RFC&nbsp;2045, November&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC2047">[RFC2047]</b></td><td class="top">Moore, K., &#8220;<a href="https://tools.ietf.org/html/rfc2047">MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text</a>&#8221;, RFC&nbsp;2047, November&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC2068">[RFC2068]</b></td><td class="top">Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. Berners-Lee, &#8220;<a href="https://tools.ietf.org/html/rfc2068">Hypertext Transfer Protocol -- HTTP/1.1</a>&#8221;, RFC&nbsp;2068, January&nbsp;1997.</td></tr><tr><td class="reference"><b id="RFC2145">[RFC2145]</b></td><td class="top">Mogul, J., Fielding, R., Gettys, J., and H. Nielsen, &#8220;<a href="https://tools.ietf.org/html/rfc2145">Use and Interpretation of HTTP Version Numbers</a>&#8221;, RFC&nbsp;2145, May&nbsp;1997.</td></tr><tr><td class="reference"><b id="RFC2616">[RFC2616]</b></td><td class="top">Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &#8220;<a href="https://tools.ietf.org/html/rfc2616">Hypertext Transfer Protocol -- HTTP/1.1</a>&#8221;, RFC&nbsp;2616, June&nbsp;1999.</td></tr><tr><td class="reference"><b id="RFC2817">[RFC2817]</b></td><td class="top">Khare, R. and S. Lawrence, &#8220;<a href="https://tools.ietf.org/html/rfc2817">Upgrading to TLS Within HTTP/1.1</a>&#8221;, RFC&nbsp;2817, May&nbsp;2000.</td></tr><tr><td class="reference"><b id="RFC2818">[RFC2818]</b></td><td class="top">Rescorla, E., &#8220;<a href="https://tools.ietf.org/html/rfc2818">HTTP Over TLS</a>&#8221;, RFC&nbsp;2818, May&nbsp;2000.</td></tr><tr><td class="reference"><b id="RFC3040">[RFC3040]</b></td><td class="top">Cooper, I., Melve, I., and G. Tomlinson, &#8220;<a href="https://tools.ietf.org/html/rfc3040">Internet Web Replication and Caching Taxonomy</a>&#8221;, RFC&nbsp;3040, January&nbsp;2001.</td></tr><tr><td class="reference"><b id="RFC4033">[RFC4033]</b></td><td class="top">Arends, R., Austein, R., Larson, M., Massey, D., and S. Rose, &#8220;<a href="https://tools.ietf.org/html/rfc4033">DNS Security Introduction and Requirements</a>&#8221;, RFC&nbsp;4033, March&nbsp;2005.</td></tr><tr><td class="reference"><b id="RFC4559">[RFC4559]</b></td><td class="top">Jaganathan, K., Zhu, L., and J. Brezak, &#8220;<a href="https://tools.ietf.org/html/rfc4559">SPNEGO-based Kerberos and NTLM HTTP Authentication in Microsoft Windows</a>&#8221;, RFC&nbsp;4559, June&nbsp;2006.</td></tr><tr><td class="reference"><b id="RFC5226">[RFC5226]</b></td><td class="top">Narten, T. and H. Alvestrand, &#8220;<a href="https://tools.ietf.org/html/rfc5226">Guidelines for Writing an IANA Considerations Section in RFCs</a>&#8221;, BCP&nbsp;26, RFC&nbsp;5226, May&nbsp;2008.</td></tr><tr><td class="reference"><b id="RFC5246">[RFC5246]</b></td><td class="top">Dierks, T. and E. Rescorla, &#8220;<a href="https://tools.ietf.org/html/rfc5246">The Transport Layer Security (TLS) Protocol Version 1.2</a>&#8221;, RFC&nbsp;5246, August&nbsp;2008.</td></tr><tr><td class="reference"><b id="RFC5322">[RFC5322]</b></td><td class="top">Resnick, P., &#8220;<a href="https://tools.ietf.org/html/rfc5322">Internet Message Format</a>&#8221;, RFC&nbsp;5322, October&nbsp;2008.</td></tr><tr><td class="reference"><b id="RFC6265">[RFC6265]</b></td><td class="top">Barth, A., &#8220;<a href="https://tools.ietf.org/html/rfc6265">HTTP State Management Mechanism</a>&#8221;, RFC&nbsp;6265, April&nbsp;2011.</td></tr><tr><td class="reference"><b id="RFC6585">[RFC6585]</b></td><td class="top">Nottingham, M. and R. Fielding, &#8220;<a href="https://tools.ietf.org/html/rfc6585">Additional HTTP Status Codes</a>&#8221;, RFC&nbsp;6585, April&nbsp;2012.</td></tr></table><div id="compatibility"><h1 id="rfc.section.A" class="np"><a href="#rfc.section.A">A.</a>&nbsp;<a href="#compatibility">HTTP Version History</a></h1><p id="rfc.section.A.p.1">HTTP has been in use since 1990. The first version, later referred to as HTTP/0.9, was a simple protocol for hypertext data transfer across the Internet, using only a single request method (GET) and no metadata. HTTP/1.0, as defined by <a href="#RFC1945" id="rfc.xref.RFC1945.3"><cite title="Hypertext Transfer Protocol -- HTTP/1.0">[RFC1945]</cite></a>, added a range of request methods and MIME-like messaging, allowing for metadata to be transferred and modifiers placed on the request/response semantics. However, HTTP/1.0 did not sufficiently take into consideration the effects of hierarchical proxies, caching, the need for persistent connections, or name-based virtual hosts. The proliferation of incompletely implemented applications calling themselves "HTTP/1.0" further necessitated a protocol version change in order for two communicating applications to determine each other's true capabilities.<a class="self" href="#rfc.section.A.p.1">&para;</a></p><p id="rfc.section.A.p.2">HTTP/1.1 remains compatible with HTTP/1.0 by including more stringent requirements that enable reliable implementations, adding only those features that can either be safely ignored by an HTTP/1.0 recipient or only be sent when communicating with a party advertising conformance with HTTP/1.1.<a class="self" href="#rfc.section.A.p.2">&para;</a></p><p id="rfc.section.A.p.3">HTTP/1.1 has been designed to make supporting previous versions easy. A general-purpose HTTP/1.1 server ought to be able to understand any valid request in the format of HTTP/1.0, responding appropriately with an HTTP/1.1 message that only uses features understood (or safely ignored) by HTTP/1.0 clients. Likewise, an HTTP/1.1 client can be expected to understand any valid HTTP/1.0 response.<a class="self" href="#rfc.section.A.p.3">&para;</a></p><p id="rfc.section.A.p.4">Since HTTP/0.9 did not support header fields in a request, there is no mechanism for it to support name-based virtual hosts (selection of resource by inspection of the <a href="#header.host" class="smpl">Host</a> header field). Any server that implements name-based virtual hosts ought to disable support for HTTP/0.9. Most requests that appear to be HTTP/0.9 are, in fact, badly constructed HTTP/1.x requests caused by a client failing to properly encode the request-target.<a class="self" href="#rfc.section.A.p.4">&para;</a></p><div id="changes.from.1.0"><h2 id="rfc.section.A.1"><a href="#rfc.section.A.1">A.1</a>&nbsp;<a href="#changes.from.1.0">Changes from HTTP/1.0</a></h2><p id="rfc.section.A.1.p.1">This section summarizes major differences between versions HTTP/1.0 and HTTP/1.1.<a class="self" href="#rfc.section.A.1.p.1">&para;</a></p><div id="changes.to.simplify.multihomed.web.servers.and.conserve.ip.addresses"><h3 id="rfc.section.A.1.1"><a href="#rfc.section.A.1.1">A.1.1</a>&nbsp;<a href="#changes.to.simplify.multihomed.web.servers.and.conserve.ip.addresses">Multihomed Web Servers</a></h3><p id="rfc.section.A.1.1.p.1">The requirements that clients and servers support the <a href="#header.host" class="smpl">Host</a> header field (<a href="#header.host" id="rfc.xref.header.host.3" title="Host">Section&nbsp;5.4</a>), report an error if it is missing from an HTTP/1.1 request, and accept absolute URIs (<a href="#request-target" title="Request Target">Section&nbsp;5.3</a>) are among the most important changes defined by HTTP/1.1.<a class="self" href="#rfc.section.A.1.1.p.1">&para;</a></p><p id="rfc.section.A.1.1.p.2">Older HTTP/1.0 clients assumed a one-to-one relationship of IP addresses and servers; there was no other established mechanism for distinguishing the intended server of a request than the IP address to which that request was directed. The <a href="#header.host" class="smpl">Host</a> header field was introduced during the development of HTTP/1.1 and, though it was quickly implemented by most HTTP/1.0 browsers, additional requirements were placed on all HTTP/1.1 requests in order to ensure complete adoption. At the time of this writing, most HTTP-based services are dependent upon the Host header field for targeting requests.<a class="self" href="#rfc.section.A.1.1.p.2">&para;</a></p></div><div id="compatibility.with.http.1.0.persistent.connections"><h3 id="rfc.section.A.1.2"><a href="#rfc.section.A.1.2">A.1.2</a>&nbsp;<a href="#compatibility.with.http.1.0.persistent.connections">Keep-Alive Connections</a></h3><p id="rfc.section.A.1.2.p.1">In HTTP/1.0, each connection is established by the client prior to the request and closed by the server after sending the response. However, some implementations implement the explicitly negotiated ("Keep-Alive") version of persistent connections described in <a href="https://tools.ietf.org/html/rfc2068#section-19.7.1">Section 19.7.1</a> of <a href="#RFC2068" id="rfc.xref.RFC2068.4"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a>.<a class="self" href="#rfc.section.A.1.2.p.1">&para;</a></p><p id="rfc.section.A.1.2.p.2">Some clients and servers might wish to be compatible with these previous approaches to persistent connections, by explicitly negotiating for them with a "Connection: keep-alive" request header field. However, some experimental implementations of HTTP/1.0 persistent connections are faulty; for example, if an HTTP/1.0 proxy server doesn't understand <a href="#header.connection" class="smpl">Connection</a>, it will erroneously forward that header field to the next inbound server, which would result in a hung connection.<a class="self" href="#rfc.section.A.1.2.p.2">&para;</a></p><p id="rfc.section.A.1.2.p.3">One attempted solution was the introduction of a Proxy-Connection header field, targeted specifically at proxies. In practice, this was also unworkable, because proxies are often deployed in multiple layers, bringing about the same problem discussed above.<a class="self" href="#rfc.section.A.1.2.p.3">&para;</a></p><p id="rfc.section.A.1.2.p.4">As a result, clients are encouraged not to send the Proxy-Connection header field in any requests.<a class="self" href="#rfc.section.A.1.2.p.4">&para;</a></p><p id="rfc.section.A.1.2.p.5">Clients are also encouraged to consider the use of Connection: keep-alive in requests carefully; while they can enable persistent connections with HTTP/1.0 servers, clients using them will need to monitor the connection for "hung" requests (which indicate that the client ought stop sending the header field), and this mechanism ought not be used by clients at all when a proxy is being used.<a class="self" href="#rfc.section.A.1.2.p.5">&para;</a></p></div><div id="introduction.of.transfer-encoding"><h3 id="rfc.section.A.1.3"><a href="#rfc.section.A.1.3">A.1.3</a>&nbsp;<a href="#introduction.of.transfer-encoding">Introduction of Transfer-Encoding</a></h3><p id="rfc.section.A.1.3.p.1">HTTP/1.1 introduces the <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field (<a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.4" title="Transfer-Encoding">Section&nbsp;3.3.1</a>). Transfer codings need to be decoded prior to forwarding an HTTP message over a MIME-compliant protocol.<a class="self" href="#rfc.section.A.1.3.p.1">&para;</a></p></div></div><div id="changes.from.rfc.2616"><h2 id="rfc.section.A.2"><a href="#rfc.section.A.2">A.2</a>&nbsp;<a href="#changes.from.rfc.2616">Changes from RFC 2616</a></h2><p id="rfc.section.A.2.p.1">HTTP's approach to error handling has been explained. (<a href="#conformance" title="Conformance and Error Handling">Section&nbsp;2.5</a>)<a class="self" href="#rfc.section.A.2.p.1">&para;</a></p><p id="rfc.section.A.2.p.2">The HTTP-version ABNF production has been clarified to be case-sensitive. Additionally, version numbers have been restricted to single digits, due to the fact that implementations are known to handle multi-digit version numbers incorrectly. (<a href="#http.version" title="Protocol Versioning">Section&nbsp;2.6</a>)<a class="self" href="#rfc.section.A.2.p.2">&para;</a></p><p id="rfc.section.A.2.p.3">Userinfo (i.e., username and password) are now disallowed in HTTP and HTTPS URIs, because of security issues related to their transmission on the wire. (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>)<a class="self" href="#rfc.section.A.2.p.3">&para;</a></p><p id="rfc.section.A.2.p.4">The HTTPS URI scheme is now defined by this specification; previously, it was done in <a href="https://tools.ietf.org/html/rfc2818#section-2.4">Section 2.4</a> of <a href="#RFC2818" id="rfc.xref.RFC2818.4"><cite title="HTTP Over TLS">[RFC2818]</cite></a>. Furthermore, it implies end-to-end security. (<a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a>)<a class="self" href="#rfc.section.A.2.p.4">&para;</a></p><p id="rfc.section.A.2.p.5">HTTP messages can be (and often are) buffered by implementations; despite it sometimes being available as a stream, HTTP is fundamentally a message-oriented protocol. Minimum supported sizes for various protocol elements have been suggested, to improve interoperability. (<a href="#http.message" title="Message Format">Section&nbsp;3</a>)<a class="self" href="#rfc.section.A.2.p.5">&para;</a></p><p id="rfc.section.A.2.p.6">Invalid whitespace around field-names is now required to be rejected, because accepting it represents a security vulnerability. The ABNF productions defining header fields now only list the field value. (<a href="#header.fields" title="Header Fields">Section&nbsp;3.2</a>)<a class="self" href="#rfc.section.A.2.p.6">&para;</a></p><p id="rfc.section.A.2.p.7">Rules about implicit linear whitespace between certain grammar productions have been removed; now whitespace is only allowed where specifically defined in the ABNF. (<a href="#whitespace" title="Whitespace">Section&nbsp;3.2.3</a>)<a class="self" href="#rfc.section.A.2.p.7">&para;</a></p><p id="rfc.section.A.2.p.8">Header fields that span multiple lines ("line folding") are deprecated. (<a href="#field.parsing" title="Field Parsing">Section&nbsp;3.2.4</a>)<a class="self" href="#rfc.section.A.2.p.8">&para;</a></p><p id="rfc.section.A.2.p.9">The NUL octet is no longer allowed in comment and quoted-string text, and handling of backslash-escaping in them has been clarified. The quoted-pair rule no longer allows escaping control characters other than HTAB. Non-US-ASCII content in header fields and the reason phrase has been obsoleted and made opaque (the TEXT rule was removed). (<a href="#field.components" title="Field Value Components">Section&nbsp;3.2.6</a>)<a class="self" href="#rfc.section.A.2.p.9">&para;</a></p><p id="rfc.section.A.2.p.10">Bogus <a href="#header.content-length" class="smpl">Content-Length</a> header fields are now required to be handled as errors by recipients. (<a href="#header.content-length" id="rfc.xref.header.content-length.2" title="Content-Length">Section&nbsp;3.3.2</a>)<a class="self" href="#rfc.section.A.2.p.10">&para;</a></p><p id="rfc.section.A.2.p.11">The algorithm for determining the message body length has been clarified to indicate all of the special cases (e.g., driven by methods or status codes) that affect it, and that new protocol elements cannot define such special cases. CONNECT is a new, special case in determining message body length. "multipart/byteranges" is no longer a way of determining message body length detection. (<a href="#message.body.length" title="Message Body Length">Section&nbsp;3.3.3</a>)<a class="self" href="#rfc.section.A.2.p.11">&para;</a></p><p id="rfc.section.A.2.p.12">The "identity" transfer coding token has been removed. (Sections <a href="#message.body" title="Message Body">3.3</a> and <a href="#transfer.codings" title="Transfer Codings">4</a>)<a class="self" href="#rfc.section.A.2.p.12">&para;</a></p><p id="rfc.section.A.2.p.13">Chunk length does not include the count of the octets in the chunk header and trailer. Line folding in chunk extensions is disallowed. (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a>)<a class="self" href="#rfc.section.A.2.p.13">&para;</a></p><p id="rfc.section.A.2.p.14">The meaning of the "deflate" content coding has been clarified. (<a href="#deflate.coding" title="Deflate Coding">Section&nbsp;4.2.2</a>)<a class="self" href="#rfc.section.A.2.p.14">&para;</a></p><p id="rfc.section.A.2.p.15">The segment + query components of RFC 3986 have been used to define the request-target, instead of abs_path from RFC 1808. The asterisk-form of the request-target is only allowed with the OPTIONS method. (<a href="#request-target" title="Request Target">Section&nbsp;5.3</a>)<a class="self" href="#rfc.section.A.2.p.15">&para;</a></p><p id="rfc.section.A.2.p.16">The term "Effective Request URI" has been introduced. (<a href="#effective.request.uri" title="Effective Request URI">Section&nbsp;5.5</a>)<a class="self" href="#rfc.section.A.2.p.16">&para;</a></p><p id="rfc.section.A.2.p.17">Gateways do not need to generate <a href="#header.via" class="smpl">Via</a> header fields anymore. (<a href="#header.via" id="rfc.xref.header.via.2" title="Via">Section&nbsp;5.7.1</a>)<a class="self" href="#rfc.section.A.2.p.17">&para;</a></p><p id="rfc.section.A.2.p.18">Exactly when "close" connection options have to be sent has been clarified. Also, "hop-by-hop" header fields are required to appear in the Connection header field; just because they're defined as hop-by-hop in this specification doesn't exempt them. (<a href="#header.connection" id="rfc.xref.header.connection.8" title="Connection">Section&nbsp;6.1</a>)<a class="self" href="#rfc.section.A.2.p.18">&para;</a></p><p id="rfc.section.A.2.p.19">The limit of two connections per server has been removed. An idempotent sequence of requests is no longer required to be retried. The requirement to retry requests under certain circumstances when the server prematurely closes the connection has been removed. Also, some extraneous requirements about when servers are allowed to close connections prematurely have been removed. (<a href="#persistent.connections" title="Persistence">Section&nbsp;6.3</a>)<a class="self" href="#rfc.section.A.2.p.19">&para;</a></p><p id="rfc.section.A.2.p.20">The semantics of the <a href="#header.upgrade" class="smpl">Upgrade</a> header field is now defined in responses other than 101 (this was incorporated from <a href="#RFC2817" id="rfc.xref.RFC2817.3"><cite title="Upgrading to TLS Within HTTP/1.1">[RFC2817]</cite></a>). Furthermore, the ordering in the field value is now significant. (<a href="#header.upgrade" id="rfc.xref.header.upgrade.3" title="Upgrade">Section&nbsp;6.7</a>)<a class="self" href="#rfc.section.A.2.p.20">&para;</a></p><p id="rfc.section.A.2.p.21">Empty list elements in list productions (e.g., a list header field containing ", ,") have been deprecated. (<a href="#abnf.extension" title="ABNF List Extension: #rule">Section&nbsp;7</a>)<a class="self" href="#rfc.section.A.2.p.21">&para;</a></p><p id="rfc.section.A.2.p.22">Registration of Transfer Codings now requires IETF Review (<a href="#transfer.coding.registry" title="Transfer Coding Registry">Section&nbsp;8.4</a>)<a class="self" href="#rfc.section.A.2.p.22">&para;</a></p><p id="rfc.section.A.2.p.23">This specification now defines the Upgrade Token Registry, previously defined in <a href="https://tools.ietf.org/html/rfc2817#section-7.2">Section 7.2</a> of <a href="#RFC2817" id="rfc.xref.RFC2817.4"><cite title="Upgrading to TLS Within HTTP/1.1">[RFC2817]</cite></a>. (<a href="#upgrade.token.registry" title="Upgrade Token Registry">Section&nbsp;8.6</a>)<a class="self" href="#rfc.section.A.2.p.23">&para;</a></p><p id="rfc.section.A.2.p.24">The expectation to support HTTP/0.9 requests has been removed. (<a href="#compatibility" title="HTTP Version History">Appendix&nbsp;A</a>)<a class="self" href="#rfc.section.A.2.p.24">&para;</a></p><p id="rfc.section.A.2.p.25">Issues with the Keep-Alive and Proxy-Connection header fields in requests are pointed out, with use of the latter being discouraged altogether. (<a href="#compatibility.with.http.1.0.persistent.connections" title="Keep-Alive Connections">Appendix&nbsp;A.1.2</a>)<a class="self" href="#rfc.section.A.2.p.25">&para;</a></p></div></div><div id="collected.abnf"><h1 id="rfc.section.B"><a href="#rfc.section.B">B.</a>&nbsp;<a href="#collected.abnf">Collected ABNF</a></h1><div id="rfc.figure.u.72"><pre class="inline"><a href="#rule.whitespace" class="smpl">BWS</a> = OWS 
     720</pre></div><div id="rfc.section.7.p.7"><p><a href="#collected.abnf" title="Collected ABNF">Appendix&nbsp;B</a> shows the collected ABNF for recipients after the list constructs have been expanded.<a class="self" href="#rfc.section.7.p.7">&para;</a></p></div></div><div id="IANA.considerations"><h1 id="rfc.section.8"><a href="#rfc.section.8">8.</a>&nbsp;<a href="#IANA.considerations">IANA Considerations</a></h1><div id="header.field.registration"><h2 id="rfc.section.8.1"><a href="#rfc.section.8.1">8.1</a>&nbsp;<a href="#header.field.registration">Header Field Registration</a></h2><div id="rfc.section.8.1.p.1"><p>HTTP header fields are registered within the "Message Headers" registry maintained at &lt;<a href="http://www.iana.org/assignments/message-headers/">http://www.iana.org/assignments/message-headers/</a>&gt;.<a class="self" href="#rfc.section.8.1.p.1">&para;</a></p></div><div id="rfc.section.8.1.p.2"><p>This document defines the following HTTP header fields, so the "Permanent Message Header Field Names" registry has been updated accordingly (see <a href="#BCP90" id="rfc.xref.BCP90.1"><cite title="Registration Procedures for Message Header Fields">[BCP90]</cite></a>).<a class="self" href="#rfc.section.8.1.p.2">&para;</a></p></div><div id="rfc.table.1"><div id="iana.header.registration.table"></div><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Header Field Name</th><th>Protocol</th><th>Status</th><th>Reference</th></tr></thead><tbody><tr><td class="left">Connection</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.connection" id="rfc.xref.header.connection.6" title="Connection">Section&nbsp;6.1</a> </td></tr><tr><td class="left">Content-Length</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.content-length" id="rfc.xref.header.content-length.1" title="Content-Length">Section&nbsp;3.3.2</a> </td></tr><tr><td class="left">Host</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.host" id="rfc.xref.header.host.2" title="Host">Section&nbsp;5.4</a> </td></tr><tr><td class="left">TE</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.te" id="rfc.xref.header.te.3" title="TE">Section&nbsp;4.3</a> </td></tr><tr><td class="left">Trailer</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.trailer" id="rfc.xref.header.trailer.1" title="Trailer">Section&nbsp;4.4</a> </td></tr><tr><td class="left">Transfer-Encoding</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.3" title="Transfer-Encoding">Section&nbsp;3.3.1</a> </td></tr><tr><td class="left">Upgrade</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.upgrade" id="rfc.xref.header.upgrade.2" title="Upgrade">Section&nbsp;6.7</a> </td></tr><tr><td class="left">Via</td><td class="left">http</td><td class="left">standard</td><td class="left"><a href="#header.via" id="rfc.xref.header.via.1" title="Via">Section&nbsp;5.7.1</a> </td></tr></tbody></table></div><div id="rfc.section.8.1.p.3"><p>Furthermore, the header field-name "Close" has been registered as "reserved", since using that name as an HTTP header field might conflict with the "close" connection option of the <a href="#header.connection" class="smpl">Connection</a> header field (<a href="#header.connection" id="rfc.xref.header.connection.7" title="Connection">Section&nbsp;6.1</a>).<a class="self" href="#rfc.section.8.1.p.3">&para;</a></p></div><div id="rfc.table.u.1"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Header Field Name</th><th>Protocol</th><th>Status</th><th>Reference</th></tr></thead><tbody><tr><td class="left">Close</td><td class="left">http</td><td class="left">reserved</td><td class="left"><a href="#header.field.registration" title="Header Field Registration">Section&nbsp;8.1</a> </td></tr></tbody></table></div><div id="rfc.section.8.1.p.4"><p>The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".<a class="self" href="#rfc.section.8.1.p.4">&para;</a></p></div></div><div id="uri.scheme.registration"><h2 id="rfc.section.8.2"><a href="#rfc.section.8.2">8.2</a>&nbsp;<a href="#uri.scheme.registration">URI Scheme Registration</a></h2><div id="rfc.section.8.2.p.1"><p>IANA maintains the registry of URI Schemes <a href="#BCP115" id="rfc.xref.BCP115.1"><cite title="Guidelines and Registration Procedures for New URI Schemes">[BCP115]</cite></a> at &lt;<a href="http://www.iana.org/assignments/uri-schemes/">http://www.iana.org/assignments/uri-schemes/</a>&gt;.<a class="self" href="#rfc.section.8.2.p.1">&para;</a></p></div><div id="rfc.section.8.2.p.2"><p>This document defines the following URI schemes, so the "Permanent URI Schemes" registry has been updated accordingly.<a class="self" href="#rfc.section.8.2.p.2">&para;</a></p></div><div id="rfc.table.u.2"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>URI Scheme</th><th>Description</th><th>Reference</th></tr></thead><tbody><tr><td class="left">http</td><td class="left">Hypertext Transfer Protocol</td><td class="left"><a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a></td></tr><tr><td class="left">https</td><td class="left">Hypertext Transfer Protocol Secure</td><td class="left"><a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a></td></tr></tbody></table></div></div><div id="internet.media.type.http"><h2 id="rfc.section.8.3"><a href="#rfc.section.8.3">8.3</a>&nbsp;<a href="#internet.media.type.http">Internet Media Type Registration</a></h2><div id="rfc.section.8.3.p.1"><p>IANA maintains the registry of Internet media types <a href="#BCP13" id="rfc.xref.BCP13.1"><cite title="Media Type Specifications and Registration Procedures">[BCP13]</cite></a> at &lt;<a href="http://www.iana.org/assignments/media-types">http://www.iana.org/assignments/media-types</a>&gt;.<a class="self" href="#rfc.section.8.3.p.1">&para;</a></p></div><div id="rfc.section.8.3.p.2"><p>This document serves as the specification for the Internet media types "message/http" and "application/http". The following has been registered with IANA.<a class="self" href="#rfc.section.8.3.p.2">&para;</a></p></div><div id="internet.media.type.message.http"><h3 id="rfc.section.8.3.1"><a href="#rfc.section.8.3.1">8.3.1</a>&nbsp;<a href="#internet.media.type.message.http">Internet Media Type message/http</a></h3><div id="rfc.section.8.3.1.p.1"><p>The message/http type can be used to enclose a single HTTP request or response message, provided that it obeys the MIME restrictions for all "message" types regarding line length and encodings.<a class="self" href="#rfc.section.8.3.1.p.1">&para;</a></p></div><div id="rfc.section.8.3.1.p.2"><dl><dt>Type name:</dt><dd>message</dd><dt>Subtype name:</dt><dd>http</dd><dt>Required parameters:</dt><dd>N/A</dd><dt>Optional parameters:</dt><dd>version, msgtype <dl><dt>version:</dt><dd>The HTTP-version number of the enclosed message (e.g., "1.1"). If not present, the version can be determined from the first line of the body.</dd><dt>msgtype:</dt><dd>The message type &#8212; "request" or "response". If not present, the type can be determined from the first line of the body.</dd></dl> </dd><dt>Encoding considerations:</dt><dd>only "7bit", "8bit", or "binary" are permitted</dd><dt>Security considerations:</dt><dd>see <a href="#security.considerations" title="Security Considerations">Section&nbsp;9</a> </dd><dt>Interoperability considerations:</dt><dd>N/A</dd><dt>Published specification:</dt><dd>This specification (see <a href="#internet.media.type.message.http" title="Internet Media Type message/http">Section&nbsp;8.3.1</a>).</dd><dt>Applications that use this media type:</dt><dd>N/A</dd><dt>Fragment identifier considerations:</dt><dd>N/A</dd><dt>Additional information:</dt><dd><dl><dt>Magic number(s):</dt><dd>N/A</dd><dt>Deprecated alias names for this type:</dt><dd>N/A</dd><dt>File extension(s):</dt><dd>N/A</dd><dt>Macintosh file type code(s):</dt><dd>N/A</dd></dl> </dd><dt>Person and email address to contact for further information:</dt><dd>See&nbsp;Authors'&nbsp;Addresses section.</dd><dt>Intended usage:</dt><dd>COMMON</dd><dt>Restrictions on usage:</dt><dd>N/A</dd><dt>Author:</dt><dd>See Authors' Addresses section.</dd><dt>Change controller:</dt><dd>IESG</dd></dl></div></div><div id="internet.media.type.application.http"><h3 id="rfc.section.8.3.2"><a href="#rfc.section.8.3.2">8.3.2</a>&nbsp;<a href="#internet.media.type.application.http">Internet Media Type application/http</a></h3><div id="rfc.section.8.3.2.p.1"><p>The application/http type can be used to enclose a pipeline of one or more HTTP request or response messages (not intermixed).<a class="self" href="#rfc.section.8.3.2.p.1">&para;</a></p></div><div id="rfc.section.8.3.2.p.2"><dl><dt>Type name:</dt><dd>application</dd><dt>Subtype name:</dt><dd>http</dd><dt>Required parameters:</dt><dd>N/A</dd><dt>Optional parameters:</dt><dd>version, msgtype <dl><dt>version:</dt><dd>The HTTP-version number of the enclosed messages (e.g., "1.1"). If not present, the version can be determined from the first line of the body.</dd><dt>msgtype:</dt><dd>The message type &#8212; "request" or "response". If not present, the type can be determined from the first line of the body.</dd></dl> </dd><dt>Encoding considerations:</dt><dd>HTTP messages enclosed by this type are in "binary" format; use of an appropriate Content-Transfer-Encoding is required when transmitted via email.</dd><dt>Security considerations:</dt><dd>see <a href="#security.considerations" title="Security Considerations">Section&nbsp;9</a> </dd><dt>Interoperability considerations:</dt><dd>N/A</dd><dt>Published specification:</dt><dd>This specification (see <a href="#internet.media.type.application.http" title="Internet Media Type application/http">Section&nbsp;8.3.2</a>).</dd><dt>Applications that use this media type:</dt><dd>N/A</dd><dt>Fragment identifier considerations:</dt><dd>N/A</dd><dt>Additional information:</dt><dd><dl><dt>Deprecated alias names for this type:</dt><dd>N/A</dd><dt>Magic number(s):</dt><dd>N/A</dd><dt>File extension(s):</dt><dd>N/A</dd><dt>Macintosh file type code(s):</dt><dd>N/A</dd></dl> </dd><dt>Person and email address to contact for further information:</dt><dd>See&nbsp;Authors'&nbsp;Addresses section.</dd><dt>Intended usage:</dt><dd>COMMON</dd><dt>Restrictions on usage:</dt><dd>N/A</dd><dt>Author:</dt><dd>See Authors' Addresses section.</dd><dt>Change controller:</dt><dd>IESG</dd></dl></div></div></div><div id="transfer.coding.registry"><h2 id="rfc.section.8.4"><a href="#rfc.section.8.4">8.4</a>&nbsp;<a href="#transfer.coding.registry">Transfer Coding Registry</a></h2><div id="rfc.section.8.4.p.1"><p>The "HTTP Transfer Coding Registry" defines the namespace for transfer coding names. It is maintained at &lt;<a href="http://www.iana.org/assignments/http-parameters">http://www.iana.org/assignments/http-parameters</a>&gt;.<a class="self" href="#rfc.section.8.4.p.1">&para;</a></p></div><div id="transfer.coding.registry.procedure"><h3 id="rfc.section.8.4.1"><a href="#rfc.section.8.4.1">8.4.1</a>&nbsp;<a href="#transfer.coding.registry.procedure">Procedure</a></h3><div id="rfc.section.8.4.1.p.1"><p>Registrations <em class="bcp14">MUST</em> include the following fields: <a class="self" href="#rfc.section.8.4.1.p.1">&para;</a></p><ul><li>Name</li><li>Description</li><li>Pointer to specification text</li></ul></div><div id="rfc.section.8.4.1.p.2"><p>Names of transfer codings <em class="bcp14">MUST NOT</em> overlap with names of content codings (<a href="rfc7231.html#content.codings" title="Content Codings">Section 3.1.2.1</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.33"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) unless the encoding transformation is identical, as is the case for the compression codings defined in <a href="#compression.codings" title="Compression Codings">Section&nbsp;4.2</a>.<a class="self" href="#rfc.section.8.4.1.p.2">&para;</a></p></div><div id="rfc.section.8.4.1.p.3"><p>Values to be added to this namespace require IETF Review (see <a href="https://tools.ietf.org/html/rfc5226#section-4.1">Section 4.1</a> of <a href="#RFC5226" id="rfc.xref.RFC5226.1"><cite title="Guidelines for Writing an IANA Considerations Section in RFCs">[RFC5226]</cite></a>), and <em class="bcp14">MUST</em> conform to the purpose of transfer coding defined in this specification.<a class="self" href="#rfc.section.8.4.1.p.3">&para;</a></p></div><div id="rfc.section.8.4.1.p.4"><p>Use of program names for the identification of encoding formats is not desirable and is discouraged for future encodings.<a class="self" href="#rfc.section.8.4.1.p.4">&para;</a></p></div></div><div id="transfer.coding.registration"><h3 id="rfc.section.8.4.2"><a href="#rfc.section.8.4.2">8.4.2</a>&nbsp;<a href="#transfer.coding.registration">Registration</a></h3><div id="rfc.section.8.4.2.p.1"><p>The "HTTP Transfer Coding Registry" has been updated with the registrations below:<a class="self" href="#rfc.section.8.4.2.p.1">&para;</a></p></div><div id="rfc.table.2"><div id="iana.transfer.coding.registration.table"></div><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Name</th><th>Description</th><th>Reference</th></tr></thead><tbody><tr><td class="left">chunked</td><td class="left">Transfer in a series of chunks</td><td class="left"><a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a> </td></tr><tr><td class="left">compress</td><td class="left">UNIX "compress" data format <a href="#Welch" id="rfc.xref.Welch.2"><cite title="A Technique for High-Performance Data Compression">[Welch]</cite></a></td><td class="left"><a href="#compress.coding" title="Compress Coding">Section&nbsp;4.2.1</a> </td></tr><tr><td class="left">deflate</td><td class="left">"deflate" compressed data (<a href="#RFC1951" id="rfc.xref.RFC1951.2"><cite title="DEFLATE Compressed Data Format Specification version 1.3">[RFC1951]</cite></a>) inside the "zlib" data format (<a href="#RFC1950" id="rfc.xref.RFC1950.2"><cite title="ZLIB Compressed Data Format Specification version 3.3">[RFC1950]</cite></a>)</td><td class="left"><a href="#deflate.coding" title="Deflate Coding">Section&nbsp;4.2.2</a> </td></tr><tr><td class="left">gzip</td><td class="left">GZIP file format <a href="#RFC1952" id="rfc.xref.RFC1952.2"><cite title="GZIP file format specification version 4.3">[RFC1952]</cite></a></td><td class="left"><a href="#gzip.coding" title="Gzip Coding">Section&nbsp;4.2.3</a> </td></tr><tr><td class="left">x-compress</td><td class="left">Deprecated (alias for compress)</td><td class="left"><a href="#compress.coding" title="Compress Coding">Section&nbsp;4.2.1</a> </td></tr><tr><td class="left">x-gzip</td><td class="left">Deprecated (alias for gzip)</td><td class="left"><a href="#gzip.coding" title="Gzip Coding">Section&nbsp;4.2.3</a> </td></tr></tbody></table></div></div></div><div id="content.coding.registration"><h2 id="rfc.section.8.5"><a href="#rfc.section.8.5">8.5</a>&nbsp;<a href="#content.coding.registration">Content Coding Registration</a></h2><div id="rfc.section.8.5.p.1"><p>IANA maintains the "HTTP Content Coding Registry" at &lt;<a href="http://www.iana.org/assignments/http-parameters">http://www.iana.org/assignments/http-parameters</a>&gt;.<a class="self" href="#rfc.section.8.5.p.1">&para;</a></p></div><div id="rfc.section.8.5.p.2"><p>The "HTTP Content Coding Registry" has been updated with the registrations below:<a class="self" href="#rfc.section.8.5.p.2">&para;</a></p></div><div id="rfc.table.3"><div id="iana.content.coding.registration.table"></div><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Name</th><th>Description</th><th>Reference</th></tr></thead><tbody><tr><td class="left">compress</td><td class="left">UNIX "compress" data format <a href="#Welch" id="rfc.xref.Welch.3"><cite title="A Technique for High-Performance Data Compression">[Welch]</cite></a></td><td class="left"><a href="#compress.coding" title="Compress Coding">Section&nbsp;4.2.1</a> </td></tr><tr><td class="left">deflate</td><td class="left">"deflate" compressed data (<a href="#RFC1951" id="rfc.xref.RFC1951.3"><cite title="DEFLATE Compressed Data Format Specification version 1.3">[RFC1951]</cite></a>) inside the "zlib" data format (<a href="#RFC1950" id="rfc.xref.RFC1950.3"><cite title="ZLIB Compressed Data Format Specification version 3.3">[RFC1950]</cite></a>)</td><td class="left"><a href="#deflate.coding" title="Deflate Coding">Section&nbsp;4.2.2</a> </td></tr><tr><td class="left">gzip</td><td class="left">GZIP file format <a href="#RFC1952" id="rfc.xref.RFC1952.3"><cite title="GZIP file format specification version 4.3">[RFC1952]</cite></a></td><td class="left"><a href="#gzip.coding" title="Gzip Coding">Section&nbsp;4.2.3</a> </td></tr><tr><td class="left">x-compress</td><td class="left">Deprecated (alias for compress)</td><td class="left"><a href="#compress.coding" title="Compress Coding">Section&nbsp;4.2.1</a> </td></tr><tr><td class="left">x-gzip</td><td class="left">Deprecated (alias for gzip)</td><td class="left"><a href="#gzip.coding" title="Gzip Coding">Section&nbsp;4.2.3</a> </td></tr></tbody></table></div></div><div id="upgrade.token.registry"><h2 id="rfc.section.8.6"><a href="#rfc.section.8.6">8.6</a>&nbsp;<a href="#upgrade.token.registry">Upgrade Token Registry</a></h2><div id="rfc.section.8.6.p.1"><p>The "Hypertext Transfer Protocol (HTTP) Upgrade Token Registry" defines the namespace for protocol-name tokens used to identify protocols in the <a href="#header.upgrade" class="smpl">Upgrade</a> header field. The registry is maintained at &lt;<a href="http://www.iana.org/assignments/http-upgrade-tokens">http://www.iana.org/assignments/http-upgrade-tokens</a>&gt;.<a class="self" href="#rfc.section.8.6.p.1">&para;</a></p></div><div id="upgrade.token.registry.procedure"><h3 id="rfc.section.8.6.1"><a href="#rfc.section.8.6.1">8.6.1</a>&nbsp;<a href="#upgrade.token.registry.procedure">Procedure</a></h3><div id="rfc.section.8.6.1.p.1"><p>Each registered protocol name is associated with contact information and an optional set of specifications that details how the connection will be processed after it has been upgraded.<a class="self" href="#rfc.section.8.6.1.p.1">&para;</a></p></div><div id="rfc.section.8.6.1.p.2"><p>Registrations happen on a "First Come First Served" basis (see <a href="https://tools.ietf.org/html/rfc5226#section-4.1">Section 4.1</a> of <a href="#RFC5226" id="rfc.xref.RFC5226.2"><cite title="Guidelines for Writing an IANA Considerations Section in RFCs">[RFC5226]</cite></a>) and are subject to the following rules: <a class="self" href="#rfc.section.8.6.1.p.2">&para;</a></p><ol><li>A protocol-name token, once registered, stays registered forever.</li><li>The registration <em class="bcp14">MUST</em> name a responsible party for the registration.</li><li>The registration <em class="bcp14">MUST</em> name a point of contact.</li><li>The registration <em class="bcp14">MAY</em> name a set of specifications associated with that token. Such specifications need not be publicly available.</li><li>The registration <em class="bcp14">SHOULD</em> name a set of expected "protocol-version" tokens associated with that token at the time of registration.</li><li>The responsible party <em class="bcp14">MAY</em> change the registration at any time. The IANA will keep a record of all such changes, and make them available upon request.</li><li>The IESG <em class="bcp14">MAY</em> reassign responsibility for a protocol token. This will normally only be used in the case when a responsible party cannot be contacted.</li></ol></div><div id="rfc.section.8.6.1.p.3"><p>This registration procedure for HTTP Upgrade Tokens replaces that previously defined in <a href="https://tools.ietf.org/html/rfc2817#section-7.2">Section 7.2</a> of <a href="#RFC2817" id="rfc.xref.RFC2817.2"><cite title="Upgrading to TLS Within HTTP/1.1">[RFC2817]</cite></a>.<a class="self" href="#rfc.section.8.6.1.p.3">&para;</a></p></div></div><div id="upgrade.token.registration"><h3 id="rfc.section.8.6.2"><a href="#rfc.section.8.6.2">8.6.2</a>&nbsp;<a href="#upgrade.token.registration">Upgrade Token Registration</a></h3><div id="rfc.section.8.6.2.p.1"><p>The "HTTP" entry in the upgrade token registry has been updated with the registration below:<a class="self" href="#rfc.section.8.6.2.p.1">&para;</a></p></div><div id="rfc.table.u.3"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Value</th><th>Description</th><th>Expected Version Tokens</th><th>Reference</th></tr></thead><tbody><tr><td class="left">HTTP</td><td class="left">Hypertext Transfer Protocol</td><td class="left">any DIGIT.DIGIT (e.g, "2.0")</td><td class="left"><a href="#http.version" title="Protocol Versioning">Section&nbsp;2.6</a></td></tr></tbody></table></div><div id="rfc.section.8.6.2.p.2"><p>The responsible party is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".<a class="self" href="#rfc.section.8.6.2.p.2">&para;</a></p></div></div></div></div><div id="security.considerations"><h1 id="rfc.section.9"><a href="#rfc.section.9">9.</a>&nbsp;<a href="#security.considerations">Security Considerations</a></h1><div id="rfc.section.9.p.1"><p>This section is meant to inform developers, information providers, and users of known security considerations relevant to HTTP message syntax, parsing, and routing. Security considerations about HTTP semantics and payloads are addressed in <a href="#RFC7231" id="rfc.xref.RFC7231.34"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>.<a class="self" href="#rfc.section.9.p.1">&para;</a></p></div><div id="establishing.authority"><h2 id="rfc.section.9.1"><a href="#rfc.section.9.1">9.1</a>&nbsp;<a href="#establishing.authority">Establishing Authority</a></h2><div id="rfc.section.9.1.p.1"><p>HTTP relies on the notion of an <dfn>authoritative response</dfn>: a response that has been determined by (or at the direction of) the authority identified within the target URI to be the most appropriate response for that request given the state of the target resource at the time of response message origination. Providing a response from a non-authoritative source, such as a shared cache, is often useful to improve performance and availability, but only to the extent that the source can be trusted or the distrusted response can be safely used.<a class="self" href="#rfc.section.9.1.p.1">&para;</a></p></div><div id="rfc.section.9.1.p.2"><p>Unfortunately, establishing authority can be difficult. For example, <dfn>phishing</dfn> is an attack on the user's perception of authority, where that perception can be misled by presenting similar branding in hypertext, possibly aided by userinfo obfuscating the authority component (see <a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>). User agents can reduce the impact of phishing attacks by enabling users to easily inspect a target URI prior to making an action, by prominently distinguishing (or rejecting) userinfo when present, and by not sending stored credentials and cookies when the referring document is from an unknown or untrusted source.<a class="self" href="#rfc.section.9.1.p.2">&para;</a></p></div><div id="rfc.section.9.1.p.3"><p>When a registered name is used in the authority component, the "http" URI scheme (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>) relies on the user's local name resolution service to determine where it can find authoritative responses. This means that any attack on a user's network host table, cached names, or name resolution libraries becomes an avenue for attack on establishing authority. Likewise, the user's choice of server for Domain Name Service (DNS), and the hierarchy of servers from which it obtains resolution results, could impact the authenticity of address mappings; DNS Security Extensions (DNSSEC, <a href="#RFC4033" id="rfc.xref.RFC4033.1"><cite title="DNS Security Introduction and Requirements">[RFC4033]</cite></a>) are one way to improve authenticity.<a class="self" href="#rfc.section.9.1.p.3">&para;</a></p></div><div id="rfc.section.9.1.p.4"><p>Furthermore, after an IP address is obtained, establishing authority for an "http" URI is vulnerable to attacks on Internet Protocol routing.<a class="self" href="#rfc.section.9.1.p.4">&para;</a></p></div><div id="rfc.section.9.1.p.5"><p>The "https" scheme (<a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a>) is intended to prevent (or at least reveal) many of these potential attacks on establishing authority, provided that the negotiated TLS connection is secured and the client properly verifies that the communicating server's identity matches the target URI's authority component (see <a href="#RFC2818" id="rfc.xref.RFC2818.3"><cite title="HTTP Over TLS">[RFC2818]</cite></a>). Correctly implementing such verification can be difficult (see <a href="#Georgiev" id="rfc.xref.Georgiev.1"><cite title="The Most Dangerous Code in the World: Validating SSL Certificates in Non-browser Software">[Georgiev]</cite></a>).<a class="self" href="#rfc.section.9.1.p.5">&para;</a></p></div></div><div id="risks.intermediaries"><h2 id="rfc.section.9.2"><a href="#rfc.section.9.2">9.2</a>&nbsp;<a href="#risks.intermediaries">Risks of Intermediaries</a></h2><div id="rfc.section.9.2.p.1"><p>By their very nature, HTTP intermediaries are men-in-the-middle and, thus, represent an opportunity for man-in-the-middle attacks. Compromise of the systems on which the intermediaries run can result in serious security and privacy problems. Intermediaries might have access to security-related information, personal information about individual users and organizations, and proprietary information belonging to users and content providers. A compromised intermediary, or an intermediary implemented or configured without regard to security and privacy considerations, might be used in the commission of a wide range of potential attacks.<a class="self" href="#rfc.section.9.2.p.1">&para;</a></p></div><div id="rfc.section.9.2.p.2"><p>Intermediaries that contain a shared cache are especially vulnerable to cache poisoning attacks, as described in <a href="rfc7234.html#security.considerations" title="Security Considerations">Section 8</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.8"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>.<a class="self" href="#rfc.section.9.2.p.2">&para;</a></p></div><div id="rfc.section.9.2.p.3"><p>Implementers need to consider the privacy and security implications of their design and coding decisions, and of the configuration options they provide to operators (especially the default configuration).<a class="self" href="#rfc.section.9.2.p.3">&para;</a></p></div><div id="rfc.section.9.2.p.4"><p>Users need to be aware that intermediaries are no more trustworthy than the people who run them; HTTP itself cannot solve this problem.<a class="self" href="#rfc.section.9.2.p.4">&para;</a></p></div></div><div id="attack.protocol.element.length"><h2 id="rfc.section.9.3"><a href="#rfc.section.9.3">9.3</a>&nbsp;<a href="#attack.protocol.element.length">Attacks via Protocol Element Length</a></h2><div id="rfc.section.9.3.p.1"><p>Because HTTP uses mostly textual, character-delimited fields, parsers are often vulnerable to attacks based on sending very long (or very slow) streams of data, particularly where an implementation is expecting a protocol element with no predefined length.<a class="self" href="#rfc.section.9.3.p.1">&para;</a></p></div><div id="rfc.section.9.3.p.2"><p>To promote interoperability, specific recommendations are made for minimum size limits on request-line (<a href="#request.line" title="Request Line">Section&nbsp;3.1.1</a>) and header fields (<a href="#header.fields" title="Header Fields">Section&nbsp;3.2</a>). These are minimum recommendations, chosen to be supportable even by implementations with limited resources; it is expected that most implementations will choose substantially higher limits.<a class="self" href="#rfc.section.9.3.p.2">&para;</a></p></div><div id="rfc.section.9.3.p.3"><p>A server can reject a message that has a request-target that is too long (<a href="rfc7231.html#status.414" title="414 URI Too Long">Section 6.5.12</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.35"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>) or a request payload that is too large (<a href="rfc7231.html#status.413" title="413 Payload Too Large">Section 6.5.11</a> of <a href="#RFC7231" id="rfc.xref.RFC7231.36"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">[RFC7231]</cite></a>). Additional status codes related to capacity limits have been defined by extensions to HTTP <a href="#RFC6585" id="rfc.xref.RFC6585.1"><cite title="Additional HTTP Status Codes">[RFC6585]</cite></a>.<a class="self" href="#rfc.section.9.3.p.3">&para;</a></p></div><div id="rfc.section.9.3.p.4"><p>Recipients ought to carefully limit the extent to which they process other protocol elements, including (but not limited to) request methods, response status phrases, header field-names, numeric values, and body chunks. Failure to limit such processing can result in buffer overflows, arithmetic overflows, or increased vulnerability to denial-of-service attacks.<a class="self" href="#rfc.section.9.3.p.4">&para;</a></p></div></div><div id="response.splitting"><h2 id="rfc.section.9.4"><a href="#rfc.section.9.4">9.4</a>&nbsp;<a href="#response.splitting">Response Splitting</a></h2><div id="rfc.section.9.4.p.1"><p>Response splitting (a.k.a, CRLF injection) is a common technique, used in various attacks on Web usage, that exploits the line-based nature of HTTP message framing and the ordered association of requests to responses on persistent connections <a href="#Klein" id="rfc.xref.Klein.1"><cite title="Divide and Conquer - HTTP Response Splitting, Web Cache Poisoning Attacks, and Related Topics">[Klein]</cite></a>. This technique can be particularly damaging when the requests pass through a shared cache.<a class="self" href="#rfc.section.9.4.p.1">&para;</a></p></div><div id="rfc.section.9.4.p.2"><p>Response splitting exploits a vulnerability in servers (usually within an application server) where an attacker can send encoded data within some parameter of the request that is later decoded and echoed within any of the response header fields of the response. If the decoded data is crafted to look like the response has ended and a subsequent response has begun, the response has been split and the content within the apparent second response is controlled by the attacker. The attacker can then make any other request on the same persistent connection and trick the recipients (including intermediaries) into believing that the second half of the split is an authoritative answer to the second request.<a class="self" href="#rfc.section.9.4.p.2">&para;</a></p></div><div id="rfc.section.9.4.p.3"><p>For example, a parameter within the request-target might be read by an application server and reused within a redirect, resulting in the same parameter being echoed in the <a href="rfc7231.html#header.location" class="smpl">Location</a> header field of the response. If the parameter is decoded by the application and not properly encoded when placed in the response field, the attacker can send encoded CRLF octets and other content that will make the application's single response look like two or more responses.<a class="self" href="#rfc.section.9.4.p.3">&para;</a></p></div><div id="rfc.section.9.4.p.4"><p>A common defense against response splitting is to filter requests for data that looks like encoded CR and LF (e.g., "%0D" and "%0A"). However, that assumes the application server is only performing URI decoding, rather than more obscure data transformations like charset transcoding, XML entity translation, base64 decoding, sprintf reformatting, etc. A more effective mitigation is to prevent anything other than the server's core protocol libraries from sending a CR or LF within the header section, which means restricting the output of header fields to APIs that filter for bad octets and not allowing application servers to write directly to the protocol stream.<a class="self" href="#rfc.section.9.4.p.4">&para;</a></p></div></div><div id="request.smuggling"><h2 id="rfc.section.9.5"><a href="#rfc.section.9.5">9.5</a>&nbsp;<a href="#request.smuggling">Request Smuggling</a></h2><div id="rfc.section.9.5.p.1"><p>Request smuggling (<a href="#Linhart" id="rfc.xref.Linhart.1"><cite title="HTTP Request Smuggling">[Linhart]</cite></a>) is a technique that exploits differences in protocol parsing among various recipients to hide additional requests (which might otherwise be blocked or disabled by policy) within an apparently harmless request. Like response splitting, request smuggling can lead to a variety of attacks on HTTP usage.<a class="self" href="#rfc.section.9.5.p.1">&para;</a></p></div><div id="rfc.section.9.5.p.2"><p>This specification has introduced new requirements on request parsing, particularly with regard to message framing in <a href="#message.body.length" title="Message Body Length">Section&nbsp;3.3.3</a>, to reduce the effectiveness of request smuggling.<a class="self" href="#rfc.section.9.5.p.2">&para;</a></p></div></div><div id="message.integrity"><h2 id="rfc.section.9.6"><a href="#rfc.section.9.6">9.6</a>&nbsp;<a href="#message.integrity">Message Integrity</a></h2><div id="rfc.section.9.6.p.1"><p>HTTP does not define a specific mechanism for ensuring message integrity, instead relying on the error-detection ability of underlying transport protocols and the use of length or chunk-delimited framing to detect completeness. Additional integrity mechanisms, such as hash functions or digital signatures applied to the content, can be selectively added to messages via extensible metadata header fields. Historically, the lack of a single integrity mechanism has been justified by the informal nature of most HTTP communication. However, the prevalence of HTTP as an information access mechanism has resulted in its increasing use within environments where verification of message integrity is crucial.<a class="self" href="#rfc.section.9.6.p.1">&para;</a></p></div><div id="rfc.section.9.6.p.2"><p>User agents are encouraged to implement configurable means for detecting and reporting failures of message integrity such that those means can be enabled within environments for which integrity is necessary. For example, a browser being used to view medical history or drug interaction information needs to indicate to the user when such information is detected by the protocol to be incomplete, expired, or corrupted during transfer. Such mechanisms might be selectively enabled via user agent extensions or the presence of message integrity metadata in a response. At a minimum, user agents ought to provide some indication that allows a user to distinguish between a complete and incomplete response message (<a href="#incomplete.messages" title="Handling Incomplete Messages">Section&nbsp;3.4</a>) when such verification is desired.<a class="self" href="#rfc.section.9.6.p.2">&para;</a></p></div></div><div id="message.confidentiality"><h2 id="rfc.section.9.7"><a href="#rfc.section.9.7">9.7</a>&nbsp;<a href="#message.confidentiality">Message Confidentiality</a></h2><div id="rfc.section.9.7.p.1"><p>HTTP relies on underlying transport protocols to provide message confidentiality when that is desired. HTTP has been specifically designed to be independent of the transport protocol, such that it can be used over many different forms of encrypted connection, with the selection of such transports being identified by the choice of URI scheme or within user agent configuration.<a class="self" href="#rfc.section.9.7.p.1">&para;</a></p></div><div id="rfc.section.9.7.p.2"><p>The "https" scheme can be used to identify resources that require a confidential connection, as described in <a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a>.<a class="self" href="#rfc.section.9.7.p.2">&para;</a></p></div></div><div id="privacy.of.server.log.information"><h2 id="rfc.section.9.8"><a href="#rfc.section.9.8">9.8</a>&nbsp;<a href="#privacy.of.server.log.information">Privacy of Server Log Information</a></h2><div id="rfc.section.9.8.p.1"><p>A server is in the position to save personal data about a user's requests over time, which might identify their reading patterns or subjects of interest. In particular, log information gathered at an intermediary often contains a history of user agent interaction, across a multitude of sites, that can be traced to individual users.<a class="self" href="#rfc.section.9.8.p.1">&para;</a></p></div><div id="rfc.section.9.8.p.2"><p>HTTP log information is confidential in nature; its handling is often constrained by laws and regulations. Log information needs to be securely stored and appropriate guidelines followed for its analysis. Anonymization of personal information within individual entries helps, but it is generally not sufficient to prevent real log traces from being re-identified based on correlation with other access characteristics. As such, access traces that are keyed to a specific client are unsafe to publish even if the key is pseudonymous.<a class="self" href="#rfc.section.9.8.p.2">&para;</a></p></div><div id="rfc.section.9.8.p.3"><p>To minimize the risk of theft or accidental publication, log information ought to be purged of personally identifiable information, including user identifiers, IP addresses, and user-provided query parameters, as soon as that information is no longer necessary to support operational needs for security, auditing, or fraud control.<a class="self" href="#rfc.section.9.8.p.3">&para;</a></p></div></div></div><div id="acks"><h1 id="rfc.section.10"><a href="#rfc.section.10">10.</a>&nbsp;<a href="#acks">Acknowledgments</a></h1><div id="rfc.section.10.p.1"><p>This edition of HTTP/1.1 builds on the many contributions that went into <a href="#RFC1945" id="rfc.xref.RFC1945.2">RFC 1945</a>, <a href="#RFC2068" id="rfc.xref.RFC2068.3">RFC 2068</a>, <a href="#RFC2145" id="rfc.xref.RFC2145.2">RFC 2145</a>, and <a href="#RFC2616" id="rfc.xref.RFC2616.3">RFC 2616</a>, including substantial contributions made by the previous authors, editors, and Working Group Chairs: Tim Berners-Lee, Ari Luotonen, Roy T. Fielding, Henrik Frystyk Nielsen, Jim Gettys, Jeffrey C. Mogul, Larry Masinter, and Paul J. Leach. Mark Nottingham oversaw this effort as Working Group Chair.<a class="self" href="#rfc.section.10.p.1">&para;</a></p></div><div id="rfc.section.10.p.2"><p>Since 1999, the following contributors have helped improve the HTTP specification by reporting bugs, asking smart questions, drafting or reviewing text, and evaluating open issues:<a class="self" href="#rfc.section.10.p.2">&para;</a></p></div><div id="rfc.section.10.p.3"><p>Adam Barth, Adam Roach, Addison Phillips, Adrian Chadd, Adrian Cole, Adrien W. de Croy, Alan Ford, Alan Ruttenberg, Albert Lunde, Alek Storm, Alex Rousskov, Alexandre Morgaut, Alexey Melnikov, Alisha Smith, Amichai Rothman, Amit Klein, Amos Jeffries, Andreas Maier, Andreas Petersson, Andrei Popov, Anil Sharma, Anne van Kesteren, Anthony Bryan, Asbjorn Ulsberg, Ashok Kumar, Balachander Krishnamurthy, Barry Leiba, Ben Laurie, Benjamin Carlyle, Benjamin Niven-Jenkins, Benoit Claise, Bil Corry, Bill Burke, Bjoern Hoehrmann, Bob Scheifler, Boris Zbarsky, Brett Slatkin, Brian Kell, Brian McBarron, Brian Pane, Brian Raymor, Brian Smith, Bruce Perens, Bryce Nesbitt, Cameron Heavon-Jones, Carl Kugler, Carsten Bormann, Charles Fry, Chris Burdess, Chris Newman, Christian Huitema, Cyrus Daboo, Dale Robert Anderson, Dan Wing, Dan Winship, Daniel Stenberg, Darrel Miller, Dave Cridland, Dave Crocker, Dave Kristol, Dave Thaler, David Booth, David Singer, David W. Morris, Diwakar Shetty, Dmitry Kurochkin, Drummond Reed, Duane Wessels, Edward Lee, Eitan Adler, Eliot Lear, Emile Stephan, Eran Hammer-Lahav, Eric D. Williams, Eric J. Bowman, Eric Lawrence, Eric Rescorla, Erik Aronesty, EungJun Yi, Evan Prodromou, Felix Geisendoerfer, Florian Weimer, Frank Ellermann, Fred Akalin, Fred Bohle, Frederic Kayser, Gabor Molnar, Gabriel Montenegro, Geoffrey Sneddon, Gervase Markham, Gili Tzabari, Grahame Grieve, Greg Slepak, Greg Wilkins, Grzegorz Calkowski, Harald Tveit Alvestrand, Harry Halpin, Helge Hess, Henrik Nordstrom, Henry S. Thompson, Henry Story, Herbert van de Sompel, Herve Ruellan, Howard Melman, Hugo Haas, Ian Fette, Ian Hickson, Ido Safruti, Ilari Liusvaara, Ilya Grigorik, Ingo Struck, J. Ross Nicoll, James Cloos, James H. Manger, James Lacey, James M. Snell, Jamie Lokier, Jan Algermissen, Jari Arkko, Jeff Hodges (who came up with the term 'effective Request-URI'), Jeff Pinner, Jeff Walden, Jim Luther, Jitu Padhye, Joe D. Williams, Joe Gregorio, Joe Orton, Joel Jaeggli, John C. Klensin, John C. Mallery, John Cowan, John Kemp, John Panzer, John Schneider, John Stracke, John Sullivan, Jonas Sicking, Jonathan A. Rees, Jonathan Billington, Jonathan Moore, Jonathan Silvera, Jordi Ros, Joris Dobbelsteen, Josh Cohen, Julien Pierre, Jungshik Shin, Justin Chapweske, Justin Erenkrantz, Justin James, Kalvinder Singh, Karl Dubost, Kathleen Moriarty, Keith Hoffman, Keith Moore, Ken Murchison, Koen Holtman, Konstantin Voronkov, Kris Zyp, Leif Hedstrom, Lionel Morand, Lisa Dusseault, Maciej Stachowiak, Manu Sporny, Marc Schneider, Marc Slemko, Mark Baker, Mark Pauley, Mark Watson, Markus Isomaki, Markus Lanthaler, Martin J. Duerst, Martin Musatov, Martin Nilsson, Martin Thomson, Matt Lynch, Matthew Cox, Matthew Kerwin, Max Clark, Menachem Dodge, Meral Shirazipour, Michael Burrows, Michael Hausenblas, Michael Scharf, Michael Sweet, Michael Tuexen, Michael Welzl, Mike Amundsen, Mike Belshe, Mike Bishop, Mike Kelly, Mike Schinkel, Miles Sabin, Murray S. Kucherawy, Mykyta Yevstifeyev, Nathan Rixham, Nicholas Shanks, Nico Williams, Nicolas Alvarez, Nicolas Mailhot, Noah Slater, Osama Mazahir, Pablo Castro, Pat Hayes, Patrick R. McManus, Paul E. Jones, Paul Hoffman, Paul Marquess, Pete Resnick, Peter Lepeska, Peter Occil, Peter Saint-Andre, Peter Watkins, Phil Archer, Phil Hunt, Philippe Mougin, Phillip Hallam-Baker, Piotr Dobrogost, Poul-Henning Kamp, Preethi Natarajan, Rajeev Bector, Ray Polk, Reto Bachmann-Gmuer, Richard Barnes, Richard Cyganiak, Rob Trace, Robby Simpson, Robert Brewer, Robert Collins, Robert Mattson, Robert O'Callahan, Robert Olofsson, Robert Sayre, Robert Siemer, Robert de Wilde, Roberto Javier Godoy, Roberto Peon, Roland Zink, Ronny Widjaja, Ryan Hamilton, S. Mike Dierken, Salvatore Loreto, Sam Johnston, Sam Pullara, Sam Ruby, Saurabh Kulkarni, Scott Lawrence (who maintained the original issues list), Sean B. Palmer, Sean Turner, Sebastien Barnoud, Shane McCarron, Shigeki Ohtsu, Simon Yarde, Stefan Eissing, Stefan Tilkov, Stefanos Harhalakis, Stephane Bortzmeyer, Stephen Farrell, Stephen Kent, Stephen Ludin, Stuart Williams, Subbu Allamaraju, Subramanian Moonesamy, Susan Hares, Sylvain Hellegouarch, Tapan Divekar, Tatsuhiro Tsujikawa, Tatsuya Hayashi, Ted Hardie, Ted Lemon, Thomas Broyer, Thomas Fossati, Thomas Maslen, Thomas Nadeau, Thomas Nordin, Thomas Roessler, Tim Bray, Tim Morgan, Tim Olsen, Tom Zhou, Travis Snoozy, Tyler Close, Vincent Murphy, Wenbo Zhu, Werner Baumann, Wilbur Streett, Wilfredo Sanchez Vega, William A. Rowe Jr., William Chan, Willy Tarreau, Xiaoshu Wang, Yaron Goland, Yngve Nysaeter Pettersen, Yoav Nir, Yogesh Bang, Yuchung Cheng, Yutaka Oiwa, Yves Lafon (long-time member of the editor team), Zed A. Shaw, and Zhong Yu.<a class="self" href="#rfc.section.10.p.3">&para;</a></p></div><div id="rfc.section.10.p.4"><p>See <a href="https://tools.ietf.org/html/rfc2616#section-16">Section 16</a> of <a href="#RFC2616" id="rfc.xref.RFC2616.4"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2616]</cite></a> for additional acknowledgements from prior revisions.<a class="self" href="#rfc.section.10.p.4">&para;</a></p></div></div><h1 id="rfc.references"><a id="rfc.section.11" href="#rfc.section.11">11.</a> References</h1><h2 id="rfc.references.1"><a href="#rfc.section.11.1" id="rfc.section.11.1">11.1</a> Normative References</h2><table><tr><td class="reference"><b id="RFC0793">[RFC0793]</b></td><td class="top">Postel, J., &#8220;<a href="https://tools.ietf.org/html/rfc793">Transmission Control Protocol</a>&#8221;, STD&nbsp;7, RFC&nbsp;793, September&nbsp;1981.</td></tr><tr><td class="reference"><b id="RFC1950">[RFC1950]</b></td><td class="top">Deutsch, L. and J-L. Gailly, &#8220;<a href="https://tools.ietf.org/html/rfc1950">ZLIB Compressed Data Format Specification version 3.3</a>&#8221;, RFC&nbsp;1950, May&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC1951">[RFC1951]</b></td><td class="top">Deutsch, P., &#8220;<a href="https://tools.ietf.org/html/rfc1951">DEFLATE Compressed Data Format Specification version 1.3</a>&#8221;, RFC&nbsp;1951, May&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC1952">[RFC1952]</b></td><td class="top">Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and G. Randers-Pehrson, &#8220;<a href="https://tools.ietf.org/html/rfc1952">GZIP file format specification version 4.3</a>&#8221;, RFC&nbsp;1952, May&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC2119">[RFC2119]</b></td><td class="top">Bradner, S., &#8220;<a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>&#8221;, BCP&nbsp;14, RFC&nbsp;2119, March&nbsp;1997.</td></tr><tr><td class="reference"><b id="RFC3986">[RFC3986]</b></td><td class="top">Berners-Lee, T., Fielding, R., and L. Masinter, &#8220;<a href="https://tools.ietf.org/html/rfc3986">Uniform Resource Identifier (URI): Generic Syntax</a>&#8221;, STD&nbsp;66, RFC&nbsp;3986, January&nbsp;2005.</td></tr><tr><td class="reference"><b id="RFC5234">[RFC5234]</b></td><td class="top">Crocker, D., Ed. and P. Overell, &#8220;<a href="https://tools.ietf.org/html/rfc5234">Augmented BNF for Syntax Specifications: ABNF</a>&#8221;, STD&nbsp;68, RFC&nbsp;5234, January&nbsp;2008.</td></tr><tr><td class="reference"><b id="RFC7231">[RFC7231]</b></td><td class="top">Fielding, R., Ed. and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7231">Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</a>&#8221;, RFC&nbsp;7231, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="RFC7232">[RFC7232]</b></td><td class="top">Fielding, R., Ed. and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7232">Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</a>&#8221;, RFC&nbsp;7232, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="RFC7233">[RFC7233]</b></td><td class="top">Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7233">Hypertext Transfer Protocol (HTTP/1.1): Range Requests</a>&#8221;, RFC&nbsp;7233, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="RFC7234">[RFC7234]</b></td><td class="top">Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7234">Hypertext Transfer Protocol (HTTP/1.1): Caching</a>&#8221;, RFC&nbsp;7234, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="RFC7235">[RFC7235]</b></td><td class="top">Fielding, R., Ed. and J. Reschke, Ed., &#8220;<a href="https://tools.ietf.org/html/rfc7235">Hypertext Transfer Protocol (HTTP/1.1): Authentication</a>&#8221;, RFC&nbsp;7235, June&nbsp;2014.</td></tr><tr><td class="reference"><b id="USASCII">[USASCII]</b></td><td class="top">American National Standards Institute, &#8220;Coded Character Set -- 7-bit American Standard Code for Information Interchange&#8221;, ANSI&nbsp;X3.4, 1986.</td></tr><tr><td class="reference"><b id="Welch">[Welch]</b></td><td class="top">Welch, T., &#8220;A Technique for High-Performance Data Compression&#8221;, IEEE Computer&nbsp;17(6), June&nbsp;1984.</td></tr></table><h2 id="rfc.references.2"><a href="#rfc.section.11.2" id="rfc.section.11.2">11.2</a> Informative References</h2><table><tr><td class="reference"><b id="BCP115">[BCP115]</b></td><td class="top">Hansen, T., Hardie, T., and L. Masinter, &#8220;<a href="https://tools.ietf.org/html/rfc4395">Guidelines and Registration Procedures for New URI Schemes</a>&#8221;, BCP&nbsp;115, RFC&nbsp;4395, February&nbsp;2006.</td></tr><tr><td class="reference"><b id="BCP13">[BCP13]</b></td><td class="top">Freed, N., Klensin, J., and T. Hansen, &#8220;<a href="https://tools.ietf.org/html/rfc6838">Media Type Specifications and Registration Procedures</a>&#8221;, BCP&nbsp;13, RFC&nbsp;6838, January&nbsp;2013.</td></tr><tr><td class="reference"><b id="BCP90">[BCP90]</b></td><td class="top">Klyne, G., Nottingham, M., and J. Mogul, &#8220;<a href="https://tools.ietf.org/html/rfc3864">Registration Procedures for Message Header Fields</a>&#8221;, BCP&nbsp;90, RFC&nbsp;3864, September&nbsp;2004.</td></tr><tr><td class="reference"><b id="Georgiev">[Georgiev]</b></td><td class="top">Georgiev, M., Iyengar, S., Jana, S., Anubhai, R., Boneh, D., and V. Shmatikov, &#8220;<a href="http://doi.acm.org/10.1145/2382196.2382204">The Most Dangerous Code in the World: Validating SSL Certificates in Non-browser Software</a>&#8221;, In Proceedings of the 2012 ACM Conference on Computer and Communications Security (CCS '12), pp. 38-49, October&nbsp;2012, &lt;<a href="http://doi.acm.org/10.1145/2382196.2382204">http://doi.acm.org/10.1145/2382196.2382204</a>&gt;.</td></tr><tr><td class="reference"><b id="ISO-8859-1">[ISO-8859-1]</b></td><td class="top">International Organization for Standardization, &#8220;Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1&#8221;, ISO/IEC&nbsp;8859-1:1998, 1998.</td></tr><tr><td class="reference"><b id="Klein">[Klein]</b></td><td class="top">Klein, A., &#8220;<a href="http://packetstormsecurity.com/papers/general/whitepaper_httpresponse.pdf">Divide and Conquer - HTTP Response Splitting, Web Cache Poisoning Attacks, and Related Topics</a>&#8221;, March&nbsp;2004, &lt;<a href="http://packetstormsecurity.com/papers/general/whitepaper_httpresponse.pdf">http://packetstormsecurity.com/papers/general/whitepaper_httpresponse.pdf</a>&gt;.</td></tr><tr><td class="reference"><b id="Kri2001">[Kri2001]</b></td><td class="top">Kristol, D., &#8220;<a href="http://arxiv.org/abs/cs.SE/0105018">HTTP Cookies: Standards, Privacy, and Politics</a>&#8221;, ACM Transactions on Internet Technology&nbsp;1(2), November&nbsp;2001, &lt;<a href="http://arxiv.org/abs/cs.SE/0105018">http://arxiv.org/abs/cs.SE/0105018</a>&gt;.</td></tr><tr><td class="reference"><b id="Linhart">[Linhart]</b></td><td class="top">Linhart, C., Klein, A., Heled, R., and S. Orrin, &#8220;<a href="http://www.watchfire.com/news/whitepapers.aspx">HTTP Request Smuggling</a>&#8221;, June&nbsp;2005, &lt;<a href="http://www.watchfire.com/news/whitepapers.aspx">http://www.watchfire.com/news/whitepapers.aspx</a>&gt;.</td></tr><tr><td class="reference"><b id="RFC1919">[RFC1919]</b></td><td class="top">Chatel, M., &#8220;<a href="https://tools.ietf.org/html/rfc1919">Classical versus Transparent IP Proxies</a>&#8221;, RFC&nbsp;1919, March&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC1945">[RFC1945]</b></td><td class="top">Berners-Lee, T., Fielding, R., and H. Nielsen, &#8220;<a href="https://tools.ietf.org/html/rfc1945">Hypertext Transfer Protocol -- HTTP/1.0</a>&#8221;, RFC&nbsp;1945, May&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC2045">[RFC2045]</b></td><td class="top">Freed, N. and N. Borenstein, &#8220;<a href="https://tools.ietf.org/html/rfc2045">Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies</a>&#8221;, RFC&nbsp;2045, November&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC2047">[RFC2047]</b></td><td class="top">Moore, K., &#8220;<a href="https://tools.ietf.org/html/rfc2047">MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text</a>&#8221;, RFC&nbsp;2047, November&nbsp;1996.</td></tr><tr><td class="reference"><b id="RFC2068">[RFC2068]</b></td><td class="top">Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. Berners-Lee, &#8220;<a href="https://tools.ietf.org/html/rfc2068">Hypertext Transfer Protocol -- HTTP/1.1</a>&#8221;, RFC&nbsp;2068, January&nbsp;1997.</td></tr><tr><td class="reference"><b id="RFC2145">[RFC2145]</b></td><td class="top">Mogul, J., Fielding, R., Gettys, J., and H. Nielsen, &#8220;<a href="https://tools.ietf.org/html/rfc2145">Use and Interpretation of HTTP Version Numbers</a>&#8221;, RFC&nbsp;2145, May&nbsp;1997.</td></tr><tr><td class="reference"><b id="RFC2616">[RFC2616]</b></td><td class="top">Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &#8220;<a href="https://tools.ietf.org/html/rfc2616">Hypertext Transfer Protocol -- HTTP/1.1</a>&#8221;, RFC&nbsp;2616, June&nbsp;1999.</td></tr><tr><td class="reference"><b id="RFC2817">[RFC2817]</b></td><td class="top">Khare, R. and S. Lawrence, &#8220;<a href="https://tools.ietf.org/html/rfc2817">Upgrading to TLS Within HTTP/1.1</a>&#8221;, RFC&nbsp;2817, May&nbsp;2000.</td></tr><tr><td class="reference"><b id="RFC2818">[RFC2818]</b></td><td class="top">Rescorla, E., &#8220;<a href="https://tools.ietf.org/html/rfc2818">HTTP Over TLS</a>&#8221;, RFC&nbsp;2818, May&nbsp;2000.</td></tr><tr><td class="reference"><b id="RFC3040">[RFC3040]</b></td><td class="top">Cooper, I., Melve, I., and G. Tomlinson, &#8220;<a href="https://tools.ietf.org/html/rfc3040">Internet Web Replication and Caching Taxonomy</a>&#8221;, RFC&nbsp;3040, January&nbsp;2001.</td></tr><tr><td class="reference"><b id="RFC4033">[RFC4033]</b></td><td class="top">Arends, R., Austein, R., Larson, M., Massey, D., and S. Rose, &#8220;<a href="https://tools.ietf.org/html/rfc4033">DNS Security Introduction and Requirements</a>&#8221;, RFC&nbsp;4033, March&nbsp;2005.</td></tr><tr><td class="reference"><b id="RFC4559">[RFC4559]</b></td><td class="top">Jaganathan, K., Zhu, L., and J. Brezak, &#8220;<a href="https://tools.ietf.org/html/rfc4559">SPNEGO-based Kerberos and NTLM HTTP Authentication in Microsoft Windows</a>&#8221;, RFC&nbsp;4559, June&nbsp;2006.</td></tr><tr><td class="reference"><b id="RFC5226">[RFC5226]</b></td><td class="top">Narten, T. and H. Alvestrand, &#8220;<a href="https://tools.ietf.org/html/rfc5226">Guidelines for Writing an IANA Considerations Section in RFCs</a>&#8221;, BCP&nbsp;26, RFC&nbsp;5226, May&nbsp;2008.</td></tr><tr><td class="reference"><b id="RFC5246">[RFC5246]</b></td><td class="top">Dierks, T. and E. Rescorla, &#8220;<a href="https://tools.ietf.org/html/rfc5246">The Transport Layer Security (TLS) Protocol Version 1.2</a>&#8221;, RFC&nbsp;5246, August&nbsp;2008.</td></tr><tr><td class="reference"><b id="RFC5322">[RFC5322]</b></td><td class="top">Resnick, P., &#8220;<a href="https://tools.ietf.org/html/rfc5322">Internet Message Format</a>&#8221;, RFC&nbsp;5322, October&nbsp;2008.</td></tr><tr><td class="reference"><b id="RFC6265">[RFC6265]</b></td><td class="top">Barth, A., &#8220;<a href="https://tools.ietf.org/html/rfc6265">HTTP State Management Mechanism</a>&#8221;, RFC&nbsp;6265, April&nbsp;2011.</td></tr><tr><td class="reference"><b id="RFC6585">[RFC6585]</b></td><td class="top">Nottingham, M. and R. Fielding, &#8220;<a href="https://tools.ietf.org/html/rfc6585">Additional HTTP Status Codes</a>&#8221;, RFC&nbsp;6585, April&nbsp;2012.</td></tr></table><div id="compatibility"><h1 id="rfc.section.A" class="np"><a href="#rfc.section.A">A.</a>&nbsp;<a href="#compatibility">HTTP Version History</a></h1><div id="rfc.section.A.p.1"><p>HTTP has been in use since 1990. The first version, later referred to as HTTP/0.9, was a simple protocol for hypertext data transfer across the Internet, using only a single request method (GET) and no metadata. HTTP/1.0, as defined by <a href="#RFC1945" id="rfc.xref.RFC1945.3"><cite title="Hypertext Transfer Protocol -- HTTP/1.0">[RFC1945]</cite></a>, added a range of request methods and MIME-like messaging, allowing for metadata to be transferred and modifiers placed on the request/response semantics. However, HTTP/1.0 did not sufficiently take into consideration the effects of hierarchical proxies, caching, the need for persistent connections, or name-based virtual hosts. The proliferation of incompletely implemented applications calling themselves "HTTP/1.0" further necessitated a protocol version change in order for two communicating applications to determine each other's true capabilities.<a class="self" href="#rfc.section.A.p.1">&para;</a></p></div><div id="rfc.section.A.p.2"><p>HTTP/1.1 remains compatible with HTTP/1.0 by including more stringent requirements that enable reliable implementations, adding only those features that can either be safely ignored by an HTTP/1.0 recipient or only be sent when communicating with a party advertising conformance with HTTP/1.1.<a class="self" href="#rfc.section.A.p.2">&para;</a></p></div><div id="rfc.section.A.p.3"><p>HTTP/1.1 has been designed to make supporting previous versions easy. A general-purpose HTTP/1.1 server ought to be able to understand any valid request in the format of HTTP/1.0, responding appropriately with an HTTP/1.1 message that only uses features understood (or safely ignored) by HTTP/1.0 clients. Likewise, an HTTP/1.1 client can be expected to understand any valid HTTP/1.0 response.<a class="self" href="#rfc.section.A.p.3">&para;</a></p></div><div id="rfc.section.A.p.4"><p>Since HTTP/0.9 did not support header fields in a request, there is no mechanism for it to support name-based virtual hosts (selection of resource by inspection of the <a href="#header.host" class="smpl">Host</a> header field). Any server that implements name-based virtual hosts ought to disable support for HTTP/0.9. Most requests that appear to be HTTP/0.9 are, in fact, badly constructed HTTP/1.x requests caused by a client failing to properly encode the request-target.<a class="self" href="#rfc.section.A.p.4">&para;</a></p></div><div id="changes.from.1.0"><h2 id="rfc.section.A.1"><a href="#rfc.section.A.1">A.1</a>&nbsp;<a href="#changes.from.1.0">Changes from HTTP/1.0</a></h2><div id="rfc.section.A.1.p.1"><p>This section summarizes major differences between versions HTTP/1.0 and HTTP/1.1.<a class="self" href="#rfc.section.A.1.p.1">&para;</a></p></div><div id="changes.to.simplify.multihomed.web.servers.and.conserve.ip.addresses"><h3 id="rfc.section.A.1.1"><a href="#rfc.section.A.1.1">A.1.1</a>&nbsp;<a href="#changes.to.simplify.multihomed.web.servers.and.conserve.ip.addresses">Multihomed Web Servers</a></h3><div id="rfc.section.A.1.1.p.1"><p>The requirements that clients and servers support the <a href="#header.host" class="smpl">Host</a> header field (<a href="#header.host" id="rfc.xref.header.host.3" title="Host">Section&nbsp;5.4</a>), report an error if it is missing from an HTTP/1.1 request, and accept absolute URIs (<a href="#request-target" title="Request Target">Section&nbsp;5.3</a>) are among the most important changes defined by HTTP/1.1.<a class="self" href="#rfc.section.A.1.1.p.1">&para;</a></p></div><div id="rfc.section.A.1.1.p.2"><p>Older HTTP/1.0 clients assumed a one-to-one relationship of IP addresses and servers; there was no other established mechanism for distinguishing the intended server of a request than the IP address to which that request was directed. The <a href="#header.host" class="smpl">Host</a> header field was introduced during the development of HTTP/1.1 and, though it was quickly implemented by most HTTP/1.0 browsers, additional requirements were placed on all HTTP/1.1 requests in order to ensure complete adoption. At the time of this writing, most HTTP-based services are dependent upon the Host header field for targeting requests.<a class="self" href="#rfc.section.A.1.1.p.2">&para;</a></p></div></div><div id="compatibility.with.http.1.0.persistent.connections"><h3 id="rfc.section.A.1.2"><a href="#rfc.section.A.1.2">A.1.2</a>&nbsp;<a href="#compatibility.with.http.1.0.persistent.connections">Keep-Alive Connections</a></h3><div id="rfc.section.A.1.2.p.1"><p>In HTTP/1.0, each connection is established by the client prior to the request and closed by the server after sending the response. However, some implementations implement the explicitly negotiated ("Keep-Alive") version of persistent connections described in <a href="https://tools.ietf.org/html/rfc2068#section-19.7.1">Section 19.7.1</a> of <a href="#RFC2068" id="rfc.xref.RFC2068.4"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a>.<a class="self" href="#rfc.section.A.1.2.p.1">&para;</a></p></div><div id="rfc.section.A.1.2.p.2"><p>Some clients and servers might wish to be compatible with these previous approaches to persistent connections, by explicitly negotiating for them with a "Connection: keep-alive" request header field. However, some experimental implementations of HTTP/1.0 persistent connections are faulty; for example, if an HTTP/1.0 proxy server doesn't understand <a href="#header.connection" class="smpl">Connection</a>, it will erroneously forward that header field to the next inbound server, which would result in a hung connection.<a class="self" href="#rfc.section.A.1.2.p.2">&para;</a></p></div><div id="rfc.section.A.1.2.p.3"><p>One attempted solution was the introduction of a Proxy-Connection header field, targeted specifically at proxies. In practice, this was also unworkable, because proxies are often deployed in multiple layers, bringing about the same problem discussed above.<a class="self" href="#rfc.section.A.1.2.p.3">&para;</a></p></div><div id="rfc.section.A.1.2.p.4"><p>As a result, clients are encouraged not to send the Proxy-Connection header field in any requests.<a class="self" href="#rfc.section.A.1.2.p.4">&para;</a></p></div><div id="rfc.section.A.1.2.p.5"><p>Clients are also encouraged to consider the use of Connection: keep-alive in requests carefully; while they can enable persistent connections with HTTP/1.0 servers, clients using them will need to monitor the connection for "hung" requests (which indicate that the client ought stop sending the header field), and this mechanism ought not be used by clients at all when a proxy is being used.<a class="self" href="#rfc.section.A.1.2.p.5">&para;</a></p></div></div><div id="introduction.of.transfer-encoding"><h3 id="rfc.section.A.1.3"><a href="#rfc.section.A.1.3">A.1.3</a>&nbsp;<a href="#introduction.of.transfer-encoding">Introduction of Transfer-Encoding</a></h3><div id="rfc.section.A.1.3.p.1"><p>HTTP/1.1 introduces the <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> header field (<a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.4" title="Transfer-Encoding">Section&nbsp;3.3.1</a>). Transfer codings need to be decoded prior to forwarding an HTTP message over a MIME-compliant protocol.<a class="self" href="#rfc.section.A.1.3.p.1">&para;</a></p></div></div></div><div id="changes.from.rfc.2616"><h2 id="rfc.section.A.2"><a href="#rfc.section.A.2">A.2</a>&nbsp;<a href="#changes.from.rfc.2616">Changes from RFC 2616</a></h2><div id="rfc.section.A.2.p.1"><p>HTTP's approach to error handling has been explained. (<a href="#conformance" title="Conformance and Error Handling">Section&nbsp;2.5</a>)<a class="self" href="#rfc.section.A.2.p.1">&para;</a></p></div><div id="rfc.section.A.2.p.2"><p>The HTTP-version ABNF production has been clarified to be case-sensitive. Additionally, version numbers have been restricted to single digits, due to the fact that implementations are known to handle multi-digit version numbers incorrectly. (<a href="#http.version" title="Protocol Versioning">Section&nbsp;2.6</a>)<a class="self" href="#rfc.section.A.2.p.2">&para;</a></p></div><div id="rfc.section.A.2.p.3"><p>Userinfo (i.e., username and password) are now disallowed in HTTP and HTTPS URIs, because of security issues related to their transmission on the wire. (<a href="#http.uri" title="http URI Scheme">Section&nbsp;2.7.1</a>)<a class="self" href="#rfc.section.A.2.p.3">&para;</a></p></div><div id="rfc.section.A.2.p.4"><p>The HTTPS URI scheme is now defined by this specification; previously, it was done in <a href="https://tools.ietf.org/html/rfc2818#section-2.4">Section 2.4</a> of <a href="#RFC2818" id="rfc.xref.RFC2818.4"><cite title="HTTP Over TLS">[RFC2818]</cite></a>. Furthermore, it implies end-to-end security. (<a href="#https.uri" title="https URI Scheme">Section&nbsp;2.7.2</a>)<a class="self" href="#rfc.section.A.2.p.4">&para;</a></p></div><div id="rfc.section.A.2.p.5"><p>HTTP messages can be (and often are) buffered by implementations; despite it sometimes being available as a stream, HTTP is fundamentally a message-oriented protocol. Minimum supported sizes for various protocol elements have been suggested, to improve interoperability. (<a href="#http.message" title="Message Format">Section&nbsp;3</a>)<a class="self" href="#rfc.section.A.2.p.5">&para;</a></p></div><div id="rfc.section.A.2.p.6"><p>Invalid whitespace around field-names is now required to be rejected, because accepting it represents a security vulnerability. The ABNF productions defining header fields now only list the field value. (<a href="#header.fields" title="Header Fields">Section&nbsp;3.2</a>)<a class="self" href="#rfc.section.A.2.p.6">&para;</a></p></div><div id="rfc.section.A.2.p.7"><p>Rules about implicit linear whitespace between certain grammar productions have been removed; now whitespace is only allowed where specifically defined in the ABNF. (<a href="#whitespace" title="Whitespace">Section&nbsp;3.2.3</a>)<a class="self" href="#rfc.section.A.2.p.7">&para;</a></p></div><div id="rfc.section.A.2.p.8"><p>Header fields that span multiple lines ("line folding") are deprecated. (<a href="#field.parsing" title="Field Parsing">Section&nbsp;3.2.4</a>)<a class="self" href="#rfc.section.A.2.p.8">&para;</a></p></div><div id="rfc.section.A.2.p.9"><p>The NUL octet is no longer allowed in comment and quoted-string text, and handling of backslash-escaping in them has been clarified. The quoted-pair rule no longer allows escaping control characters other than HTAB. Non-US-ASCII content in header fields and the reason phrase has been obsoleted and made opaque (the TEXT rule was removed). (<a href="#field.components" title="Field Value Components">Section&nbsp;3.2.6</a>)<a class="self" href="#rfc.section.A.2.p.9">&para;</a></p></div><div id="rfc.section.A.2.p.10"><p>Bogus <a href="#header.content-length" class="smpl">Content-Length</a> header fields are now required to be handled as errors by recipients. (<a href="#header.content-length" id="rfc.xref.header.content-length.2" title="Content-Length">Section&nbsp;3.3.2</a>)<a class="self" href="#rfc.section.A.2.p.10">&para;</a></p></div><div id="rfc.section.A.2.p.11"><p>The algorithm for determining the message body length has been clarified to indicate all of the special cases (e.g., driven by methods or status codes) that affect it, and that new protocol elements cannot define such special cases. CONNECT is a new, special case in determining message body length. "multipart/byteranges" is no longer a way of determining message body length detection. (<a href="#message.body.length" title="Message Body Length">Section&nbsp;3.3.3</a>)<a class="self" href="#rfc.section.A.2.p.11">&para;</a></p></div><div id="rfc.section.A.2.p.12"><p>The "identity" transfer coding token has been removed. (Sections <a href="#message.body" title="Message Body">3.3</a> and <a href="#transfer.codings" title="Transfer Codings">4</a>)<a class="self" href="#rfc.section.A.2.p.12">&para;</a></p></div><div id="rfc.section.A.2.p.13"><p>Chunk length does not include the count of the octets in the chunk header and trailer. Line folding in chunk extensions is disallowed. (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section&nbsp;4.1</a>)<a class="self" href="#rfc.section.A.2.p.13">&para;</a></p></div><div id="rfc.section.A.2.p.14"><p>The meaning of the "deflate" content coding has been clarified. (<a href="#deflate.coding" title="Deflate Coding">Section&nbsp;4.2.2</a>)<a class="self" href="#rfc.section.A.2.p.14">&para;</a></p></div><div id="rfc.section.A.2.p.15"><p>The segment + query components of RFC 3986 have been used to define the request-target, instead of abs_path from RFC 1808. The asterisk-form of the request-target is only allowed with the OPTIONS method. (<a href="#request-target" title="Request Target">Section&nbsp;5.3</a>)<a class="self" href="#rfc.section.A.2.p.15">&para;</a></p></div><div id="rfc.section.A.2.p.16"><p>The term "Effective Request URI" has been introduced. (<a href="#effective.request.uri" title="Effective Request URI">Section&nbsp;5.5</a>)<a class="self" href="#rfc.section.A.2.p.16">&para;</a></p></div><div id="rfc.section.A.2.p.17"><p>Gateways do not need to generate <a href="#header.via" class="smpl">Via</a> header fields anymore. (<a href="#header.via" id="rfc.xref.header.via.2" title="Via">Section&nbsp;5.7.1</a>)<a class="self" href="#rfc.section.A.2.p.17">&para;</a></p></div><div id="rfc.section.A.2.p.18"><p>Exactly when "close" connection options have to be sent has been clarified. Also, "hop-by-hop" header fields are required to appear in the Connection header field; just because they're defined as hop-by-hop in this specification doesn't exempt them. (<a href="#header.connection" id="rfc.xref.header.connection.8" title="Connection">Section&nbsp;6.1</a>)<a class="self" href="#rfc.section.A.2.p.18">&para;</a></p></div><div id="rfc.section.A.2.p.19"><p>The limit of two connections per server has been removed. An idempotent sequence of requests is no longer required to be retried. The requirement to retry requests under certain circumstances when the server prematurely closes the connection has been removed. Also, some extraneous requirements about when servers are allowed to close connections prematurely have been removed. (<a href="#persistent.connections" title="Persistence">Section&nbsp;6.3</a>)<a class="self" href="#rfc.section.A.2.p.19">&para;</a></p></div><div id="rfc.section.A.2.p.20"><p>The semantics of the <a href="#header.upgrade" class="smpl">Upgrade</a> header field is now defined in responses other than 101 (this was incorporated from <a href="#RFC2817" id="rfc.xref.RFC2817.3"><cite title="Upgrading to TLS Within HTTP/1.1">[RFC2817]</cite></a>). Furthermore, the ordering in the field value is now significant. (<a href="#header.upgrade" id="rfc.xref.header.upgrade.3" title="Upgrade">Section&nbsp;6.7</a>)<a class="self" href="#rfc.section.A.2.p.20">&para;</a></p></div><div id="rfc.section.A.2.p.21"><p>Empty list elements in list productions (e.g., a list header field containing ", ,") have been deprecated. (<a href="#abnf.extension" title="ABNF List Extension: #rule">Section&nbsp;7</a>)<a class="self" href="#rfc.section.A.2.p.21">&para;</a></p></div><div id="rfc.section.A.2.p.22"><p>Registration of Transfer Codings now requires IETF Review (<a href="#transfer.coding.registry" title="Transfer Coding Registry">Section&nbsp;8.4</a>)<a class="self" href="#rfc.section.A.2.p.22">&para;</a></p></div><div id="rfc.section.A.2.p.23"><p>This specification now defines the Upgrade Token Registry, previously defined in <a href="https://tools.ietf.org/html/rfc2817#section-7.2">Section 7.2</a> of <a href="#RFC2817" id="rfc.xref.RFC2817.4"><cite title="Upgrading to TLS Within HTTP/1.1">[RFC2817]</cite></a>. (<a href="#upgrade.token.registry" title="Upgrade Token Registry">Section&nbsp;8.6</a>)<a class="self" href="#rfc.section.A.2.p.23">&para;</a></p></div><div id="rfc.section.A.2.p.24"><p>The expectation to support HTTP/0.9 requests has been removed. (<a href="#compatibility" title="HTTP Version History">Appendix&nbsp;A</a>)<a class="self" href="#rfc.section.A.2.p.24">&para;</a></p></div><div id="rfc.section.A.2.p.25"><p>Issues with the Keep-Alive and Proxy-Connection header fields in requests are pointed out, with use of the latter being discouraged altogether. (<a href="#compatibility.with.http.1.0.persistent.connections" title="Keep-Alive Connections">Appendix&nbsp;A.1.2</a>)<a class="self" href="#rfc.section.A.2.p.25">&para;</a></p></div></div></div><div id="collected.abnf"><h1 id="rfc.section.B"><a href="#rfc.section.B">B.</a>&nbsp;<a href="#collected.abnf">Collected ABNF</a></h1><div id="rfc.figure.u.72"><pre class="inline"><a href="#rule.whitespace" class="smpl">BWS</a> = OWS 
    741721 
    742722<a href="#header.connection" class="smpl">Connection</a> = *( "," OWS ) connection-option *( OWS "," [ OWS 
  • specs/rfc7231.html

    r2732 r2733  
    4141        } 
    4242         
    43         insertErrata(rfcno, cont); 
    44    
    45         cont.style.display = "block"; 
    46       } else { 
    47         console.error(xhr.statusText); 
    48       } 
    49     } 
    50   }; 
    51   xhr.onerror = function (e) { 
    52     console.error(xhr.status + " " + xhr.statusText); 
    53   }; 
    54   xhr.send(null); 
    55 } 
    56  
    57 function insertErrata(rfcno, container) { 
    58   var xhr = new XMLHttpRequest(); 
    59   xhr.open("GET", "http://greenbytes.de/tech/webdav/rfcerrata.raw", true); 
    60   xhr.onload = function (e) { 
    61     if (xhr.readyState === 4) { 
    62       if (xhr.status === 200) { 
    63         var t = "\n" + xhr.responseText + "\n"; 
    64         if (t.indexOf(rfcno) >= 0) { 
    65           container.appendChild(newElement("br")); 
     43        c = getChildByName(info, "errata"); 
     44        if (c !== null) { 
     45          cont.appendChild(newElement("br")); 
    6646          var link = newElementWithText("a", "errata"); 
    6747          link.setAttribute("href", "http://www.rfc-editor.org/errata_search.php?rfc=" + rfcno); 
     
    6949          errata.appendChild(link); 
    7050          errata.appendChild(newText(".")); 
    71           container.appendChild(errata); 
     51          cont.appendChild(errata); 
    7252        } 
     53 
     54        cont.style.display = "block"; 
    7355      } else { 
    7456        console.error(xhr.statusText); 
     
    146128body { 
    147129  color: black; 
    148   font-family: cambria, helvetica, arial, sans-serif; 
     130  font-family: cambria, georgia, serif; 
    149131  font-size: 12pt; 
    150132  margin: 2em auto; 
     
    152134} 
    153135samp, tt, code, pre { 
    154   font-family: consolas, monospace; 
     136  font-family: consolas, monaco, monospace; 
    155137} 
    156138cite { 
     
    234216  background-color: white; 
    235217  padding: 0em; 
     218  page-break-inside: auto; 
    236219} 
    237220pre.text { 
     
    361344} 
    362345.title, .filename, h1, h2, h3, h4 { 
    363   font-family: candara, helvetica, arial, sans-serif; 
    364 } 
    365 samp, tt, code, pre { 
    366   font: consolas, monospace; 
     346  font-family: candara, calibri, segoe, optima, arial, sans-serif; 
    367347} 
    368348ul.ind, ul.ind ul { 
     
    478458  } 
    479459 
    480   ul.toc a:nth-child(2)::after { 
     460  ul.toc a:last-child::after { 
    481461    content: leader('.') target-counter(attr(href), page); 
    482462  } 
     
    529509    } 
    530510} 
    531 </style><link rel="Contents" href="#rfc.toc"><link rel="Author" href="#rfc.authors"><link rel="Copyright" href="#rfc.copyrightnotice"><link rel="Index" href="#rfc.index"><link rel="Chapter" title="1 Introduction" href="#rfc.section.1"><link rel="Chapter" title="2 Resources" href="#rfc.section.2"><link rel="Chapter" title="3 Representations" href="#rfc.section.3"><link rel="Chapter" title="4 Request Methods" href="#rfc.section.4"><link rel="Chapter" title="5 Request Header Fields" href="#rfc.section.5"><link rel="Chapter" title="6 Response Status Codes" href="#rfc.section.6"><link rel="Chapter" title="7 Response Header Fields" href="#rfc.section.7"><link rel="Chapter" title="8 IANA Considerations" href="#rfc.section.8"><link rel="Chapter" title="9 Security Considerations" href="#rfc.section.9"><link rel="Chapter" title="10 Acknowledgments" href="#rfc.section.10"><link rel="Chapter" href="#rfc.section.11" title="11 References"><link rel="Appendix" title="A Differences between HTTP and MIME" href="#rfc.section.A"><link rel="Appendix" title="B Changes from RFC 2616" href="#rfc.section.B"><link rel="Appendix" title="C Imported ABNF" href="#rfc.section.C"><link rel="Appendix" title="D Collected ABNF" href="#rfc.section.D"><link href="rfc7230.html" rel="prev"><link href="rfc7232.html" rel="next"><link rel="Alternate" title="Authorative ASCII Version" href="http://www.ietf.org/rfc/rfc7231.txt"><link rel="Help" title="RFC-Editor's Status Page" href="http://www.rfc-editor.org/info/rfc7231"><link rel="Help" title="Additional Information on tools.ietf.org" href="http://tools.ietf.org/html/rfc7231"><meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1.662, 2014/07/19 09:19:17, XSLT vendor: SAXON 6.5.5 from Michael Kay http://saxon.sf.net/"><meta name="keywords" content="Hypertext Transfer Protocol, HTTP, HTTP semantics, HTTP payload, HTTP content, HTTP method, HTTP status code"><link rel="schema.dct" href="http://purl.org/dc/terms/"><meta name="dct.creator" content="Fielding, R."><meta name="dct.creator" content="Reschke, J. F."><meta name="dct.identifier" content="urn:ietf:rfc:7231"><meta name="dct.issued" scheme="ISO8601" content="2014-06"><meta name="dct.replaces" content="urn:ietf:rfc:2616"><meta name="dct.abstract" content="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."><meta name="dct.isPartOf" content="urn:issn:2070-1721"><meta name="description" content="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."></head><body onload="getMeta(7231,&#34;rfc.meta&#34;);"><table class="header" id="rfc.headerblock"><tbody><tr><td class="left">Internet Engineering Task Force (IETF)</td><td class="right">R. Fielding, Editor</td></tr><tr><td class="left">Request for Comments: 7231</td><td class="right">Adobe</td></tr><tr><td class="left">Obsoletes: <a href="https://tools.ietf.org/html/rfc2616">2616</a></td><td class="right">J. Reschke, Editor</td></tr><tr><td class="left">Updates: <a href="https://tools.ietf.org/html/rfc2817">2817</a></td><td class="right">greenbytes</td></tr><tr><td class="left">Category: Standards Track</td><td class="right">June 2014</td></tr><tr><td class="left">ISSN: 2070-1721</td><td class="right"></td></tr></tbody></table><p class="title" id="rfc.title">Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</p><h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1><p>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.</p><div id="rfc.meta" style="float: right; border: 1px solid black; margin: 2em; padding: 1em; display: none;"></div><div id="rfc.status"><h1><a href="#rfc.status">Status of This Memo</a></h1><p>This is an Internet Standards Track document.</p><p>This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.</p><p>Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at <a href="http://www.rfc-editor.org/info/rfc7231">http://www.rfc-editor.org/info/rfc7231</a>.</p></div><div id="rfc.copyrightnotice"><h1><a href="#rfc.copyrightnotice">Copyright Notice</a></h1><p>Copyright &copy; 2014 IETF Trust and the persons identified as the document authors. All rights reserved.</p><p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.</p><p>This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.</p></div><hr class="noprint"><div id="rfc.toc"><h1 class="np"><a href="#rfc.toc">Table of Contents</a></h1><ul class="toc"><li><a href="#rfc.section.1">1.</a>&nbsp;&nbsp;&nbsp;<a href="#introduction">Introduction</a><ul><li><a href="#rfc.section.1.1">1.1</a>&nbsp;&nbsp;&nbsp;<a href="#conformance">Conformance and Error Handling</a></li><li><a href="#rfc.section.1.2">1.2</a>&nbsp;&nbsp;&nbsp;<a href="#notation">Syntax Notation</a></li></ul></li><li><a href="#rfc.section.2">2.</a>&nbsp;&nbsp;&nbsp;<a href="#resources">Resources</a></li><li><a href="#rfc.section.3">3.</a>&nbsp;&nbsp;&nbsp;<a href="#representations">Representations</a><ul><li><a href="#rfc.section.3.1">3.1</a>&nbsp;&nbsp;&nbsp;<a href="#representation.metadata">Representation Metadata</a><ul><li><a href="#rfc.section.3.1.1">3.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#data.type">Processing Representation Data</a></li><li><a href="#rfc.section.3.1.2">3.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#data.encoding">Encoding for Compression or Integrity</a></li><li><a href="#rfc.section.3.1.3">3.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#audience.language">Audience Language</a></li><li><a href="#rfc.section.3.1.4">3.1.4</a>&nbsp;&nbsp;&nbsp;<a href="#identification">Identification</a></li></ul></li><li><a href="#rfc.section.3.2">3.2</a>&nbsp;&nbsp;&nbsp;<a href="#representation.data">Representation Data</a></li><li><a href="#rfc.section.3.3">3.3</a>&nbsp;&nbsp;&nbsp;<a href="#payload">Payload Semantics</a></li><li><a href="#rfc.section.3.4">3.4</a>&nbsp;&nbsp;&nbsp;<a href="#content.negotiation">Content Negotiation</a><ul><li><a href="#rfc.section.3.4.1">3.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#proactive.negotiation">Proactive Negotiation</a></li><li><a href="#rfc.section.3.4.2">3.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#reactive.negotiation">Reactive Negotiation</a></li></ul></li></ul></li><li><a href="#rfc.section.4">4.</a>&nbsp;&nbsp;&nbsp;<a href="#methods">Request Methods</a><ul><li><a href="#rfc.section.4.1">4.1</a>&nbsp;&nbsp;&nbsp;<a href="#method.overview">Overview</a></li><li><a href="#rfc.section.4.2">4.2</a>&nbsp;&nbsp;&nbsp;<a href="#method.properties">Common Method Properties</a><ul><li><a href="#rfc.section.4.2.1">4.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#safe.methods">Safe Methods</a></li><li><a href="#rfc.section.4.2.2">4.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#idempotent.methods">Idempotent Methods</a></li><li><a href="#rfc.section.4.2.3">4.2.3</a>&nbsp;&nbsp;&nbsp;<a href="#cacheable.methods">Cacheable Methods</a></li></ul></li><li><a href="#rfc.section.4.3">4.3</a>&nbsp;&nbsp;&nbsp;<a href="#method.definitions">Method Definitions</a><ul><li><a href="#rfc.section.4.3.1">4.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#GET">GET</a></li><li><a href="#rfc.section.4.3.2">4.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#HEAD">HEAD</a></li><li><a href="#rfc.section.4.3.3">4.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#POST">POST</a></li><li><a href="#rfc.section.4.3.4">4.3.4</a>&nbsp;&nbsp;&nbsp;<a href="#PUT">PUT</a></li><li><a href="#rfc.section.4.3.5">4.3.5</a>&nbsp;&nbsp;&nbsp;<a href="#DELETE">DELETE</a></li><li><a href="#rfc.section.4.3.6">4.3.6</a>&nbsp;&nbsp;&nbsp;<a href="#CONNECT">CONNECT</a></li><li><a href="#rfc.section.4.3.7">4.3.7</a>&nbsp;&nbsp;&nbsp;<a href="#OPTIONS">OPTIONS</a></li><li><a href="#rfc.section.4.3.8">4.3.8</a>&nbsp;&nbsp;&nbsp;<a href="#TRACE">TRACE</a></li></ul></li></ul></li><li><a href="#rfc.section.5">5.</a>&nbsp;&nbsp;&nbsp;<a href="#request.header.fields">Request Header Fields</a><ul><li><a href="#rfc.section.5.1">5.1</a>&nbsp;&nbsp;&nbsp;<a href="#request.controls">Controls</a><ul><li><a href="#rfc.section.5.1.1">5.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.expect">Expect</a></li><li><a href="#rfc.section.5.1.2">5.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.max-forwards">Max-Forwards</a></li></ul></li><li><a href="#rfc.section.5.2">5.2</a>&nbsp;&nbsp;&nbsp;<a href="#request.conditionals">Conditionals</a></li><li><a href="#rfc.section.5.3">5.3</a>&nbsp;&nbsp;&nbsp;<a href="#request.conneg">Content Negotiation</a><ul><li><a href="#rfc.section.5.3.1">5.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#quality.values">Quality Values</a></li><li><a href="#rfc.section.5.3.2">5.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.accept">Accept</a></li><li><a href="#rfc.section.5.3.3">5.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.accept-charset">Accept-Charset</a></li><li><a href="#rfc.section.5.3.4">5.3.4</a>&nbsp;&nbsp;&nbsp;<a href="#header.accept-encoding">Accept-Encoding</a></li><li><a href="#rfc.section.5.3.5">5.3.5</a>&nbsp;&nbsp;&nbsp;<a href="#header.accept-language">Accept-Language</a></li></ul></li><li><a href="#rfc.section.5.4">5.4</a>&nbsp;&nbsp;&nbsp;<a href="#request.auth">Authentication Credentials</a></li><li><a href="#rfc.section.5.5">5.5</a>&nbsp;&nbsp;&nbsp;<a href="#request.context">Request Context</a><ul><li><a href="#rfc.section.5.5.1">5.5.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.from">From</a></li><li><a href="#rfc.section.5.5.2">5.5.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.referer">Referer</a></li><li><a href="#rfc.section.5.5.3">5.5.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.user-agent">User-Agent</a></li></ul></li></ul></li><li><a href="#rfc.section.6">6.</a>&nbsp;&nbsp;&nbsp;<a href="#status.codes">Response Status Codes</a><ul><li><a href="#rfc.section.6.1">6.1</a>&nbsp;&nbsp;&nbsp;<a href="#overview.of.status.codes">Overview of Status Codes</a></li><li><a href="#rfc.section.6.2">6.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.1xx">Informational 1xx</a><ul><li><a href="#rfc.section.6.2.1">6.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.100">100 Continue</a></li><li><a href="#rfc.section.6.2.2">6.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.101">101 Switching Protocols</a></li></ul></li><li><a href="#rfc.section.6.3">6.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.2xx">Successful 2xx</a><ul><li><a href="#rfc.section.6.3.1">6.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.200">200 OK</a></li><li><a href="#rfc.section.6.3.2">6.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.201">201 Created</a></li><li><a href="#rfc.section.6.3.3">6.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.202">202 Accepted</a></li><li><a href="#rfc.section.6.3.4">6.3.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.203">203 Non-Authoritative Information</a></li><li><a href="#rfc.section.6.3.5">6.3.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.204">204 No Content</a></li><li><a href="#rfc.section.6.3.6">6.3.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.205">205 Reset Content</a></li></ul></li><li><a href="#rfc.section.6.4">6.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.3xx">Redirection 3xx</a><ul><li><a href="#rfc.section.6.4.1">6.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.300">300 Multiple Choices</a></li><li><a href="#rfc.section.6.4.2">6.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.301">301 Moved Permanently</a></li><li><a href="#rfc.section.6.4.3">6.4.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.302">302 Found</a></li><li><a href="#rfc.section.6.4.4">6.4.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.303">303 See Other</a></li><li><a href="#rfc.section.6.4.5">6.4.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.305">305 Use Proxy</a></li><li><a href="#rfc.section.6.4.6">6.4.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.306">306 (Unused)</a></li><li><a href="#rfc.section.6.4.7">6.4.7</a>&nbsp;&nbsp;&nbsp;<a href="#status.307">307 Temporary Redirect</a></li></ul></li><li><a href="#rfc.section.6.5">6.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.4xx">Client Error 4xx</a><ul><li><a href="#rfc.section.6.5.1">6.5.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.400">400 Bad Request</a></li><li><a href="#rfc.section.6.5.2">6.5.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.402">402 Payment Required</a></li><li><a href="#rfc.section.6.5.3">6.5.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.403">403 Forbidden</a></li><li><a href="#rfc.section.6.5.4">6.5.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.404">404 Not Found</a></li><li><a href="#rfc.section.6.5.5">6.5.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.405">405 Method Not Allowed</a></li><li><a href="#rfc.section.6.5.6">6.5.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.406">406 Not Acceptable</a></li><li><a href="#rfc.section.6.5.7">6.5.7</a>&nbsp;&nbsp;&nbsp;<a href="#status.408">408 Request Timeout</a></li><li><a href="#rfc.section.6.5.8">6.5.8</a>&nbsp;&nbsp;&nbsp;<a href="#status.409">409 Conflict</a></li><li><a href="#rfc.section.6.5.9">6.5.9</a>&nbsp;&nbsp;&nbsp;<a href="#status.410">410 Gone</a></li><li><a href="#rfc.section.6.5.10">6.5.10</a>&nbsp;&nbsp;&nbsp;<a href="#status.411">411 Length Required</a></li><li><a href="#rfc.section.6.5.11">6.5.11</a>&nbsp;&nbsp;&nbsp;<a href="#status.413">413 Payload Too Large</a></li><li><a href="#rfc.section.6.5.12">6.5.12</a>&nbsp;&nbsp;&nbsp;<a href="#status.414">414 URI Too Long</a></li><li><a href="#rfc.section.6.5.13">6.5.13</a>&nbsp;&nbsp;&nbsp;<a href="#status.415">415 Unsupported Media Type</a></li><li><a href="#rfc.section.6.5.14">6.5.14</a>&nbsp;&nbsp;&nbsp;<a href="#status.417">417 Expectation Failed</a></li><li><a href="#rfc.section.6.5.15">6.5.15</a>&nbsp;&nbsp;&nbsp;<a href="#status.426">426 Upgrade Required</a></li></ul></li><li><a href="#rfc.section.6.6">6.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.5xx">Server Error 5xx</a><ul><li><a href="#rfc.section.6.6.1">6.6.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.500">500 Internal Server Error</a></li><li><a href="#rfc.section.6.6.2">6.6.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.501">501 Not Implemented</a></li><li><a href="#rfc.section.6.6.3">6.6.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.502">502 Bad Gateway</a></li><li><a href="#rfc.section.6.6.4">6.6.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.503">503 Service Unavailable</a></li><li><a href="#rfc.section.6.6.5">6.6.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.504">504 Gateway Timeout</a></li><li><a href="#rfc.section.6.6.6">6.6.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.505">505 HTTP Version Not Supported</a></li></ul></li></ul></li><li><a href="#rfc.section.7">7.</a>&nbsp;&nbsp;&nbsp;<a href="#response.header.fields">Response Header Fields</a><ul><li><a href="#rfc.section.7.1">7.1</a>&nbsp;&nbsp;&nbsp;<a href="#response.control.data">Control Data</a><ul><li><a href="#rfc.section.7.1.1">7.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#origination.date">Origination Date</a></li><li><a href="#rfc.section.7.1.2">7.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.location">Location</a></li><li><a href="#rfc.section.7.1.3">7.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.retry-after">Retry-After</a></li><li><a href="#rfc.section.7.1.4">7.1.4</a>&nbsp;&nbsp;&nbsp;<a href="#header.vary">Vary</a></li></ul></li><li><a href="#rfc.section.7.2">7.2</a>&nbsp;&nbsp;&nbsp;<a href="#response.validator">Validator Header Fields</a></li><li><a href="#rfc.section.7.3">7.3</a>&nbsp;&nbsp;&nbsp;<a href="#response.auth">Authentication Challenges</a></li><li><a href="#rfc.section.7.4">7.4</a>&nbsp;&nbsp;&nbsp;<a href="#response.context">Response Context</a><ul><li><a href="#rfc.section.7.4.1">7.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.allow">Allow</a></li><li><a href="#rfc.section.7.4.2">7.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.server">Server</a></li></ul></li></ul></li><li><a href="#rfc.section.8">8.</a>&nbsp;&nbsp;&nbsp;<a href="#IANA.considerations">IANA Considerations</a><ul><li><a href="#rfc.section.8.1">8.1</a>&nbsp;&nbsp;&nbsp;<a href="#method.registry">Method Registry</a><ul><li><a href="#rfc.section.8.1.1">8.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#method.registry.procedure">Procedure</a></li><li><a href="#rfc.section.8.1.2">8.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#considerations.for.new.methods">Considerations for New Methods</a></li><li><a href="#rfc.section.8.1.3">8.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#method.registration">Registrations</a></li></ul></li><li><a href="#rfc.section.8.2">8.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.code.registry">Status Code Registry</a><ul><li><a href="#rfc.section.8.2.1">8.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.code.registry.procedure">Procedure</a></li><li><a href="#rfc.section.8.2.2">8.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#considerations.for.new.status.codes">Considerations for New Status Codes</a></li><li><a href="#rfc.section.8.2.3">8.2.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.code.registration">Registrations</a></li></ul></li><li><a href="#rfc.section.8.3">8.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.field.registry">Header Field Registry</a><ul><li><a href="#rfc.section.8.3.1">8.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#considerations.for.new.header.fields">Considerations for New Header Fields</a></li><li><a href="#rfc.section.8.3.2">8.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.field.registration">Registrations</a></li></ul></li><li><a href="#rfc.section.8.4">8.4</a>&nbsp;&nbsp;&nbsp;<a href="#content.coding.registry">Content Coding Registry</a><ul><li><a href="#rfc.section.8.4.1">8.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#content.coding.procedure">Procedure</a></li><li><a href="#rfc.section.8.4.2">8.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#content.coding.registration">Registrations</a></li></ul></li></ul></li><li><a href="#rfc.section.9">9.</a>&nbsp;&nbsp;&nbsp;<a href="#security.considerations">Security Considerations</a><ul><li><a href="#rfc.section.9.1">9.1</a>&nbsp;&nbsp;&nbsp;<a href="#attack.pathname">Attacks Based on File and Path Names</a></li><li><a href="#rfc.section.9.2">9.2</a>&nbsp;&nbsp;&nbsp;<a href="#attack.injection">Attacks Based on Command, Code, or Query Injection</a></li><li><a href="#rfc.section.9.3">9.3</a>&nbsp;&nbsp;&nbsp;<a href="#personal.information">Disclosure of Personal Information</a></li><li><a href="#rfc.section.9.4">9.4</a>&nbsp;&nbsp;&nbsp;<a href="#sensitive.information.in.uris">Disclosure of Sensitive Information in URIs</a></li><li><a href="#rfc.section.9.5">9.5</a>&nbsp;&nbsp;&nbsp;<a href="#fragment.disclosure">Disclosure of Fragment after Redirects</a></li><li><a href="#rfc.section.9.6">9.6</a>&nbsp;&nbsp;&nbsp;<a href="#disclosure.product.information">Disclosure of Product Information</a></li><li><a href="#rfc.section.9.7">9.7</a>&nbsp;&nbsp;&nbsp;<a href="#fingerprinting">Browser Fingerprinting</a></li></ul></li><li><a href="#rfc.section.10">10.</a>&nbsp;&nbsp;&nbsp;<a href="#acks">Acknowledgments</a></li><li><a href="#rfc.section.11">11.</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references">References</a><ul><li><a href="#rfc.section.11.1">11.1</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references.1">Normative References</a></li><li><a href="#rfc.section.11.2">11.2</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references.2">Informative References</a></li></ul></li><li><a href="#rfc.section.A">A.</a>&nbsp;&nbsp;&nbsp;<a href="#differences.between.http.and.mime">Differences between HTTP and MIME</a><ul><li><a href="#rfc.section.A.1">A.1</a>&nbsp;&nbsp;&nbsp;<a href="#mime-version">MIME-Version</a></li><li><a href="#rfc.section.A.2">A.2</a>&nbsp;&nbsp;&nbsp;<a href="#conversion.to.canonical.form">Conversion to Canonical Form</a></li><li><a href="#rfc.section.A.3">A.3</a>&nbsp;&nbsp;&nbsp;<a href="#conversion.of.date.formats">Conversion of Date Formats</a></li><li><a href="#rfc.section.A.4">A.4</a>&nbsp;&nbsp;&nbsp;<a href="#conversion.content-encoding">Conversion of Content-Encoding</a></li><li><a href="#rfc.section.A.5">A.5</a>&nbsp;&nbsp;&nbsp;<a href="#conversion.content-transfer-encoding">Conversion of Content-Transfer-Encoding</a></li><li><a href="#rfc.section.A.6">A.6</a>&nbsp;&nbsp;&nbsp;<a href="#mhtml.line.length">MHTML and Line Length Limitations</a></li></ul></li><li><a href="#rfc.section.B">B.</a>&nbsp;&nbsp;&nbsp;<a href="#changes.from.rfc.2616">Changes from RFC 2616</a></li><li><a href="#rfc.section.C">C.</a>&nbsp;&nbsp;&nbsp;<a href="#imported.abnf">Imported ABNF</a></li><li><a href="#rfc.section.D">D.</a>&nbsp;&nbsp;&nbsp;<a href="#collected.abnf">Collected ABNF</a></li><li><a href="#rfc.index">Index</a></li><li><a href="#rfc.authors">Authors' Addresses</a></li></ul></div><div id="introduction"><h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a>&nbsp;<a href="#introduction">Introduction</a></h1><p id="rfc.section.1.p.1">Each Hypertext Transfer Protocol (HTTP) message is either a request or a response. A server listens on a connection for a request, parses each message received, interprets the message semantics in relation to the identified request target, and responds to that request with one or more response messages. A client constructs request messages to communicate specific intentions, examines received responses to see if the intentions were carried out, and determines how to interpret the results. This document defines HTTP/1.1 request and response semantics in terms of the architecture defined in <a href="#RFC7230" id="rfc.xref.RFC7230.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.<a class="self" href="#rfc.section.1.p.1">&para;</a></p><p id="rfc.section.1.p.2">HTTP provides a uniform interface for interacting with a resource (<a href="#resources" title="Resources">Section&nbsp;2</a>), regardless of its type, nature, or implementation, via the manipulation and transfer of representations (<a href="#representations" title="Representations">Section&nbsp;3</a>).<a class="self" href="#rfc.section.1.p.2">&para;</a></p><p id="rfc.section.1.p.3">HTTP semantics include the intentions defined by each request method (<a href="#methods" title="Request Methods">Section&nbsp;4</a>), extensions to those semantics that might be described in request header fields (<a href="#request.header.fields" title="Request Header Fields">Section&nbsp;5</a>), the meaning of status codes to indicate a machine-readable response (<a href="#status.codes" title="Response Status Codes">Section&nbsp;6</a>), and the meaning of other control data and resource metadata that might be given in response header fields (<a href="#response.header.fields" title="Response Header Fields">Section&nbsp;7</a>).<a class="self" href="#rfc.section.1.p.3">&para;</a></p><p id="rfc.section.1.p.4"><span id="rfc.iref.c.1"></span> This document also defines representation metadata that describe how a payload is intended to be interpreted by a recipient, the request header fields that might influence content selection, and the various selection algorithms that are collectively referred to as "<dfn>content negotiation</dfn>" (<a href="#content.negotiation" title="Content Negotiation">Section&nbsp;3.4</a>).<a class="self" href="#rfc.section.1.p.4">&para;</a></p><div id="conformance"><h2 id="rfc.section.1.1"><a href="#rfc.section.1.1">1.1</a>&nbsp;<a href="#conformance">Conformance and Error Handling</a></h2><p id="rfc.section.1.1.p.1">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 <a href="#RFC2119" id="rfc.xref.RFC2119.1"><cite title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</cite></a>.<a class="self" href="#rfc.section.1.1.p.1">&para;</a></p><p id="rfc.section.1.1.p.2">Conformance criteria and considerations regarding error handling are defined in <a href="rfc7230.html#conformance" title="Conformance and Error Handling">Section 2.5</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.<a class="self" href="#rfc.section.1.1.p.2">&para;</a></p></div><div id="notation"><h2 id="rfc.section.1.2"><a href="#rfc.section.1.2">1.2</a>&nbsp;<a href="#notation">Syntax Notation</a></h2><p id="rfc.section.1.2.p.1">This specification uses the Augmented Backus-Naur Form (ABNF) notation of <a href="#RFC5234" id="rfc.xref.RFC5234.1"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> with a list extension, defined in <a href="rfc7230.html#abnf.extension" title="ABNF List Extension: #rule">Section 7</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>, that allows for compact definition of comma-separated lists using a '#' operator (similar to how the '*' operator indicates repetition). <a href="#imported.abnf" title="Imported ABNF">Appendix&nbsp;C</a> describes rules imported from other documents. <a href="#collected.abnf" title="Collected ABNF">Appendix&nbsp;D</a> shows the collected grammar with all list operators expanded to standard ABNF notation.<a class="self" href="#rfc.section.1.2.p.1">&para;</a></p><p id="rfc.section.1.2.p.2">This specification uses the terms "character", "character encoding scheme", "charset", and "protocol element" as they are defined in <a href="#RFC6365" id="rfc.xref.RFC6365.1"><cite title="Terminology Used in Internationalization in the IETF">[RFC6365]</cite></a>.<a class="self" href="#rfc.section.1.2.p.2">&para;</a></p></div></div><div id="resources"><h1 id="rfc.section.2"><a href="#rfc.section.2">2.</a>&nbsp;<a href="#resources">Resources</a></h1><p id="rfc.section.2.p.1">The target of an HTTP request is called a "<dfn>resource</dfn>". HTTP does not limit the nature of a resource; it merely defines an interface that might be used to interact with resources. Each resource is identified by a Uniform Resource Identifier (URI), as described in <a href="rfc7230.html#uri" title="Uniform Resource Identifiers">Section 2.7</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.<a class="self" href="#rfc.section.2.p.1">&para;</a></p><p id="rfc.section.2.p.2">When a client constructs an HTTP/1.1 request message, it sends the <a href="rfc7230.html#target-resource" class="smpl">target URI</a> in one of various forms, as defined in (<a href="rfc7230.html#request-target" title="Request Target">Section 5.3</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>). When a request is received, the server reconstructs an <a href="rfc7230.html#effective.request.uri" class="smpl">effective request URI</a> for the target resource (<a href="rfc7230.html#effective.request.uri" title="Effective Request URI">Section 5.5</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.6"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>).<a class="self" href="#rfc.section.2.p.2">&para;</a></p><p id="rfc.section.2.p.3">One design goal of HTTP is to separate resource identification from request semantics, which is made possible by vesting the request semantics in the request method (<a href="#methods" title="Request Methods">Section&nbsp;4</a>) and a few request-modifying header fields (<a href="#request.header.fields" title="Request Header Fields">Section&nbsp;5</a>). If there is a conflict between the method semantics and any semantic implied by the URI itself, as described in <a href="#safe.methods" title="Safe Methods">Section&nbsp;4.2.1</a>, the method semantics take precedence.<a class="self" href="#rfc.section.2.p.3">&para;</a></p></div><div id="representations"><h1 id="rfc.section.3"><a href="#rfc.section.3">3.</a>&nbsp;<a href="#representations">Representations</a></h1><p id="rfc.section.3.p.1">Considering that a resource could be anything, and that the uniform interface provided by HTTP is similar to a window through which one can observe and act upon such a thing only through the communication of messages to some independent actor on the other side, an abstraction is needed to represent ("take the place of") the current or desired state of that thing in our communications. That abstraction is called a representation <a href="#REST" id="rfc.xref.REST.1"><cite title="Architectural Styles and the Design of Network-based Software Architectures">[REST]</cite></a>.<a class="self" href="#rfc.section.3.p.1">&para;</a></p><p id="rfc.section.3.p.2">For the purposes of HTTP, a "<dfn>representation</dfn>" is information that is intended to reflect a past, current, or desired state of a given resource, in a format that can be readily communicated via the protocol, and that consists of a set of representation metadata and a potentially unbounded stream of representation data.<a class="self" href="#rfc.section.3.p.2">&para;</a></p><p id="rfc.section.3.p.3">An origin server might be provided with, or be capable of generating, multiple representations that are each intended to reflect the current state of a <a href="#resources" class="smpl">target resource</a>. In such cases, some algorithm is used by the origin server to select one of those representations as most applicable to a given request, usually based on <a href="#content.negotiation" class="smpl">content negotiation</a>. This "<dfn>selected representation</dfn>" is used to provide the data and metadata for evaluating conditional requests <a href="#RFC7232" id="rfc.xref.RFC7232.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a> and constructing the payload for <a href="#status.200" class="smpl">200 (OK)</a> and <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> responses to GET (<a href="#GET" id="rfc.xref.GET.1" title="GET">Section&nbsp;4.3.1</a>).<a class="self" href="#rfc.section.3.p.3">&para;</a></p><div id="representation.metadata"><h2 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1</a>&nbsp;<a href="#representation.metadata">Representation Metadata</a></h2><p id="rfc.section.3.1.p.1">Representation header fields provide metadata about the representation. When a message includes a payload body, the representation header fields describe how to interpret the representation data enclosed in the payload body. In a response to a HEAD request, the representation header fields describe the representation data that would have been enclosed in the payload body if the same request had been a GET.<a class="self" href="#rfc.section.3.1.p.1">&para;</a></p><p id="rfc.section.3.1.p.2">The following header fields convey representation metadata:<a class="self" href="#rfc.section.3.1.p.2">&para;</a></p><div id="rfc.table.u.1"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Header Field Name</th><th>Defined in...</th></tr></thead><tbody><tr><td class="left">Content-Type</td><td class="left"><a href="#header.content-type" id="rfc.xref.header.content-type.1" title="Content-Type">Section&nbsp;3.1.1.5</a></td></tr><tr><td class="left">Content-Encoding</td><td class="left"><a href="#header.content-encoding" id="rfc.xref.header.content-encoding.1" title="Content-Encoding">Section&nbsp;3.1.2.2</a></td></tr><tr><td class="left">Content-Language</td><td class="left"><a href="#header.content-language" id="rfc.xref.header.content-language.1" title="Content-Language">Section&nbsp;3.1.3.2</a></td></tr><tr><td class="left">Content-Location</td><td class="left"><a href="#header.content-location" id="rfc.xref.header.content-location.1" title="Content-Location">Section&nbsp;3.1.4.2</a></td></tr></tbody></table></div><div id="data.type"><h3 id="rfc.section.3.1.1"><a href="#rfc.section.3.1.1">3.1.1</a>&nbsp;<a href="#data.type">Processing Representation Data</a></h3><div id="media.type"><h4 id="rfc.section.3.1.1.1"><a href="#rfc.section.3.1.1.1">3.1.1.1</a>&nbsp;<a href="#media.type">Media Type</a></h4><p id="rfc.section.3.1.1.1.p.1">HTTP uses Internet media types <a href="#RFC2046" id="rfc.xref.RFC2046.1"><cite title="Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types">[RFC2046]</cite></a> in the <a href="#header.content-type" class="smpl">Content-Type</a> (<a href="#header.content-type" id="rfc.xref.header.content-type.2" title="Content-Type">Section&nbsp;3.1.1.5</a>) and <a href="#header.accept" class="smpl">Accept</a> (<a href="#header.accept" id="rfc.xref.header.accept.1" title="Accept">Section&nbsp;5.3.2</a>) header fields in order to provide open and extensible data typing and type negotiation. Media types define both a data format and various processing models: how to process that data in accordance with each context in which it is received.<a class="self" href="#rfc.section.3.1.1.1.p.1">&para;</a></p><div id="rfc.figure.u.1"><pre class="inline"><span id="rfc.iref.g.1"></span><span id="rfc.iref.g.2"></span><span id="rfc.iref.g.3"></span>  <a href="#media.type" class="smpl">media-type</a> = <a href="#media.type" class="smpl">type</a> "/" <a href="#media.type" class="smpl">subtype</a> *( <a href="#imported.abnf" class="smpl">OWS</a> ";" <a href="#imported.abnf" class="smpl">OWS</a> <a href="#rule.parameter" class="smpl">parameter</a> ) 
     511</style><link rel="Contents" href="#rfc.toc"><link rel="Author" href="#rfc.authors"><link rel="Copyright" href="#rfc.copyrightnotice"><link rel="Index" href="#rfc.index"><link rel="Chapter" title="1 Introduction" href="#rfc.section.1"><link rel="Chapter" title="2 Resources" href="#rfc.section.2"><link rel="Chapter" title="3 Representations" href="#rfc.section.3"><link rel="Chapter" title="4 Request Methods" href="#rfc.section.4"><link rel="Chapter" title="5 Request Header Fields" href="#rfc.section.5"><link rel="Chapter" title="6 Response Status Codes" href="#rfc.section.6"><link rel="Chapter" title="7 Response Header Fields" href="#rfc.section.7"><link rel="Chapter" title="8 IANA Considerations" href="#rfc.section.8"><link rel="Chapter" title="9 Security Considerations" href="#rfc.section.9"><link rel="Chapter" title="10 Acknowledgments" href="#rfc.section.10"><link rel="Chapter" href="#rfc.section.11" title="11 References"><link rel="Appendix" title="A Differences between HTTP and MIME" href="#rfc.section.A"><link rel="Appendix" title="B Changes from RFC 2616" href="#rfc.section.B"><link rel="Appendix" title="C Imported ABNF" href="#rfc.section.C"><link rel="Appendix" title="D Collected ABNF" href="#rfc.section.D"><link href="rfc7230.html" rel="prev"><link href="rfc7232.html" rel="next"><link rel="Alternate" title="Authorative ASCII Version" href="http://www.ietf.org/rfc/rfc7231.txt"><link rel="Help" title="RFC-Editor's Status Page" href="http://www.rfc-editor.org/info/rfc7231"><link rel="Help" title="Additional Information on tools.ietf.org" href="http://tools.ietf.org/html/rfc7231"><meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1.669, 2014/09/04 09:19:16, XSLT vendor: SAXON 6.5.5 from Michael Kay http://saxon.sf.net/"><meta name="keywords" content="Hypertext Transfer Protocol, HTTP, HTTP semantics, HTTP payload, HTTP content, HTTP method, HTTP status code"><link rel="schema.dct" href="http://purl.org/dc/terms/"><meta name="dct.creator" content="Fielding, R."><meta name="dct.creator" content="Reschke, J. F."><meta name="dct.identifier" content="urn:ietf:rfc:7231"><meta name="dct.issued" scheme="ISO8601" content="2014-06"><meta name="dct.replaces" content="urn:ietf:rfc:2616"><meta name="dct.abstract" content="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."><meta name="dct.isPartOf" content="urn:issn:2070-1721"><meta name="description" content="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."></head><body onload="getMeta(7231,&#34;rfc.meta&#34;);"><table class="header" id="rfc.headerblock"><tbody><tr><td class="left">Internet Engineering Task Force (IETF)</td><td class="right">R. Fielding, Editor</td></tr><tr><td class="left">Request for Comments: 7231</td><td class="right">Adobe</td></tr><tr><td class="left">Obsoletes: <a href="https://tools.ietf.org/html/rfc2616">2616</a></td><td class="right">J. Reschke, Editor</td></tr><tr><td class="left">Updates: <a href="https://tools.ietf.org/html/rfc2817">2817</a></td><td class="right">greenbytes</td></tr><tr><td class="left">Category: Standards Track</td><td class="right">June 2014</td></tr><tr><td class="left">ISSN: 2070-1721</td><td class="right"></td></tr></tbody></table><p class="title" id="rfc.title">Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</p><h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1><p>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.</p><div id="rfc.meta" style="float: right; border: 1px solid black; margin: 2em; padding: 1em; display: none;"></div><div id="rfc.status"><h1><a href="#rfc.status">Status of This Memo</a></h1><p>This is an Internet Standards Track document.</p><p>This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.</p><p>Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at <a href="http://www.rfc-editor.org/info/rfc7231">http://www.rfc-editor.org/info/rfc7231</a>.</p></div><div id="rfc.copyrightnotice"><h1><a href="#rfc.copyrightnotice">Copyright Notice</a></h1><p>Copyright &copy; 2014 IETF Trust and the persons identified as the document authors. All rights reserved.</p><p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.</p><p>This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.</p></div><hr class="noprint"><div id="rfc.toc"><h1 class="np"><a href="#rfc.toc">Table of Contents</a></h1><ul class="toc"><li><a href="#rfc.section.1">1.</a>&nbsp;&nbsp;&nbsp;<a href="#introduction">Introduction</a><ul><li><a href="#rfc.section.1.1">1.1</a>&nbsp;&nbsp;&nbsp;<a href="#conformance">Conformance and Error Handling</a></li><li><a href="#rfc.section.1.2">1.2</a>&nbsp;&nbsp;&nbsp;<a href="#notation">Syntax Notation</a></li></ul></li><li><a href="#rfc.section.2">2.</a>&nbsp;&nbsp;&nbsp;<a href="#resources">Resources</a></li><li><a href="#rfc.section.3">3.</a>&nbsp;&nbsp;&nbsp;<a href="#representations">Representations</a><ul><li><a href="#rfc.section.3.1">3.1</a>&nbsp;&nbsp;&nbsp;<a href="#representation.metadata">Representation Metadata</a><ul><li><a href="#rfc.section.3.1.1">3.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#data.type">Processing Representation Data</a></li><li><a href="#rfc.section.3.1.2">3.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#data.encoding">Encoding for Compression or Integrity</a></li><li><a href="#rfc.section.3.1.3">3.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#audience.language">Audience Language</a></li><li><a href="#rfc.section.3.1.4">3.1.4</a>&nbsp;&nbsp;&nbsp;<a href="#identification">Identification</a></li></ul></li><li><a href="#rfc.section.3.2">3.2</a>&nbsp;&nbsp;&nbsp;<a href="#representation.data">Representation Data</a></li><li><a href="#rfc.section.3.3">3.3</a>&nbsp;&nbsp;&nbsp;<a href="#payload">Payload Semantics</a></li><li><a href="#rfc.section.3.4">3.4</a>&nbsp;&nbsp;&nbsp;<a href="#content.negotiation">Content Negotiation</a><ul><li><a href="#rfc.section.3.4.1">3.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#proactive.negotiation">Proactive Negotiation</a></li><li><a href="#rfc.section.3.4.2">3.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#reactive.negotiation">Reactive Negotiation</a></li></ul></li></ul></li><li><a href="#rfc.section.4">4.</a>&nbsp;&nbsp;&nbsp;<a href="#methods">Request Methods</a><ul><li><a href="#rfc.section.4.1">4.1</a>&nbsp;&nbsp;&nbsp;<a href="#method.overview">Overview</a></li><li><a href="#rfc.section.4.2">4.2</a>&nbsp;&nbsp;&nbsp;<a href="#method.properties">Common Method Properties</a><ul><li><a href="#rfc.section.4.2.1">4.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#safe.methods">Safe Methods</a></li><li><a href="#rfc.section.4.2.2">4.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#idempotent.methods">Idempotent Methods</a></li><li><a href="#rfc.section.4.2.3">4.2.3</a>&nbsp;&nbsp;&nbsp;<a href="#cacheable.methods">Cacheable Methods</a></li></ul></li><li><a href="#rfc.section.4.3">4.3</a>&nbsp;&nbsp;&nbsp;<a href="#method.definitions">Method Definitions</a><ul><li><a href="#rfc.section.4.3.1">4.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#GET">GET</a></li><li><a href="#rfc.section.4.3.2">4.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#HEAD">HEAD</a></li><li><a href="#rfc.section.4.3.3">4.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#POST">POST</a></li><li><a href="#rfc.section.4.3.4">4.3.4</a>&nbsp;&nbsp;&nbsp;<a href="#PUT">PUT</a></li><li><a href="#rfc.section.4.3.5">4.3.5</a>&nbsp;&nbsp;&nbsp;<a href="#DELETE">DELETE</a></li><li><a href="#rfc.section.4.3.6">4.3.6</a>&nbsp;&nbsp;&nbsp;<a href="#CONNECT">CONNECT</a></li><li><a href="#rfc.section.4.3.7">4.3.7</a>&nbsp;&nbsp;&nbsp;<a href="#OPTIONS">OPTIONS</a></li><li><a href="#rfc.section.4.3.8">4.3.8</a>&nbsp;&nbsp;&nbsp;<a href="#TRACE">TRACE</a></li></ul></li></ul></li><li><a href="#rfc.section.5">5.</a>&nbsp;&nbsp;&nbsp;<a href="#request.header.fields">Request Header Fields</a><ul><li><a href="#rfc.section.5.1">5.1</a>&nbsp;&nbsp;&nbsp;<a href="#request.controls">Controls</a><ul><li><a href="#rfc.section.5.1.1">5.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.expect">Expect</a></li><li><a href="#rfc.section.5.1.2">5.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.max-forwards">Max-Forwards</a></li></ul></li><li><a href="#rfc.section.5.2">5.2</a>&nbsp;&nbsp;&nbsp;<a href="#request.conditionals">Conditionals</a></li><li><a href="#rfc.section.5.3">5.3</a>&nbsp;&nbsp;&nbsp;<a href="#request.conneg">Content Negotiation</a><ul><li><a href="#rfc.section.5.3.1">5.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#quality.values">Quality Values</a></li><li><a href="#rfc.section.5.3.2">5.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.accept">Accept</a></li><li><a href="#rfc.section.5.3.3">5.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.accept-charset">Accept-Charset</a></li><li><a href="#rfc.section.5.3.4">5.3.4</a>&nbsp;&nbsp;&nbsp;<a href="#header.accept-encoding">Accept-Encoding</a></li><li><a href="#rfc.section.5.3.5">5.3.5</a>&nbsp;&nbsp;&nbsp;<a href="#header.accept-language">Accept-Language</a></li></ul></li><li><a href="#rfc.section.5.4">5.4</a>&nbsp;&nbsp;&nbsp;<a href="#request.auth">Authentication Credentials</a></li><li><a href="#rfc.section.5.5">5.5</a>&nbsp;&nbsp;&nbsp;<a href="#request.context">Request Context</a><ul><li><a href="#rfc.section.5.5.1">5.5.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.from">From</a></li><li><a href="#rfc.section.5.5.2">5.5.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.referer">Referer</a></li><li><a href="#rfc.section.5.5.3">5.5.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.user-agent">User-Agent</a></li></ul></li></ul></li><li><a href="#rfc.section.6">6.</a>&nbsp;&nbsp;&nbsp;<a href="#status.codes">Response Status Codes</a><ul><li><a href="#rfc.section.6.1">6.1</a>&nbsp;&nbsp;&nbsp;<a href="#overview.of.status.codes">Overview of Status Codes</a></li><li><a href="#rfc.section.6.2">6.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.1xx">Informational 1xx</a><ul><li><a href="#rfc.section.6.2.1">6.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.100">100 Continue</a></li><li><a href="#rfc.section.6.2.2">6.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.101">101 Switching Protocols</a></li></ul></li><li><a href="#rfc.section.6.3">6.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.2xx">Successful 2xx</a><ul><li><a href="#rfc.section.6.3.1">6.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.200">200 OK</a></li><li><a href="#rfc.section.6.3.2">6.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.201">201 Created</a></li><li><a href="#rfc.section.6.3.3">6.3.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.202">202 Accepted</a></li><li><a href="#rfc.section.6.3.4">6.3.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.203">203 Non-Authoritative Information</a></li><li><a href="#rfc.section.6.3.5">6.3.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.204">204 No Content</a></li><li><a href="#rfc.section.6.3.6">6.3.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.205">205 Reset Content</a></li></ul></li><li><a href="#rfc.section.6.4">6.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.3xx">Redirection 3xx</a><ul><li><a href="#rfc.section.6.4.1">6.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.300">300 Multiple Choices</a></li><li><a href="#rfc.section.6.4.2">6.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.301">301 Moved Permanently</a></li><li><a href="#rfc.section.6.4.3">6.4.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.302">302 Found</a></li><li><a href="#rfc.section.6.4.4">6.4.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.303">303 See Other</a></li><li><a href="#rfc.section.6.4.5">6.4.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.305">305 Use Proxy</a></li><li><a href="#rfc.section.6.4.6">6.4.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.306">306 (Unused)</a></li><li><a href="#rfc.section.6.4.7">6.4.7</a>&nbsp;&nbsp;&nbsp;<a href="#status.307">307 Temporary Redirect</a></li></ul></li><li><a href="#rfc.section.6.5">6.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.4xx">Client Error 4xx</a><ul><li><a href="#rfc.section.6.5.1">6.5.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.400">400 Bad Request</a></li><li><a href="#rfc.section.6.5.2">6.5.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.402">402 Payment Required</a></li><li><a href="#rfc.section.6.5.3">6.5.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.403">403 Forbidden</a></li><li><a href="#rfc.section.6.5.4">6.5.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.404">404 Not Found</a></li><li><a href="#rfc.section.6.5.5">6.5.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.405">405 Method Not Allowed</a></li><li><a href="#rfc.section.6.5.6">6.5.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.406">406 Not Acceptable</a></li><li><a href="#rfc.section.6.5.7">6.5.7</a>&nbsp;&nbsp;&nbsp;<a href="#status.408">408 Request Timeout</a></li><li><a href="#rfc.section.6.5.8">6.5.8</a>&nbsp;&nbsp;&nbsp;<a href="#status.409">409 Conflict</a></li><li><a href="#rfc.section.6.5.9">6.5.9</a>&nbsp;&nbsp;&nbsp;<a href="#status.410">410 Gone</a></li><li><a href="#rfc.section.6.5.10">6.5.10</a>&nbsp;&nbsp;&nbsp;<a href="#status.411">411 Length Required</a></li><li><a href="#rfc.section.6.5.11">6.5.11</a>&nbsp;&nbsp;&nbsp;<a href="#status.413">413 Payload Too Large</a></li><li><a href="#rfc.section.6.5.12">6.5.12</a>&nbsp;&nbsp;&nbsp;<a href="#status.414">414 URI Too Long</a></li><li><a href="#rfc.section.6.5.13">6.5.13</a>&nbsp;&nbsp;&nbsp;<a href="#status.415">415 Unsupported Media Type</a></li><li><a href="#rfc.section.6.5.14">6.5.14</a>&nbsp;&nbsp;&nbsp;<a href="#status.417">417 Expectation Failed</a></li><li><a href="#rfc.section.6.5.15">6.5.15</a>&nbsp;&nbsp;&nbsp;<a href="#status.426">426 Upgrade Required</a></li></ul></li><li><a href="#rfc.section.6.6">6.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.5xx">Server Error 5xx</a><ul><li><a href="#rfc.section.6.6.1">6.6.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.500">500 Internal Server Error</a></li><li><a href="#rfc.section.6.6.2">6.6.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.501">501 Not Implemented</a></li><li><a href="#rfc.section.6.6.3">6.6.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.502">502 Bad Gateway</a></li><li><a href="#rfc.section.6.6.4">6.6.4</a>&nbsp;&nbsp;&nbsp;<a href="#status.503">503 Service Unavailable</a></li><li><a href="#rfc.section.6.6.5">6.6.5</a>&nbsp;&nbsp;&nbsp;<a href="#status.504">504 Gateway Timeout</a></li><li><a href="#rfc.section.6.6.6">6.6.6</a>&nbsp;&nbsp;&nbsp;<a href="#status.505">505 HTTP Version Not Supported</a></li></ul></li></ul></li><li><a href="#rfc.section.7">7.</a>&nbsp;&nbsp;&nbsp;<a href="#response.header.fields">Response Header Fields</a><ul><li><a href="#rfc.section.7.1">7.1</a>&nbsp;&nbsp;&nbsp;<a href="#response.control.data">Control Data</a><ul><li><a href="#rfc.section.7.1.1">7.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#origination.date">Origination Date</a></li><li><a href="#rfc.section.7.1.2">7.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.location">Location</a></li><li><a href="#rfc.section.7.1.3">7.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.retry-after">Retry-After</a></li><li><a href="#rfc.section.7.1.4">7.1.4</a>&nbsp;&nbsp;&nbsp;<a href="#header.vary">Vary</a></li></ul></li><li><a href="#rfc.section.7.2">7.2</a>&nbsp;&nbsp;&nbsp;<a href="#response.validator">Validator Header Fields</a></li><li><a href="#rfc.section.7.3">7.3</a>&nbsp;&nbsp;&nbsp;<a href="#response.auth">Authentication Challenges</a></li><li><a href="#rfc.section.7.4">7.4</a>&nbsp;&nbsp;&nbsp;<a href="#response.context">Response Context</a><ul><li><a href="#rfc.section.7.4.1">7.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#header.allow">Allow</a></li><li><a href="#rfc.section.7.4.2">7.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.server">Server</a></li></ul></li></ul></li><li><a href="#rfc.section.8">8.</a>&nbsp;&nbsp;&nbsp;<a href="#IANA.considerations">IANA Considerations</a><ul><li><a href="#rfc.section.8.1">8.1</a>&nbsp;&nbsp;&nbsp;<a href="#method.registry">Method Registry</a><ul><li><a href="#rfc.section.8.1.1">8.1.1</a>&nbsp;&nbsp;&nbsp;<a href="#method.registry.procedure">Procedure</a></li><li><a href="#rfc.section.8.1.2">8.1.2</a>&nbsp;&nbsp;&nbsp;<a href="#considerations.for.new.methods">Considerations for New Methods</a></li><li><a href="#rfc.section.8.1.3">8.1.3</a>&nbsp;&nbsp;&nbsp;<a href="#method.registration">Registrations</a></li></ul></li><li><a href="#rfc.section.8.2">8.2</a>&nbsp;&nbsp;&nbsp;<a href="#status.code.registry">Status Code Registry</a><ul><li><a href="#rfc.section.8.2.1">8.2.1</a>&nbsp;&nbsp;&nbsp;<a href="#status.code.registry.procedure">Procedure</a></li><li><a href="#rfc.section.8.2.2">8.2.2</a>&nbsp;&nbsp;&nbsp;<a href="#considerations.for.new.status.codes">Considerations for New Status Codes</a></li><li><a href="#rfc.section.8.2.3">8.2.3</a>&nbsp;&nbsp;&nbsp;<a href="#status.code.registration">Registrations</a></li></ul></li><li><a href="#rfc.section.8.3">8.3</a>&nbsp;&nbsp;&nbsp;<a href="#header.field.registry">Header Field Registry</a><ul><li><a href="#rfc.section.8.3.1">8.3.1</a>&nbsp;&nbsp;&nbsp;<a href="#considerations.for.new.header.fields">Considerations for New Header Fields</a></li><li><a href="#rfc.section.8.3.2">8.3.2</a>&nbsp;&nbsp;&nbsp;<a href="#header.field.registration">Registrations</a></li></ul></li><li><a href="#rfc.section.8.4">8.4</a>&nbsp;&nbsp;&nbsp;<a href="#content.coding.registry">Content Coding Registry</a><ul><li><a href="#rfc.section.8.4.1">8.4.1</a>&nbsp;&nbsp;&nbsp;<a href="#content.coding.procedure">Procedure</a></li><li><a href="#rfc.section.8.4.2">8.4.2</a>&nbsp;&nbsp;&nbsp;<a href="#content.coding.registration">Registrations</a></li></ul></li></ul></li><li><a href="#rfc.section.9">9.</a>&nbsp;&nbsp;&nbsp;<a href="#security.considerations">Security Considerations</a><ul><li><a href="#rfc.section.9.1">9.1</a>&nbsp;&nbsp;&nbsp;<a href="#attack.pathname">Attacks Based on File and Path Names</a></li><li><a href="#rfc.section.9.2">9.2</a>&nbsp;&nbsp;&nbsp;<a href="#attack.injection">Attacks Based on Command, Code, or Query Injection</a></li><li><a href="#rfc.section.9.3">9.3</a>&nbsp;&nbsp;&nbsp;<a href="#personal.information">Disclosure of Personal Information</a></li><li><a href="#rfc.section.9.4">9.4</a>&nbsp;&nbsp;&nbsp;<a href="#sensitive.information.in.uris">Disclosure of Sensitive Information in URIs</a></li><li><a href="#rfc.section.9.5">9.5</a>&nbsp;&nbsp;&nbsp;<a href="#fragment.disclosure">Disclosure of Fragment after Redirects</a></li><li><a href="#rfc.section.9.6">9.6</a>&nbsp;&nbsp;&nbsp;<a href="#disclosure.product.information">Disclosure of Product Information</a></li><li><a href="#rfc.section.9.7">9.7</a>&nbsp;&nbsp;&nbsp;<a href="#fingerprinting">Browser Fingerprinting</a></li></ul></li><li><a href="#rfc.section.10">10.</a>&nbsp;&nbsp;&nbsp;<a href="#acks">Acknowledgments</a></li><li><a href="#rfc.section.11">11.</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references">References</a><ul><li><a href="#rfc.section.11.1">11.1</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references.1">Normative References</a></li><li><a href="#rfc.section.11.2">11.2</a>&nbsp;&nbsp;&nbsp;<a href="#rfc.references.2">Informative References</a></li></ul></li><li><a href="#rfc.section.A">A.</a>&nbsp;&nbsp;&nbsp;<a href="#differences.between.http.and.mime">Differences between HTTP and MIME</a><ul><li><a href="#rfc.section.A.1">A.1</a>&nbsp;&nbsp;&nbsp;<a href="#mime-version">MIME-Version</a></li><li><a href="#rfc.section.A.2">A.2</a>&nbsp;&nbsp;&nbsp;<a href="#conversion.to.canonical.form">Conversion to Canonical Form</a></li><li><a href="#rfc.section.A.3">A.3</a>&nbsp;&nbsp;&nbsp;<a href="#conversion.of.date.formats">Conversion of Date Formats</a></li><li><a href="#rfc.section.A.4">A.4</a>&nbsp;&nbsp;&nbsp;<a href="#conversion.content-encoding">Conversion of Content-Encoding</a></li><li><a href="#rfc.section.A.5">A.5</a>&nbsp;&nbsp;&nbsp;<a href="#conversion.content-transfer-encoding">Conversion of Content-Transfer-Encoding</a></li><li><a href="#rfc.section.A.6">A.6</a>&nbsp;&nbsp;&nbsp;<a href="#mhtml.line.length">MHTML and Line Length Limitations</a></li></ul></li><li><a href="#rfc.section.B">B.</a>&nbsp;&nbsp;&nbsp;<a href="#changes.from.rfc.2616">Changes from RFC 2616</a></li><li><a href="#rfc.section.C">C.</a>&nbsp;&nbsp;&nbsp;<a href="#imported.abnf">Imported ABNF</a></li><li><a href="#rfc.section.D">D.</a>&nbsp;&nbsp;&nbsp;<a href="#collected.abnf">Collected ABNF</a></li><li><a href="#rfc.index">Index</a></li><li><a href="#rfc.authors">Authors' Addresses</a></li></ul></div><div id="introduction"><h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a>&nbsp;<a href="#introduction">Introduction</a></h1><div id="rfc.section.1.p.1"><p>Each Hypertext Transfer Protocol (HTTP) message is either a request or a response. A server listens on a connection for a request, parses each message received, interprets the message semantics in relation to the identified request target, and responds to that request with one or more response messages. A client constructs request messages to communicate specific intentions, examines received responses to see if the intentions were carried out, and determines how to interpret the results. This document defines HTTP/1.1 request and response semantics in terms of the architecture defined in <a href="#RFC7230" id="rfc.xref.RFC7230.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.<a class="self" href="#rfc.section.1.p.1">&para;</a></p></div><div id="rfc.section.1.p.2"><p>HTTP provides a uniform interface for interacting with a resource (<a href="#resources" title="Resources">Section&nbsp;2</a>), regardless of its type, nature, or implementation, via the manipulation and transfer of representations (<a href="#representations" title="Representations">Section&nbsp;3</a>).<a class="self" href="#rfc.section.1.p.2">&para;</a></p></div><div id="rfc.section.1.p.3"><p>HTTP semantics include the intentions defined by each request method (<a href="#methods" title="Request Methods">Section&nbsp;4</a>), extensions to those semantics that might be described in request header fields (<a href="#request.header.fields" title="Request Header Fields">Section&nbsp;5</a>), the meaning of status codes to indicate a machine-readable response (<a href="#status.codes" title="Response Status Codes">Section&nbsp;6</a>), and the meaning of other control data and resource metadata that might be given in response header fields (<a href="#response.header.fields" title="Response Header Fields">Section&nbsp;7</a>).<a class="self" href="#rfc.section.1.p.3">&para;</a></p></div><div id="rfc.section.1.p.4"><p><span id="rfc.iref.c.1"></span> This document also defines representation metadata that describe how a payload is intended to be interpreted by a recipient, the request header fields that might influence content selection, and the various selection algorithms that are collectively referred to as "<dfn>content negotiation</dfn>" (<a href="#content.negotiation" title="Content Negotiation">Section&nbsp;3.4</a>).<a class="self" href="#rfc.section.1.p.4">&para;</a></p></div><div id="conformance"><h2 id="rfc.section.1.1"><a href="#rfc.section.1.1">1.1</a>&nbsp;<a href="#conformance">Conformance and Error Handling</a></h2><div id="rfc.section.1.1.p.1"><p>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 <a href="#RFC2119" id="rfc.xref.RFC2119.1"><cite title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</cite></a>.<a class="self" href="#rfc.section.1.1.p.1">&para;</a></p></div><div id="rfc.section.1.1.p.2"><p>Conformance criteria and considerations regarding error handling are defined in <a href="rfc7230.html#conformance" title="Conformance and Error Handling">Section 2.5</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.<a class="self" href="#rfc.section.1.1.p.2">&para;</a></p></div></div><div id="notation"><h2 id="rfc.section.1.2"><a href="#rfc.section.1.2">1.2</a>&nbsp;<a href="#notation">Syntax Notation</a></h2><div id="rfc.section.1.2.p.1"><p>This specification uses the Augmented Backus-Naur Form (ABNF) notation of <a href="#RFC5234" id="rfc.xref.RFC5234.1"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> with a list extension, defined in <a href="rfc7230.html#abnf.extension" title="ABNF List Extension: #rule">Section 7</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>, that allows for compact definition of comma-separated lists using a '#' operator (similar to how the '*' operator indicates repetition). <a href="#imported.abnf" title="Imported ABNF">Appendix&nbsp;C</a> describes rules imported from other documents. <a href="#collected.abnf" title="Collected ABNF">Appendix&nbsp;D</a> shows the collected grammar with all list operators expanded to standard ABNF notation.<a class="self" href="#rfc.section.1.2.p.1">&para;</a></p></div><div id="rfc.section.1.2.p.2"><p>This specification uses the terms "character", "character encoding scheme", "charset", and "protocol element" as they are defined in <a href="#RFC6365" id="rfc.xref.RFC6365.1"><cite title="Terminology Used in Internationalization in the IETF">[RFC6365]</cite></a>.<a class="self" href="#rfc.section.1.2.p.2">&para;</a></p></div></div></div><div id="resources"><h1 id="rfc.section.2"><a href="#rfc.section.2">2.</a>&nbsp;<a href="#resources">Resources</a></h1><div id="rfc.section.2.p.1"><p>The target of an HTTP request is called a "<dfn>resource</dfn>". HTTP does not limit the nature of a resource; it merely defines an interface that might be used to interact with resources. Each resource is identified by a Uniform Resource Identifier (URI), as described in <a href="rfc7230.html#uri" title="Uniform Resource Identifiers">Section 2.7</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.<a class="self" href="#rfc.section.2.p.1">&para;</a></p></div><div id="rfc.section.2.p.2"><p>When a client constructs an HTTP/1.1 request message, it sends the <a href="rfc7230.html#target-resource" class="smpl">target URI</a> in one of various forms, as defined in (<a href="rfc7230.html#request-target" title="Request Target">Section 5.3</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>). When a request is received, the server reconstructs an <a href="rfc7230.html#effective.request.uri" class="smpl">effective request URI</a> for the target resource (<a href="rfc7230.html#effective.request.uri" title="Effective Request URI">Section 5.5</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.6"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>).<a class="self" href="#rfc.section.2.p.2">&para;</a></p></div><div id="rfc.section.2.p.3"><p>One design goal of HTTP is to separate resource identification from request semantics, which is made possible by vesting the request semantics in the request method (<a href="#methods" title="Request Methods">Section&nbsp;4</a>) and a few request-modifying header fields (<a href="#request.header.fields" title="Request Header Fields">Section&nbsp;5</a>). If there is a conflict between the method semantics and any semantic implied by the URI itself, as described in <a href="#safe.methods" title="Safe Methods">Section&nbsp;4.2.1</a>, the method semantics take precedence.<a class="self" href="#rfc.section.2.p.3">&para;</a></p></div></div><div id="representations"><h1 id="rfc.section.3"><a href="#rfc.section.3">3.</a>&nbsp;<a href="#representations">Representations</a></h1><div id="rfc.section.3.p.1"><p>Considering that a resource could be anything, and that the uniform interface provided by HTTP is similar to a window through which one can observe and act upon such a thing only through the communication of messages to some independent actor on the other side, an abstraction is needed to represent ("take the place of") the current or desired state of that thing in our communications. That abstraction is called a representation <a href="#REST" id="rfc.xref.REST.1"><cite title="Architectural Styles and the Design of Network-based Software Architectures">[REST]</cite></a>.<a class="self" href="#rfc.section.3.p.1">&para;</a></p></div><div id="rfc.section.3.p.2"><p>For the purposes of HTTP, a "<dfn>representation</dfn>" is information that is intended to reflect a past, current, or desired state of a given resource, in a format that can be readily communicated via the protocol, and that consists of a set of representation metadata and a potentially unbounded stream of representation data.<a class="self" href="#rfc.section.3.p.2">&para;</a></p></div><div id="rfc.section.3.p.3"><p>An origin server might be provided with, or be capable of generating, multiple representations that are each intended to reflect the current state of a <a href="#resources" class="smpl">target resource</a>. In such cases, some algorithm is used by the origin server to select one of those representations as most applicable to a given request, usually based on <a href="#content.negotiation" class="smpl">content negotiation</a>. This "<dfn>selected representation</dfn>" is used to provide the data and metadata for evaluating conditional requests <a href="#RFC7232" id="rfc.xref.RFC7232.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a> and constructing the payload for <a href="#status.200" class="smpl">200 (OK)</a> and <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a> responses to GET (<a href="#GET" id="rfc.xref.GET.1" title="GET">Section&nbsp;4.3.1</a>).<a class="self" href="#rfc.section.3.p.3">&para;</a></p></div><div id="representation.metadata"><h2 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1</a>&nbsp;<a href="#representation.metadata">Representation Metadata</a></h2><div id="rfc.section.3.1.p.1"><p>Representation header fields provide metadata about the representation. When a message includes a payload body, the representation header fields describe how to interpret the representation data enclosed in the payload body. In a response to a HEAD request, the representation header fields describe the representation data that would have been enclosed in the payload body if the same request had been a GET.<a class="self" href="#rfc.section.3.1.p.1">&para;</a></p></div><div id="rfc.section.3.1.p.2"><p>The following header fields convey representation metadata:<a class="self" href="#rfc.section.3.1.p.2">&para;</a></p></div><div id="rfc.table.u.1"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Header Field Name</th><th>Defined in...</th></tr></thead><tbody><tr><td class="left">Content-Type</td><td class="left"><a href="#header.content-type" id="rfc.xref.header.content-type.1" title="Content-Type">Section&nbsp;3.1.1.5</a></td></tr><tr><td class="left">Content-Encoding</td><td class="left"><a href="#header.content-encoding" id="rfc.xref.header.content-encoding.1" title="Content-Encoding">Section&nbsp;3.1.2.2</a></td></tr><tr><td class="left">Content-Language</td><td class="left"><a href="#header.content-language" id="rfc.xref.header.content-language.1" title="Content-Language">Section&nbsp;3.1.3.2</a></td></tr><tr><td class="left">Content-Location</td><td class="left"><a href="#header.content-location" id="rfc.xref.header.content-location.1" title="Content-Location">Section&nbsp;3.1.4.2</a></td></tr></tbody></table></div><div id="data.type"><h3 id="rfc.section.3.1.1"><a href="#rfc.section.3.1.1">3.1.1</a>&nbsp;<a href="#data.type">Processing Representation Data</a></h3><div id="media.type"><h4 id="rfc.section.3.1.1.1"><a href="#rfc.section.3.1.1.1">3.1.1.1</a>&nbsp;<a href="#media.type">Media Type</a></h4><div id="rfc.section.3.1.1.1.p.1"><p>HTTP uses Internet media types <a href="#RFC2046" id="rfc.xref.RFC2046.1"><cite title="Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types">[RFC2046]</cite></a> in the <a href="#header.content-type" class="smpl">Content-Type</a> (<a href="#header.content-type" id="rfc.xref.header.content-type.2" title="Content-Type">Section&nbsp;3.1.1.5</a>) and <a href="#header.accept" class="smpl">Accept</a> (<a href="#header.accept" id="rfc.xref.header.accept.1" title="Accept">Section&nbsp;5.3.2</a>) header fields in order to provide open and extensible data typing and type negotiation. Media types define both a data format and various processing models: how to process that data in accordance with each context in which it is received.<a class="self" href="#rfc.section.3.1.1.1.p.1">&para;</a></p></div><div id="rfc.figure.u.1"><pre class="inline"><span id="rfc.iref.g.1"></span><span id="rfc.iref.g.2"></span><span id="rfc.iref.g.3"></span>  <a href="#media.type" class="smpl">media-type</a> = <a href="#media.type" class="smpl">type</a> "/" <a href="#media.type" class="smpl">subtype</a> *( <a href="#imported.abnf" class="smpl">OWS</a> ";" <a href="#imported.abnf" class="smpl">OWS</a> <a href="#rule.parameter" class="smpl">parameter</a> ) 
    532512  <a href="#media.type" class="smpl">type</a>       = <a href="#imported.abnf" class="smpl">token</a> 
    533513  <a href="#media.type" class="smpl">subtype</a>    = <a href="#imported.abnf" class="smpl">token</a> 
    534 </pre></div><div id="rule.parameter"><p id="rfc.section.3.1.1.1.p.2"> The type/subtype <em class="bcp14">MAY</em> be followed by parameters in the form of name=value pairs.<a class="self" href="#rfc.section.3.1.1.1.p.2">&para;</a></p></div><div id="rfc.figure.u.2"><pre class="inline"><span id="rfc.iref.g.4"></span>  <a href="#rule.parameter" class="smpl">parameter</a>      = <a href="#imported.abnf" class="smpl">token</a> "=" ( <a href="#imported.abnf" class="smpl">token</a> / <a href="#imported.abnf" class="smpl">quoted-string</a> ) 
    535 </pre></div><p id="rfc.section.3.1.1.1.p.3">The type, subtype, and parameter name tokens are case-insensitive. Parameter values might or might not be case-sensitive, depending on the semantics of the parameter name. The presence or absence of a parameter might be significant to the processing of a media-type, depending on its definition within the media type registry.<a class="self" href="#rfc.section.3.1.1.1.p.3">&para;</a></p><p id="rfc.section.3.1.1.1.p.4">A parameter value that matches the <a href="#imported.abnf" class="smpl">token</a> production can be transmitted either as a token or within a quoted-string. The quoted and unquoted values are equivalent. For example, the following examples are all equivalent, but the first is preferred for consistency:<a class="self" href="#rfc.section.3.1.1.1.p.4">&para;</a></p><div id="rfc.figure.u.3"><pre class="text">  text/html;charset=utf-8 
     514</pre></div><div id="rule.parameter"><div id="rfc.section.3.1.1.1.p.2"><p> The type/subtype <em class="bcp14">MAY</em> be followed by parameters in the form of name=value pairs.<a class="self" href="#rfc.section.3.1.1.1.p.2">&para;</a></p></div></div><div id="rfc.figure.u.2"><pre class="inline"><span id="rfc.iref.g.4"></span>  <a href="#rule.parameter" class="smpl">parameter</a>      = <a href="#imported.abnf" class="smpl">token</a> "=" ( <a href="#imported.abnf" class="smpl">token</a> / <a href="#imported.abnf" class="smpl">quoted-string</a> ) 
     515</pre></div><div id="rfc.section.3.1.1.1.p.3"><p>The type, subtype, and parameter name tokens are case-insensitive. Parameter values might or might not be case-sensitive, depending on the semantics of the parameter name. The presence or absence of a parameter might be significant to the processing of a media-type, depending on its definition within the media type registry.<a class="self" href="#rfc.section.3.1.1.1.p.3">&para;</a></p></div><div id="rfc.section.3.1.1.1.p.4"><p>A parameter value that matches the <a href="#imported.abnf" class="smpl">token</a> production can be transmitted either as a token or within a quoted-string. The quoted and unquoted values are equivalent. For example, the following examples are all equivalent, but the first is preferred for consistency:<a class="self" href="#rfc.section.3.1.1.1.p.4">&para;</a></p></div><div id="rfc.figure.u.3"><pre class="text">  text/html;charset=utf-8 
    536516  text/html;charset=UTF-8 
    537517  Text/HTML;Charset="utf-8" 
    538518  text/html; charset="utf-8" 
    539 </pre></div><p id="rfc.section.3.1.1.1.p.5">Internet media types ought to be registered with IANA according to the procedures defined in <a href="#BCP13" id="rfc.xref.BCP13.1"><cite title="Media Type Specifications and Registration Procedures">[BCP13]</cite></a>.<a class="self" href="#rfc.section.3.1.1.1.p.5">&para;</a></p><div class="note" id="rfc.section.3.1.1.1.p.6"><p><b>Note:</b> Unlike some similar constructs in other header fields, media type parameters do not allow whitespace (even "bad" whitespace) around the "=" character.</p> </div></div><div id="charset"><h4 id="rfc.section.3.1.1.2"><a href="#rfc.section.3.1.1.2">3.1.1.2</a>&nbsp;<a href="#charset">Charset</a></h4><p id="rfc.section.3.1.1.2.p.1">HTTP uses <dfn>charset</dfn> names to indicate or negotiate the character encoding scheme of a textual representation <a href="#RFC6365" id="rfc.xref.RFC6365.2"><cite title="Terminology Used in Internationalization in the IETF">[RFC6365]</cite></a>. A charset is identified by a case-insensitive token.<a class="self" href="#rfc.section.3.1.1.2.p.1">&para;</a></p><div id="rfc.figure.u.4"><pre class="inline"><span id="rfc.iref.g.5"></span>  <a href="#charset" class="smpl">charset</a> = <a href="#imported.abnf" class="smpl">token</a> 
    540 </pre></div><p id="rfc.section.3.1.1.2.p.2">Charset names ought to be registered in the IANA "Character Sets" registry (&lt;<a href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a>&gt;) according to the procedures defined in <a href="#RFC2978" id="rfc.xref.RFC2978.1"><cite title="IANA Charset Registration Procedures">[RFC2978]</cite></a>.<a class="self" href="#rfc.section.3.1.1.2.p.2">&para;</a></p></div><div id="canonicalization.and.text.defaults"><h4 id="rfc.section.3.1.1.3"><a href="#rfc.section.3.1.1.3">3.1.1.3</a>&nbsp;<a href="#canonicalization.and.text.defaults">Canonicalization and Text Defaults</a></h4><p id="rfc.section.3.1.1.3.p.1">Internet media types are registered with a canonical form in order to be interoperable among systems with varying native encoding formats. Representations selected or transferred via HTTP ought to be in canonical form, for many of the same reasons described by the Multipurpose Internet Mail Extensions (MIME) <a href="#RFC2045" id="rfc.xref.RFC2045.1"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a>. However, the performance characteristics of email deployments (i.e., store and forward messages to peers) are significantly different from those common to HTTP and the Web (server-based information services). Furthermore, MIME's constraints for the sake of compatibility with older mail transfer protocols do not apply to HTTP (see <a href="#differences.between.http.and.mime" title="Differences between HTTP and MIME">Appendix&nbsp;A</a>).<a class="self" href="#rfc.section.3.1.1.3.p.1">&para;</a></p><p id="rfc.section.3.1.1.3.p.2">MIME's canonical form requires that media subtypes of the "text" type use CRLF as the text line break. HTTP allows the transfer of text media with plain CR or LF alone representing a line break, when such line breaks are consistent for an entire representation. An HTTP sender <em class="bcp14">MAY</em> generate, and a recipient <em class="bcp14">MUST</em> be able to parse, line breaks in text media that consist of CRLF, bare CR, or bare LF. In addition, text media in HTTP is not limited to charsets that use octets 13 and 10 for CR and LF, respectively. This flexibility regarding line breaks applies only to text within a representation that has been assigned a "text" media type; it does not apply to "multipart" types or HTTP elements outside the payload body (e.g., header fields).<a class="self" href="#rfc.section.3.1.1.3.p.2">&para;</a></p><p id="rfc.section.3.1.1.3.p.3">If a representation is encoded with a content-coding, the underlying data ought to be in a form defined above prior to being encoded.<a class="self" href="#rfc.section.3.1.1.3.p.3">&para;</a></p></div><div id="multipart.types"><h4 id="rfc.section.3.1.1.4"><a href="#rfc.section.3.1.1.4">3.1.1.4</a>&nbsp;<a href="#multipart.types">Multipart Types</a></h4><p id="rfc.section.3.1.1.4.p.1">MIME provides for a number of "multipart" types &#8212; encapsulations of one or more representations within a single message body. All multipart types share a common syntax, as defined in <a href="https://tools.ietf.org/html/rfc2046#section-5.1.1">Section 5.1.1</a> of <a href="#RFC2046" id="rfc.xref.RFC2046.2"><cite title="Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types">[RFC2046]</cite></a>, and include a boundary parameter as part of the media type value. The message body is itself a protocol element; a sender <em class="bcp14">MUST</em> generate only CRLF to represent line breaks between body parts.<a class="self" href="#rfc.section.3.1.1.4.p.1">&para;</a></p><p id="rfc.section.3.1.1.4.p.2">HTTP message framing does not use the multipart boundary as an indicator of message body length, though it might be used by implementations that generate or process the payload. For example, the "multipart/form-data" type is often used for carrying form data in a request, as described in <a href="#RFC2388" id="rfc.xref.RFC2388.1"><cite title="Returning Values from Forms: multipart/form-data">[RFC2388]</cite></a>, and the "multipart/byteranges" type is defined by this specification for use in some <a href="rfc7233.html#status.206" class="smpl">206 (Partial Content)</a> responses <a href="#RFC7233" id="rfc.xref.RFC7233.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[RFC7233]</cite></a>.<a class="self" href="#rfc.section.3.1.1.4.p.2">&para;</a></p></div><div id="header.content-type"><h4 id="rfc.section.3.1.1.5"><a href="#rfc.section.3.1.1.5">3.1.1.5</a>&nbsp;<a href="#header.content-type">Content-Type</a></h4><p id="rfc.section.3.1.1.5.p.1">The "Content-Type" header field indicates the media type of the associated representation: either the representation enclosed in the message payload or the <a href="#representations" class="smpl">selected representation</a>, as determined by the message semantics. The indicated media type defines both the data format and how that data is intended to be processed by a recipient, within the scope of the received message semantics, after any content codings indicated by <a href="#header.content-encoding" class="smpl">Content-Encoding</a> are decoded.<a class="self" href="#rfc.section.3.1.1.5.p.1">&para;</a></p><div id="rfc.figure.u.5"><pre class="inline"><span id="rfc.iref.g.6"></span>  <a href="#header.content-type" class="smpl">Content-Type</a> = <a href="#media.type" class="smpl">media-type</a> 
    541 </pre></div><p id="rfc.section.3.1.1.5.p.2">Media types are defined in <a href="#media.type" title="Media Type">Section&nbsp;3.1.1.1</a>. An example of the field is<a class="self" href="#rfc.section.3.1.1.5.p.2">&para;</a></p><div id="rfc.figure.u.6"><pre class="text">  Content-Type: text/html; charset=ISO-8859-4 
    542 </pre></div><p id="rfc.section.3.1.1.5.p.3">A sender that generates a message containing a payload body <em class="bcp14">SHOULD</em> generate a Content-Type header field in that message unless the intended media type of the enclosed representation is unknown to the sender. If a Content-Type header field is not present, the recipient <em class="bcp14">MAY</em> either assume a media type of "application/octet-stream" (<a href="#RFC2046" id="rfc.xref.RFC2046.3"><cite title="Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types">[RFC2046]</cite></a>, <a href="https://tools.ietf.org/html/rfc2046#section-4.5.1">Section 4.5.1</a>) or examine the data to determine its type.<a class="self" href="#rfc.section.3.1.1.5.p.3">&para;</a></p><p id="rfc.section.3.1.1.5.p.4">In practice, resource owners do not always properly configure their origin server to provide the correct Content-Type for a given representation, with the result that some clients will examine a payload's content and override the specified type. Clients that do so risk drawing incorrect conclusions, which might expose additional security risks (e.g., "privilege escalation"). Furthermore, it is impossible to determine the sender's intent by examining the data format: many data formats match multiple media types that differ only in processing semantics. Implementers are encouraged to provide a means of disabling such "content sniffing" when it is used.<a class="self" href="#rfc.section.3.1.1.5.p.4">&para;</a></p></div></div><div id="data.encoding"><h3 id="rfc.section.3.1.2"><a href="#rfc.section.3.1.2">3.1.2</a>&nbsp;<a href="#data.encoding">Encoding for Compression or Integrity</a></h3><div id="content.codings"><h4 id="rfc.section.3.1.2.1"><a href="#rfc.section.3.1.2.1">3.1.2.1</a>&nbsp;<a href="#content.codings">Content Codings</a></h4><p id="rfc.section.3.1.2.1.p.1">Content coding values indicate an encoding transformation that has been or can be applied to a representation. Content codings are primarily used to allow a representation to be compressed or otherwise usefully transformed without losing the identity of its underlying media type and without loss of information. Frequently, the representation is stored in coded form, transmitted directly, and only decoded by the final recipient.<a class="self" href="#rfc.section.3.1.2.1.p.1">&para;</a></p><div id="rfc.figure.u.7"><pre class="inline"><span id="rfc.iref.g.7"></span>  <a href="#content.codings" class="smpl">content-coding</a>   = <a href="#imported.abnf" class="smpl">token</a> 
    543 </pre></div><p id="rfc.section.3.1.2.1.p.2">All content-coding values are case-insensitive and ought to be registered within the "HTTP Content Coding Registry", as defined in <a href="#content.coding.registry" title="Content Coding Registry">Section&nbsp;8.4</a>. They are used in the <a href="#header.accept-encoding" class="smpl">Accept-Encoding</a> (<a href="#header.accept-encoding" id="rfc.xref.header.accept-encoding.1" title="Accept-Encoding">Section&nbsp;5.3.4</a>) and <a href="#header.content-encoding" class="smpl">Content-Encoding</a> (<a href="#header.content-encoding" id="rfc.xref.header.content-encoding.2" title="Content-Encoding">Section&nbsp;3.1.2.2</a>) header fields.<a class="self" href="#rfc.section.3.1.2.1.p.2">&para;</a></p><p id="rfc.section.3.1.2.1.p.3">The following content-coding values are defined by this specification: <a class="self" href="#rfc.section.3.1.2.1.p.3">&para;</a></p><ul class="empty"><li>compress (and x-compress): See <a href="rfc7230.html#compress.coding" title="Compress Coding">Section 4.2.1</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.7"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.</li><li>deflate: See <a href="rfc7230.html#deflate.coding" title="Deflate Coding">Section 4.2.2</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.8"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.</li><li>gzip (and x-gzip): See <a href="rfc7230.html#gzip.coding" title="Gzip Coding">Section 4.2.3</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.9"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.</li></ul></div><div id="header.content-encoding"><h4 id="rfc.section.3.1.2.2"><a href="#rfc.section.3.1.2.2">3.1.2.2</a>&nbsp;<a href="#header.content-encoding">Content-Encoding</a></h4><p id="rfc.section.3.1.2.2.p.1">The "Content-Encoding" header field indicates what content codings have been applied to the representation, beyond those inherent in the media type, and thus what decoding mechanisms have to be applied in order to obtain data in the media type referenced by the <a href="#header.content-type" class="smpl">Content-Type</a> header field. Content-Encoding is primarily used to allow a representation's data to be compressed without losing the identity of its underlying media type.<a class="self" href="#rfc.section.3.1.2.2.p.1">&para;</a></p><div id="rfc.figure.u.8"><pre class="inline"><span id="rfc.iref.g.8"></span>  <a href="#header.content-encoding" class="smpl">Content-Encoding</a> = 1#<a href="#content.codings" class="smpl">content-coding</a> 
    544 </pre></div><p id="rfc.section.3.1.2.2.p.2">An example of its use is<a class="self" href="#rfc.section.3.1.2.2.p.2">&para;</a></p><div id="rfc.figure.u.9"><pre class="text">  Content-Encoding: gzip 
    545 </pre></div><p id="rfc.section.3.1.2.2.p.3">If one or more encodings have been applied to a representation, the sender that applied the encodings <em class="bcp14">MUST</em> generate a Content-Encoding header field that lists the content codings in the order in which they were applied. Additional information about the encoding parameters can be provided by other header fields not defined by this specification.<a class="self" href="#rfc.section.3.1.2.2.p.3">&para;</a></p><p id="rfc.section.3.1.2.2.p.4">Unlike Transfer-Encoding (<a href="rfc7230.html#header.transfer-encoding" title="Transfer-Encoding">Section 3.3.1</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.10"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>), the codings listed in Content-Encoding are a characteristic of the representation; the representation is defined in terms of the coded form, and all other metadata about the representation is about the coded form unless otherwise noted in the metadata definition. Typically, the representation is only decoded just prior to rendering or analogous usage.<a class="self" href="#rfc.section.3.1.2.2.p.4">&para;</a></p><p id="rfc.section.3.1.2.2.p.5">If the media type includes an inherent encoding, such as a data format that is always compressed, then that encoding would not be restated in Content-Encoding even if it happens to be the same algorithm as one of the content codings. Such a content coding would only be listed if, for some bizarre reason, it is applied a second time to form the representation. Likewise, an origin server might choose to publish the same data as multiple representations that differ only in whether the coding is defined as part of <a href="#header.content-type" class="smpl">Content-Type</a> or Content-Encoding, since some user agents will behave differently in their handling of each response (e.g., open a "Save as ..." dialog instead of automatic decompression and rendering of content).<a class="self" href="#rfc.section.3.1.2.2.p.5">&para;</a></p><p id="rfc.section.3.1.2.2.p.6">An origin server <em class="bcp14">MAY</em> respond with a status code of <a href="#status.415" class="smpl">415 (Unsupported Media Type)</a> if a representation in the request message has a content coding that is not acceptable.<a class="self" href="#rfc.section.3.1.2.2.p.6">&para;</a></p></div></div><div id="audience.language"><h3 id="rfc.section.3.1.3"><a href="#rfc.section.3.1.3">3.1.3</a>&nbsp;<a href="#audience.language">Audience Language</a></h3><div id="language.tags"><h4 id="rfc.section.3.1.3.1"><a href="#rfc.section.3.1.3.1">3.1.3.1</a>&nbsp;<a href="#language.tags">Language Tags</a></h4><p id="rfc.section.3.1.3.1.p.1">A language tag, as defined in <a href="#RFC5646" id="rfc.xref.RFC5646.1"><cite title="Tags for Identifying Languages">[RFC5646]</cite></a>, identifies a natural language spoken, written, or otherwise conveyed by human beings for communication of information to other human beings. Computer languages are explicitly excluded.<a class="self" href="#rfc.section.3.1.3.1.p.1">&para;</a></p><p id="rfc.section.3.1.3.1.p.2">HTTP uses language tags within the <a href="#header.accept-language" class="smpl">Accept-Language</a> and <a href="#header.content-language" class="smpl">Content-Language</a> header fields. <a href="#header.accept-language" class="smpl">Accept-Language</a> uses the broader language-range production defined in <a href="#header.accept-language" id="rfc.xref.header.accept-language.1" title="Accept-Language">Section&nbsp;5.3.5</a>, whereas <a href="#header.content-language" class="smpl">Content-Language</a> uses the language-tag production defined below.<a class="self" href="#rfc.section.3.1.3.1.p.2">&para;</a></p><div id="rfc.figure.u.10"><pre class="inline"><span id="rfc.iref.g.9"></span>  <a href="#language.tags" class="smpl">language-tag</a> = &lt;Language-Tag, see <a href="#RFC5646" id="rfc.xref.RFC5646.2"><cite title="Tags for Identifying Languages">[RFC5646]</cite></a>, <a href="https://tools.ietf.org/html/rfc5646#section-2.1">Section 2.1</a>&gt; 
    546 </pre></div><p id="rfc.section.3.1.3.1.p.3">A language tag is a sequence of one or more case-insensitive subtags, each separated by a hyphen character ("-", %x2D). In most cases, a language tag consists of a primary language subtag that identifies a broad family of related languages (e.g., "en" = English), which is optionally followed by a series of subtags that refine or narrow that language's range (e.g., "en-CA" = the variety of English as communicated in Canada). Whitespace is not allowed within a language tag. Example tags include:<a class="self" href="#rfc.section.3.1.3.1.p.3">&para;</a></p><div id="rfc.figure.u.11"><pre class="text">  fr, en-US, es-419, az-Arab, x-pig-latin, man-Nkoo-GN 
    547 </pre></div><p id="rfc.section.3.1.3.1.p.4">See <a href="#RFC5646" id="rfc.xref.RFC5646.3"><cite title="Tags for Identifying Languages">[RFC5646]</cite></a> for further information.<a class="self" href="#rfc.section.3.1.3.1.p.4">&para;</a></p></div><div id="header.content-language"><h4 id="rfc.section.3.1.3.2"><a href="#rfc.section.3.1.3.2">3.1.3.2</a>&nbsp;<a href="#header.content-language">Content-Language</a></h4><p id="rfc.section.3.1.3.2.p.1">The "Content-Language" header field describes the natural language(s) of the intended audience for the representation. Note that this might not be equivalent to all the languages used within the representation.<a class="self" href="#rfc.section.3.1.3.2.p.1">&para;</a></p><div id="rfc.figure.u.12"><pre class="inline"><span id="rfc.iref.g.10"></span>  <a href="#header.content-language" class="smpl">Content-Language</a> = 1#<a href="#language.tags" class="smpl">language-tag</a> 
    548 </pre></div><p id="rfc.section.3.1.3.2.p.2">Language tags are defined in <a href="#language.tags" title="Language Tags">Section&nbsp;3.1.3.1</a>. The primary purpose of Content-Language is to allow a user to identify and differentiate representations according to the users' own preferred language. Thus, if the content is intended only for a Danish-literate audience, the appropriate field is<a class="self" href="#rfc.section.3.1.3.2.p.2">&para;</a></p><div id="rfc.figure.u.13"><pre class="text">  Content-Language: da 
    549 </pre></div><p id="rfc.section.3.1.3.2.p.3">If no Content-Language is specified, the default is that the content is intended for all language audiences. This might mean that the sender does not consider it to be specific to any natural language, or that the sender does not know for which language it is intended.<a class="self" href="#rfc.section.3.1.3.2.p.3">&para;</a></p><p id="rfc.section.3.1.3.2.p.4">Multiple languages <em class="bcp14">MAY</em> be listed for content that is intended for multiple audiences. For example, a rendition of the "Treaty of Waitangi", presented simultaneously in the original Maori and English versions, would call for<a class="self" href="#rfc.section.3.1.3.2.p.4">&para;</a></p><div id="rfc.figure.u.14"><pre class="text">  Content-Language: mi, en 
    550 </pre></div><p id="rfc.section.3.1.3.2.p.5">However, just because multiple languages are present within a representation does not mean that it is intended for multiple linguistic audiences. An example would be a beginner's language primer, such as "A First Lesson in Latin", which is clearly intended to be used by an English-literate audience. In this case, the Content-Language would properly only include "en".<a class="self" href="#rfc.section.3.1.3.2.p.5">&para;</a></p><p id="rfc.section.3.1.3.2.p.6">Content-Language <em class="bcp14">MAY</em> be applied to any media type &#8212; it is not limited to textual documents.<a class="self" href="#rfc.section.3.1.3.2.p.6">&para;</a></p></div></div><div id="identification"><h3 id="rfc.section.3.1.4"><a href="#rfc.section.3.1.4">3.1.4</a>&nbsp;<a href="#identification">Identification</a></h3><div id="identifying.payload"><h4 id="rfc.section.3.1.4.1"><a href="#rfc.section.3.1.4.1">3.1.4.1</a>&nbsp;<a href="#identifying.payload">Identifying a Representation</a></h4><p id="rfc.section.3.1.4.1.p.1">When a complete or partial representation is transferred in a message payload, it is often desirable for the sender to supply, or the recipient to determine, an identifier for a resource corresponding to that representation.<a class="self" href="#rfc.section.3.1.4.1.p.1">&para;</a></p><p id="rfc.section.3.1.4.1.p.2">For a request message: <a class="self" href="#rfc.section.3.1.4.1.p.2">&para;</a></p><ul><li>If the request has a <a href="#header.content-location" class="smpl">Content-Location</a> header field, then the sender asserts that the payload is a representation of the resource identified by the Content-Location field-value. However, such an assertion cannot be trusted unless it can be verified by other means (not defined by this specification). The information might still be useful for revision history links.</li><li>Otherwise, the payload is unidentified.</li></ul><p id="rfc.section.3.1.4.1.p.3">For a response message, the following rules are applied in order until a match is found: <a class="self" href="#rfc.section.3.1.4.1.p.3">&para;</a></p><ol><li>If the request method is GET or HEAD and the response status code is <a href="#status.200" class="smpl">200 (OK)</a>, <a href="#status.204" class="smpl">204 (No Content)</a>, <a href="rfc7233.html#status.206" class="smpl">206 (Partial Content)</a>, or <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a>, the payload is a representation of the resource identified by the effective request URI (<a href="rfc7230.html#effective.request.uri" title="Effective Request URI">Section 5.5</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.11"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>).</li><li>If the request method is GET or HEAD and the response status code is <a href="#status.203" class="smpl">203 (Non-Authoritative Information)</a>, the payload is a potentially modified or enhanced representation of the <a href="#resources" class="smpl">target resource</a> as provided by an intermediary.</li><li>If the response has a <a href="#header.content-location" class="smpl">Content-Location</a> header field and its field-value is a reference to the same URI as the effective request URI, the payload is a representation of the resource identified by the effective request URI.</li><li>If the response has a <a href="#header.content-location" class="smpl">Content-Location</a> header field and its field-value is a reference to a URI different from the effective request URI, then the sender asserts that the payload is a representation of the resource identified by the Content-Location field-value. However, such an assertion cannot be trusted unless it can be verified by other means (not defined by this specification).</li><li>Otherwise, the payload is unidentified.</li></ol></div><div id="header.content-location"><h4 id="rfc.section.3.1.4.2"><a href="#rfc.section.3.1.4.2">3.1.4.2</a>&nbsp;<a href="#header.content-location">Content-Location</a></h4><p id="rfc.section.3.1.4.2.p.1">The "Content-Location" header field references a URI that can be used as an identifier for a specific resource corresponding to the representation in this message's payload. In other words, if one were to perform a GET request on this URI at the time of this message's generation, then a <a href="#status.200" class="smpl">200 (OK)</a> response would contain the same representation that is enclosed as payload in this message.<a class="self" href="#rfc.section.3.1.4.2.p.1">&para;</a></p><div id="rfc.figure.u.15"><pre class="inline"><span id="rfc.iref.g.11"></span>  <a href="#header.content-location" class="smpl">Content-Location</a> = <a href="#imported.abnf" class="smpl">absolute-URI</a> / <a href="#imported.abnf" class="smpl">partial-URI</a> 
    551 </pre></div><p id="rfc.section.3.1.4.2.p.2">The Content-Location value is not a replacement for the effective Request URI (<a href="rfc7230.html#effective.request.uri" title="Effective Request URI">Section 5.5</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.12"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>). It is representation metadata. It has the same syntax and semantics as the header field of the same name defined for MIME body parts in <a href="https://tools.ietf.org/html/rfc2557#section-4">Section 4</a> of <a href="#RFC2557" id="rfc.xref.RFC2557.1"><cite title="MIME Encapsulation of Aggregate Documents, such as HTML (MHTML)">[RFC2557]</cite></a>. However, its appearance in an HTTP message has some special implications for HTTP recipients.<a class="self" href="#rfc.section.3.1.4.2.p.2">&para;</a></p><p id="rfc.section.3.1.4.2.p.3">If Content-Location is included in a <a href="#status.2xx" class="smpl">2xx (Successful)</a> response message and its value refers (after conversion to absolute form) to a URI that is the same as the effective request URI, then the recipient <em class="bcp14">MAY</em> consider the payload to be a current representation of that resource at the time indicated by the message origination date. For a GET (<a href="#GET" id="rfc.xref.GET.2" title="GET">Section&nbsp;4.3.1</a>) or HEAD (<a href="#HEAD" id="rfc.xref.HEAD.1" title="HEAD">Section&nbsp;4.3.2</a>) request, this is the same as the default semantics when no Content-Location is provided by the server. For a state-changing request like PUT (<a href="#PUT" id="rfc.xref.PUT.1" title="PUT">Section&nbsp;4.3.4</a>) or POST (<a href="#POST" id="rfc.xref.POST.1" title="POST">Section&nbsp;4.3.3</a>), it implies that the server's response contains the new representation of that resource, thereby distinguishing it from representations that might only report about the action (e.g., "It worked!"). This allows authoring applications to update their local copies without the need for a subsequent GET request.<a class="self" href="#rfc.section.3.1.4.2.p.3">&para;</a></p><p id="rfc.section.3.1.4.2.p.4">If Content-Location is included in a <a href="#status.2xx" class="smpl">2xx (Successful)</a> response message and its field-value refers to a URI that differs from the effective request URI, then the origin server claims that the URI is an identifier for a different resource corresponding to the enclosed representation. Such a claim can only be trusted if both identifiers share the same resource owner, which cannot be programmatically determined via HTTP. <a class="self" href="#rfc.section.3.1.4.2.p.4">&para;</a></p><ul><li>For a response to a GET or HEAD request, this is an indication that the effective request URI refers to a resource that is subject to content negotiation and the Content-Location field-value is a more specific identifier for the <a href="#representations" class="smpl">selected representation</a>.</li><li>For a <a href="#status.201" class="smpl">201 (Created)</a> response to a state-changing method, a Content-Location field-value that is identical to the <a href="#header.location" class="smpl">Location</a> field-value indicates that this payload is a current representation of the newly created resource.</li><li>Otherwise, such a Content-Location indicates that this payload is a representation reporting on the requested action's status and that the same report is available (for future access with GET) at the given URI. For example, a purchase transaction made via a POST request might include a receipt document as the payload of the <a href="#status.200" class="smpl">200 (OK)</a> response; the Content-Location field-value provides an identifier for retrieving a copy of that same receipt in the future.</li></ul><p id="rfc.section.3.1.4.2.p.5">A user agent that sends Content-Location in a request message is stating that its value refers to where the user agent originally obtained the content of the enclosed representation (prior to any modifications made by that user agent). In other words, the user agent is providing a back link to the source of the original representation.<a class="self" href="#rfc.section.3.1.4.2.p.5">&para;</a></p><p id="rfc.section.3.1.4.2.p.6">An origin server that receives a Content-Location field in a request message <em class="bcp14">MUST</em> treat the information as transitory request context rather than as metadata to be saved verbatim as part of the representation. An origin server <em class="bcp14">MAY</em> use that context to guide in processing the request or to save it for other uses, such as within source links or versioning metadata. However, an origin server <em class="bcp14">MUST NOT</em> use such context information to alter the request semantics.<a class="self" href="#rfc.section.3.1.4.2.p.6">&para;</a></p><p id="rfc.section.3.1.4.2.p.7">For example, if a client makes a PUT request on a negotiated resource and the origin server accepts that PUT (without redirection), then the new state of that resource is expected to be consistent with the one representation supplied in that PUT; the Content-Location cannot be used as a form of reverse content selection identifier to update only one of the negotiated representations. If the user agent had wanted the latter semantics, it would have applied the PUT directly to the Content-Location URI.<a class="self" href="#rfc.section.3.1.4.2.p.7">&para;</a></p></div></div></div><div id="representation.data"><h2 id="rfc.section.3.2"><a href="#rfc.section.3.2">3.2</a>&nbsp;<a href="#representation.data">Representation Data</a></h2><p id="rfc.section.3.2.p.1">The representation data associated with an HTTP message is either provided as the payload body of the message or referred to by the message semantics and the effective request URI. The representation data is in a format and encoding defined by the representation metadata header fields.<a class="self" href="#rfc.section.3.2.p.1">&para;</a></p><p id="rfc.section.3.2.p.2">The data type of the representation data is determined via the header fields <a href="#header.content-type" class="smpl">Content-Type</a> and <a href="#header.content-encoding" class="smpl">Content-Encoding</a>. These define a two-layer, ordered encoding model:<a class="self" href="#rfc.section.3.2.p.2">&para;</a></p><div id="rfc.figure.u.16"><pre class="text">  representation-data := Content-Encoding( Content-Type( bits ) ) 
    552 </pre></div></div><div id="payload"><h2 id="rfc.section.3.3"><a href="#rfc.section.3.3">3.3</a>&nbsp;<a href="#payload">Payload Semantics</a></h2><p id="rfc.section.3.3.p.1">Some HTTP messages transfer a complete or partial representation as the message "<dfn>payload</dfn>". In some cases, a payload might contain only the associated representation's header fields (e.g., responses to HEAD) or only some part(s) of the representation data (e.g., the <a href="rfc7233.html#status.206" class="smpl">206 (Partial Content)</a> status code).<a class="self" href="#rfc.section.3.3.p.1">&para;</a></p><p id="rfc.section.3.3.p.2">The purpose of a payload in a request is defined by the method semantics. For example, a representation in the payload of a PUT request (<a href="#PUT" id="rfc.xref.PUT.2" title="PUT">Section&nbsp;4.3.4</a>) represents the desired state of the <a href="#resources" class="smpl">target resource</a> if the request is successfully applied, whereas a representation in the payload of a POST request (<a href="#POST" id="rfc.xref.POST.2" title="POST">Section&nbsp;4.3.3</a>) represents information to be processed by the target resource.<a class="self" href="#rfc.section.3.3.p.2">&para;</a></p><p id="rfc.section.3.3.p.3">In a response, the payload's purpose is defined by both the request method and the response status code. For example, the payload of a <a href="#status.200" class="smpl">200 (OK)</a> response to GET (<a href="#GET" id="rfc.xref.GET.3" title="GET">Section&nbsp;4.3.1</a>) represents the current state of the <a href="#resources" class="smpl">target resource</a>, as observed at the time of the message origination date (<a href="#header.date" id="rfc.xref.header.date.1" title="Date">Section&nbsp;7.1.1.2</a>), whereas the payload of the same status code in a response to POST might represent either the processing result or the new state of the target resource after applying the processing. Response messages with an error status code usually contain a payload that represents the error condition, such that it describes the error state and what next steps are suggested for resolving it.<a class="self" href="#rfc.section.3.3.p.3">&para;</a></p><p id="rfc.section.3.3.p.4">Header fields that specifically describe the payload, rather than the associated representation, are referred to as "payload header fields". Payload header fields are defined in other parts of this specification, due to their impact on message parsing.<a class="self" href="#rfc.section.3.3.p.4">&para;</a></p><div id="rfc.table.u.2"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Header Field Name</th><th>Defined in...</th></tr></thead><tbody><tr><td class="left">Content-Length</td><td class="left"><a href="rfc7230.html#header.content-length" title="Content-Length">Section 3.3.2</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.13"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a></td></tr><tr><td class="left">Content-Range</td><td class="left"><a href="rfc7233.html#header.content-range" title="Content-Range">Section 4.2</a> of <a href="#RFC7233" id="rfc.xref.RFC7233.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[RFC7233]</cite></a></td></tr><tr><td class="left">Trailer</td><td class="left"><a href="rfc7230.html#header.trailer" title="Trailer">Section 4.4</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.14"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a></td></tr><tr><td class="left">Transfer-Encoding</td><td class="left"><a href="rfc7230.html#header.transfer-encoding" title="Transfer-Encoding">Section 3.3.1</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.15"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a></td></tr></tbody></table></div></div><div id="content.negotiation"><h2 id="rfc.section.3.4"><a href="#rfc.section.3.4">3.4</a>&nbsp;<a href="#content.negotiation">Content Negotiation</a></h2><p id="rfc.section.3.4.p.1">When responses convey payload information, whether indicating a success or an error, the origin server often has different ways of representing that information; for example, in different formats, languages, or encodings. Likewise, different users or user agents might have differing capabilities, characteristics, or preferences that could influence which representation, among those available, would be best to deliver. For this reason, HTTP provides mechanisms for <a href="#content.negotiation" class="smpl">content negotiation</a>.<a class="self" href="#rfc.section.3.4.p.1">&para;</a></p><p id="rfc.section.3.4.p.2">This specification defines two patterns of content negotiation that can be made visible within the protocol: "proactive", where the server selects the representation based upon the user agent's stated preferences, and "reactive" negotiation, where the server provides a list of representations for the user agent to choose from. Other patterns of content negotiation include "conditional content", where the representation consists of multiple parts that are selectively rendered based on user agent parameters, "active content", where the representation contains a script that makes additional (more specific) requests based on the user agent characteristics, and "Transparent Content Negotiation" (<a href="#RFC2295" id="rfc.xref.RFC2295.1"><cite title="Transparent Content Negotiation in HTTP">[RFC2295]</cite></a>), where content selection is performed by an intermediary. These patterns are not mutually exclusive, and each has trade-offs in applicability and practicality.<a class="self" href="#rfc.section.3.4.p.2">&para;</a></p><p id="rfc.section.3.4.p.3">Note that, in all cases, HTTP is not aware of the resource semantics. The consistency with which an origin server responds to requests, over time and over the varying dimensions of content negotiation, and thus the "sameness" of a resource's observed representations over time, is determined entirely by whatever entity or algorithm selects or generates those responses. HTTP pays no attention to the man behind the curtain.<a class="self" href="#rfc.section.3.4.p.3">&para;</a></p><div id="proactive.negotiation"><h3 id="rfc.section.3.4.1"><a href="#rfc.section.3.4.1">3.4.1</a>&nbsp;<a href="#proactive.negotiation">Proactive Negotiation</a></h3><p id="rfc.section.3.4.1.p.1">When content negotiation preferences are sent by the user agent in a request to encourage an algorithm located at the server to select the preferred representation, it is called <dfn>proactive negotiation</dfn> (a.k.a., <dfn>server-driven negotiation</dfn>). Selection is based on the available representations for a response (the dimensions over which it might vary, such as language, content-coding, etc.) compared to various information supplied in the request, including both the explicit negotiation fields of <a href="#request.conneg" title="Content Negotiation">Section&nbsp;5.3</a> and implicit characteristics, such as the client's network address or parts of the <a href="#header.user-agent" class="smpl">User-Agent</a> field.<a class="self" href="#rfc.section.3.4.1.p.1">&para;</a></p><p id="rfc.section.3.4.1.p.2">Proactive negotiation is advantageous when the algorithm for selecting from among the available representations is difficult to describe to a user agent, or when the server desires to send its "best guess" to the user agent along with the first response (hoping to avoid the round trip delay of a subsequent request if the "best guess" is good enough for the user). In order to improve the server's guess, a user agent <em class="bcp14">MAY</em> send request header fields that describe its preferences.<a class="self" href="#rfc.section.3.4.1.p.2">&para;</a></p><p id="rfc.section.3.4.1.p.3">Proactive negotiation has serious disadvantages: <a class="self" href="#rfc.section.3.4.1.p.3">&para;</a></p><ul><li>It is impossible for the server to accurately determine what might be "best" for any given user, since that would require complete knowledge of both the capabilities of the user agent and the intended use for the response (e.g., does the user want to view it on screen or print it on paper?);</li><li>Having the user agent describe its capabilities in every request can be both very inefficient (given that only a small percentage of responses have multiple representations) and a potential risk to the user's privacy;</li><li>It complicates the implementation of an origin server and the algorithms for generating responses to a request; and,</li><li>It limits the reusability of responses for shared caching.</li></ul><p id="rfc.section.3.4.1.p.4">A user agent cannot rely on proactive negotiation preferences being consistently honored, since the origin server might not implement proactive negotiation for the requested resource or might decide that sending a response that doesn't conform to the user agent's preferences is better than sending a <a href="#status.406" class="smpl">406 (Not Acceptable)</a> response.<a class="self" href="#rfc.section.3.4.1.p.4">&para;</a></p><p id="rfc.section.3.4.1.p.5">A <a href="#header.vary" class="smpl">Vary</a> header field (<a href="#header.vary" id="rfc.xref.header.vary.1" title="Vary">Section&nbsp;7.1.4</a>) is often sent in a response subject to proactive negotiation to indicate what parts of the request information were used in the selection algorithm.<a class="self" href="#rfc.section.3.4.1.p.5">&para;</a></p></div><div id="reactive.negotiation"><h3 id="rfc.section.3.4.2"><a href="#rfc.section.3.4.2">3.4.2</a>&nbsp;<a href="#reactive.negotiation">Reactive Negotiation</a></h3><p id="rfc.section.3.4.2.p.1">With <dfn>reactive negotiation</dfn> (a.k.a., <dfn>agent-driven negotiation</dfn>), selection of the best response representation (regardless of the status code) is performed by the user agent after receiving an initial response from the origin server that contains a list of resources for alternative representations. If the user agent is not satisfied by the initial response representation, it can perform a GET request on one or more of the alternative resources, selected based on metadata included in the list, to obtain a different form of representation for that response. Selection of alternatives might be performed automatically by the user agent or manually by the user selecting from a generated (possibly hypertext) menu.<a class="self" href="#rfc.section.3.4.2.p.1">&para;</a></p><p id="rfc.section.3.4.2.p.2">Note that the above refers to representations of the response, in general, not representations of the resource. The alternative representations are only considered representations of the target resource if the response in which those alternatives are provided has the semantics of being a representation of the target resource (e.g., a <a href="#status.200" class="smpl">200 (OK)</a> response to a GET request) or has the semantics of providing links to alternative representations for the target resource (e.g., a <a href="#status.300" class="smpl">300 (Multiple Choices)</a> response to a GET request).<a class="self" href="#rfc.section.3.4.2.p.2">&para;</a></p><p id="rfc.section.3.4.2.p.3">A server might choose not to send an initial representation, other than the list of alternatives, and thereby indicate that reactive negotiation by the user agent is preferred. For example, the alternatives listed in responses with the <a href="#status.300" class="smpl">300 (Multiple Choices)</a> and <a href="#status.406" class="smpl">406 (Not Acceptable)</a> status codes include information about the available representations so that the user or user agent can react by making a selection.<a class="self" href="#rfc.section.3.4.2.p.3">&para;</a></p><p id="rfc.section.3.4.2.p.4">Reactive negotiation is advantageous when the response would vary over commonly used dimensions (such as type, language, or encoding), when the origin server is unable to determine a user agent's capabilities from examining the request, and generally when public caches are used to distribute server load and reduce network usage.<a class="self" href="#rfc.section.3.4.2.p.4">&para;</a></p><p id="rfc.section.3.4.2.p.5">Reactive negotiation suffers from the disadvantages of transmitting a list of alternatives to the user agent, which degrades user-perceived latency if transmitted in the header section, and needing a second request to obtain an alternate representation. Furthermore, this specification does not define a mechanism for supporting automatic selection, though it does not prevent such a mechanism from being developed as an extension.<a class="self" href="#rfc.section.3.4.2.p.5">&para;</a></p></div></div></div><div id="methods"><h1 id="rfc.section.4"><a href="#rfc.section.4">4.</a>&nbsp;<a href="#methods">Request Methods</a></h1><div id="method.overview"><h2 id="rfc.section.4.1"><a href="#rfc.section.4.1">4.1</a>&nbsp;<a href="#method.overview">Overview</a></h2><p id="rfc.section.4.1.p.1">The request method token is the primary source of request semantics; it indicates the purpose for which the client has made this request and what is expected by the client as a successful result.<a class="self" href="#rfc.section.4.1.p.1">&para;</a></p><p id="rfc.section.4.1.p.2">The request method's semantics might be further specialized by the semantics of some header fields when present in a request (<a href="#request.header.fields" title="Request Header Fields">Section&nbsp;5</a>) if those additional semantics do not conflict with the method. For example, a client can send conditional request header fields (<a href="#request.conditionals" title="Conditionals">Section&nbsp;5.2</a>) to make the requested action conditional on the current state of the target resource (<a href="#RFC7232" id="rfc.xref.RFC7232.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a>).<a class="self" href="#rfc.section.4.1.p.2">&para;</a></p><div id="rfc.figure.u.17"><pre class="inline"><span id="rfc.iref.g.12"></span>  <a href="#method.overview" class="smpl">method</a> = <a href="#imported.abnf" class="smpl">token</a> 
    553 </pre></div><p id="rfc.section.4.1.p.3">HTTP was originally designed to be usable as an interface to distributed object systems. The request method was envisioned as applying semantics to a <a href="#resources" class="smpl">target resource</a> in much the same way as invoking a defined method on an identified object would apply semantics. The method token is case-sensitive because it might be used as a gateway to object-based systems with case-sensitive method names.<a class="self" href="#rfc.section.4.1.p.3">&para;</a></p><p id="rfc.section.4.1.p.4">Unlike distributed objects, the standardized request methods in HTTP are not resource-specific, since uniform interfaces provide for better visibility and reuse in network-based systems <a href="#REST" id="rfc.xref.REST.2"><cite title="Architectural Styles and the Design of Network-based Software Architectures">[REST]</cite></a>. Once defined, a standardized method ought to have the same semantics when applied to any resource, though each resource determines for itself whether those semantics are implemented or allowed.<a class="self" href="#rfc.section.4.1.p.4">&para;</a></p><p id="rfc.section.4.1.p.5">This specification defines a number of standardized methods that are commonly used in HTTP, as outlined by the following table. By convention, standardized methods are defined in all-uppercase US-ASCII letters.<a class="self" href="#rfc.section.4.1.p.5">&para;</a></p><div id="rfc.table.1"><div id="table.of.methods"></div><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Method</th><th>Description</th><th>Sec.</th></tr></thead><tbody><tr><td class="left">GET</td><td class="left">Transfer a current representation of the target resource.</td><td class="left"><a href="#GET" id="rfc.xref.GET.4" title="GET">4.3.1</a></td></tr><tr><td class="left">HEAD</td><td class="left">Same as GET, but only transfer the status line and header section.</td><td class="left"><a href="#HEAD" id="rfc.xref.HEAD.2" title="HEAD">4.3.2</a></td></tr><tr><td class="left">POST</td><td class="left">Perform resource-specific processing on the request payload.</td><td class="left"><a href="#POST" id="rfc.xref.POST.3" title="POST">4.3.3</a></td></tr><tr><td class="left">PUT</td><td class="left">Replace all current representations of the target resource with the request payload.</td><td class="left"><a href="#PUT" id="rfc.xref.PUT.3" title="PUT">4.3.4</a></td></tr><tr><td class="left">DELETE</td><td class="left">Remove all current representations of the target resource.</td><td class="left"><a href="#DELETE" id="rfc.xref.DELETE.1" title="DELETE">4.3.5</a></td></tr><tr><td class="left">CONNECT</td><td class="left">Establish a tunnel to the server identified by the target resource.</td><td class="left"><a href="#CONNECT" id="rfc.xref.CONNECT.1" title="CONNECT">4.3.6</a></td></tr><tr><td class="left">OPTIONS</td><td class="left">Describe the communication options for the target resource.</td><td class="left"><a href="#OPTIONS" id="rfc.xref.OPTIONS.1" title="OPTIONS">4.3.7</a></td></tr><tr><td class="left">TRACE</td><td class="left">Perform a message loop-back test along the path to the target resource.</td><td class="left"><a href="#TRACE" id="rfc.xref.TRACE.1" title="TRACE">4.3.8</a></td></tr></tbody></table></div><p id="rfc.section.4.1.p.6">All general-purpose servers <em class="bcp14">MUST</em> support the methods GET and HEAD. All other methods are <em class="bcp14">OPTIONAL</em>.<a class="self" href="#rfc.section.4.1.p.6">&para;</a></p><p id="rfc.section.4.1.p.7">Additional methods, outside the scope of this specification, have been standardized for use in HTTP. All such methods ought to be registered within the "Hypertext Transfer Protocol (HTTP) Method Registry" maintained by IANA, as defined in <a href="#method.registry" title="Method Registry">Section&nbsp;8.1</a>.<a class="self" href="#rfc.section.4.1.p.7">&para;</a></p><p id="rfc.section.4.1.p.8">The set of methods allowed by a target resource can be listed in an <a href="#header.allow" class="smpl">Allow</a> header field (<a href="#header.allow" id="rfc.xref.header.allow.1" title="Allow">Section&nbsp;7.4.1</a>). However, the set of allowed methods can change dynamically. When a request method is received that is unrecognized or not implemented by an origin server, the origin server <em class="bcp14">SHOULD</em> respond with the <a href="#status.501" class="smpl">501 (Not Implemented)</a> status code. When a request method is received that is known by an origin server but not allowed for the target resource, the origin server <em class="bcp14">SHOULD</em> respond with the <a href="#status.405" class="smpl">405 (Method Not Allowed)</a> status code.<a class="self" href="#rfc.section.4.1.p.8">&para;</a></p></div><div id="method.properties"><h2 id="rfc.section.4.2"><a href="#rfc.section.4.2">4.2</a>&nbsp;<a href="#method.properties">Common Method Properties</a></h2><div id="safe.methods"><h3 id="rfc.section.4.2.1"><a href="#rfc.section.4.2.1">4.2.1</a>&nbsp;<a href="#safe.methods">Safe Methods</a></h3><p id="rfc.section.4.2.1.p.1">Request methods are considered "<dfn>safe</dfn>" if their defined semantics are essentially read-only; i.e., the client does not request, and does not expect, any state change on the origin server as a result of applying a safe method to a target resource. Likewise, reasonable use of a safe method is not expected to cause any harm, loss of property, or unusual burden on the origin server.<a class="self" href="#rfc.section.4.2.1.p.1">&para;</a></p><p id="rfc.section.4.2.1.p.2">This definition of safe methods does not prevent an implementation from including behavior that is potentially harmful, that is not entirely read-only, or that causes side effects while invoking a safe method. What is important, however, is that the client did not request that additional behavior and cannot be held accountable for it. For example, most servers append request information to access log files at the completion of every response, regardless of the method, and that is considered safe even though the log storage might become full and crash the server. Likewise, a safe request initiated by selecting an advertisement on the Web will often have the side effect of charging an advertising account.<a class="self" href="#rfc.section.4.2.1.p.2">&para;</a></p><p id="rfc.section.4.2.1.p.3">Of the request methods defined by this specification, the GET, HEAD, OPTIONS, and TRACE methods are defined to be safe.<a class="self" href="#rfc.section.4.2.1.p.3">&para;</a></p><p id="rfc.section.4.2.1.p.4">The purpose of distinguishing between safe and unsafe methods is to allow automated retrieval processes (spiders) and cache performance optimization (pre-fetching) to work without fear of causing harm. In addition, it allows a user agent to apply appropriate constraints on the automated use of unsafe methods when processing potentially untrusted content.<a class="self" href="#rfc.section.4.2.1.p.4">&para;</a></p><p id="rfc.section.4.2.1.p.5">A user agent <em class="bcp14">SHOULD</em> distinguish between safe and unsafe methods when presenting potential actions to a user, such that the user can be made aware of an unsafe action before it is requested.<a class="self" href="#rfc.section.4.2.1.p.5">&para;</a></p><p id="rfc.section.4.2.1.p.6">When a resource is constructed such that parameters within the effective request URI have the effect of selecting an action, it is the resource owner's responsibility to ensure that the action is consistent with the request method semantics. For example, it is common for Web-based content editing software to use actions within query parameters, such as "page?do=delete". If the purpose of such a resource is to perform an unsafe action, then the resource owner <em class="bcp14">MUST</em> disable or disallow that action when it is accessed using a safe request method. Failure to do so will result in unfortunate side effects when automated processes perform a GET on every URI reference for the sake of link maintenance, pre-fetching, building a search index, etc.<a class="self" href="#rfc.section.4.2.1.p.6">&para;</a></p></div><div id="idempotent.methods"><h3 id="rfc.section.4.2.2"><a href="#rfc.section.4.2.2">4.2.2</a>&nbsp;<a href="#idempotent.methods">Idempotent Methods</a></h3><p id="rfc.section.4.2.2.p.1">A request method is considered "<dfn id="idempotent">idempotent</dfn>" if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request. Of the request methods defined by this specification, PUT, DELETE, and safe request methods are idempotent.<a class="self" href="#rfc.section.4.2.2.p.1">&para;</a></p><p id="rfc.section.4.2.2.p.2">Like the definition of safe, the idempotent property only applies to what has been requested by the user; a server is free to log each request separately, retain a revision control history, or implement other non-idempotent side effects for each idempotent request.<a class="self" href="#rfc.section.4.2.2.p.2">&para;</a></p><p id="rfc.section.4.2.2.p.3">Idempotent methods are distinguished because the request can be repeated automatically if a communication failure occurs before the client is able to read the server's response. For example, if a client sends a PUT request and the underlying connection is closed before any response is received, then the client can establish a new connection and retry the idempotent request. It knows that repeating the request will have the same intended effect, even if the original request succeeded, though the response might differ.<a class="self" href="#rfc.section.4.2.2.p.3">&para;</a></p></div><div id="cacheable.methods"><h3 id="rfc.section.4.2.3"><a href="#rfc.section.4.2.3">4.2.3</a>&nbsp;<a href="#cacheable.methods">Cacheable Methods</a></h3><p id="rfc.section.4.2.3.p.1">Request methods can be defined as "<dfn id="cacheable">cacheable</dfn>" to indicate that responses to them are allowed to be stored for future reuse; for specific requirements see <a href="#RFC7234" id="rfc.xref.RFC7234.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>. In general, safe methods that do not depend on a current or authoritative response are defined as cacheable; this specification defines GET, HEAD, and POST as cacheable, although the overwhelming majority of cache implementations only support GET and HEAD.<a class="self" href="#rfc.section.4.2.3.p.1">&para;</a></p></div></div><div id="method.definitions"><h2 id="rfc.section.4.3"><a href="#rfc.section.4.3">4.3</a>&nbsp;<a href="#method.definitions">Method Definitions</a></h2><div id="GET"><h3 id="rfc.section.4.3.1"><a href="#rfc.section.4.3.1">4.3.1</a>&nbsp;<a href="#GET">GET</a></h3><div id="rfc.iref.g.13"></div><p id="rfc.section.4.3.1.p.1">The GET method requests transfer of a current selected representation for the <a href="#resources" class="smpl">target resource</a>. GET is the primary mechanism of information retrieval and the focus of almost all performance optimizations. Hence, when people speak of retrieving some identifiable information via HTTP, they are generally referring to making a GET request.<a class="self" href="#rfc.section.4.3.1.p.1">&para;</a></p><p id="rfc.section.4.3.1.p.2">It is tempting to think of resource identifiers as remote file system pathnames and of representations as being a copy of the contents of such files. In fact, that is how many resources are implemented (see <a href="#attack.pathname" title="Attacks Based on File and Path Names">Section&nbsp;9.1</a> for related security considerations). However, there are no such limitations in practice. The HTTP interface for a resource is just as likely to be implemented as a tree of content objects, a programmatic view on various database records, or a gateway to other information systems. Even when the URI mapping mechanism is tied to a file system, an origin server might be configured to execute the files with the request as input and send the output as the representation rather than transfer the files directly. Regardless, only the origin server needs to know how each of its resource identifiers corresponds to an implementation and how each implementation manages to select and send a current representation of the target resource in a response to GET.<a class="self" href="#rfc.section.4.3.1.p.2">&para;</a></p><p id="rfc.section.4.3.1.p.3">A client can alter the semantics of GET to be a "range request", requesting transfer of only some part(s) of the selected representation, by sending a <a href="rfc7233.html#header.range" class="smpl">Range</a> header field in the request (<a href="#RFC7233" id="rfc.xref.RFC7233.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[RFC7233]</cite></a>).<a class="self" href="#rfc.section.4.3.1.p.3">&para;</a></p><p id="rfc.section.4.3.1.p.4">A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.<a class="self" href="#rfc.section.4.3.1.p.4">&para;</a></p><p id="rfc.section.4.3.1.p.5">The response to a GET request is cacheable; a cache <em class="bcp14">MAY</em> use it to satisfy subsequent GET and HEAD requests unless otherwise indicated by the Cache-Control header field (<a href="rfc7234.html#header.cache-control" title="Cache-Control">Section 5.2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>).<a class="self" href="#rfc.section.4.3.1.p.5">&para;</a></p></div><div id="HEAD"><h3 id="rfc.section.4.3.2"><a href="#rfc.section.4.3.2">4.3.2</a>&nbsp;<a href="#HEAD">HEAD</a></h3><div id="rfc.iref.h.1"></div><p id="rfc.section.4.3.2.p.1">The HEAD method is identical to GET except that the server <em class="bcp14">MUST NOT</em> send a message body in the response (i.e., the response terminates at the end of the header section). The server <em class="bcp14">SHOULD</em> send the same header fields in response to a HEAD request as it would have sent if the request had been a GET, except that the payload header fields (<a href="#payload" title="Payload Semantics">Section&nbsp;3.3</a>) <em class="bcp14">MAY</em> be omitted. This method can be used for obtaining metadata about the selected representation without transferring the representation data and is often used for testing hypertext links for validity, accessibility, and recent modification.<a class="self" href="#rfc.section.4.3.2.p.1">&para;</a></p><p id="rfc.section.4.3.2.p.2">A payload within a HEAD request message has no defined semantics; sending a payload body on a HEAD request might cause some existing implementations to reject the request.<a class="self" href="#rfc.section.4.3.2.p.2">&para;</a></p><p id="rfc.section.4.3.2.p.3">The response to a HEAD request is cacheable; a cache <em class="bcp14">MAY</em> use it to satisfy subsequent HEAD requests unless otherwise indicated by the Cache-Control header field (<a href="rfc7234.html#header.cache-control" title="Cache-Control">Section 5.2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>). A HEAD response might also have an effect on previously cached responses to GET; see <a href="rfc7234.html#head.effects" title="Freshening Responses via HEAD">Section 4.3.5</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>.<a class="self" href="#rfc.section.4.3.2.p.3">&para;</a></p></div><div id="POST"><h3 id="rfc.section.4.3.3"><a href="#rfc.section.4.3.3">4.3.3</a>&nbsp;<a href="#POST">POST</a></h3><p id="rfc.section.4.3.3.p.1">The POST method requests that the <a href="#resources" class="smpl">target resource</a> process the representation enclosed in the request according to the resource's own specific semantics. For example, POST is used for the following functions (among others): <a class="self" href="#rfc.section.4.3.3.p.1">&para;</a></p><ul><li>Providing a block of data, such as the fields entered into an HTML form, to a data-handling process;</li><li>Posting a message to a bulletin board, newsgroup, mailing list, blog, or similar group of articles;</li><li>Creating a new resource that has yet to be identified by the origin server; and</li><li>Appending data to a resource's existing representation(s).</li></ul><p id="rfc.section.4.3.3.p.2">An origin server indicates response semantics by choosing an appropriate status code depending on the result of processing the POST request; almost all of the status codes defined by this specification might be received in a response to POST (the exceptions being <a href="rfc7233.html#status.206" class="smpl">206 (Partial Content)</a>, <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a>, and <a href="rfc7233.html#status.416" class="smpl">416 (Range Not Satisfiable)</a>).<a class="self" href="#rfc.section.4.3.3.p.2">&para;</a></p><p id="rfc.section.4.3.3.p.3">If one or more resources has been created on the origin server as a result of successfully processing a POST request, the origin server <em class="bcp14">SHOULD</em> send a <a href="#status.201" class="smpl">201 (Created)</a> response containing a <a href="#header.location" class="smpl">Location</a> header field that provides an identifier for the primary resource created (<a href="#header.location" id="rfc.xref.header.location.1" title="Location">Section&nbsp;7.1.2</a>) and a representation that describes the status of the request while referring to the new resource(s).<a class="self" href="#rfc.section.4.3.3.p.3">&para;</a></p><p id="rfc.section.4.3.3.p.4">Responses to POST requests are only cacheable when they include explicit freshness information (see <a href="rfc7234.html#calculating.freshness.lifetime" title="Calculating Freshness Lifetime">Section 4.2.1</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>). However, POST caching is not widely implemented. For cases where an origin server wishes the client to be able to cache the result of a POST in a way that can be reused by a later GET, the origin server <em class="bcp14">MAY</em> send a <a href="#status.200" class="smpl">200 (OK)</a> response containing the result and a <a href="#header.content-location" class="smpl">Content-Location</a> header field that has the same value as the POST's effective request URI (<a href="#header.content-location" id="rfc.xref.header.content-location.2" title="Content-Location">Section&nbsp;3.1.4.2</a>).<a class="self" href="#rfc.section.4.3.3.p.4">&para;</a></p><p id="rfc.section.4.3.3.p.5">If the result of processing a POST would be equivalent to a representation of an existing resource, an origin server <em class="bcp14">MAY</em> redirect the user agent to that resource by sending a <a href="#status.303" class="smpl">303 (See Other)</a> response with the existing resource's identifier in the <a href="#header.location" class="smpl">Location</a> field. This has the benefits of providing the user agent a resource identifier and transferring the representation via a method more amenable to shared caching, though at the cost of an extra request if the user agent does not already have the representation cached.<a class="self" href="#rfc.section.4.3.3.p.5">&para;</a></p></div><div id="PUT"><h3 id="rfc.section.4.3.4"><a href="#rfc.section.4.3.4">4.3.4</a>&nbsp;<a href="#PUT">PUT</a></h3><div id="rfc.iref.p.1"></div><p id="rfc.section.4.3.4.p.1">The PUT method requests that the state of the <a href="#resources" class="smpl">target resource</a> be created or replaced with the state defined by the representation enclosed in the request message payload. A successful PUT of a given representation would suggest that a subsequent GET on that same target resource will result in an equivalent representation being sent in a <a href="#status.200" class="smpl">200 (OK)</a> response. However, there is no guarantee that such a state change will be observable, since the target resource might be acted upon by other user agents in parallel, or might be subject to dynamic processing by the origin server, before any subsequent GET is received. A successful response only implies that the user agent's intent was achieved at the time of its processing by the origin server.<a class="self" href="#rfc.section.4.3.4.p.1">&para;</a></p><p id="rfc.section.4.3.4.p.2">If the target resource does not have a current representation and the PUT successfully creates one, then the origin server <em class="bcp14">MUST</em> inform the user agent by sending a <a href="#status.201" class="smpl">201 (Created)</a> response. If the target resource does have a current representation and that representation is successfully modified in accordance with the state of the enclosed representation, then the origin server <em class="bcp14">MUST</em> send either a <a href="#status.200" class="smpl">200 (OK)</a> or a <a href="#status.204" class="smpl">204 (No Content)</a> response to indicate successful completion of the request.<a class="self" href="#rfc.section.4.3.4.p.2">&para;</a></p><p id="rfc.section.4.3.4.p.3">An origin server <em class="bcp14">SHOULD</em> ignore unrecognized header fields received in a PUT request (i.e., do not save them as part of the resource state).<a class="self" href="#rfc.section.4.3.4.p.3">&para;</a></p><p id="rfc.section.4.3.4.p.4">An origin server <em class="bcp14">SHOULD</em> verify that the PUT representation is consistent with any constraints the server has for the target resource that cannot or will not be changed by the PUT. This is particularly important when the origin server uses internal configuration information related to the URI in order to set the values for representation metadata on GET responses. When a PUT representation is inconsistent with the target resource, the origin server <em class="bcp14">SHOULD</em> either make them consistent, by transforming the representation or changing the resource configuration, or respond with an appropriate error message containing sufficient information to explain why the representation is unsuitable. The <a href="#status.409" class="smpl">409 (Conflict)</a> or <a href="#status.415" class="smpl">415 (Unsupported Media Type)</a> status codes are suggested, with the latter being specific to constraints on <a href="#header.content-type" class="smpl">Content-Type</a> values.<a class="self" href="#rfc.section.4.3.4.p.4">&para;</a></p><p id="rfc.section.4.3.4.p.5">For example, if the target resource is configured to always have a <a href="#header.content-type" class="smpl">Content-Type</a> of "text/html" and the representation being PUT has a Content-Type of "image/jpeg", the origin server ought to do one of: <a class="self" href="#rfc.section.4.3.4.p.5">&para;</a></p><ol class="la"><li>reconfigure the target resource to reflect the new media type;</li><li>transform the PUT representation to a format consistent with that of the resource before saving it as the new resource state; or,</li><li>reject the request with a <a href="#status.415" class="smpl">415 (Unsupported Media Type)</a> response indicating that the target resource is limited to "text/html", perhaps including a link to a different resource that would be a suitable target for the new representation.</li></ol><p id="rfc.section.4.3.4.p.6">HTTP does not define exactly how a PUT method affects the state of an origin server beyond what can be expressed by the intent of the user agent request and the semantics of the origin server response. It does not define what a resource might be, in any sense of that word, beyond the interface provided via HTTP. It does not define how resource state is "stored", nor how such storage might change as a result of a change in resource state, nor how the origin server translates resource state into representations. Generally speaking, all implementation details behind the resource interface are intentionally hidden by the server.<a class="self" href="#rfc.section.4.3.4.p.6">&para;</a></p><p id="rfc.section.4.3.4.p.7">An origin server <em class="bcp14">MUST NOT</em> send a validator header field (<a href="#response.validator" title="Validator Header Fields">Section&nbsp;7.2</a>), such as an <a href="rfc7232.html#header.etag" class="smpl">ETag</a> or <a href="rfc7232.html#header.last-modified" class="smpl">Last-Modified</a> field, in a successful response to PUT unless the request's representation data was saved without any transformation applied to the body (i.e., the resource's new representation data is identical to the representation data received in the PUT request) and the validator field value reflects the new representation. This requirement allows a user agent to know when the representation body it has in memory remains current as a result of the PUT, thus not in need of being retrieved again from the origin server, and that the new validator(s) received in the response can be used for future conditional requests in order to prevent accidental overwrites (<a href="#request.conditionals" title="Conditionals">Section&nbsp;5.2</a>).<a class="self" href="#rfc.section.4.3.4.p.7">&para;</a></p><p id="rfc.section.4.3.4.p.8">The fundamental difference between the POST and PUT methods is highlighted by the different intent for the enclosed representation. The target resource in a POST request is intended to handle the enclosed representation according to the resource's own semantics, whereas the enclosed representation in a PUT request is defined as replacing the state of the target resource. Hence, the intent of PUT is idempotent and visible to intermediaries, even though the exact effect is only known by the origin server.<a class="self" href="#rfc.section.4.3.4.p.8">&para;</a></p><p id="rfc.section.4.3.4.p.9">Proper interpretation of a PUT request presumes that the user agent knows which target resource is desired. A service that selects a proper URI on behalf of the client, after receiving a state-changing request, <em class="bcp14">SHOULD</em> be implemented using the POST method rather than PUT. If the origin server will not make the requested PUT state change to the target resource and instead wishes to have it applied to a different resource, such as when the resource has been moved to a different URI, then the origin server <em class="bcp14">MUST</em> send an appropriate <a href="#status.3xx" class="smpl">3xx (Redirection)</a> response; the user agent <em class="bcp14">MAY</em> then make its own decision regarding whether or not to redirect the request.<a class="self" href="#rfc.section.4.3.4.p.9">&para;</a></p><p id="rfc.section.4.3.4.p.10">A PUT request applied to the target resource can have side effects on other resources. For example, an article might have a URI for identifying "the current version" (a resource) that is separate from the URIs identifying each particular version (different resources that at one point shared the same state as the current version resource). A successful PUT request on "the current version" URI might therefore create a new version resource in addition to changing the state of the target resource, and might also cause links to be added between the related resources.<a class="self" href="#rfc.section.4.3.4.p.10">&para;</a></p><p id="rfc.section.4.3.4.p.11">An origin server that allows PUT on a given target resource <em class="bcp14">MUST</em> send a <a href="#status.400" class="smpl">400 (Bad Request)</a> response to a PUT request that contains a <a href="rfc7233.html#header.content-range" class="smpl">Content-Range</a> header field (<a href="rfc7233.html#header.content-range" title="Content-Range">Section 4.2</a> of <a href="#RFC7233" id="rfc.xref.RFC7233.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[RFC7233]</cite></a>), since the payload is likely to be partial content that has been mistakenly PUT as a full representation. Partial content updates are possible by targeting a separately identified resource with state that overlaps a portion of the larger resource, or by using a different method that has been specifically defined for partial updates (for example, the PATCH method defined in <a href="#RFC5789" id="rfc.xref.RFC5789.1"><cite title="PATCH Method for HTTP">[RFC5789]</cite></a>).<a class="self" href="#rfc.section.4.3.4.p.11">&para;</a></p><p id="rfc.section.4.3.4.p.12">Responses to the PUT method are not cacheable. If a successful PUT request passes through a cache that has one or more stored responses for the effective request URI, those stored responses will be invalidated (see <a href="rfc7234.html#invalidation" title="Invalidation">Section 4.4</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.6"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>).<a class="self" href="#rfc.section.4.3.4.p.12">&para;</a></p></div><div id="DELETE"><h3 id="rfc.section.4.3.5"><a href="#rfc.section.4.3.5">4.3.5</a>&nbsp;<a href="#DELETE">DELETE</a></h3><div id="rfc.iref.d.1"></div><p id="rfc.section.4.3.5.p.1">The DELETE method requests that the origin server remove the association between the <a href="#resources" class="smpl">target resource</a> and its current functionality. In effect, this method is similar to the rm command in UNIX: it expresses a deletion operation on the URI mapping of the origin server rather than an expectation that the previously associated information be deleted.<a class="self" href="#rfc.section.4.3.5.p.1">&para;</a></p><p id="rfc.section.4.3.5.p.2">If the target resource has one or more current representations, they might or might not be destroyed by the origin server, and the associated storage might or might not be reclaimed, depending entirely on the nature of the resource and its implementation by the origin server (which are beyond the scope of this specification). Likewise, other implementation aspects of a resource might need to be deactivated or archived as a result of a DELETE, such as database or gateway connections. In general, it is assumed that the origin server will only allow DELETE on resources for which it has a prescribed mechanism for accomplishing the deletion.<a class="self" href="#rfc.section.4.3.5.p.2">&para;</a></p><p id="rfc.section.4.3.5.p.3">Relatively few resources allow the DELETE method &#8212; its primary use is for remote authoring environments, where the user has some direction regarding its effect. For example, a resource that was previously created using a PUT request, or identified via the Location header field after a <a href="#status.201" class="smpl">201 (Created)</a> response to a POST request, might allow a corresponding DELETE request to undo those actions. Similarly, custom user agent implementations that implement an authoring function, such as revision control clients using HTTP for remote operations, might use DELETE based on an assumption that the server's URI space has been crafted to correspond to a version repository.<a class="self" href="#rfc.section.4.3.5.p.3">&para;</a></p><p id="rfc.section.4.3.5.p.4">If a DELETE method is successfully applied, the origin server <em class="bcp14">SHOULD</em> send a <a href="#status.202" class="smpl">202 (Accepted)</a> status code if the action will likely succeed but has not yet been enacted, a <a href="#status.204" class="smpl">204 (No Content)</a> status code if the action has been enacted and no further information is to be supplied, or a <a href="#status.200" class="smpl">200 (OK)</a> status code if the action has been enacted and the response message includes a representation describing the status.<a class="self" href="#rfc.section.4.3.5.p.4">&para;</a></p><p id="rfc.section.4.3.5.p.5">A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request.<a class="self" href="#rfc.section.4.3.5.p.5">&para;</a></p><p id="rfc.section.4.3.5.p.6">Responses to the DELETE method are not cacheable. If a DELETE request passes through a cache that has one or more stored responses for the effective request URI, those stored responses will be invalidated (see <a href="rfc7234.html#invalidation" title="Invalidation">Section 4.4</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.7"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>).<a class="self" href="#rfc.section.4.3.5.p.6">&para;</a></p></div><div id="CONNECT"><h3 id="rfc.section.4.3.6"><a href="#rfc.section.4.3.6">4.3.6</a>&nbsp;<a href="#CONNECT">CONNECT</a></h3><p id="rfc.section.4.3.6.p.1">The CONNECT method requests that the recipient establish a tunnel to the destination origin server identified by the request-target and, if successful, thereafter restrict its behavior to blind forwarding of packets, in both directions, until the tunnel is closed. Tunnels are commonly used to create an end-to-end virtual connection, through one or more proxies, which can then be secured using TLS (Transport Layer Security, <a href="#RFC5246" id="rfc.xref.RFC5246.1"><cite title="The Transport Layer Security (TLS) Protocol Version 1.2">[RFC5246]</cite></a>).<a class="self" href="#rfc.section.4.3.6.p.1">&para;</a></p><p id="rfc.section.4.3.6.p.2">CONNECT is intended only for use in requests to a proxy. An origin server that receives a CONNECT request for itself <em class="bcp14">MAY</em> respond with a <a href="#status.2xx" class="smpl">2xx (Successful)</a> status code to indicate that a connection is established. However, most origin servers do not implement CONNECT.<a class="self" href="#rfc.section.4.3.6.p.2">&para;</a></p><p id="rfc.section.4.3.6.p.3">A client sending a CONNECT request <em class="bcp14">MUST</em> send the authority form of request-target (<a href="rfc7230.html#request-target" title="Request Target">Section 5.3</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.16"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>); i.e., the request-target consists of only the host name and port number of the tunnel destination, separated by a colon. For example,<a class="self" href="#rfc.section.4.3.6.p.3">&para;</a></p><div id="rfc.figure.u.18"><pre class="text2">CONNECT server.example.com:80 HTTP/1.1 
     519</pre></div><div id="rfc.section.3.1.1.1.p.5"><p>Internet media types ought to be registered with IANA according to the procedures defined in <a href="#BCP13" id="rfc.xref.BCP13.1"><cite title="Media Type Specifications and Registration Procedures">[BCP13]</cite></a>.<a class="self" href="#rfc.section.3.1.1.1.p.5">&para;</a></p></div><div class="note" id="rfc.section.3.1.1.1.p.6"><p><b>Note:</b> Unlike some similar constructs in other header fields, media type parameters do not allow whitespace (even "bad" whitespace) around the "=" character.<a class="self" href="#rfc.section.3.1.1.1.p.6">&para;</a></p></div></div><div id="charset"><h4 id="rfc.section.3.1.1.2"><a href="#rfc.section.3.1.1.2">3.1.1.2</a>&nbsp;<a href="#charset">Charset</a></h4><div id="rfc.section.3.1.1.2.p.1"><p>HTTP uses <dfn>charset</dfn> names to indicate or negotiate the character encoding scheme of a textual representation <a href="#RFC6365" id="rfc.xref.RFC6365.2"><cite title="Terminology Used in Internationalization in the IETF">[RFC6365]</cite></a>. A charset is identified by a case-insensitive token.<a class="self" href="#rfc.section.3.1.1.2.p.1">&para;</a></p></div><div id="rfc.figure.u.4"><pre class="inline"><span id="rfc.iref.g.5"></span>  <a href="#charset" class="smpl">charset</a> = <a href="#imported.abnf" class="smpl">token</a> 
     520</pre></div><div id="rfc.section.3.1.1.2.p.2"><p>Charset names ought to be registered in the IANA "Character Sets" registry (&lt;<a href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a>&gt;) according to the procedures defined in <a href="#RFC2978" id="rfc.xref.RFC2978.1"><cite title="IANA Charset Registration Procedures">[RFC2978]</cite></a>.<a class="self" href="#rfc.section.3.1.1.2.p.2">&para;</a></p></div></div><div id="canonicalization.and.text.defaults"><h4 id="rfc.section.3.1.1.3"><a href="#rfc.section.3.1.1.3">3.1.1.3</a>&nbsp;<a href="#canonicalization.and.text.defaults">Canonicalization and Text Defaults</a></h4><div id="rfc.section.3.1.1.3.p.1"><p>Internet media types are registered with a canonical form in order to be interoperable among systems with varying native encoding formats. Representations selected or transferred via HTTP ought to be in canonical form, for many of the same reasons described by the Multipurpose Internet Mail Extensions (MIME) <a href="#RFC2045" id="rfc.xref.RFC2045.1"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a>. However, the performance characteristics of email deployments (i.e., store and forward messages to peers) are significantly different from those common to HTTP and the Web (server-based information services). Furthermore, MIME's constraints for the sake of compatibility with older mail transfer protocols do not apply to HTTP (see <a href="#differences.between.http.and.mime" title="Differences between HTTP and MIME">Appendix&nbsp;A</a>).<a class="self" href="#rfc.section.3.1.1.3.p.1">&para;</a></p></div><div id="rfc.section.3.1.1.3.p.2"><p>MIME's canonical form requires that media subtypes of the "text" type use CRLF as the text line break. HTTP allows the transfer of text media with plain CR or LF alone representing a line break, when such line breaks are consistent for an entire representation. An HTTP sender <em class="bcp14">MAY</em> generate, and a recipient <em class="bcp14">MUST</em> be able to parse, line breaks in text media that consist of CRLF, bare CR, or bare LF. In addition, text media in HTTP is not limited to charsets that use octets 13 and 10 for CR and LF, respectively. This flexibility regarding line breaks applies only to text within a representation that has been assigned a "text" media type; it does not apply to "multipart" types or HTTP elements outside the payload body (e.g., header fields).<a class="self" href="#rfc.section.3.1.1.3.p.2">&para;</a></p></div><div id="rfc.section.3.1.1.3.p.3"><p>If a representation is encoded with a content-coding, the underlying data ought to be in a form defined above prior to being encoded.<a class="self" href="#rfc.section.3.1.1.3.p.3">&para;</a></p></div></div><div id="multipart.types"><h4 id="rfc.section.3.1.1.4"><a href="#rfc.section.3.1.1.4">3.1.1.4</a>&nbsp;<a href="#multipart.types">Multipart Types</a></h4><div id="rfc.section.3.1.1.4.p.1"><p>MIME provides for a number of "multipart" types &#8212; encapsulations of one or more representations within a single message body. All multipart types share a common syntax, as defined in <a href="https://tools.ietf.org/html/rfc2046#section-5.1.1">Section 5.1.1</a> of <a href="#RFC2046" id="rfc.xref.RFC2046.2"><cite title="Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types">[RFC2046]</cite></a>, and include a boundary parameter as part of the media type value. The message body is itself a protocol element; a sender <em class="bcp14">MUST</em> generate only CRLF to represent line breaks between body parts.<a class="self" href="#rfc.section.3.1.1.4.p.1">&para;</a></p></div><div id="rfc.section.3.1.1.4.p.2"><p>HTTP message framing does not use the multipart boundary as an indicator of message body length, though it might be used by implementations that generate or process the payload. For example, the "multipart/form-data" type is often used for carrying form data in a request, as described in <a href="#RFC2388" id="rfc.xref.RFC2388.1"><cite title="Returning Values from Forms: multipart/form-data">[RFC2388]</cite></a>, and the "multipart/byteranges" type is defined by this specification for use in some <a href="rfc7233.html#status.206" class="smpl">206 (Partial Content)</a> responses <a href="#RFC7233" id="rfc.xref.RFC7233.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[RFC7233]</cite></a>.<a class="self" href="#rfc.section.3.1.1.4.p.2">&para;</a></p></div></div><div id="header.content-type"><h4 id="rfc.section.3.1.1.5"><a href="#rfc.section.3.1.1.5">3.1.1.5</a>&nbsp;<a href="#header.content-type">Content-Type</a></h4><div id="rfc.section.3.1.1.5.p.1"><p>The "Content-Type" header field indicates the media type of the associated representation: either the representation enclosed in the message payload or the <a href="#representations" class="smpl">selected representation</a>, as determined by the message semantics. The indicated media type defines both the data format and how that data is intended to be processed by a recipient, within the scope of the received message semantics, after any content codings indicated by <a href="#header.content-encoding" class="smpl">Content-Encoding</a> are decoded.<a class="self" href="#rfc.section.3.1.1.5.p.1">&para;</a></p></div><div id="rfc.figure.u.5"><pre class="inline"><span id="rfc.iref.g.6"></span>  <a href="#header.content-type" class="smpl">Content-Type</a> = <a href="#media.type" class="smpl">media-type</a> 
     521</pre></div><div id="rfc.section.3.1.1.5.p.2"><p>Media types are defined in <a href="#media.type" title="Media Type">Section&nbsp;3.1.1.1</a>. An example of the field is<a class="self" href="#rfc.section.3.1.1.5.p.2">&para;</a></p></div><div id="rfc.figure.u.6"><pre class="text">  Content-Type: text/html; charset=ISO-8859-4 
     522</pre></div><div id="rfc.section.3.1.1.5.p.3"><p>A sender that generates a message containing a payload body <em class="bcp14">SHOULD</em> generate a Content-Type header field in that message unless the intended media type of the enclosed representation is unknown to the sender. If a Content-Type header field is not present, the recipient <em class="bcp14">MAY</em> either assume a media type of "application/octet-stream" (<a href="#RFC2046" id="rfc.xref.RFC2046.3"><cite title="Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types">[RFC2046]</cite></a>, <a href="https://tools.ietf.org/html/rfc2046#section-4.5.1">Section 4.5.1</a>) or examine the data to determine its type.<a class="self" href="#rfc.section.3.1.1.5.p.3">&para;</a></p></div><div id="rfc.section.3.1.1.5.p.4"><p>In practice, resource owners do not always properly configure their origin server to provide the correct Content-Type for a given representation, with the result that some clients will examine a payload's content and override the specified type. Clients that do so risk drawing incorrect conclusions, which might expose additional security risks (e.g., "privilege escalation"). Furthermore, it is impossible to determine the sender's intent by examining the data format: many data formats match multiple media types that differ only in processing semantics. Implementers are encouraged to provide a means of disabling such "content sniffing" when it is used.<a class="self" href="#rfc.section.3.1.1.5.p.4">&para;</a></p></div></div></div><div id="data.encoding"><h3 id="rfc.section.3.1.2"><a href="#rfc.section.3.1.2">3.1.2</a>&nbsp;<a href="#data.encoding">Encoding for Compression or Integrity</a></h3><div id="content.codings"><h4 id="rfc.section.3.1.2.1"><a href="#rfc.section.3.1.2.1">3.1.2.1</a>&nbsp;<a href="#content.codings">Content Codings</a></h4><div id="rfc.section.3.1.2.1.p.1"><p>Content coding values indicate an encoding transformation that has been or can be applied to a representation. Content codings are primarily used to allow a representation to be compressed or otherwise usefully transformed without losing the identity of its underlying media type and without loss of information. Frequently, the representation is stored in coded form, transmitted directly, and only decoded by the final recipient.<a class="self" href="#rfc.section.3.1.2.1.p.1">&para;</a></p></div><div id="rfc.figure.u.7"><pre class="inline"><span id="rfc.iref.g.7"></span>  <a href="#content.codings" class="smpl">content-coding</a>   = <a href="#imported.abnf" class="smpl">token</a> 
     523</pre></div><div id="rfc.section.3.1.2.1.p.2"><p>All content-coding values are case-insensitive and ought to be registered within the "HTTP Content Coding Registry", as defined in <a href="#content.coding.registry" title="Content Coding Registry">Section&nbsp;8.4</a>. They are used in the <a href="#header.accept-encoding" class="smpl">Accept-Encoding</a> (<a href="#header.accept-encoding" id="rfc.xref.header.accept-encoding.1" title="Accept-Encoding">Section&nbsp;5.3.4</a>) and <a href="#header.content-encoding" class="smpl">Content-Encoding</a> (<a href="#header.content-encoding" id="rfc.xref.header.content-encoding.2" title="Content-Encoding">Section&nbsp;3.1.2.2</a>) header fields.<a class="self" href="#rfc.section.3.1.2.1.p.2">&para;</a></p></div><div id="rfc.section.3.1.2.1.p.3"><p>The following content-coding values are defined by this specification: <a class="self" href="#rfc.section.3.1.2.1.p.3">&para;</a></p><ul class="empty"><li>compress (and x-compress): See <a href="rfc7230.html#compress.coding" title="Compress Coding">Section 4.2.1</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.7"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.</li><li>deflate: See <a href="rfc7230.html#deflate.coding" title="Deflate Coding">Section 4.2.2</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.8"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.</li><li>gzip (and x-gzip): See <a href="rfc7230.html#gzip.coding" title="Gzip Coding">Section 4.2.3</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.9"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>.</li></ul></div></div><div id="header.content-encoding"><h4 id="rfc.section.3.1.2.2"><a href="#rfc.section.3.1.2.2">3.1.2.2</a>&nbsp;<a href="#header.content-encoding">Content-Encoding</a></h4><div id="rfc.section.3.1.2.2.p.1"><p>The "Content-Encoding" header field indicates what content codings have been applied to the representation, beyond those inherent in the media type, and thus what decoding mechanisms have to be applied in order to obtain data in the media type referenced by the <a href="#header.content-type" class="smpl">Content-Type</a> header field. Content-Encoding is primarily used to allow a representation's data to be compressed without losing the identity of its underlying media type.<a class="self" href="#rfc.section.3.1.2.2.p.1">&para;</a></p></div><div id="rfc.figure.u.8"><pre class="inline"><span id="rfc.iref.g.8"></span>  <a href="#header.content-encoding" class="smpl">Content-Encoding</a> = 1#<a href="#content.codings" class="smpl">content-coding</a> 
     524</pre></div><div id="rfc.section.3.1.2.2.p.2"><p>An example of its use is<a class="self" href="#rfc.section.3.1.2.2.p.2">&para;</a></p></div><div id="rfc.figure.u.9"><pre class="text">  Content-Encoding: gzip 
     525</pre></div><div id="rfc.section.3.1.2.2.p.3"><p>If one or more encodings have been applied to a representation, the sender that applied the encodings <em class="bcp14">MUST</em> generate a Content-Encoding header field that lists the content codings in the order in which they were applied. Additional information about the encoding parameters can be provided by other header fields not defined by this specification.<a class="self" href="#rfc.section.3.1.2.2.p.3">&para;</a></p></div><div id="rfc.section.3.1.2.2.p.4"><p>Unlike Transfer-Encoding (<a href="rfc7230.html#header.transfer-encoding" title="Transfer-Encoding">Section 3.3.1</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.10"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>), the codings listed in Content-Encoding are a characteristic of the representation; the representation is defined in terms of the coded form, and all other metadata about the representation is about the coded form unless otherwise noted in the metadata definition. Typically, the representation is only decoded just prior to rendering or analogous usage.<a class="self" href="#rfc.section.3.1.2.2.p.4">&para;</a></p></div><div id="rfc.section.3.1.2.2.p.5"><p>If the media type includes an inherent encoding, such as a data format that is always compressed, then that encoding would not be restated in Content-Encoding even if it happens to be the same algorithm as one of the content codings. Such a content coding would only be listed if, for some bizarre reason, it is applied a second time to form the representation. Likewise, an origin server might choose to publish the same data as multiple representations that differ only in whether the coding is defined as part of <a href="#header.content-type" class="smpl">Content-Type</a> or Content-Encoding, since some user agents will behave differently in their handling of each response (e.g., open a "Save as ..." dialog instead of automatic decompression and rendering of content).<a class="self" href="#rfc.section.3.1.2.2.p.5">&para;</a></p></div><div id="rfc.section.3.1.2.2.p.6"><p>An origin server <em class="bcp14">MAY</em> respond with a status code of <a href="#status.415" class="smpl">415 (Unsupported Media Type)</a> if a representation in the request message has a content coding that is not acceptable.<a class="self" href="#rfc.section.3.1.2.2.p.6">&para;</a></p></div></div></div><div id="audience.language"><h3 id="rfc.section.3.1.3"><a href="#rfc.section.3.1.3">3.1.3</a>&nbsp;<a href="#audience.language">Audience Language</a></h3><div id="language.tags"><h4 id="rfc.section.3.1.3.1"><a href="#rfc.section.3.1.3.1">3.1.3.1</a>&nbsp;<a href="#language.tags">Language Tags</a></h4><div id="rfc.section.3.1.3.1.p.1"><p>A language tag, as defined in <a href="#RFC5646" id="rfc.xref.RFC5646.1"><cite title="Tags for Identifying Languages">[RFC5646]</cite></a>, identifies a natural language spoken, written, or otherwise conveyed by human beings for communication of information to other human beings. Computer languages are explicitly excluded.<a class="self" href="#rfc.section.3.1.3.1.p.1">&para;</a></p></div><div id="rfc.section.3.1.3.1.p.2"><p>HTTP uses language tags within the <a href="#header.accept-language" class="smpl">Accept-Language</a> and <a href="#header.content-language" class="smpl">Content-Language</a> header fields. <a href="#header.accept-language" class="smpl">Accept-Language</a> uses the broader language-range production defined in <a href="#header.accept-language" id="rfc.xref.header.accept-language.1" title="Accept-Language">Section&nbsp;5.3.5</a>, whereas <a href="#header.content-language" class="smpl">Content-Language</a> uses the language-tag production defined below.<a class="self" href="#rfc.section.3.1.3.1.p.2">&para;</a></p></div><div id="rfc.figure.u.10"><pre class="inline"><span id="rfc.iref.g.9"></span>  <a href="#language.tags" class="smpl">language-tag</a> = &lt;Language-Tag, see <a href="#RFC5646" id="rfc.xref.RFC5646.2"><cite title="Tags for Identifying Languages">[RFC5646]</cite></a>, <a href="https://tools.ietf.org/html/rfc5646#section-2.1">Section 2.1</a>&gt; 
     526</pre></div><div id="rfc.section.3.1.3.1.p.3"><p>A language tag is a sequence of one or more case-insensitive subtags, each separated by a hyphen character ("-", %x2D). In most cases, a language tag consists of a primary language subtag that identifies a broad family of related languages (e.g., "en" = English), which is optionally followed by a series of subtags that refine or narrow that language's range (e.g., "en-CA" = the variety of English as communicated in Canada). Whitespace is not allowed within a language tag. Example tags include:<a class="self" href="#rfc.section.3.1.3.1.p.3">&para;</a></p></div><div id="rfc.figure.u.11"><pre class="text">  fr, en-US, es-419, az-Arab, x-pig-latin, man-Nkoo-GN 
     527</pre></div><div id="rfc.section.3.1.3.1.p.4"><p>See <a href="#RFC5646" id="rfc.xref.RFC5646.3"><cite title="Tags for Identifying Languages">[RFC5646]</cite></a> for further information.<a class="self" href="#rfc.section.3.1.3.1.p.4">&para;</a></p></div></div><div id="header.content-language"><h4 id="rfc.section.3.1.3.2"><a href="#rfc.section.3.1.3.2">3.1.3.2</a>&nbsp;<a href="#header.content-language">Content-Language</a></h4><div id="rfc.section.3.1.3.2.p.1"><p>The "Content-Language" header field describes the natural language(s) of the intended audience for the representation. Note that this might not be equivalent to all the languages used within the representation.<a class="self" href="#rfc.section.3.1.3.2.p.1">&para;</a></p></div><div id="rfc.figure.u.12"><pre class="inline"><span id="rfc.iref.g.10"></span>  <a href="#header.content-language" class="smpl">Content-Language</a> = 1#<a href="#language.tags" class="smpl">language-tag</a> 
     528</pre></div><div id="rfc.section.3.1.3.2.p.2"><p>Language tags are defined in <a href="#language.tags" title="Language Tags">Section&nbsp;3.1.3.1</a>. The primary purpose of Content-Language is to allow a user to identify and differentiate representations according to the users' own preferred language. Thus, if the content is intended only for a Danish-literate audience, the appropriate field is<a class="self" href="#rfc.section.3.1.3.2.p.2">&para;</a></p></div><div id="rfc.figure.u.13"><pre class="text">  Content-Language: da 
     529</pre></div><div id="rfc.section.3.1.3.2.p.3"><p>If no Content-Language is specified, the default is that the content is intended for all language audiences. This might mean that the sender does not consider it to be specific to any natural language, or that the sender does not know for which language it is intended.<a class="self" href="#rfc.section.3.1.3.2.p.3">&para;</a></p></div><div id="rfc.section.3.1.3.2.p.4"><p>Multiple languages <em class="bcp14">MAY</em> be listed for content that is intended for multiple audiences. For example, a rendition of the "Treaty of Waitangi", presented simultaneously in the original Maori and English versions, would call for<a class="self" href="#rfc.section.3.1.3.2.p.4">&para;</a></p></div><div id="rfc.figure.u.14"><pre class="text">  Content-Language: mi, en 
     530</pre></div><div id="rfc.section.3.1.3.2.p.5"><p>However, just because multiple languages are present within a representation does not mean that it is intended for multiple linguistic audiences. An example would be a beginner's language primer, such as "A First Lesson in Latin", which is clearly intended to be used by an English-literate audience. In this case, the Content-Language would properly only include "en".<a class="self" href="#rfc.section.3.1.3.2.p.5">&para;</a></p></div><div id="rfc.section.3.1.3.2.p.6"><p>Content-Language <em class="bcp14">MAY</em> be applied to any media type &#8212; it is not limited to textual documents.<a class="self" href="#rfc.section.3.1.3.2.p.6">&para;</a></p></div></div></div><div id="identification"><h3 id="rfc.section.3.1.4"><a href="#rfc.section.3.1.4">3.1.4</a>&nbsp;<a href="#identification">Identification</a></h3><div id="identifying.payload"><h4 id="rfc.section.3.1.4.1"><a href="#rfc.section.3.1.4.1">3.1.4.1</a>&nbsp;<a href="#identifying.payload">Identifying a Representation</a></h4><div id="rfc.section.3.1.4.1.p.1"><p>When a complete or partial representation is transferred in a message payload, it is often desirable for the sender to supply, or the recipient to determine, an identifier for a resource corresponding to that representation.<a class="self" href="#rfc.section.3.1.4.1.p.1">&para;</a></p></div><div id="rfc.section.3.1.4.1.p.2"><p>For a request message: <a class="self" href="#rfc.section.3.1.4.1.p.2">&para;</a></p><ul><li>If the request has a <a href="#header.content-location" class="smpl">Content-Location</a> header field, then the sender asserts that the payload is a representation of the resource identified by the Content-Location field-value. However, such an assertion cannot be trusted unless it can be verified by other means (not defined by this specification). The information might still be useful for revision history links.</li><li>Otherwise, the payload is unidentified.</li></ul></div><div id="rfc.section.3.1.4.1.p.3"><p>For a response message, the following rules are applied in order until a match is found: <a class="self" href="#rfc.section.3.1.4.1.p.3">&para;</a></p><ol><li>If the request method is GET or HEAD and the response status code is <a href="#status.200" class="smpl">200 (OK)</a>, <a href="#status.204" class="smpl">204 (No Content)</a>, <a href="rfc7233.html#status.206" class="smpl">206 (Partial Content)</a>, or <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a>, the payload is a representation of the resource identified by the effective request URI (<a href="rfc7230.html#effective.request.uri" title="Effective Request URI">Section 5.5</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.11"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>).</li><li>If the request method is GET or HEAD and the response status code is <a href="#status.203" class="smpl">203 (Non-Authoritative Information)</a>, the payload is a potentially modified or enhanced representation of the <a href="#resources" class="smpl">target resource</a> as provided by an intermediary.</li><li>If the response has a <a href="#header.content-location" class="smpl">Content-Location</a> header field and its field-value is a reference to the same URI as the effective request URI, the payload is a representation of the resource identified by the effective request URI.</li><li>If the response has a <a href="#header.content-location" class="smpl">Content-Location</a> header field and its field-value is a reference to a URI different from the effective request URI, then the sender asserts that the payload is a representation of the resource identified by the Content-Location field-value. However, such an assertion cannot be trusted unless it can be verified by other means (not defined by this specification).</li><li>Otherwise, the payload is unidentified.</li></ol></div></div><div id="header.content-location"><h4 id="rfc.section.3.1.4.2"><a href="#rfc.section.3.1.4.2">3.1.4.2</a>&nbsp;<a href="#header.content-location">Content-Location</a></h4><div id="rfc.section.3.1.4.2.p.1"><p>The "Content-Location" header field references a URI that can be used as an identifier for a specific resource corresponding to the representation in this message's payload. In other words, if one were to perform a GET request on this URI at the time of this message's generation, then a <a href="#status.200" class="smpl">200 (OK)</a> response would contain the same representation that is enclosed as payload in this message.<a class="self" href="#rfc.section.3.1.4.2.p.1">&para;</a></p></div><div id="rfc.figure.u.15"><pre class="inline"><span id="rfc.iref.g.11"></span>  <a href="#header.content-location" class="smpl">Content-Location</a> = <a href="#imported.abnf" class="smpl">absolute-URI</a> / <a href="#imported.abnf" class="smpl">partial-URI</a> 
     531</pre></div><div id="rfc.section.3.1.4.2.p.2"><p>The Content-Location value is not a replacement for the effective Request URI (<a href="rfc7230.html#effective.request.uri" title="Effective Request URI">Section 5.5</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.12"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a>). It is representation metadata. It has the same syntax and semantics as the header field of the same name defined for MIME body parts in <a href="https://tools.ietf.org/html/rfc2557#section-4">Section 4</a> of <a href="#RFC2557" id="rfc.xref.RFC2557.1"><cite title="MIME Encapsulation of Aggregate Documents, such as HTML (MHTML)">[RFC2557]</cite></a>. However, its appearance in an HTTP message has some special implications for HTTP recipients.<a class="self" href="#rfc.section.3.1.4.2.p.2">&para;</a></p></div><div id="rfc.section.3.1.4.2.p.3"><p>If Content-Location is included in a <a href="#status.2xx" class="smpl">2xx (Successful)</a> response message and its value refers (after conversion to absolute form) to a URI that is the same as the effective request URI, then the recipient <em class="bcp14">MAY</em> consider the payload to be a current representation of that resource at the time indicated by the message origination date. For a GET (<a href="#GET" id="rfc.xref.GET.2" title="GET">Section&nbsp;4.3.1</a>) or HEAD (<a href="#HEAD" id="rfc.xref.HEAD.1" title="HEAD">Section&nbsp;4.3.2</a>) request, this is the same as the default semantics when no Content-Location is provided by the server. For a state-changing request like PUT (<a href="#PUT" id="rfc.xref.PUT.1" title="PUT">Section&nbsp;4.3.4</a>) or POST (<a href="#POST" id="rfc.xref.POST.1" title="POST">Section&nbsp;4.3.3</a>), it implies that the server's response contains the new representation of that resource, thereby distinguishing it from representations that might only report about the action (e.g., "It worked!"). This allows authoring applications to update their local copies without the need for a subsequent GET request.<a class="self" href="#rfc.section.3.1.4.2.p.3">&para;</a></p></div><div id="rfc.section.3.1.4.2.p.4"><p>If Content-Location is included in a <a href="#status.2xx" class="smpl">2xx (Successful)</a> response message and its field-value refers to a URI that differs from the effective request URI, then the origin server claims that the URI is an identifier for a different resource corresponding to the enclosed representation. Such a claim can only be trusted if both identifiers share the same resource owner, which cannot be programmatically determined via HTTP. <a class="self" href="#rfc.section.3.1.4.2.p.4">&para;</a></p><ul><li>For a response to a GET or HEAD request, this is an indication that the effective request URI refers to a resource that is subject to content negotiation and the Content-Location field-value is a more specific identifier for the <a href="#representations" class="smpl">selected representation</a>.</li><li>For a <a href="#status.201" class="smpl">201 (Created)</a> response to a state-changing method, a Content-Location field-value that is identical to the <a href="#header.location" class="smpl">Location</a> field-value indicates that this payload is a current representation of the newly created resource.</li><li>Otherwise, such a Content-Location indicates that this payload is a representation reporting on the requested action's status and that the same report is available (for future access with GET) at the given URI. For example, a purchase transaction made via a POST request might include a receipt document as the payload of the <a href="#status.200" class="smpl">200 (OK)</a> response; the Content-Location field-value provides an identifier for retrieving a copy of that same receipt in the future.</li></ul></div><div id="rfc.section.3.1.4.2.p.5"><p>A user agent that sends Content-Location in a request message is stating that its value refers to where the user agent originally obtained the content of the enclosed representation (prior to any modifications made by that user agent). In other words, the user agent is providing a back link to the source of the original representation.<a class="self" href="#rfc.section.3.1.4.2.p.5">&para;</a></p></div><div id="rfc.section.3.1.4.2.p.6"><p>An origin server that receives a Content-Location field in a request message <em class="bcp14">MUST</em> treat the information as transitory request context rather than as metadata to be saved verbatim as part of the representation. An origin server <em class="bcp14">MAY</em> use that context to guide in processing the request or to save it for other uses, such as within source links or versioning metadata. However, an origin server <em class="bcp14">MUST NOT</em> use such context information to alter the request semantics.<a class="self" href="#rfc.section.3.1.4.2.p.6">&para;</a></p></div><div id="rfc.section.3.1.4.2.p.7"><p>For example, if a client makes a PUT request on a negotiated resource and the origin server accepts that PUT (without redirection), then the new state of that resource is expected to be consistent with the one representation supplied in that PUT; the Content-Location cannot be used as a form of reverse content selection identifier to update only one of the negotiated representations. If the user agent had wanted the latter semantics, it would have applied the PUT directly to the Content-Location URI.<a class="self" href="#rfc.section.3.1.4.2.p.7">&para;</a></p></div></div></div></div><div id="representation.data"><h2 id="rfc.section.3.2"><a href="#rfc.section.3.2">3.2</a>&nbsp;<a href="#representation.data">Representation Data</a></h2><div id="rfc.section.3.2.p.1"><p>The representation data associated with an HTTP message is either provided as the payload body of the message or referred to by the message semantics and the effective request URI. The representation data is in a format and encoding defined by the representation metadata header fields.<a class="self" href="#rfc.section.3.2.p.1">&para;</a></p></div><div id="rfc.section.3.2.p.2"><p>The data type of the representation data is determined via the header fields <a href="#header.content-type" class="smpl">Content-Type</a> and <a href="#header.content-encoding" class="smpl">Content-Encoding</a>. These define a two-layer, ordered encoding model:<a class="self" href="#rfc.section.3.2.p.2">&para;</a></p></div><div id="rfc.figure.u.16"><pre class="text">  representation-data := Content-Encoding( Content-Type( bits ) ) 
     532</pre></div></div><div id="payload"><h2 id="rfc.section.3.3"><a href="#rfc.section.3.3">3.3</a>&nbsp;<a href="#payload">Payload Semantics</a></h2><div id="rfc.section.3.3.p.1"><p>Some HTTP messages transfer a complete or partial representation as the message "<dfn>payload</dfn>". In some cases, a payload might contain only the associated representation's header fields (e.g., responses to HEAD) or only some part(s) of the representation data (e.g., the <a href="rfc7233.html#status.206" class="smpl">206 (Partial Content)</a> status code).<a class="self" href="#rfc.section.3.3.p.1">&para;</a></p></div><div id="rfc.section.3.3.p.2"><p>The purpose of a payload in a request is defined by the method semantics. For example, a representation in the payload of a PUT request (<a href="#PUT" id="rfc.xref.PUT.2" title="PUT">Section&nbsp;4.3.4</a>) represents the desired state of the <a href="#resources" class="smpl">target resource</a> if the request is successfully applied, whereas a representation in the payload of a POST request (<a href="#POST" id="rfc.xref.POST.2" title="POST">Section&nbsp;4.3.3</a>) represents information to be processed by the target resource.<a class="self" href="#rfc.section.3.3.p.2">&para;</a></p></div><div id="rfc.section.3.3.p.3"><p>In a response, the payload's purpose is defined by both the request method and the response status code. For example, the payload of a <a href="#status.200" class="smpl">200 (OK)</a> response to GET (<a href="#GET" id="rfc.xref.GET.3" title="GET">Section&nbsp;4.3.1</a>) represents the current state of the <a href="#resources" class="smpl">target resource</a>, as observed at the time of the message origination date (<a href="#header.date" id="rfc.xref.header.date.1" title="Date">Section&nbsp;7.1.1.2</a>), whereas the payload of the same status code in a response to POST might represent either the processing result or the new state of the target resource after applying the processing. Response messages with an error status code usually contain a payload that represents the error condition, such that it describes the error state and what next steps are suggested for resolving it.<a class="self" href="#rfc.section.3.3.p.3">&para;</a></p></div><div id="rfc.section.3.3.p.4"><p>Header fields that specifically describe the payload, rather than the associated representation, are referred to as "payload header fields". Payload header fields are defined in other parts of this specification, due to their impact on message parsing.<a class="self" href="#rfc.section.3.3.p.4">&para;</a></p></div><div id="rfc.table.u.2"><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Header Field Name</th><th>Defined in...</th></tr></thead><tbody><tr><td class="left">Content-Length</td><td class="left"><a href="rfc7230.html#header.content-length" title="Content-Length">Section 3.3.2</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.13"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a></td></tr><tr><td class="left">Content-Range</td><td class="left"><a href="rfc7233.html#header.content-range" title="Content-Range">Section 4.2</a> of <a href="#RFC7233" id="rfc.xref.RFC7233.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[RFC7233]</cite></a></td></tr><tr><td class="left">Trailer</td><td class="left"><a href="rfc7230.html#header.trailer" title="Trailer">Section 4.4</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.14"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a></td></tr><tr><td class="left">Transfer-Encoding</td><td class="left"><a href="rfc7230.html#header.transfer-encoding" title="Transfer-Encoding">Section 3.3.1</a> of <a href="#RFC7230" id="rfc.xref.RFC7230.15"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[RFC7230]</cite></a></td></tr></tbody></table></div></div><div id="content.negotiation"><h2 id="rfc.section.3.4"><a href="#rfc.section.3.4">3.4</a>&nbsp;<a href="#content.negotiation">Content Negotiation</a></h2><div id="rfc.section.3.4.p.1"><p>When responses convey payload information, whether indicating a success or an error, the origin server often has different ways of representing that information; for example, in different formats, languages, or encodings. Likewise, different users or user agents might have differing capabilities, characteristics, or preferences that could influence which representation, among those available, would be best to deliver. For this reason, HTTP provides mechanisms for <a href="#content.negotiation" class="smpl">content negotiation</a>.<a class="self" href="#rfc.section.3.4.p.1">&para;</a></p></div><div id="rfc.section.3.4.p.2"><p>This specification defines two patterns of content negotiation that can be made visible within the protocol: "proactive", where the server selects the representation based upon the user agent's stated preferences, and "reactive" negotiation, where the server provides a list of representations for the user agent to choose from. Other patterns of content negotiation include "conditional content", where the representation consists of multiple parts that are selectively rendered based on user agent parameters, "active content", where the representation contains a script that makes additional (more specific) requests based on the user agent characteristics, and "Transparent Content Negotiation" (<a href="#RFC2295" id="rfc.xref.RFC2295.1"><cite title="Transparent Content Negotiation in HTTP">[RFC2295]</cite></a>), where content selection is performed by an intermediary. These patterns are not mutually exclusive, and each has trade-offs in applicability and practicality.<a class="self" href="#rfc.section.3.4.p.2">&para;</a></p></div><div id="rfc.section.3.4.p.3"><p>Note that, in all cases, HTTP is not aware of the resource semantics. The consistency with which an origin server responds to requests, over time and over the varying dimensions of content negotiation, and thus the "sameness" of a resource's observed representations over time, is determined entirely by whatever entity or algorithm selects or generates those responses. HTTP pays no attention to the man behind the curtain.<a class="self" href="#rfc.section.3.4.p.3">&para;</a></p></div><div id="proactive.negotiation"><h3 id="rfc.section.3.4.1"><a href="#rfc.section.3.4.1">3.4.1</a>&nbsp;<a href="#proactive.negotiation">Proactive Negotiation</a></h3><div id="rfc.section.3.4.1.p.1"><p>When content negotiation preferences are sent by the user agent in a request to encourage an algorithm located at the server to select the preferred representation, it is called <dfn>proactive negotiation</dfn> (a.k.a., <dfn>server-driven negotiation</dfn>). Selection is based on the available representations for a response (the dimensions over which it might vary, such as language, content-coding, etc.) compared to various information supplied in the request, including both the explicit negotiation fields of <a href="#request.conneg" title="Content Negotiation">Section&nbsp;5.3</a> and implicit characteristics, such as the client's network address or parts of the <a href="#header.user-agent" class="smpl">User-Agent</a> field.<a class="self" href="#rfc.section.3.4.1.p.1">&para;</a></p></div><div id="rfc.section.3.4.1.p.2"><p>Proactive negotiation is advantageous when the algorithm for selecting from among the available representations is difficult to describe to a user agent, or when the server desires to send its "best guess" to the user agent along with the first response (hoping to avoid the round trip delay of a subsequent request if the "best guess" is good enough for the user). In order to improve the server's guess, a user agent <em class="bcp14">MAY</em> send request header fields that describe its preferences.<a class="self" href="#rfc.section.3.4.1.p.2">&para;</a></p></div><div id="rfc.section.3.4.1.p.3"><p>Proactive negotiation has serious disadvantages: <a class="self" href="#rfc.section.3.4.1.p.3">&para;</a></p><ul><li>It is impossible for the server to accurately determine what might be "best" for any given user, since that would require complete knowledge of both the capabilities of the user agent and the intended use for the response (e.g., does the user want to view it on screen or print it on paper?);</li><li>Having the user agent describe its capabilities in every request can be both very inefficient (given that only a small percentage of responses have multiple representations) and a potential risk to the user's privacy;</li><li>It complicates the implementation of an origin server and the algorithms for generating responses to a request; and,</li><li>It limits the reusability of responses for shared caching.</li></ul></div><div id="rfc.section.3.4.1.p.4"><p>A user agent cannot rely on proactive negotiation preferences being consistently honored, since the origin server might not implement proactive negotiation for the requested resource or might decide that sending a response that doesn't conform to the user agent's preferences is better than sending a <a href="#status.406" class="smpl">406 (Not Acceptable)</a> response.<a class="self" href="#rfc.section.3.4.1.p.4">&para;</a></p></div><div id="rfc.section.3.4.1.p.5"><p>A <a href="#header.vary" class="smpl">Vary</a> header field (<a href="#header.vary" id="rfc.xref.header.vary.1" title="Vary">Section&nbsp;7.1.4</a>) is often sent in a response subject to proactive negotiation to indicate what parts of the request information were used in the selection algorithm.<a class="self" href="#rfc.section.3.4.1.p.5">&para;</a></p></div></div><div id="reactive.negotiation"><h3 id="rfc.section.3.4.2"><a href="#rfc.section.3.4.2">3.4.2</a>&nbsp;<a href="#reactive.negotiation">Reactive Negotiation</a></h3><div id="rfc.section.3.4.2.p.1"><p>With <dfn>reactive negotiation</dfn> (a.k.a., <dfn>agent-driven negotiation</dfn>), selection of the best response representation (regardless of the status code) is performed by the user agent after receiving an initial response from the origin server that contains a list of resources for alternative representations. If the user agent is not satisfied by the initial response representation, it can perform a GET request on one or more of the alternative resources, selected based on metadata included in the list, to obtain a different form of representation for that response. Selection of alternatives might be performed automatically by the user agent or manually by the user selecting from a generated (possibly hypertext) menu.<a class="self" href="#rfc.section.3.4.2.p.1">&para;</a></p></div><div id="rfc.section.3.4.2.p.2"><p>Note that the above refers to representations of the response, in general, not representations of the resource. The alternative representations are only considered representations of the target resource if the response in which those alternatives are provided has the semantics of being a representation of the target resource (e.g., a <a href="#status.200" class="smpl">200 (OK)</a> response to a GET request) or has the semantics of providing links to alternative representations for the target resource (e.g., a <a href="#status.300" class="smpl">300 (Multiple Choices)</a> response to a GET request).<a class="self" href="#rfc.section.3.4.2.p.2">&para;</a></p></div><div id="rfc.section.3.4.2.p.3"><p>A server might choose not to send an initial representation, other than the list of alternatives, and thereby indicate that reactive negotiation by the user agent is preferred. For example, the alternatives listed in responses with the <a href="#status.300" class="smpl">300 (Multiple Choices)</a> and <a href="#status.406" class="smpl">406 (Not Acceptable)</a> status codes include information about the available representations so that the user or user agent can react by making a selection.<a class="self" href="#rfc.section.3.4.2.p.3">&para;</a></p></div><div id="rfc.section.3.4.2.p.4"><p>Reactive negotiation is advantageous when the response would vary over commonly used dimensions (such as type, language, or encoding), when the origin server is unable to determine a user agent's capabilities from examining the request, and generally when public caches are used to distribute server load and reduce network usage.<a class="self" href="#rfc.section.3.4.2.p.4">&para;</a></p></div><div id="rfc.section.3.4.2.p.5"><p>Reactive negotiation suffers from the disadvantages of transmitting a list of alternatives to the user agent, which degrades user-perceived latency if transmitted in the header section, and needing a second request to obtain an alternate representation. Furthermore, this specification does not define a mechanism for supporting automatic selection, though it does not prevent such a mechanism from being developed as an extension.<a class="self" href="#rfc.section.3.4.2.p.5">&para;</a></p></div></div></div></div><div id="methods"><h1 id="rfc.section.4"><a href="#rfc.section.4">4.</a>&nbsp;<a href="#methods">Request Methods</a></h1><div id="method.overview"><h2 id="rfc.section.4.1"><a href="#rfc.section.4.1">4.1</a>&nbsp;<a href="#method.overview">Overview</a></h2><div id="rfc.section.4.1.p.1"><p>The request method token is the primary source of request semantics; it indicates the purpose for which the client has made this request and what is expected by the client as a successful result.<a class="self" href="#rfc.section.4.1.p.1">&para;</a></p></div><div id="rfc.section.4.1.p.2"><p>The request method's semantics might be further specialized by the semantics of some header fields when present in a request (<a href="#request.header.fields" title="Request Header Fields">Section&nbsp;5</a>) if those additional semantics do not conflict with the method. For example, a client can send conditional request header fields (<a href="#request.conditionals" title="Conditionals">Section&nbsp;5.2</a>) to make the requested action conditional on the current state of the target resource (<a href="#RFC7232" id="rfc.xref.RFC7232.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests">[RFC7232]</cite></a>).<a class="self" href="#rfc.section.4.1.p.2">&para;</a></p></div><div id="rfc.figure.u.17"><pre class="inline"><span id="rfc.iref.g.12"></span>  <a href="#method.overview" class="smpl">method</a> = <a href="#imported.abnf" class="smpl">token</a> 
     533</pre></div><div id="rfc.section.4.1.p.3"><p>HTTP was originally designed to be usable as an interface to distributed object systems. The request method was envisioned as applying semantics to a <a href="#resources" class="smpl">target resource</a> in much the same way as invoking a defined method on an identified object would apply semantics. The method token is case-sensitive because it might be used as a gateway to object-based systems with case-sensitive method names.<a class="self" href="#rfc.section.4.1.p.3">&para;</a></p></div><div id="rfc.section.4.1.p.4"><p>Unlike distributed objects, the standardized request methods in HTTP are not resource-specific, since uniform interfaces provide for better visibility and reuse in network-based systems <a href="#REST" id="rfc.xref.REST.2"><cite title="Architectural Styles and the Design of Network-based Software Architectures">[REST]</cite></a>. Once defined, a standardized method ought to have the same semantics when applied to any resource, though each resource determines for itself whether those semantics are implemented or allowed.<a class="self" href="#rfc.section.4.1.p.4">&para;</a></p></div><div id="rfc.section.4.1.p.5"><p>This specification defines a number of standardized methods that are commonly used in HTTP, as outlined by the following table. By convention, standardized methods are defined in all-uppercase US-ASCII letters.<a class="self" href="#rfc.section.4.1.p.5">&para;</a></p></div><div id="rfc.table.1"><div id="table.of.methods"></div><table class="tt full left" cellpadding="3" cellspacing="0"><thead><tr><th>Method</th><th>Description</th><th>Sec.</th></tr></thead><tbody><tr><td class="left">GET</td><td class="left">Transfer a current representation of the target resource.</td><td class="left"><a href="#GET" id="rfc.xref.GET.4" title="GET">4.3.1</a></td></tr><tr><td class="left">HEAD</td><td class="left">Same as GET, but only transfer the status line and header section.</td><td class="left"><a href="#HEAD" id="rfc.xref.HEAD.2" title="HEAD">4.3.2</a></td></tr><tr><td class="left">POST</td><td class="left">Perform resource-specific processing on the request payload.</td><td class="left"><a href="#POST" id="rfc.xref.POST.3" title="POST">4.3.3</a></td></tr><tr><td class="left">PUT</td><td class="left">Replace all current representations of the target resource with the request payload.</td><td class="left"><a href="#PUT" id="rfc.xref.PUT.3" title="PUT">4.3.4</a></td></tr><tr><td class="left">DELETE</td><td class="left">Remove all current representations of the target resource.</td><td class="left"><a href="#DELETE" id="rfc.xref.DELETE.1" title="DELETE">4.3.5</a></td></tr><tr><td class="left">CONNECT</td><td class="left">Establish a tunnel to the server identified by the target resource.</td><td class="left"><a href="#CONNECT" id="rfc.xref.CONNECT.1" title="CONNECT">4.3.6</a></td></tr><tr><td class="left">OPTIONS</td><td class="left">Describe the communication options for the target resource.</td><td class="left"><a href="#OPTIONS" id="rfc.xref.OPTIONS.1" title="OPTIONS">4.3.7</a></td></tr><tr><td class="left">TRACE</td><td class="left">Perform a message loop-back test along the path to the target resource.</td><td class="left"><a href="#TRACE" id="rfc.xref.TRACE.1" title="TRACE">4.3.8</a></td></tr></tbody></table></div><div id="rfc.section.4.1.p.6"><p>All general-purpose servers <em class="bcp14">MUST</em> support the methods GET and HEAD. All other methods are <em class="bcp14">OPTIONAL</em>.<a class="self" href="#rfc.section.4.1.p.6">&para;</a></p></div><div id="rfc.section.4.1.p.7"><p>Additional methods, outside the scope of this specification, have been standardized for use in HTTP. All such methods ought to be registered within the "Hypertext Transfer Protocol (HTTP) Method Registry" maintained by IANA, as defined in <a href="#method.registry" title="Method Registry">Section&nbsp;8.1</a>.<a class="self" href="#rfc.section.4.1.p.7">&para;</a></p></div><div id="rfc.section.4.1.p.8"><p>The set of methods allowed by a target resource can be listed in an <a href="#header.allow" class="smpl">Allow</a> header field (<a href="#header.allow" id="rfc.xref.header.allow.1" title="Allow">Section&nbsp;7.4.1</a>). However, the set of allowed methods can change dynamically. When a request method is received that is unrecognized or not implemented by an origin server, the origin server <em class="bcp14">SHOULD</em> respond with the <a href="#status.501" class="smpl">501 (Not Implemented)</a> status code. When a request method is received that is known by an origin server but not allowed for the target resource, the origin server <em class="bcp14">SHOULD</em> respond with the <a href="#status.405" class="smpl">405 (Method Not Allowed)</a> status code.<a class="self" href="#rfc.section.4.1.p.8">&para;</a></p></div></div><div id="method.properties"><h2 id="rfc.section.4.2"><a href="#rfc.section.4.2">4.2</a>&nbsp;<a href="#method.properties">Common Method Properties</a></h2><div id="safe.methods"><h3 id="rfc.section.4.2.1"><a href="#rfc.section.4.2.1">4.2.1</a>&nbsp;<a href="#safe.methods">Safe Methods</a></h3><div id="rfc.section.4.2.1.p.1"><p>Request methods are considered "<dfn>safe</dfn>" if their defined semantics are essentially read-only; i.e., the client does not request, and does not expect, any state change on the origin server as a result of applying a safe method to a target resource. Likewise, reasonable use of a safe method is not expected to cause any harm, loss of property, or unusual burden on the origin server.<a class="self" href="#rfc.section.4.2.1.p.1">&para;</a></p></div><div id="rfc.section.4.2.1.p.2"><p>This definition of safe methods does not prevent an implementation from including behavior that is potentially harmful, that is not entirely read-only, or that causes side effects while invoking a safe method. What is important, however, is that the client did not request that additional behavior and cannot be held accountable for it. For example, most servers append request information to access log files at the completion of every response, regardless of the method, and that is considered safe even though the log storage might become full and crash the server. Likewise, a safe request initiated by selecting an advertisement on the Web will often have the side effect of charging an advertising account.<a class="self" href="#rfc.section.4.2.1.p.2">&para;</a></p></div><div id="rfc.section.4.2.1.p.3"><p>Of the request methods defined by this specification, the GET, HEAD, OPTIONS, and TRACE methods are defined to be safe.<a class="self" href="#rfc.section.4.2.1.p.3">&para;</a></p></div><div id="rfc.section.4.2.1.p.4"><p>The purpose of distinguishing between safe and unsafe methods is to allow automated retrieval processes (spiders) and cache performance optimization (pre-fetching) to work without fear of causing harm. In addition, it allows a user agent to apply appropriate constraints on the automated use of unsafe methods when processing potentially untrusted content.<a class="self" href="#rfc.section.4.2.1.p.4">&para;</a></p></div><div id="rfc.section.4.2.1.p.5"><p>A user agent <em class="bcp14">SHOULD</em> distinguish between safe and unsafe methods when presenting potential actions to a user, such that the user can be made aware of an unsafe action before it is requested.<a class="self" href="#rfc.section.4.2.1.p.5">&para;</a></p></div><div id="rfc.section.4.2.1.p.6"><p>When a resource is constructed such that parameters within the effective request URI have the effect of selecting an action, it is the resource owner's responsibility to ensure that the action is consistent with the request method semantics. For example, it is common for Web-based content editing software to use actions within query parameters, such as "page?do=delete". If the purpose of such a resource is to perform an unsafe action, then the resource owner <em class="bcp14">MUST</em> disable or disallow that action when it is accessed using a safe request method. Failure to do so will result in unfortunate side effects when automated processes perform a GET on every URI reference for the sake of link maintenance, pre-fetching, building a search index, etc.<a class="self" href="#rfc.section.4.2.1.p.6">&para;</a></p></div></div><div id="idempotent.methods"><h3 id="rfc.section.4.2.2"><a href="#rfc.section.4.2.2">4.2.2</a>&nbsp;<a href="#idempotent.methods">Idempotent Methods</a></h3><div id="rfc.section.4.2.2.p.1"><p>A request method is considered "<dfn id="idempotent">idempotent</dfn>" if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request. Of the request methods defined by this specification, PUT, DELETE, and safe request methods are idempotent.<a class="self" href="#rfc.section.4.2.2.p.1">&para;</a></p></div><div id="rfc.section.4.2.2.p.2"><p>Like the definition of safe, the idempotent property only applies to what has been requested by the user; a server is free to log each request separately, retain a revision control history, or implement other non-idempotent side effects for each idempotent request.<a class="self" href="#rfc.section.4.2.2.p.2">&para;</a></p></div><div id="rfc.section.4.2.2.p.3"><p>Idempotent methods are distinguished because the request can be repeated automatically if a communication failure occurs before the client is able to read the server's response. For example, if a client sends a PUT request and the underlying connection is closed before any response is received, then the client can establish a new connection and retry the idempotent request. It knows that repeating the request will have the same intended effect, even if the original request succeeded, though the response might differ.<a class="self" href="#rfc.section.4.2.2.p.3">&para;</a></p></div></div><div id="cacheable.methods"><h3 id="rfc.section.4.2.3"><a href="#rfc.section.4.2.3">4.2.3</a>&nbsp;<a href="#cacheable.methods">Cacheable Methods</a></h3><div id="rfc.section.4.2.3.p.1"><p>Request methods can be defined as "<dfn id="cacheable">cacheable</dfn>" to indicate that responses to them are allowed to be stored for future reuse; for specific requirements see <a href="#RFC7234" id="rfc.xref.RFC7234.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>. In general, safe methods that do not depend on a current or authoritative response are defined as cacheable; this specification defines GET, HEAD, and POST as cacheable, although the overwhelming majority of cache implementations only support GET and HEAD.<a class="self" href="#rfc.section.4.2.3.p.1">&para;</a></p></div></div></div><div id="method.definitions"><h2 id="rfc.section.4.3"><a href="#rfc.section.4.3">4.3</a>&nbsp;<a href="#method.definitions">Method Definitions</a></h2><div id="GET"><h3 id="rfc.section.4.3.1"><a href="#rfc.section.4.3.1">4.3.1</a>&nbsp;<a href="#GET">GET</a></h3><div id="rfc.iref.g.13"></div><div id="rfc.section.4.3.1.p.1"><p>The GET method requests transfer of a current selected representation for the <a href="#resources" class="smpl">target resource</a>. GET is the primary mechanism of information retrieval and the focus of almost all performance optimizations. Hence, when people speak of retrieving some identifiable information via HTTP, they are generally referring to making a GET request.<a class="self" href="#rfc.section.4.3.1.p.1">&para;</a></p></div><div id="rfc.section.4.3.1.p.2"><p>It is tempting to think of resource identifiers as remote file system pathnames and of representations as being a copy of the contents of such files. In fact, that is how many resources are implemented (see <a href="#attack.pathname" title="Attacks Based on File and Path Names">Section&nbsp;9.1</a> for related security considerations). However, there are no such limitations in practice. The HTTP interface for a resource is just as likely to be implemented as a tree of content objects, a programmatic view on various database records, or a gateway to other information systems. Even when the URI mapping mechanism is tied to a file system, an origin server might be configured to execute the files with the request as input and send the output as the representation rather than transfer the files directly. Regardless, only the origin server needs to know how each of its resource identifiers corresponds to an implementation and how each implementation manages to select and send a current representation of the target resource in a response to GET.<a class="self" href="#rfc.section.4.3.1.p.2">&para;</a></p></div><div id="rfc.section.4.3.1.p.3"><p>A client can alter the semantics of GET to be a "range request", requesting transfer of only some part(s) of the selected representation, by sending a <a href="rfc7233.html#header.range" class="smpl">Range</a> header field in the request (<a href="#RFC7233" id="rfc.xref.RFC7233.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Range Requests">[RFC7233]</cite></a>).<a class="self" href="#rfc.section.4.3.1.p.3">&para;</a></p></div><div id="rfc.section.4.3.1.p.4"><p>A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.<a class="self" href="#rfc.section.4.3.1.p.4">&para;</a></p></div><div id="rfc.section.4.3.1.p.5"><p>The response to a GET request is cacheable; a cache <em class="bcp14">MAY</em> use it to satisfy subsequent GET and HEAD requests unless otherwise indicated by the Cache-Control header field (<a href="rfc7234.html#header.cache-control" title="Cache-Control">Section 5.2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>).<a class="self" href="#rfc.section.4.3.1.p.5">&para;</a></p></div></div><div id="HEAD"><h3 id="rfc.section.4.3.2"><a href="#rfc.section.4.3.2">4.3.2</a>&nbsp;<a href="#HEAD">HEAD</a></h3><div id="rfc.iref.h.1"></div><div id="rfc.section.4.3.2.p.1"><p>The HEAD method is identical to GET except that the server <em class="bcp14">MUST NOT</em> send a message body in the response (i.e., the response terminates at the end of the header section). The server <em class="bcp14">SHOULD</em> send the same header fields in response to a HEAD request as it would have sent if the request had been a GET, except that the payload header fields (<a href="#payload" title="Payload Semantics">Section&nbsp;3.3</a>) <em class="bcp14">MAY</em> be omitted. This method can be used for obtaining metadata about the selected representation without transferring the representation data and is often used for testing hypertext links for validity, accessibility, and recent modification.<a class="self" href="#rfc.section.4.3.2.p.1">&para;</a></p></div><div id="rfc.section.4.3.2.p.2"><p>A payload within a HEAD request message has no defined semantics; sending a payload body on a HEAD request might cause some existing implementations to reject the request.<a class="self" href="#rfc.section.4.3.2.p.2">&para;</a></p></div><div id="rfc.section.4.3.2.p.3"><p>The response to a HEAD request is cacheable; a cache <em class="bcp14">MAY</em> use it to satisfy subsequent HEAD requests unless otherwise indicated by the Cache-Control header field (<a href="rfc7234.html#header.cache-control" title="Cache-Control">Section 5.2</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>). A HEAD response might also have an effect on previously cached responses to GET; see <a href="rfc7234.html#head.effects" title="Freshening Responses via HEAD">Section 4.3.5</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.4"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>.<a class="self" href="#rfc.section.4.3.2.p.3">&para;</a></p></div></div><div id="POST"><h3 id="rfc.section.4.3.3"><a href="#rfc.section.4.3.3">4.3.3</a>&nbsp;<a href="#POST">POST</a></h3><div id="rfc.section.4.3.3.p.1"><p>The POST method requests that the <a href="#resources" class="smpl">target resource</a> process the representation enclosed in the request according to the resource's own specific semantics. For example, POST is used for the following functions (among others): <a class="self" href="#rfc.section.4.3.3.p.1">&para;</a></p><ul><li>Providing a block of data, such as the fields entered into an HTML form, to a data-handling process;</li><li>Posting a message to a bulletin board, newsgroup, mailing list, blog, or similar group of articles;</li><li>Creating a new resource that has yet to be identified by the origin server; and</li><li>Appending data to a resource's existing representation(s).</li></ul></div><div id="rfc.section.4.3.3.p.2"><p>An origin server indicates response semantics by choosing an appropriate status code depending on the result of processing the POST request; almost all of the status codes defined by this specification might be received in a response to POST (the exceptions being <a href="rfc7233.html#status.206" class="smpl">206 (Partial Content)</a>, <a href="rfc7232.html#status.304" class="smpl">304 (Not Modified)</a>, and <a href="rfc7233.html#status.416" class="smpl">416 (Range Not Satisfiable)</a>).<a class="self" href="#rfc.section.4.3.3.p.2">&para;</a></p></div><div id="rfc.section.4.3.3.p.3"><p>If one or more resources has been created on the origin server as a result of successfully processing a POST request, the origin server <em class="bcp14">SHOULD</em> send a <a href="#status.201" class="smpl">201 (Created)</a> response containing a <a href="#header.location" class="smpl">Location</a> header field that provides an identifier for the primary resource created (<a href="#header.location" id="rfc.xref.header.location.1" title="Location">Section&nbsp;7.1.2</a>) and a representation that describes the status of the request while referring to the new resource(s).<a class="self" href="#rfc.section.4.3.3.p.3">&para;</a></p></div><div id="rfc.section.4.3.3.p.4"><p>Responses to POST requests are only cacheable when they include explicit freshness information (see <a href="rfc7234.html#calculating.freshness.lifetime" title="Calculating Freshness Lifetime">Section 4.2.1</a> of <a href="#RFC7234" id="rfc.xref.RFC7234.5"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Caching">[RFC7234]</cite></a>). However, POST caching is not widely implemented. For cases where an origin server wishes the client to be able to cache the result of a POST in a way that can be reused by a later GET, the origin server <em class="bcp14">MAY</em> send a <a href="#status.200" class="smpl">200 (OK)</a> response containing the result and a <a href="#header.content-location" class="smpl">Content-Location</a> header field that has the same value as the POST's effective request URI (<a href="#header.content-location" id="rfc.xref.header.content-location.2" title="Content-Location">Section&nbsp;3.1.4.2</a>).<a class="self" href="#rfc.section.4.3.3.p.4">&para;</a></p></div><div id="rfc.section.4.3.3.p.5"><p>If the result of processing a POST would be equivalent to a representation of an existing resource, an origin server <em class="bcp14">MAY</em> redirect the user agent to that resource by sending a <a href="#status.303" class="smpl">303 (See Other)</a> response with the existing resource's identifier in the <a href="#header.location" class="smpl">Location</a> field. This has the benefits of providing the user agent a resource identifier and transferring the representation via a method more amenable to shared caching, though at the cost of an extra request if the user agent does not already have the representation cached.<a class="self" href="#rfc.section.4.3.3.p.5">&para;</a></p></div></div><div id="PUT"><h3 id="rfc.section.4.3.4"><a href="#rfc.section.4.3.4">4.3.4</a>&nbsp;<a href="#PUT">PUT</a></h3><div id="rfc.iref.p.1"></div><div id="rfc.section.4.3.4.p.1"><p>The PUT method requests that the state of the <a href="#resources" class="smpl">target resource</a> be created or replaced with the state defined by the representation enclosed in the request message payload. A successful PUT of a given representation would suggest that a subsequent GET on that same target resource will result in an equivalent representation being sent in a <a href="#status.200" class="smpl">200 (OK)</a> response. However, there is no guarantee that such a state change will be observable, since the target resource might be acted upon by other user agents in parallel, or might be subject to dynamic processing by the origin server, before any subsequent GET is received. A successful response only implies that the user agent's intent was achieved at the time of its processing by the origin server.<a class="self" href="#rfc.section.4.3.4.p.1">&para;</a></p></div><div id="rfc.