source: draft-ietf-httpbis/latest/p1-messaging.xml @ 754

Last change on this file since 754 was 754, checked in by julian.reschke@…, 10 years ago

Update to latest version of xml2rfc and rfc2629.xslt, bump document dates

  • Property svn:eol-style set to native
File size: 230.1 KB
RevLine 
[29]1<?xml version="1.0" encoding="utf-8"?>
[101]2<?xml-stylesheet type='text/xsl' href='../myxml2rfc.xslt'?>
[8]3<!DOCTYPE rfc [
4  <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>">
5  <!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST</bcp14>">
6  <!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MUST NOT</bcp14>">
7  <!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>OPTIONAL</bcp14>">
8  <!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>RECOMMENDED</bcp14>">
9  <!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>REQUIRED</bcp14>">
10  <!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL</bcp14>">
11  <!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHALL NOT</bcp14>">
12  <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD</bcp14>">
13  <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>SHOULD NOT</bcp14>">
[29]14  <!ENTITY ID-VERSION "latest">
[754]15  <!ENTITY ID-MONTH "February">
[741]16  <!ENTITY ID-YEAR "2010">
[640]17  <!ENTITY caching-overview       "<xref target='Part6' x:rel='#caching.overview' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
[31]18  <!ENTITY payload                "<xref target='Part3' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
[115]19  <!ENTITY media-types            "<xref target='Part3' x:rel='#media.types' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
20  <!ENTITY content-codings        "<xref target='Part3' x:rel='#content.codings' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
[31]21  <!ENTITY CONNECT                "<xref target='Part2' x:rel='#CONNECT' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
22  <!ENTITY content.negotiation    "<xref target='Part3' x:rel='#content.negotiation' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
23  <!ENTITY diff2045entity         "<xref target='Part3' x:rel='#differences.between.http.entities.and.rfc.2045.entities' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
24  <!ENTITY entity                 "<xref target='Part3' x:rel='#entity' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
[207]25  <!ENTITY entity-body            "<xref target='Part3' x:rel='#entity.body' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
[31]26  <!ENTITY entity-header-fields   "<xref target='Part3' x:rel='#entity.header.fields' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
27  <!ENTITY header-cache-control   "<xref target='Part6' x:rel='#header.cache-control' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
28  <!ENTITY header-expect          "<xref target='Part2' x:rel='#header.expect' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
29  <!ENTITY header-pragma          "<xref target='Part6' x:rel='#header.pragma' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
30  <!ENTITY header-warning         "<xref target='Part6' x:rel='#header.warning' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
31  <!ENTITY idempotent-methods     "<xref target='Part2' x:rel='#idempotent.methods' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
32  <!ENTITY request-header-fields  "<xref target='Part2' x:rel='#request.header.fields' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
33  <!ENTITY response-header-fields "<xref target='Part2' x:rel='#response.header.fields' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
34  <!ENTITY status-codes           "<xref target='Part2' x:rel='#status.codes' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
35  <!ENTITY status-100             "<xref target='Part2' x:rel='#status.100' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
36  <!ENTITY status-1xx             "<xref target='Part2' x:rel='#status.1xx' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
37  <!ENTITY status-414             "<xref target='Part2' x:rel='#status.414' xmlns:x='http://purl.org/net/xml2rfc/ext'/>">
[8]38]>
39<?rfc toc="yes" ?>
[29]40<?rfc symrefs="yes" ?>
41<?rfc sortrefs="yes" ?>
[8]42<?rfc compact="yes"?>
43<?rfc subcompact="no" ?>
44<?rfc linkmailto="no" ?>
45<?rfc editing="no" ?>
[203]46<?rfc comments="yes"?>
47<?rfc inline="yes"?>
[8]48<?rfc-ext allow-markup-in-artwork="yes" ?>
49<?rfc-ext include-references-in-index="yes" ?>
[684]50<rfc obsoletes="2616" updates="2817" category="std" x:maturity-level="draft"
[446]51     ipr="pre5378Trust200902" docName="draft-ietf-httpbis-p1-messaging-&ID-VERSION;"
[153]52     xmlns:x='http://purl.org/net/xml2rfc/ext'>
[8]53<front>
54
[120]55  <title abbrev="HTTP/1.1, Part 1">HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title>
[8]56
[29]57  <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
58    <organization abbrev="Day Software">Day Software</organization>
[8]59    <address>
60      <postal>
[29]61        <street>23 Corporate Plaza DR, Suite 280</street>
62        <city>Newport Beach</city>
[8]63        <region>CA</region>
[29]64        <code>92660</code>
65        <country>USA</country>
[8]66      </postal>
[29]67      <phone>+1-949-706-5300</phone>
68      <facsimile>+1-949-706-5305</facsimile>
69      <email>fielding@gbiv.com</email>
70      <uri>http://roy.gbiv.com/</uri>
[8]71    </address>
72  </author>
73
[29]74  <author initials="J." surname="Gettys" fullname="Jim Gettys">
75    <organization>One Laptop per Child</organization>
[8]76    <address>
77      <postal>
[29]78        <street>21 Oak Knoll Road</street>
79        <city>Carlisle</city>
[8]80        <region>MA</region>
[29]81        <code>01741</code>
82        <country>USA</country>
[8]83      </postal>
[29]84      <email>jg@laptop.org</email>
85      <uri>http://www.laptop.org/</uri>
[8]86    </address>
87  </author>
88 
89  <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
[29]90    <organization abbrev="HP">Hewlett-Packard Company</organization>
[8]91    <address>
92      <postal>
[29]93        <street>HP Labs, Large Scale Systems Group</street>
94        <street>1501 Page Mill Road, MS 1177</street>
[8]95        <city>Palo Alto</city>
96        <region>CA</region>
[29]97        <code>94304</code>
98        <country>USA</country>
[8]99      </postal>
[29]100      <email>JeffMogul@acm.org</email>
[8]101    </address>
102  </author>
103
104  <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
[29]105    <organization abbrev="Microsoft">Microsoft Corporation</organization>
[8]106    <address>
107      <postal>
[29]108        <street>1 Microsoft Way</street>
109        <city>Redmond</city>
110        <region>WA</region>
111        <code>98052</code>
112        <country>USA</country>
[8]113      </postal>
[29]114      <email>henrikn@microsoft.com</email>
[8]115    </address>
116  </author>
117
118  <author initials="L." surname="Masinter" fullname="Larry Masinter">
[29]119    <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
[8]120    <address>
121      <postal>
[29]122        <street>345 Park Ave</street>
123        <city>San Jose</city>
[8]124        <region>CA</region>
[29]125        <code>95110</code>
126        <country>USA</country>
[8]127      </postal>
[29]128      <email>LMM@acm.org</email>
129      <uri>http://larry.masinter.net/</uri>
[8]130    </address>
131  </author>
132 
133  <author initials="P." surname="Leach" fullname="Paul J. Leach">
134    <organization abbrev="Microsoft">Microsoft Corporation</organization>
135    <address>
136      <postal>
137        <street>1 Microsoft Way</street>
138        <city>Redmond</city>
139        <region>WA</region>
140        <code>98052</code>
141      </postal>
142      <email>paulle@microsoft.com</email>
143    </address>
144  </author>
145   
146  <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
147    <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
148    <address>
149      <postal>
[34]150        <street>MIT Computer Science and Artificial Intelligence Laboratory</street>
151        <street>The Stata Center, Building 32</street>
152        <street>32 Vassar Street</street>
[8]153        <city>Cambridge</city>
154        <region>MA</region>
155        <code>02139</code>
[29]156        <country>USA</country>
[8]157      </postal>
158      <email>timbl@w3.org</email>
[34]159      <uri>http://www.w3.org/People/Berners-Lee/</uri>
[8]160    </address>
161  </author>
162
[95]163  <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">
[94]164    <organization abbrev="W3C">World Wide Web Consortium</organization>
165    <address>
166      <postal>
167        <street>W3C / ERCIM</street>
168        <street>2004, rte des Lucioles</street>
169        <city>Sophia-Antipolis</city>
170        <region>AM</region>
171        <code>06902</code>
172        <country>France</country>
173      </postal>
174      <email>ylafon@w3.org</email>
175      <uri>http://www.raubacapeu.net/people/yves/</uri>
176    </address>
177  </author>
178
[95]179  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
180    <organization abbrev="greenbytes">greenbytes GmbH</organization>
181    <address>
182      <postal>
183        <street>Hafenweg 16</street>
184        <city>Muenster</city><region>NW</region><code>48155</code>
185        <country>Germany</country>
186      </postal>
[609]187      <phone>+49 251 2807760</phone>
188      <facsimile>+49 251 2807761</facsimile>
189      <email>julian.reschke@greenbytes.de</email>
190      <uri>http://greenbytes.de/tech/webdav/</uri>
[95]191    </address>
192  </author>
193
[31]194  <date month="&ID-MONTH;" year="&ID-YEAR;"/>
[440]195  <workgroup>HTTPbis Working Group</workgroup>
[8]196
197<abstract>
198<t>
199   The Hypertext Transfer Protocol (HTTP) is an application-level
[451]200   protocol for distributed, collaborative, hypertext information
[29]201   systems. HTTP has been in use by the World Wide Web global information
[35]202   initiative since 1990. This document is Part 1 of the seven-part specification
[29]203   that defines the protocol referred to as "HTTP/1.1" and, taken together,
[51]204   obsoletes RFC 2616.  Part 1 provides an overview of HTTP and
[29]205   its associated terminology, defines the "http" and "https" Uniform
206   Resource Identifier (URI) schemes, defines the generic message syntax
207   and parsing requirements for HTTP message frames, and describes
208   general security concerns for implementations.
[8]209</t>
210</abstract>
[36]211
212<note title="Editorial Note (To be removed by RFC Editor)">
213  <t>
214    Discussion of this draft should take place on the HTTPBIS working group
215    mailing list (ietf-http-wg@w3.org). The current issues list is
[324]216    at <eref target="http://tools.ietf.org/wg/httpbis/trac/report/11"/>
[36]217    and related documents (including fancy diffs) can be found at
[324]218    <eref target="http://tools.ietf.org/wg/httpbis/"/>.
[36]219  </t>
[153]220  <t>
[720]221    The changes in this draft are summarized in <xref target="changes.since.08"/>.
[153]222  </t>
[36]223</note>
[8]224</front>
225<middle>
226<section title="Introduction" anchor="introduction">
[29]227<t>
[8]228   The Hypertext Transfer Protocol (HTTP) is an application-level
[374]229   request/response protocol that uses extensible semantics and MIME-like
[391]230   message payloads for flexible interaction with network-based hypertext
[374]231   information systems. HTTP relies upon the Uniform Resource Identifier (URI)
[544]232   standard <xref target="RFC3986"/> to indicate request targets and
[391]233   relationships between resources.
[374]234   Messages are passed in a format similar to that used by Internet mail
235   <xref target="RFC5322"/> and the Multipurpose Internet Mail Extensions
236   (MIME) <xref target="RFC2045"/> (see &diff2045entity; for the differences
237   between HTTP and MIME messages).
[8]238</t>
239<t>
[544]240   HTTP is a generic interface protocol for information systems. It is
[391]241   designed to hide the details of how a service is implemented by presenting
242   a uniform interface to clients that is independent of the types of
243   resources provided. Likewise, servers do not need to be aware of each
244   client's purpose: an HTTP request can be considered in isolation rather
245   than being associated with a specific type of client or a predetermined
246   sequence of application steps. The result is a protocol that can be used
247   effectively in many different contexts and for which implementations can
248   evolve independently over time.
249</t>
250<t>
[374]251   HTTP is also designed for use as a generic protocol for translating
[544]252   communication to and from other Internet information systems.
[374]253   HTTP proxies and gateways provide access to alternative information
[451]254   services by translating their diverse protocols into a hypertext
[374]255   format that can be viewed and manipulated by clients in the same way
256   as HTTP services.
[8]257</t>
258<t>
[544]259   One consequence of HTTP flexibility is that the protocol cannot be
260   defined in terms of what occurs behind the interface. Instead, we
261   are limited to defining the syntax of communication, the intent
262   of received communication, and the expected behavior of recipients.
263   If the communication is considered in isolation, then successful
264   actions should be reflected in corresponding changes to the
265   observable interface provided by servers. However, since multiple
266   clients may act in parallel and perhaps at cross-purposes, we
267   cannot require that such changes be observable beyond the scope
268   of a single response.
[391]269</t>
270<t>
[374]271   This document is Part 1 of the seven-part specification of HTTP,
272   defining the protocol referred to as "HTTP/1.1" and obsoleting
273   <xref target="RFC2616"/>.
[544]274   Part 1 describes the architectural elements that are used or
[621]275   referred to in HTTP, defines the "http" and "https" URI schemes,
276   describes overall network operation and connection management,
277   and defines HTTP message framing and forwarding requirements.
[374]278   Our goal is to define all of the mechanisms necessary for HTTP message
279   handling that are independent of message semantics, thereby defining the
[544]280   complete set of requirements for message parsers and
[391]281   message-forwarding intermediaries.
[163]282</t>
283
[8]284<section title="Requirements" anchor="intro.requirements">
285<t>
286   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
287   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
[96]288   document are to be interpreted as described in <xref target="RFC2119"/>.
[8]289</t>
290<t>
291   An implementation is not compliant if it fails to satisfy one or more
292   of the &MUST; or &REQUIRED; level requirements for the protocols it
293   implements. An implementation that satisfies all the &MUST; or &REQUIRED;
294   level and all the &SHOULD; level requirements for its protocols is said
295   to be "unconditionally compliant"; one that satisfies all the &MUST;
296   level requirements but not all the &SHOULD; level requirements for its
297   protocols is said to be "conditionally compliant."
298</t>
299</section>
300
[390]301<section title="Syntax Notation" anchor="notation">
302<iref primary="true" item="Grammar" subitem="ALPHA"/>
303<iref primary="true" item="Grammar" subitem="CR"/>
304<iref primary="true" item="Grammar" subitem="CRLF"/>
305<iref primary="true" item="Grammar" subitem="CTL"/>
306<iref primary="true" item="Grammar" subitem="DIGIT"/>
307<iref primary="true" item="Grammar" subitem="DQUOTE"/>
308<iref primary="true" item="Grammar" subitem="HEXDIG"/>
309<iref primary="true" item="Grammar" subitem="LF"/>
310<iref primary="true" item="Grammar" subitem="OCTET"/>
311<iref primary="true" item="Grammar" subitem="SP"/>
[395]312<iref primary="true" item="Grammar" subitem="VCHAR"/>
[390]313<iref primary="true" item="Grammar" subitem="WSP"/>
[543]314<t>
315   This specification uses the Augmented Backus-Naur Form (ABNF) notation
316   of <xref target="RFC5234"/>.
317</t>
[390]318<t anchor="core.rules">
319  <x:anchor-alias value="ALPHA"/>
320  <x:anchor-alias value="CTL"/>
321  <x:anchor-alias value="CR"/>
322  <x:anchor-alias value="CRLF"/>
323  <x:anchor-alias value="DIGIT"/>
324  <x:anchor-alias value="DQUOTE"/>
325  <x:anchor-alias value="HEXDIG"/>
326  <x:anchor-alias value="LF"/>
327  <x:anchor-alias value="OCTET"/>
328  <x:anchor-alias value="SP"/>
[395]329  <x:anchor-alias value="VCHAR"/>
[390]330  <x:anchor-alias value="WSP"/>
[543]331   The following core rules are included by
[390]332   reference, as defined in <xref target="RFC5234" x:fmt="," x:sec="B.1"/>:
[395]333   ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls),
[390]334   DIGIT (decimal 0-9), DQUOTE (double quote),
[395]335   HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed),
336   OCTET (any 8-bit sequence of data), SP (space),
337   VCHAR (any visible <xref target="USASCII"/> character),
[401]338   and WSP (whitespace).
[390]339</t>
[738]340<t>
341   As a syntactical convention, ABNF rule names prefixed with "obs-" denote
342   "obsolete" grammar rules that appear for historical reasons.
343</t>
[8]344
[368]345<section title="ABNF Extension: #rule" anchor="notation.abnf">
[738]346<t>
347  The #rule extension to the ABNF rules of <xref target="RFC5234"/> is used to
348  improve readability.
349</t>
350<t>
351  A construct "#" is defined, similar to "*", for defining comma-delimited
352  lists of elements. The full form is "&lt;n&gt;#&lt;m&gt;element" indicating
353  at least &lt;n&gt; and at most &lt;m&gt; elements, each separated by a single
354  comma (",") and optional whitespace (OWS,
355  <xref target="basic.rules"/>).   
356</t>
357<figure><preamble>
358  Thus,
[400]359</preamble><artwork type="example">
360  1#element =&gt; element *( OWS "," OWS element )
361</artwork></figure>
[738]362<figure><preamble>
363  and:
[400]364</preamble><artwork type="example">
365  #element =&gt; [ 1#element ]
366</artwork></figure>
[738]367<figure><preamble>
368  and for n &gt;= 1 and m &gt; 1:
[400]369</preamble><artwork type="example">
370  &lt;n&gt;#&lt;m&gt;element =&gt; element &lt;n-1&gt;*&lt;m-1&gt;( OWS "," OWS element )
371</artwork></figure>
[738]372<t>
373  For compatibility with legacy list rules, recipients &SHOULD; accept empty
374  list elements. In other words, consumers would follow the list productions:
375</t>
[400]376<figure><artwork type="example">
[458]377  #element =&gt; [ ( "," / element ) *( OWS "," [ OWS element ] ) ]
378 
379  1#element =&gt; *( "," OWS ) element *( OWS "," [ OWS element ] )
[738]380</artwork></figure>
[421]381<t>
[738]382  Note that empty elements do not contribute to the count of elements present,
383  though.
384</t>
385<t>
386  For example, given these ABNF productions:
387</t>
388<figure><artwork type="example">
389  example-list      = 1#example-list-elmt
390  example-list-elmt = token ; see <xref target="basic.rules"/> 
391</artwork></figure>
392<t>
393  Then these are valid values for example-list (not including the double
394  quotes, which are present for delimitation only):
395</t>
396<figure><artwork type="example">
397  "foo,bar"
398  " foo ,bar,"
399  "  foo , ,bar,charlie   "
400  "foo ,bar,   charlie "
401</artwork></figure>
402<t>
403  But these values would be invalid, as at least one non-empty element is
404  required:
405</t>
406<figure><artwork type="example">
407  ""
408  ","
409  ",   ,"
410</artwork></figure>
411<t>
[421]412  <xref target="collected.abnf"/> shows the collected ABNF, with the list rules
413  expanded as explained above.
414</t>
[335]415</section>
416
[8]417<section title="Basic Rules" anchor="basic.rules">
[229]418<t anchor="rule.CRLF">
419  <x:anchor-alias value="CRLF"/>
[8]420   HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
421   protocol elements except the entity-body (see <xref target="tolerant.applications"/> for
422   tolerant applications). The end-of-line marker within an entity-body
[115]423   is defined by its associated media type, as described in &media-types;.
[8]424</t>
[229]425<t anchor="rule.LWS">
[395]426   This specification uses three rules to denote the use of linear
427   whitespace: OWS (optional whitespace), RWS (required whitespace), and
428   BWS ("bad" whitespace).
[8]429</t>
[368]430<t>
[401]431   The OWS rule is used where zero or more linear whitespace characters may
[395]432   appear. OWS &SHOULD; either not be produced or be produced as a single SP
433   character. Multiple OWS characters that occur within field-content &SHOULD;
434   be replaced with a single SP before interpreting the field value or
435   forwarding the message downstream.
[368]436</t>
437<t>
[401]438   RWS is used when at least one linear whitespace character is required to
[395]439   separate field tokens. RWS &SHOULD; be produced as a single SP character.
440   Multiple RWS characters that occur within field-content &SHOULD; be
441   replaced with a single SP before interpreting the field value or
442   forwarding the message downstream.
[368]443</t>
444<t>
[395]445   BWS is used where the grammar allows optional whitespace for historical
446   reasons but senders &SHOULD-NOT; produce it in messages. HTTP/1.1
447   recipients &MUST; accept such bad optional whitespace and remove it before
448   interpreting the field value or forwarding the message downstream.
[368]449</t>
[351]450<t anchor="rule.whitespace">
451  <x:anchor-alias value="BWS"/>
452  <x:anchor-alias value="OWS"/>
453  <x:anchor-alias value="RWS"/>
454  <x:anchor-alias value="obs-fold"/>
[367]455</t>
[351]456<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="OWS"/><iref primary="true" item="Grammar" subitem="RWS"/><iref primary="true" item="Grammar" subitem="BWS"/>
[367]457  <x:ref>OWS</x:ref>            = *( [ obs-fold ] <x:ref>WSP</x:ref> )
[401]458                 ; "optional" whitespace
[351]459  <x:ref>RWS</x:ref>            = 1*( [ obs-fold ] <x:ref>WSP</x:ref> )
[401]460                 ; "required" whitespace
[351]461  <x:ref>BWS</x:ref>            = <x:ref>OWS</x:ref>
[401]462                 ; "bad" whitespace
[351]463  <x:ref>obs-fold</x:ref>       = <x:ref>CRLF</x:ref>
[647]464                 ; see <xref target="header.fields"/>
[351]465</artwork></figure>
[229]466<t anchor="rule.token.separators">
467  <x:anchor-alias value="tchar"/>
468  <x:anchor-alias value="token"/>
[744]469  <x:anchor-alias value="special"/>
[747]470   Many HTTP/1.1 header field values consist of words (token or quoted-string)
471   separated by whitespace or special characters. These special characters
472   &MUST; be in a quoted string to be used within a parameter value (as defined
473   in <xref target="transfer.codings"/>).
[8]474</t>
[744]475<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="token"/><iref primary="true" item="Grammar" subitem="tchar"/><iref primary="true" item="Grammar" subitem="special"/>
476  <x:ref>token</x:ref>          = 1*<x:ref>tchar</x:ref>
477<!--
478  IMPORTANT: when editing "tchar" make sure that "special" is updated accordingly!!!
479 -->
[334]480  <x:ref>tchar</x:ref>          = "!" / "#" / "$" / "%" / "&amp;" / "'" / "*"
481                 / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
482                 / <x:ref>DIGIT</x:ref> / <x:ref>ALPHA</x:ref>
[744]483                 ; any <x:ref>VCHAR</x:ref>, except <x:ref>special</x:ref>
484
485  <x:ref>special</x:ref>        = "(" / ")" / "&lt;" / ">" / "@" / ","
486                 / ";" / ":" / "\" / DQUOTE / "/" / "["
487                 / "]" / "?" / "=" / "{" / "}"
[8]488</artwork></figure>
[229]489<t anchor="rule.quoted-string">
490  <x:anchor-alias value="quoted-string"/>
491  <x:anchor-alias value="qdtext"/>
[395]492  <x:anchor-alias value="obs-text"/>
[8]493   A string of text is parsed as a single word if it is quoted using
494   double-quote marks.
495</t>
[395]496<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="quoted-string"/><iref primary="true" item="Grammar" subitem="qdtext"/><iref primary="true" item="Grammar" subitem="obs-text"/>
[429]497  <x:ref>quoted-string</x:ref>  = <x:ref>DQUOTE</x:ref> *( <x:ref>qdtext</x:ref> / <x:ref>quoted-pair</x:ref> ) <x:ref>DQUOTE</x:ref>
[687]498  <x:ref>qdtext</x:ref>         = <x:ref>OWS</x:ref> / %x21 / %x23-5B / %x5D-7E / <x:ref>obs-text</x:ref>
499                 ; <x:ref>OWS</x:ref> / &lt;<x:ref>VCHAR</x:ref> except <x:ref>DQUOTE</x:ref> and "\"&gt; / <x:ref>obs-text</x:ref> 
[395]500  <x:ref>obs-text</x:ref>       = %x80-FF
[8]501</artwork></figure>
[229]502<t anchor="rule.quoted-pair">
503  <x:anchor-alias value="quoted-pair"/>
[696]504   The backslash character ("\") can be used as a single-character
[703]505   quoting mechanism within quoted-string constructs:
[8]506</t>
[696]507<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="quoted-pair"/>
508  <x:ref>quoted-pair</x:ref>    = "\" ( <x:ref>WSP</x:ref> / <x:ref>VCHAR</x:ref> / <x:ref>obs-text</x:ref> )
[8]509</artwork></figure>
[702]510<t>
511   Producers &SHOULD-NOT; escape characters that do not require escaping
[703]512   (i.e., other than DQUOTE and the backslash character).
[702]513</t>
[8]514</section>
[207]515
516<section title="ABNF Rules defined in other Parts of the Specification" anchor="abnf.dependencies">
[229]517  <x:anchor-alias value="request-header"/>
518  <x:anchor-alias value="response-header"/>
519  <x:anchor-alias value="entity-body"/>
520  <x:anchor-alias value="entity-header"/>
521  <x:anchor-alias value="Cache-Control"/>
522  <x:anchor-alias value="Pragma"/>
523  <x:anchor-alias value="Warning"/>
[207]524<t>
525  The ABNF rules below are defined in other parts:
526</t>
527<figure><!-- Part2--><artwork type="abnf2616">
[229]528  <x:ref>request-header</x:ref>  = &lt;request-header, defined in &request-header-fields;&gt;
529  <x:ref>response-header</x:ref> = &lt;response-header, defined in &response-header-fields;&gt;
[207]530</artwork></figure>
531<figure><!-- Part3--><artwork type="abnf2616">
[229]532  <x:ref>entity-body</x:ref>     = &lt;entity-body, defined in &entity-body;&gt;
533  <x:ref>entity-header</x:ref>   = &lt;entity-header, defined in &entity-header-fields;&gt;
[207]534</artwork></figure>
535<figure><!-- Part6--><artwork type="abnf2616">
[229]536  <x:ref>Cache-Control</x:ref>   = &lt;Cache-Control, defined in &header-pragma;&gt;
537  <x:ref>Pragma</x:ref>          = &lt;Pragma, defined in &header-pragma;&gt;
538  <x:ref>Warning</x:ref>         = &lt;Warning, defined in &header-warning;&gt;
[207]539</artwork></figure>
[8]540</section>
541
[207]542</section>
[391]543</section>
[207]544
[391]545<section title="HTTP architecture" anchor="architecture">
546<t>
[621]547   HTTP was created for the World Wide Web architecture
[391]548   and has evolved over time to support the scalability needs of a worldwide
549   hypertext system. Much of that architecture is reflected in the terminology
550   and syntax productions used to define HTTP.
551</t>
552
[630]553<section title="Client/Server Operation" anchor="operation">
554<iref item="client"/>
555<iref item="server"/>
556<iref item="connection"/>
[624]557<t>
[630]558   HTTP is a request/response protocol that operates by exchanging messages
559   across a reliable transport or session-layer connection. An HTTP client
560   is a program that establishes a connection to a server for the purpose
561   of sending one or more HTTP requests.  An HTTP server is a program that
562   accepts connections in order to service HTTP requests by sending HTTP
563   responses.
[624]564</t>
[630]565<iref item="user agent"/>
566<iref item="origin server"/>
[624]567<t>
[630]568   Note that the terms "client" and "server" refer only to the roles that
569   these programs perform for a particular connection.  The same program
570   may act as a client on some connections and a server on others.  We use
571   the term "user agent" to refer to the program that initiates a request,
572   such as a WWW browser, editor, or spider (web-traversing robot), and
573   the term "origin server" to refer to the program that can originate
574   authoritative responses to a request.
575</t>
576<t>
577   Most HTTP communication consists of a retrieval request (GET) for
578   a representation of some resource identified by a URI.  In the
[624]579   simplest case, this may be accomplished via a single connection (v)
580   between the user agent (UA) and the origin server (O).
581</t>
582<figure><artwork type="drawing">
583       request chain ------------------------&gt;
584    UA -------------------v------------------- O
585       &lt;----------------------- response chain
586</artwork></figure>
[630]587<iref item="message"/>
588<iref item="request"/>
589<iref item="response"/>
[624]590<t>
[630]591   A client sends an HTTP request to the server in the form of a request
592   message (<xref target="request"/>), beginning with a method, URI, and
593   protocol version, followed by MIME-like header fields containing
594   request modifiers, client information, and payload metadata, an empty
[677]595   line to indicate the end of the header section, and finally the payload
596   body (if any).
597</t>
598<t>
599   A server responds to the client's request by sending an HTTP response
600   message (<xref target="response"/>), beginning with a status line that
601   includes the protocol version, a success or error code, and textual
[630]602   reason phrase, followed by MIME-like header fields containing server
[677]603   information, resource metadata, and payload metadata, an empty line to
604   indicate the end of the header section, and finally the payload body (if any).
[630]605</t>
[633]606<t>
[630]607   The following example illustrates a typical message exchange for a
608   GET request on the URI "http://www.example.com/hello.txt":
[633]609</t>
610<figure><preamble>
[630]611client request:
[633]612</preamble><artwork  type="message/http; msgtype=&#34;request&#34;" x:indent-with="  ">
613GET /hello.txt HTTP/1.1
614User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
615Host: www.example.com
616Accept: */*
[634]617
[633]618</artwork></figure>
619<figure><preamble>
[630]620server response:
[633]621</preamble><artwork type="message/http; msgtype=&#34;response&#34;" x:indent-with="  ">
622HTTP/1.1 200 OK
623Date: Mon, 27 Jul 2009 12:28:53 GMT
624Server: Apache
625Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
626ETag: "34aa387-d-1568eb00"
627Accept-Ranges: bytes
628Content-Length: <x:length-of target="exbody"/>
629Vary: Accept-Encoding
630Content-Type: text/plain
[630]631
[633]632<x:span anchor="exbody">Hello World!
633</x:span></artwork></figure>
[630]634</section>
635
636<section title="Intermediaries" anchor="intermediaries">
637<t>
[624]638   A more complicated situation occurs when one or more intermediaries
639   are present in the request/response chain. There are three common
[630]640   forms of intermediary: proxy, gateway, and tunnel.  In some cases,
641   a single intermediary may act as an origin server, proxy, gateway,
642   or tunnel, switching behavior based on the nature of each request.
[624]643</t>
644<figure><artwork type="drawing">
645       request chain --------------------------------------&gt;
646    UA -----v----- A -----v----- B -----v----- C -----v----- O
647       &lt;------------------------------------- response chain
648</artwork></figure>
649<t>
650   The figure above shows three intermediaries (A, B, and C) between the
651   user agent and origin server. A request or response message that
652   travels the whole chain will pass through four separate connections.
[630]653   Some HTTP communication options
[624]654   may apply only to the connection with the nearest, non-tunnel
655   neighbor, only to the end-points of the chain, or to all connections
656   along the chain. Although the diagram is linear, each participant may
657   be engaged in multiple, simultaneous communications. For example, B
658   may be receiving requests from many clients other than A, and/or
659   forwarding requests to servers other than C, at the same time that it
660   is handling A's request.
661</t>
662<t>
[630]663<iref item="upstream"/><iref item="downstream"/>
664<iref item="inbound"/><iref item="outbound"/>
665   We use the terms "upstream" and "downstream" to describe various
666   requirements in relation to the directional flow of a message:
667   all messages flow from upstream to downstream.
668   Likewise, we use the terms "inbound" and "outbound" to refer to
669   directions in relation to the request path: "inbound" means toward
670   the origin server and "outbound" means toward the user agent.
[624]671</t>
[630]672<t><iref item="proxy"/>
673   A proxy is a message forwarding agent that is selected by the
674   client, usually via local configuration rules, to receive requests
675   for some type(s) of absolute URI and attempt to satisfy those
676   requests via translation through the HTTP interface.  Some translations
677   are minimal, such as for proxy requests for "http" URIs, whereas
678   other requests may require translation to and from entirely different
679   application-layer protocols. Proxies are often used to group an
680   organization's HTTP requests through a common intermediary for the
681   sake of security, annotation services, or shared caching.
682</t>
683<t><iref item="gateway"/><iref item="reverse proxy"/>
684   A gateway (a.k.a., reverse proxy) is a receiving agent that acts
685   as a layer above some other server(s) and translates the received
686   requests to the underlying server's protocol.  Gateways are often
687   used for load balancing or partitioning HTTP services across
688   multiple machines.
689   Unlike a proxy, a gateway receives requests as if it were the
690   origin server for the requested resource; the requesting client
691   will not be aware that it is communicating with a gateway.
692   A gateway communicates with the client as if the gateway is the
693   origin server and thus is subject to all of the requirements on
694   origin servers for that connection.  A gateway communicates
695   with inbound servers using any protocol it desires, including
696   private extensions to HTTP that are outside the scope of this
697   specification.
698</t>
699<t><iref item="tunnel"/>
700   A tunnel acts as a blind relay between two connections
701   without changing the messages. Once active, a tunnel is not
702   considered a party to the HTTP communication, though the tunnel may
703   have been initiated by an HTTP request. A tunnel ceases to exist when
704   both ends of the relayed connection are closed. Tunnels are used to
705   extend a virtual connection through an intermediary, such as when
706   transport-layer security is used to establish private communication
707   through a shared firewall proxy.
708</t>
709</section>
710
711<section title="Caches" anchor="caches">
712<iref item="cache"/>
713<t>
714   Any party to HTTP communication that is not acting as a tunnel may
715   employ an internal cache for handling requests.
716   A cache is a local store of previous response messages and the
717   subsystem that controls its message storage, retrieval, and deletion.
718   A cache stores cacheable responses in order to reduce the response
719   time and network bandwidth consumption on future, equivalent
720   requests. Any client or server may include a cache, though a cache
721   cannot be used by a server while it is acting as a tunnel.
722</t>
723<t>
724   The effect of a cache is that the request/response chain is shortened
725   if one of the participants along the chain has a cached response
726   applicable to that request. The following illustrates the resulting
727   chain if B has a cached copy of an earlier response from O (via C)
728   for a request which has not been cached by UA or A.
729</t>
[624]730<figure><artwork type="drawing">
731          request chain ----------&gt;
732       UA -----v----- A -----v----- B - - - - - - C - - - - - - O
733          &lt;--------- response chain
734</artwork></figure>
[630]735<t><iref item="cacheable"/>
736   A response is cacheable if a cache is allowed to store a copy of
737   the response message for use in answering subsequent requests.
738   Even when a response is cacheable, there may be additional
739   constraints placed by the client or by the origin server on when
740   that cached response can be used for a particular request. HTTP
741   requirements for cache behavior and cacheable responses are
[640]742   defined in &caching-overview;
[624]743</t>
744<t>
[630]745   There are a wide variety of architectures and configurations
746   of caches and proxies deployed across the World Wide Web and
747   inside large organizations. These systems include national hierarchies
[624]748   of proxy caches to save transoceanic bandwidth, systems that
749   broadcast or multicast cache entries, organizations that distribute
[639]750   subsets of cached data via optical media, and so on.
[624]751</t>
[630]752</section>
753
754<section title="Transport Independence" anchor="transport-independence">
[624]755<t>
[630]756  HTTP systems are used in a wide variety of environments, from
757  corporate intranets with high-bandwidth links to long-distance
758  communication over low-power radio links and intermittent connectivity.
759</t>
760<t>
[624]761   HTTP communication usually takes place over TCP/IP connections. The
762   default port is TCP 80 (<eref target="http://www.iana.org/assignments/port-numbers"/>), but other ports can be used. This does
763   not preclude HTTP from being implemented on top of any other protocol
764   on the Internet, or on other networks. HTTP only presumes a reliable
765   transport; any protocol that provides such guarantees can be used;
766   the mapping of the HTTP/1.1 request and response structures onto the
767   transport data units of the protocol in question is outside the scope
768   of this specification.
769</t>
770<t>
771   In HTTP/1.0, most implementations used a new connection for each
772   request/response exchange. In HTTP/1.1, a connection may be used for
773   one or more request/response exchanges, although connections may be
774   closed for a variety of reasons (see <xref target="persistent.connections"/>).
775</t>
776</section>
777
[625]778<section title="HTTP Version" anchor="http.version">
779  <x:anchor-alias value="HTTP-Version"/>
780  <x:anchor-alias value="HTTP-Prot-Name"/>
781<t>
782   HTTP uses a "&lt;major&gt;.&lt;minor&gt;" numbering scheme to indicate versions
783   of the protocol. The protocol versioning policy is intended to allow
784   the sender to indicate the format of a message and its capacity for
785   understanding further HTTP communication, rather than the features
786   obtained via that communication. No change is made to the version
787   number for the addition of message components which do not affect
788   communication behavior or which only add to extensible field values.
789   The &lt;minor&gt; number is incremented when the changes made to the
790   protocol add features which do not change the general message parsing
791   algorithm, but which may add to the message semantics and imply
792   additional capabilities of the sender. The &lt;major&gt; number is
793   incremented when the format of a message within the protocol is
794   changed. See <xref target="RFC2145"/> for a fuller explanation.
795</t>
796<t>
797   The version of an HTTP message is indicated by an HTTP-Version field
798   in the first line of the message. HTTP-Version is case-sensitive.
799</t>
800<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="HTTP-Version"/><iref primary="true" item="Grammar" subitem="HTTP-Prot-Name"/>
801  <x:ref>HTTP-Version</x:ref>   = <x:ref>HTTP-Prot-Name</x:ref> "/" 1*<x:ref>DIGIT</x:ref> "." 1*<x:ref>DIGIT</x:ref>
802  <x:ref>HTTP-Prot-Name</x:ref> = <x:abnf-char-sequence>"HTTP"</x:abnf-char-sequence> ; "HTTP", case-sensitive
803</artwork></figure>
804<t>
805   Note that the major and minor numbers &MUST; be treated as separate
806   integers and that each &MAY; be incremented higher than a single digit.
807   Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is
808   lower than HTTP/12.3. Leading zeros &MUST; be ignored by recipients and
809   &MUST-NOT; be sent.
810</t>
811<t>
812   An application that sends a request or response message that includes
813   HTTP-Version of "HTTP/1.1" &MUST; be at least conditionally compliant
814   with this specification. Applications that are at least conditionally
815   compliant with this specification &SHOULD; use an HTTP-Version of
816   "HTTP/1.1" in their messages, and &MUST; do so for any message that is
817   not compatible with HTTP/1.0. For more details on when to send
818   specific HTTP-Version values, see <xref target="RFC2145"/>.
819</t>
820<t>
821   The HTTP version of an application is the highest HTTP version for
822   which the application is at least conditionally compliant.
823</t>
824<t>
825   Proxy and gateway applications need to be careful when forwarding
826   messages in protocol versions different from that of the application.
827   Since the protocol version indicates the protocol capability of the
828   sender, a proxy/gateway &MUST-NOT; send a message with a version
829   indicator which is greater than its actual version. If a higher
830   version request is received, the proxy/gateway &MUST; either downgrade
831   the request version, or respond with an error, or switch to tunnel
832   behavior.
833</t>
834<t>
835   Due to interoperability problems with HTTP/1.0 proxies discovered
836   since the publication of <xref target="RFC2068"/>, caching proxies &MUST;, gateways
837   &MAY;, and tunnels &MUST-NOT; upgrade the request to the highest version
838   they support. The proxy/gateway's response to that request &MUST; be in
839   the same major version as the request.
840</t>
841<x:note>
842  <t>
843    <x:h>Note:</x:h> Converting between versions of HTTP may involve modification
844    of header fields required or forbidden by the versions involved.
845  </t>
846</x:note>
847</section>
848
[391]849<section title="Uniform Resource Identifiers" anchor="uri">
[621]850<iref primary="true" item="resource"/>
[391]851<t>
852   Uniform Resource Identifiers (URIs) <xref target="RFC3986"/> are used
853   throughout HTTP as the means for identifying resources. URI references
[621]854   are used to target requests, indicate redirects, and define relationships.
[391]855   HTTP does not limit what a resource may be; it merely defines an interface
856   that can be used to interact with a resource via HTTP. More information on
857   the scope of URIs and resources can be found in <xref target="RFC3986"/>.
858</t>
859  <x:anchor-alias value="URI"/>
860  <x:anchor-alias value="URI-reference"/>
861  <x:anchor-alias value="absolute-URI"/>
862  <x:anchor-alias value="relative-part"/>
863  <x:anchor-alias value="authority"/>
864  <x:anchor-alias value="path-abempty"/>
865  <x:anchor-alias value="path-absolute"/>
866  <x:anchor-alias value="port"/>
867  <x:anchor-alias value="query"/>
868  <x:anchor-alias value="uri-host"/>
869  <x:anchor-alias value="partial-URI"/>
870<t>
871   This specification adopts the definitions of "URI-reference",
[649]872   "absolute-URI", "relative-part", "port", "host",
[391]873   "path-abempty", "path-absolute", "query", and "authority" from
874   <xref target="RFC3986"/>. In addition, we define a partial-URI rule for
875   protocol elements that allow a relative URI without a fragment.
876</t>
877<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="URI-reference"/><iref primary="true" item="Grammar" subitem="absolute-URI"/><iref primary="true" item="Grammar" subitem="authority"/><iref primary="true" item="Grammar" subitem="path-absolute"/><iref primary="true" item="Grammar" subitem="port"/><iref primary="true" item="Grammar" subitem="query"/><iref primary="true" item="Grammar" subitem="uri-host"/>
[395]878  <x:ref>URI</x:ref>           = &lt;URI, defined in <xref target="RFC3986" x:fmt="," x:sec="3"/>&gt;
879  <x:ref>URI-reference</x:ref> = &lt;URI-reference, defined in <xref target="RFC3986" x:fmt="," x:sec="4.1"/>&gt;
880  <x:ref>absolute-URI</x:ref>  = &lt;absolute-URI, defined in <xref target="RFC3986" x:fmt="," x:sec="4.3"/>&gt;
881  <x:ref>relative-part</x:ref> = &lt;relative-part, defined in <xref target="RFC3986" x:fmt="," x:sec="4.2"/>&gt;
882  <x:ref>authority</x:ref>     = &lt;authority, defined in <xref target="RFC3986" x:fmt="," x:sec="3.2"/>&gt;
883  <x:ref>path-abempty</x:ref>  = &lt;path-abempty, defined in <xref target="RFC3986" x:fmt="," x:sec="3.3"/>&gt;
884  <x:ref>path-absolute</x:ref> = &lt;path-absolute, defined in <xref target="RFC3986" x:fmt="," x:sec="3.3"/>&gt;
885  <x:ref>port</x:ref>          = &lt;port, defined in <xref target="RFC3986" x:fmt="," x:sec="3.2.3"/>&gt;
886  <x:ref>query</x:ref>         = &lt;query, defined in <xref target="RFC3986" x:fmt="," x:sec="3.4"/>&gt;
887  <x:ref>uri-host</x:ref>      = &lt;host, defined in <xref target="RFC3986" x:fmt="," x:sec="3.2.2"/>&gt;
[391]888 
889  <x:ref>partial-URI</x:ref>   = relative-part [ "?" query ]
890</artwork></figure>
891<t>
892   Each protocol element in HTTP that allows a URI reference will indicate in
893   its ABNF production whether the element allows only a URI in absolute form
894   (absolute-URI), any relative reference (relative-ref), or some other subset
895   of the URI-reference grammar. Unless otherwise indicated, URI references
896   are parsed relative to the request target (the default base URI for both
897   the request and its corresponding response).
898</t>
899
900<section title="http URI scheme" anchor="http.uri">
901  <x:anchor-alias value="http-URI"/>
902  <iref item="http URI scheme" primary="true"/>
903  <iref item="URI scheme" subitem="http" primary="true"/>
904<t>
[621]905   The "http" URI scheme is hereby defined for the purpose of minting
906   identifiers according to their association with the hierarchical
907   namespace governed by a potential HTTP origin server listening for
908   TCP connections on a given port.
909   The HTTP server is identified via the generic syntax's
910   <x:ref>authority</x:ref> component, which includes a host
911   identifier and optional TCP port, and the remainder of the URI is
912   considered to be identifying data corresponding to a resource for
913   which that server might provide an HTTP interface.
[391]914</t>
915<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="http-URI"/>
916  <x:ref>http-URI</x:ref> = "http:" "//" <x:ref>authority</x:ref> <x:ref>path-abempty</x:ref> [ "?" <x:ref>query</x:ref> ]
917</artwork></figure>
918<t>
[621]919   The host identifier within an <x:ref>authority</x:ref> component is
920   defined in <xref target="RFC3986" x:fmt="," x:sec="3.2.2"/>.  If host is
921   provided as an IP literal or IPv4 address, then the HTTP server is any
922   listener on the indicated TCP port at that IP address. If host is a
923   registered name, then that name is considered an indirect identifier
924   and the recipient might use a name resolution service, such as DNS,
925   to find the address of a listener for that host.
926   The host &MUST-NOT; be empty; if an "http" URI is received with an
927   empty host, then it &MUST; be rejected as invalid.
928   If the port subcomponent is empty or not given, then TCP port 80 is
929   assumed (the default reserved port for WWW services).
[391]930</t>
[621]931<t>
932   Regardless of the form of host identifier, access to that host is not
933   implied by the mere presence of its name or address. The host may or may
934   not exist and, even when it does exist, may or may not be running an
935   HTTP server or listening to the indicated port. The "http" URI scheme
936   makes use of the delegated nature of Internet names and addresses to
937   establish a naming authority (whatever entity has the ability to place
938   an HTTP server at that Internet name or address) and allows that
939   authority to determine which names are valid and how they might be used.
940</t>
941<t>
942   When an "http" URI is used within a context that calls for access to the
943   indicated resource, a client &MAY; attempt access by resolving
944   the host to an IP address, establishing a TCP connection to that address
945   on the indicated port, and sending an HTTP request message to the server
946   containing the URI's identifying data as described in <xref target="request"/>.
947   If the server responds to that request with a non-interim HTTP response
948   message, as described in <xref target="response"/>, then that response
949   is considered an authoritative answer to the client's request.
950</t>
951<t>
952   Although HTTP is independent of the transport protocol, the "http"
953   scheme is specific to TCP-based services because the name delegation
954   process depends on TCP for establishing authority.
955   An HTTP service based on some other underlying connection protocol
956   would presumably be identified using a different URI scheme, just as
957   the "https" scheme (below) is used for servers that require an SSL/TLS
958   transport layer on a connection. Other protocols may also be used to
959   provide access to "http" identified resources --- it is only the
960   authoritative interface used for mapping the namespace that is
961   specific to TCP.
962</t>
[452]963</section>
964
965<section title="https URI scheme" anchor="https.uri">
[622]966   <x:anchor-alias value="https-URI"/>
[452]967   <iref item="https URI scheme"/>
968   <iref item="URI scheme" subitem="https"/>
969<t>
[621]970   The "https" URI scheme is hereby defined for the purpose of minting
971   identifiers according to their association with the hierarchical
972   namespace governed by a potential HTTP origin server listening for
973   SSL/TLS-secured connections on a given TCP port.
974   The host and port are determined in the same way
975   as for the "http" scheme, except that a default TCP port of 443
976   is assumed if the port subcomponent is empty or not given.
[452]977</t>
[621]978<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="https-URI"/>
979  <x:ref>https-URI</x:ref> = "https:" "//" <x:ref>authority</x:ref> <x:ref>path-abempty</x:ref> [ "?" <x:ref>query</x:ref> ]
980</artwork></figure>
981<t>
982   The primary difference between the "http" and "https" schemes is
983   that interaction with the latter is required to be secured for
984   privacy through the use of strong encryption. The URI cannot be
985   sent in a request until the connection is secure. Likewise, the
986   default for caching is that each response that would be considered
987   "public" under the "http" scheme is instead treated as "private"
988   and thus not eligible for shared caching.
989</t>
990<t>
991   The process for authoritative access to an "https" identified
992   resource is defined in <xref target="RFC2818"/>.
993</t>
[391]994</section>
995
[621]996<section title="http and https URI Normalization and Comparison" anchor="uri.comparison">
[391]997<t>
[621]998   Since the "http" and "https" schemes conform to the URI generic syntax,
999   such URIs are normalized and compared according to the algorithm defined
1000   in <xref target="RFC3986" x:fmt="," x:sec="6"/>, using the defaults
1001   described above for each scheme.
[391]1002</t>
1003<t>
[621]1004   If the port is equal to the default port for a scheme, the normal
1005   form is to elide the port subcomponent. Likewise, an empty path
1006   component is equivalent to an absolute path of "/", so the normal
1007   form is to provide a path of "/" instead. The scheme and host
1008   are case-insensitive and normally provided in lowercase; all
1009   other components are compared in a case-sensitive manner.
1010   Characters other than those in the "reserved" set are equivalent
1011   to their percent-encoded octets (see <xref target="RFC3986"
1012   x:fmt="," x:sec="2.1"/>): the normal form is to not encode them.
1013</t>
1014<t>
[391]1015   For example, the following three URIs are equivalent:
1016</t>
1017<figure><artwork type="example">
1018   http://example.com:80/~smith/home.html
1019   http://EXAMPLE.com/%7Esmith/home.html
1020   http://EXAMPLE.com:/%7esmith/home.html
1021</artwork></figure>
[621]1022<t>
1023   <cref>[[This paragraph does not belong here. --Roy]]</cref>
1024   If path-abempty is the empty string (i.e., there is no slash "/"
1025   path separator following the authority), then the "http" URI
1026   &MUST; be given as "/" when
1027   used as a request-target (<xref target="request-target"/>). If a proxy
1028   receives a host name which is not a fully qualified domain name, it
1029   &MAY; add its domain to the host name it received. If a proxy receives
1030   a fully qualified domain name, the proxy &MUST-NOT; change the host
1031   name.
1032</t>
[391]1033</section>
1034</section>
[676]1035</section>
[391]1036
[8]1037<section title="HTTP Message" anchor="http.message">
[647]1038<x:anchor-alias value="generic-message"/>
1039<x:anchor-alias value="message.types"/>
1040<x:anchor-alias value="HTTP-message"/>
1041<x:anchor-alias value="start-line"/>
1042<iref item="header section"/>
1043<iref item="headers"/>
1044<iref item="header field"/>
[8]1045<t>
[647]1046   All HTTP/1.1 messages consist of a start-line followed by a sequence of
1047   characters in a format similar to the Internet Message Format
1048   <xref target="RFC5322"/>: zero or more header fields (collectively
1049   referred to as the "headers" or the "header section"), an empty line
1050   indicating the end of the header section, and an optional message-body.
[8]1051</t>
1052<t>
[647]1053   An HTTP message can either be a request from client to server or a
1054   response from server to client.  Syntactically, the two types of message
1055   differ only in the start-line, which is either a Request-Line (for requests)
1056   or a Status-Line (for responses), and in the algorithm for determining
1057   the length of the message-body (<xref target="message.length"/>).
1058   In theory, a client could receive requests and a server could receive
1059   responses, distinguishing them by their different start-line formats,
1060   but in practice servers are implemented to only expect a request
1061   (a response is interpreted as an unknown or invalid request method)
1062   and clients are implemented to only expect a response.
[8]1063</t>
[647]1064<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="HTTP-message"/>
1065  <x:ref>HTTP-message</x:ref>    = <x:ref>start-line</x:ref>
1066                    *( <x:ref>header-field</x:ref> <x:ref>CRLF</x:ref> )
[229]1067                    <x:ref>CRLF</x:ref>
1068                    [ <x:ref>message-body</x:ref> ]
[334]1069  <x:ref>start-line</x:ref>      = <x:ref>Request-Line</x:ref> / <x:ref>Status-Line</x:ref>
[8]1070</artwork></figure>
1071<t>
[395]1072   Whitespace (WSP) &MUST-NOT; be sent between the start-line and the first
1073   header field. The presence of whitespace might be an attempt to trick a
1074   noncompliant implementation of HTTP into ignoring that field or processing
1075   the next line as a new request, either of which may result in security
1076   issues when implementations within the request chain interpret the
1077   same message differently. HTTP/1.1 servers &MUST; reject such a message
1078   with a 400 (Bad Request) response.
1079</t>
[647]1080
1081<section title="Message Parsing Robustness" anchor="message.robustness">
1082<t>
1083   In the interest of robustness, servers &SHOULD; ignore at least one
1084   empty line received where a Request-Line is expected. In other words, if
1085   the server is reading the protocol stream at the beginning of a
1086   message and receives a CRLF first, it should ignore the CRLF.
1087</t>
1088<t>
1089   Some old HTTP/1.0 client implementations generate an extra CRLF
1090   after a POST request as a lame workaround for some early server
1091   applications that failed to read message-body content that was
1092   not terminated by a line-ending. An HTTP/1.1 client &MUST-NOT;
1093   preface or follow a request with an extra CRLF.  If terminating
1094   the request message-body with a line-ending is desired, then the
1095   client &MUST; include the terminating CRLF octets as part of the
1096   message-body length.
1097</t>
1098<t>
1099   The normal procedure for parsing an HTTP message is to read the
1100   start-line into a structure, read each header field into a hash
1101   table by field name until the empty line, and then use the parsed
1102   data to determine if a message-body is expected.  If a message-body
1103   has been indicated, then it is read as a stream until an amount
1104   of OCTETs equal to the message-length is read or the connection
1105   is closed.  Care must be taken to parse an HTTP message as a sequence
1106   of OCTETs in an encoding that is a superset of US-ASCII.  Attempting
1107   to parse HTTP as a stream of Unicode characters in a character encoding
1108   like UTF-16 may introduce security flaws due to the differing ways
1109   that such parsers interpret invalid characters.
1110</t>
[8]1111</section>
1112
[647]1113<section title="Header Fields" anchor="header.fields">
1114  <x:anchor-alias value="header-field"/>
[229]1115  <x:anchor-alias value="field-content"/>
1116  <x:anchor-alias value="field-name"/>
1117  <x:anchor-alias value="field-value"/>
[647]1118  <x:anchor-alias value="OWS"/>
[8]1119<t>
[647]1120   Each HTTP header field consists of a case-insensitive field name
1121   followed by a colon (":"), optional whitespace, and the field value.
[8]1122</t>
[647]1123<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="header-field"/><iref primary="true" item="Grammar" subitem="field-name"/><iref primary="true" item="Grammar" subitem="field-value"/><iref primary="true" item="Grammar" subitem="field-content"/>
[693]1124  <x:ref>header-field</x:ref>   = <x:ref>field-name</x:ref> ":" <x:ref>OWS</x:ref> [ <x:ref>field-value</x:ref> ] <x:ref>OWS</x:ref>
[229]1125  <x:ref>field-name</x:ref>     = <x:ref>token</x:ref>
[369]1126  <x:ref>field-value</x:ref>    = *( <x:ref>field-content</x:ref> / <x:ref>OWS</x:ref> )
[395]1127  <x:ref>field-content</x:ref>  = *( <x:ref>WSP</x:ref> / <x:ref>VCHAR</x:ref> / <x:ref>obs-text</x:ref> )
[8]1128</artwork></figure>
1129<t>
[647]1130   No whitespace is allowed between the header field name and colon. For
[395]1131   security reasons, any request message received containing such whitespace
[647]1132   &MUST; be rejected with a response code of 400 (Bad Request). A proxy
1133   &MUST; remove any such whitespace from a response message before
1134   forwarding the message downstream.
[8]1135</t>
1136<t>
[647]1137   A field value &MAY; be preceded by optional whitespace (OWS); a single SP is
1138   preferred. The field value does not include any leading or trailing white
[395]1139   space: OWS occurring before the first non-whitespace character of the
[647]1140   field value or after the last non-whitespace character of the field value
[748]1141   is ignored and &SHOULD; be removed before further processing (as this does
1142   not change the meaning of the header field).
[395]1143</t>
1144<t>
[647]1145   The order in which header fields with differing field names are
1146   received is not significant. However, it is "good practice" to send
1147   header fields that contain control data first, such as Host on
1148   requests and Date on responses, so that implementations can decide
1149   when not to handle a message as early as possible.  A server &MUST;
1150   wait until the entire header section is received before interpreting
1151   a request message, since later header fields might include conditionals,
1152   authentication credentials, or deliberately misleading duplicate
1153   header fields that would impact request processing.
1154</t>
1155<t>
[651]1156   Multiple header fields with the same field name &MUST-NOT; be
1157   sent in a message unless the entire field value for that
[647]1158   header field is defined as a comma-separated list [i.e., #(values)].
1159   Multiple header fields with the same field name can be combined into
1160   one "field-name: field-value" pair, without changing the semantics of the
1161   message, by appending each subsequent field value to the combined
1162   field value in order, separated by a comma. The order in which
1163   header fields with the same field name are received is therefore
1164   significant to the interpretation of the combined field value;
1165   a proxy &MUST-NOT; change the order of these field values when
1166   forwarding a message.
1167</t>
1168<x:note>
1169  <t>
1170   <x:h>Note:</x:h> the "Set-Cookie" header as implemented in
1171   practice (as opposed to how it is specified in <xref target="RFC2109"/>)
1172   can occur multiple times, but does not use the list syntax, and thus cannot
1173   be combined into a single line. (See Appendix A.2.3 of <xref target="Kri2001"/>
1174   for details.) Also note that the Set-Cookie2 header specified in
1175   <xref target="RFC2965"/> does not share this problem.
1176  </t>
1177</x:note>
1178<t>
[395]1179   Historically, HTTP header field values could be extended over multiple
1180   lines by preceding each extra line with at least one space or horizontal
1181   tab character (line folding). This specification deprecates such line
1182   folding except within the message/http media type
1183   (<xref target="internet.media.type.message.http"/>).
1184   HTTP/1.1 senders &MUST-NOT; produce messages that include line folding
1185   (i.e., that contain any field-content that matches the obs-fold rule) unless
1186   the message is intended for packaging within the message/http media type.
1187   HTTP/1.1 recipients &SHOULD; accept line folding and replace any embedded
1188   obs-fold whitespace with a single SP prior to interpreting the field value
1189   or forwarding the message downstream.
1190</t>
[647]1191<t>
1192   Historically, HTTP has allowed field content with text in the ISO-8859-1
1193   <xref target="ISO-8859-1"/> character encoding and supported other
1194   character sets only through use of <xref target="RFC2047"/> encoding.
1195   In practice, most HTTP header field values use only a subset of the
1196   US-ASCII character encoding <xref target="USASCII"/>. Newly defined
1197   header fields &SHOULD; limit their field values to US-ASCII characters.
1198   Recipients &SHOULD; treat other (obs-text) octets in field content as
1199   opaque data.
1200</t>
[395]1201<t anchor="rule.comment">
1202  <x:anchor-alias value="comment"/>
1203  <x:anchor-alias value="ctext"/>
1204   Comments can be included in some HTTP header fields by surrounding
1205   the comment text with parentheses. Comments are only allowed in
1206   fields containing "comment" as part of their field value definition.
1207</t>
1208<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="comment"/><iref primary="true" item="Grammar" subitem="ctext"/>
[702]1209  <x:ref>comment</x:ref>        = "(" *( <x:ref>ctext</x:ref> / <x:ref>quoted-cpair</x:ref> / <x:ref>comment</x:ref> ) ")"
[687]1210  <x:ref>ctext</x:ref>          = <x:ref>OWS</x:ref> / %x21-27 / %x2A-5B / %x5D-7E / <x:ref>obs-text</x:ref>
1211                 ; <x:ref>OWS</x:ref> / &lt;<x:ref>VCHAR</x:ref> except "(", ")", and "\"&gt; / <x:ref>obs-text</x:ref>
[395]1212</artwork></figure>
[702]1213<t anchor="rule.quoted-cpair">
1214  <x:anchor-alias value="quoted-cpair"/>
1215   The backslash character ("\") can be used as a single-character
[703]1216   quoting mechanism within comment constructs:
[702]1217</t>
1218<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="quoted-cpair"/>
1219  <x:ref>quoted-cpair</x:ref>    = "\" ( <x:ref>WSP</x:ref> / <x:ref>VCHAR</x:ref> / <x:ref>obs-text</x:ref> )
1220</artwork></figure>
1221<t>
1222   Producers &SHOULD-NOT; escape characters that do not require escaping
[703]1223   (i.e., other than the backslash character "\" and the parentheses "(" and
1224   ")").
[702]1225</t>
[8]1226</section>
1227
1228<section title="Message Body" anchor="message.body">
[229]1229  <x:anchor-alias value="message-body"/>
[8]1230<t>
1231   The message-body (if any) of an HTTP message is used to carry the
1232   entity-body associated with the request or response. The message-body
1233   differs from the entity-body only when a transfer-coding has been
1234   applied, as indicated by the Transfer-Encoding header field (<xref target="header.transfer-encoding"/>).
1235</t>
1236<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="message-body"/>
[229]1237  <x:ref>message-body</x:ref> = <x:ref>entity-body</x:ref>
[334]1238               / &lt;entity-body encoded as per <x:ref>Transfer-Encoding</x:ref>&gt;
[8]1239</artwork></figure>
1240<t>
1241   Transfer-Encoding &MUST; be used to indicate any transfer-codings
1242   applied by an application to ensure safe and proper transfer of the
1243   message. Transfer-Encoding is a property of the message, not of the
1244   entity, and thus &MAY; be added or removed by any application along the
1245   request/response chain. (However, <xref target="transfer.codings"/> places restrictions on
1246   when certain transfer-codings may be used.)
1247</t>
1248<t>
1249   The rules for when a message-body is allowed in a message differ for
1250   requests and responses.
1251</t>
1252<t>
1253   The presence of a message-body in a request is signaled by the
1254   inclusion of a Content-Length or Transfer-Encoding header field in
[647]1255   the request's header fields.
[171]1256   When a request message contains both a message-body of non-zero
1257   length and a method that does not define any semantics for that
1258   request message-body, then an origin server &SHOULD; either ignore
1259   the message-body or respond with an appropriate error message
1260   (e.g., 413).  A proxy or gateway, when presented the same request,
1261   &SHOULD; either forward the request inbound with the message-body or
1262   ignore the message-body when determining a response.
[8]1263</t>
1264<t>
1265   For response messages, whether or not a message-body is included with
1266   a message is dependent on both the request method and the response
1267   status code (<xref target="status.code.and.reason.phrase"/>). All responses to the HEAD request method
1268   &MUST-NOT; include a message-body, even though the presence of entity-header
1269   fields might lead one to believe they do. All 1xx
[753]1270   (Informational), 204 (No Content), and 304 (Not Modified) responses
[8]1271   &MUST-NOT; include a message-body. All other responses do include a
1272   message-body, although it &MAY; be of zero length.
1273</t>
1274</section>
1275
1276<section title="Message Length" anchor="message.length">
1277<t>
1278   The transfer-length of a message is the length of the message-body as
1279   it appears in the message; that is, after any transfer-codings have
1280   been applied. When a message-body is included with a message, the
1281   transfer-length of that body is determined by one of the following
1282   (in order of precedence):
1283</t>
1284<t>
1285  <list style="numbers">
1286    <x:lt><t>
1287     Any response message which "&MUST-NOT;" include a message-body (such
1288     as the 1xx, 204, and 304 responses and any response to a HEAD
1289     request) is always terminated by the first empty line after the
1290     header fields, regardless of the entity-header fields present in
1291     the message.
1292    </t></x:lt>
1293    <x:lt><t>
[85]1294     If a Transfer-Encoding header field (<xref target="header.transfer-encoding"/>)
[276]1295     is present and the "chunked" transfer-coding (<xref target="transfer.codings"/>)
1296     is used, the transfer-length is defined by the use of this transfer-coding.
1297     If a Transfer-Encoding header field is present and the "chunked" transfer-coding
1298     is not present, the transfer-length is defined by the sender closing the connection.
[8]1299    </t></x:lt>
1300    <x:lt><t>
1301     If a Content-Length header field (<xref target="header.content-length"/>) is present, its
[576]1302     value in OCTETs represents both the entity-length and the
[8]1303     transfer-length. The Content-Length header field &MUST-NOT; be sent
1304     if these two lengths are different (i.e., if a Transfer-Encoding
1305     header field is present). If a message is received with both a
1306     Transfer-Encoding header field and a Content-Length header field,
1307     the latter &MUST; be ignored.
1308    </t></x:lt>
1309    <x:lt><t>
1310     If the message uses the media type "multipart/byteranges", and the
[71]1311     transfer-length is not otherwise specified, then this self-delimiting
[8]1312     media type defines the transfer-length. This media type
[71]1313     &MUST-NOT; be used unless the sender knows that the recipient can parse
1314     it; the presence in a request of a Range header with multiple byte-range
1315     specifiers from a 1.1 client implies that the client can parse
[8]1316     multipart/byteranges responses.
1317    <list style="empty"><t>
1318       A range header might be forwarded by a 1.0 proxy that does not
1319       understand multipart/byteranges; in this case the server &MUST;
1320       delimit the message using methods defined in items 1, 3 or 5 of
1321       this section.
1322    </t></list>
1323    </t></x:lt>
1324    <x:lt><t>
1325     By the server closing the connection. (Closing the connection
1326     cannot be used to indicate the end of a request body, since that
1327     would leave no possibility for the server to send back a response.)
1328    </t></x:lt>
1329  </list>
1330</t>
1331<t>
1332   For compatibility with HTTP/1.0 applications, HTTP/1.1 requests
1333   containing a message-body &MUST; include a valid Content-Length header
1334   field unless the server is known to be HTTP/1.1 compliant. If a
1335   request contains a message-body and a Content-Length is not given,
[137]1336   the server &SHOULD; respond with 400 (Bad Request) if it cannot
1337   determine the length of the message, or with 411 (Length Required) if
[8]1338   it wishes to insist on receiving a valid Content-Length.
1339</t>
1340<t>
1341   All HTTP/1.1 applications that receive entities &MUST; accept the
1342   "chunked" transfer-coding (<xref target="transfer.codings"/>), thus allowing this mechanism
1343   to be used for messages when the message length cannot be determined
1344   in advance.
1345</t>
1346<t>
1347   Messages &MUST-NOT; include both a Content-Length header field and a
[85]1348   transfer-coding. If the message does include a
[8]1349   transfer-coding, the Content-Length &MUST; be ignored.
1350</t>
1351<t>
1352   When a Content-Length is given in a message where a message-body is
1353   allowed, its field value &MUST; exactly match the number of OCTETs in
1354   the message-body. HTTP/1.1 user agents &MUST; notify the user when an
1355   invalid length is received and detected.
1356</t>
1357</section>
1358
1359<section title="General Header Fields" anchor="general.header.fields">
[229]1360  <x:anchor-alias value="general-header"/>
[8]1361<t>
1362   There are a few header fields which have general applicability for
1363   both request and response messages, but which do not apply to the
1364   entity being transferred. These header fields apply only to the
1365   message being transmitted.
1366</t>
1367<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="general-header"/>
[229]1368  <x:ref>general-header</x:ref> = <x:ref>Cache-Control</x:ref>            ; &header-cache-control;
[334]1369                 / <x:ref>Connection</x:ref>               ; <xref target="header.connection"/>
1370                 / <x:ref>Date</x:ref>                     ; <xref target="header.date"/>
1371                 / <x:ref>Pragma</x:ref>                   ; &header-pragma;
1372                 / <x:ref>Trailer</x:ref>                  ; <xref target="header.trailer"/>
1373                 / <x:ref>Transfer-Encoding</x:ref>        ; <xref target="header.transfer-encoding"/>
1374                 / <x:ref>Upgrade</x:ref>                  ; <xref target="header.upgrade"/>
1375                 / <x:ref>Via</x:ref>                      ; <xref target="header.via"/>
1376                 / <x:ref>Warning</x:ref>                  ; &header-warning;
[8]1377</artwork></figure>
1378<t>
1379   General-header field names can be extended reliably only in
1380   combination with a change in the protocol version. However, new or
1381   experimental header fields may be given the semantics of general
1382   header fields if all parties in the communication recognize them to
1383   be general-header fields. Unrecognized header fields are treated as
1384   entity-header fields.
1385</t>
1386</section>
1387</section>
1388
1389<section title="Request" anchor="request">
[229]1390  <x:anchor-alias value="Request"/>
[8]1391<t>
1392   A request message from a client to a server includes, within the
1393   first line of that message, the method to be applied to the resource,
1394   the identifier of the resource, and the protocol version in use.
1395</t>
[29]1396<!--                 Host                      ; should be moved here eventually -->
[8]1397<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Request"/>
[229]1398  <x:ref>Request</x:ref>       = <x:ref>Request-Line</x:ref>              ; <xref target="request-line"/>
1399                  *(( <x:ref>general-header</x:ref>        ; <xref target="general.header.fields"/>
[334]1400                   / <x:ref>request-header</x:ref>         ; &request-header-fields;
[636]1401                   / <x:ref>entity-header</x:ref> ) <x:ref>CRLF</x:ref> ) ; &entity-header-fields;
[229]1402                  <x:ref>CRLF</x:ref>
1403                  [ <x:ref>message-body</x:ref> ]          ; <xref target="message.body"/>
[8]1404</artwork></figure>
1405
1406<section title="Request-Line" anchor="request-line">
[229]1407  <x:anchor-alias value="Request-Line"/>
[8]1408<t>
1409   The Request-Line begins with a method token, followed by the
[391]1410   request-target and the protocol version, and ending with CRLF. The
[8]1411   elements are separated by SP characters. No CR or LF is allowed
1412   except in the final CRLF sequence.
1413</t>
1414<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Request-Line"/>
[391]1415  <x:ref>Request-Line</x:ref>   = <x:ref>Method</x:ref> <x:ref>SP</x:ref> <x:ref>request-target</x:ref> <x:ref>SP</x:ref> <x:ref>HTTP-Version</x:ref> <x:ref>CRLF</x:ref>
[8]1416</artwork></figure>
1417
1418<section title="Method" anchor="method">
[229]1419  <x:anchor-alias value="Method"/>
[8]1420<t>
1421   The Method  token indicates the method to be performed on the
[391]1422   resource identified by the request-target. The method is case-sensitive.
[8]1423</t>
1424<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Method"/><iref primary="true" item="Grammar" subitem="extension-method"/>
[229]1425  <x:ref>Method</x:ref>         = <x:ref>token</x:ref>
[8]1426</artwork></figure>
1427</section>
1428
[391]1429<section title="request-target" anchor="request-target">
1430  <x:anchor-alias value="request-target"/>
[8]1431<t>
[452]1432   The request-target
[8]1433   identifies the resource upon which to apply the request.
1434</t>
[391]1435<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="request-target"/>
[404]1436  <x:ref>request-target</x:ref> = "*"
[374]1437                 / <x:ref>absolute-URI</x:ref>
[334]1438                 / ( <x:ref>path-absolute</x:ref> [ "?" <x:ref>query</x:ref> ] )
1439                 / <x:ref>authority</x:ref>
[8]1440</artwork></figure>
1441<t>
[391]1442   The four options for request-target are dependent on the nature of the
[8]1443   request. The asterisk "*" means that the request does not apply to a
1444   particular resource, but to the server itself, and is only allowed
1445   when the method used does not necessarily apply to a resource. One
1446   example would be
1447</t>
1448<figure><artwork type="example">
[402]1449  OPTIONS * HTTP/1.1
[8]1450</artwork></figure>
1451<t>
[374]1452   The absolute-URI form is &REQUIRED; when the request is being made to a
[8]1453   proxy. The proxy is requested to forward the request or service it
1454   from a valid cache, and return the response. Note that the proxy &MAY;
1455   forward the request on to another proxy or directly to the server
[374]1456   specified by the absolute-URI. In order to avoid request loops, a
[8]1457   proxy &MUST; be able to recognize all of its server names, including
1458   any aliases, local variations, and the numeric IP address. An example
1459   Request-Line would be:
1460</t>
1461<figure><artwork type="example">
[402]1462  GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1
[8]1463</artwork></figure>
1464<t>
[374]1465   To allow for transition to absolute-URIs in all requests in future
1466   versions of HTTP, all HTTP/1.1 servers &MUST; accept the absolute-URI
[8]1467   form in requests, even though HTTP/1.1 clients will only generate
1468   them in requests to proxies.
1469</t>
1470<t>
[29]1471   The authority form is only used by the CONNECT method (&CONNECT;).
[8]1472</t>
1473<t>
[391]1474   The most common form of request-target is that used to identify a
[8]1475   resource on an origin server or gateway. In this case the absolute
[374]1476   path of the URI &MUST; be transmitted (see <xref target="http.uri"/>, path-absolute) as
[391]1477   the request-target, and the network location of the URI (authority) &MUST;
[8]1478   be transmitted in a Host header field. For example, a client wishing
1479   to retrieve the resource above directly from the origin server would
[90]1480   create a TCP connection to port 80 of the host "www.example.org" and send
[8]1481   the lines:
1482</t>
1483<figure><artwork type="example">
[402]1484  GET /pub/WWW/TheProject.html HTTP/1.1
1485  Host: www.example.org
[8]1486</artwork></figure>
1487<t>
1488   followed by the remainder of the Request. Note that the absolute path
1489   cannot be empty; if none is present in the original URI, it &MUST; be
1490   given as "/" (the server root).
1491</t>
1492<t>
[403]1493   If a proxy receives a request without any path in the request-target and
1494   the method specified is capable of supporting the asterisk form of
1495   request-target, then the last proxy on the request chain &MUST; forward the
1496   request with "*" as the final request-target.
1497</t>
1498<figure><preamble>   
1499   For example, the request
1500</preamble><artwork type="example">
1501  OPTIONS http://www.example.org:8001 HTTP/1.1
1502</artwork></figure>
1503<figure><preamble>   
1504  would be forwarded by the proxy as
1505</preamble><artwork type="example">
1506  OPTIONS * HTTP/1.1
1507  Host: www.example.org:8001
1508</artwork>
1509<postamble>
1510   after connecting to port 8001 of host "www.example.org".
1511</postamble>
1512</figure>
1513<t>
[391]1514   The request-target is transmitted in the format specified in
[452]1515   <xref target="http.uri"/>. If the request-target is percent-encoded
1516   (<xref target="RFC3986" x:fmt="," x:sec="2.1"/>), the origin server
[391]1517   &MUST; decode the request-target in order to
[8]1518   properly interpret the request. Servers &SHOULD; respond to invalid
[391]1519   request-targets with an appropriate status code.
[8]1520</t>
1521<t>
[185]1522   A transparent proxy &MUST-NOT; rewrite the "path-absolute" part of the
[391]1523   received request-target when forwarding it to the next inbound server,
[185]1524   except as noted above to replace a null path-absolute with "/".
[8]1525</t>
[563]1526<x:note>
1527  <t>
1528    <x:h>Note:</x:h> The "no rewrite" rule prevents the proxy from changing the
1529    meaning of the request when the origin server is improperly using
1530    a non-reserved URI character for a reserved purpose.  Implementors
1531    should be aware that some pre-HTTP/1.1 proxies have been known to
1532    rewrite the request-target.
1533  </t>
1534</x:note>
[8]1535<t>
[391]1536   HTTP does not place a pre-defined limit on the length of a request-target.
1537   A server &MUST; be prepared to receive URIs of unbounded length and
[452]1538   respond with the 414 (URI Too Long) status if the received
[391]1539   request-target would be longer than the server wishes to handle
1540   (see &status-414;).
1541</t>
1542<t>
1543   Various ad-hoc limitations on request-target length are found in practice.
1544   It is &RECOMMENDED; that all HTTP senders and recipients support
1545   request-target lengths of 8000 or more OCTETs.
1546</t>
[8]1547</section>
1548</section>
1549
1550<section title="The Resource Identified by a Request" anchor="the.resource.identified.by.a.request">
1551<t>
1552   The exact resource identified by an Internet request is determined by
[391]1553   examining both the request-target and the Host header field.
[8]1554</t>
1555<t>
1556   An origin server that does not allow resources to differ by the
1557   requested host &MAY; ignore the Host header field value when
1558   determining the resource identified by an HTTP/1.1 request. (But see
1559   <xref target="changes.to.simplify.multi-homed.web.servers.and.conserve.ip.addresses"/>
1560   for other requirements on Host support in HTTP/1.1.)
1561</t>
1562<t>
1563   An origin server that does differentiate resources based on the host
1564   requested (sometimes referred to as virtual hosts or vanity host
1565   names) &MUST; use the following rules for determining the requested
1566   resource on an HTTP/1.1 request:
1567  <list style="numbers">
[391]1568    <t>If request-target is an absolute-URI, the host is part of the
1569     request-target. Any Host header field value in the request &MUST; be
[8]1570     ignored.</t>
[391]1571    <t>If the request-target is not an absolute-URI, and the request includes
[8]1572     a Host header field, the host is determined by the Host header
1573     field value.</t>
1574    <t>If the host as determined by rule 1 or 2 is not a valid host on
1575     the server, the response &MUST; be a 400 (Bad Request) error message.</t>
1576  </list>
1577</t>
1578<t>
1579   Recipients of an HTTP/1.0 request that lacks a Host header field &MAY;
1580   attempt to use heuristics (e.g., examination of the URI path for
1581   something unique to a particular host) in order to determine what
1582   exact resource is being requested.
1583</t>
1584</section>
1585
1586</section>
1587
1588
1589<section title="Response" anchor="response">
[229]1590  <x:anchor-alias value="Response"/>
[8]1591<t>
1592   After receiving and interpreting a request message, a server responds
1593   with an HTTP response message.
1594</t>
1595<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Response"/>
[229]1596  <x:ref>Response</x:ref>      = <x:ref>Status-Line</x:ref>               ; <xref target="status-line"/>
1597                  *(( <x:ref>general-header</x:ref>        ; <xref target="general.header.fields"/>
[334]1598                   / <x:ref>response-header</x:ref>        ; &response-header-fields;
[692]1599                   / <x:ref>entity-header</x:ref> ) <x:ref>CRLF</x:ref> ) ; &entity-header-fields;
[229]1600                  <x:ref>CRLF</x:ref>
1601                  [ <x:ref>message-body</x:ref> ]          ; <xref target="message.body"/>
[8]1602</artwork></figure>
1603
1604<section title="Status-Line" anchor="status-line">
[229]1605  <x:anchor-alias value="Status-Line"/>
[8]1606<t>
1607   The first line of a Response message is the Status-Line, consisting
1608   of the protocol version followed by a numeric status code and its
1609   associated textual phrase, with each element separated by SP
1610   characters. No CR or LF is allowed except in the final CRLF sequence.
1611</t>
1612<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Status-Line"/>
[229]1613  <x:ref>Status-Line</x:ref> = <x:ref>HTTP-Version</x:ref> <x:ref>SP</x:ref> <x:ref>Status-Code</x:ref> <x:ref>SP</x:ref> <x:ref>Reason-Phrase</x:ref> <x:ref>CRLF</x:ref>
[8]1614</artwork></figure>
1615
1616<section title="Status Code and Reason Phrase" anchor="status.code.and.reason.phrase">
[229]1617  <x:anchor-alias value="Reason-Phrase"/>
1618  <x:anchor-alias value="Status-Code"/>
[8]1619<t>
1620   The Status-Code element is a 3-digit integer result code of the
1621   attempt to understand and satisfy the request. These codes are fully
[198]1622   defined in &status-codes;.  The Reason Phrase exists for the sole
1623   purpose of providing a textual description associated with the numeric
1624   status code, out of deference to earlier Internet application protocols
1625   that were more frequently used with interactive text clients.
1626   A client &SHOULD; ignore the content of the Reason Phrase.
[8]1627</t>
1628<t>
1629   The first digit of the Status-Code defines the class of response. The
1630   last two digits do not have any categorization role. There are 5
1631   values for the first digit:
1632  <list style="symbols">
1633    <t>
1634      1xx: Informational - Request received, continuing process
1635    </t>
1636    <t>
1637      2xx: Success - The action was successfully received,
1638        understood, and accepted
1639    </t>
1640    <t>
1641      3xx: Redirection - Further action must be taken in order to
1642        complete the request
1643    </t>
1644    <t>
1645      4xx: Client Error - The request contains bad syntax or cannot
1646        be fulfilled
1647    </t>
1648    <t>
1649      5xx: Server Error - The server failed to fulfill an apparently
1650        valid request
1651    </t>
1652  </list>
1653</t>
1654<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Status-Code"/><iref primary="true" item="Grammar" subitem="extension-code"/><iref primary="true" item="Grammar" subitem="Reason-Phrase"/>
[229]1655  <x:ref>Status-Code</x:ref>    = 3<x:ref>DIGIT</x:ref>
[395]1656  <x:ref>Reason-Phrase</x:ref>  = *( <x:ref>WSP</x:ref> / <x:ref>VCHAR</x:ref> / <x:ref>obs-text</x:ref> )
[8]1657</artwork></figure>
1658</section>
1659</section>
1660
1661</section>
1662
1663
[623]1664<section title="Protocol Parameters" anchor="protocol.parameters">
1665
1666<section title="Date/Time Formats: Full Date" anchor="date.time.formats.full.date">
1667  <x:anchor-alias value="HTTP-date"/>
1668<t>
1669   HTTP applications have historically allowed three different formats
1670   for the representation of date/time stamps:
1671</t>
1672<figure><artwork type="example">
1673  Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 1123
1674  Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format
1675  Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format
1676</artwork></figure>
1677<t>
1678   The first format is preferred as an Internet standard and represents
1679   a fixed-length subset of that defined by <xref target="RFC1123"/>. The
1680   other formats are described here only for
1681   compatibility with obsolete implementations.
1682   HTTP/1.1 clients and servers that parse the date value &MUST; accept
1683   all three formats (for compatibility with HTTP/1.0), though they &MUST;
1684   only generate the RFC 1123 format for representing HTTP-date values
1685   in header fields. See <xref target="tolerant.applications"/> for further information.
1686</t>
1687<t>
1688   All HTTP date/time stamps &MUST; be represented in Greenwich Mean Time
1689   (GMT), without exception. For the purposes of HTTP, GMT is exactly
1690   equal to UTC (Coordinated Universal Time). This is indicated in the
1691   first two formats by the inclusion of "GMT" as the three-letter
1692   abbreviation for time zone, and &MUST; be assumed when reading the
1693   asctime format. HTTP-date is case sensitive and &MUST-NOT; include
1694   additional whitespace beyond that specifically included as SP in the
1695   grammar.
1696</t>
1697<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="HTTP-date"/>
1698  <x:ref>HTTP-date</x:ref>    = <x:ref>rfc1123-date</x:ref> / <x:ref>obs-date</x:ref>
1699</artwork></figure>
1700<t anchor="preferred.date.format">
1701  <x:anchor-alias value="rfc1123-date"/>
1702  <x:anchor-alias value="time-of-day"/>
1703  <x:anchor-alias value="hour"/>
1704  <x:anchor-alias value="minute"/>
1705  <x:anchor-alias value="second"/>
1706  <x:anchor-alias value="day-name"/>
1707  <x:anchor-alias value="day"/>
1708  <x:anchor-alias value="month"/>
1709  <x:anchor-alias value="year"/>
1710  <x:anchor-alias value="GMT"/>
1711  Preferred format:
1712</t>
1713<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="rfc1123-date"/><iref primary="true" item="Grammar" subitem="date1"/><iref primary="true" item="Grammar" subitem="time-of-day"/><iref primary="true" item="Grammar" subitem="hour"/><iref primary="true" item="Grammar" subitem="minute"/><iref primary="true" item="Grammar" subitem="second"/><iref primary="true" item="Grammar" subitem="day-name"/><iref primary="true" item="Grammar" subitem="day-name-l"/><iref primary="true" item="Grammar" subitem="day"/><iref primary="true" item="Grammar" subitem="month"/><iref primary="true" item="Grammar" subitem="year"/><iref primary="true" item="Grammar" subitem="GMT"/>
1714  <x:ref>rfc1123-date</x:ref> = <x:ref>day-name</x:ref> "," <x:ref>SP</x:ref> date1 <x:ref>SP</x:ref> <x:ref>time-of-day</x:ref> <x:ref>SP</x:ref> <x:ref>GMT</x:ref>
1715
1716  <x:ref>day-name</x:ref>     = <x:abnf-char-sequence>"Mon"</x:abnf-char-sequence> ; "Mon", case-sensitive
1717               / <x:abnf-char-sequence>"Tue"</x:abnf-char-sequence> ; "Tue", case-sensitive
1718               / <x:abnf-char-sequence>"Wed"</x:abnf-char-sequence> ; "Wed", case-sensitive
1719               / <x:abnf-char-sequence>"Thu"</x:abnf-char-sequence> ; "Thu", case-sensitive
1720               / <x:abnf-char-sequence>"Fri"</x:abnf-char-sequence> ; "Fri", case-sensitive
1721               / <x:abnf-char-sequence>"Sat"</x:abnf-char-sequence> ; "Sat", case-sensitive
1722               / <x:abnf-char-sequence>"Sun"</x:abnf-char-sequence> ; "Sun", case-sensitive
1723               
1724  <x:ref>date1</x:ref>        = <x:ref>day</x:ref> <x:ref>SP</x:ref> <x:ref>month</x:ref> <x:ref>SP</x:ref> <x:ref>year</x:ref>
1725               ; e.g., 02 Jun 1982
1726
1727  <x:ref>day</x:ref>          = 2<x:ref>DIGIT</x:ref>
1728  <x:ref>month</x:ref>        = <x:abnf-char-sequence>"Jan"</x:abnf-char-sequence> ; "Jan", case-sensitive
1729               / <x:abnf-char-sequence>"Feb"</x:abnf-char-sequence> ; "Feb", case-sensitive
1730               / <x:abnf-char-sequence>"Mar"</x:abnf-char-sequence> ; "Mar", case-sensitive
1731               / <x:abnf-char-sequence>"Apr"</x:abnf-char-sequence> ; "Apr", case-sensitive
1732               / <x:abnf-char-sequence>"May"</x:abnf-char-sequence> ; "May", case-sensitive
1733               / <x:abnf-char-sequence>"Jun"</x:abnf-char-sequence> ; "Jun", case-sensitive
1734               / <x:abnf-char-sequence>"Jul"</x:abnf-char-sequence> ; "Jul", case-sensitive
1735               / <x:abnf-char-sequence>"Aug"</x:abnf-char-sequence> ; "Aug", case-sensitive
1736               / <x:abnf-char-sequence>"Sep"</x:abnf-char-sequence> ; "Sep", case-sensitive
1737               / <x:abnf-char-sequence>"Oct"</x:abnf-char-sequence> ; "Oct", case-sensitive
1738               / <x:abnf-char-sequence>"Nov"</x:abnf-char-sequence> ; "Nov", case-sensitive
1739               / <x:abnf-char-sequence>"Dec"</x:abnf-char-sequence> ; "Dec", case-sensitive
1740  <x:ref>year</x:ref>         = 4<x:ref>DIGIT</x:ref>
1741
1742  <x:ref>GMT</x:ref>   = <x:abnf-char-sequence>"GMT"</x:abnf-char-sequence> ; "GMT", case-sensitive
1743
1744  <x:ref>time-of-day</x:ref>  = <x:ref>hour</x:ref> ":" <x:ref>minute</x:ref> ":" <x:ref>second</x:ref>
1745                 ; 00:00:00 - 23:59:59
1746                 
1747  <x:ref>hour</x:ref>         = 2<x:ref>DIGIT</x:ref>               
1748  <x:ref>minute</x:ref>       = 2<x:ref>DIGIT</x:ref>               
1749  <x:ref>second</x:ref>       = 2<x:ref>DIGIT</x:ref>               
1750</artwork></figure>
1751<t>
1752  The semantics of <x:ref>day-name</x:ref>, <x:ref>day</x:ref>,
1753  <x:ref>month</x:ref>, <x:ref>year</x:ref>, and <x:ref>time-of-day</x:ref> are the
1754  same as those defined for the RFC 5322 constructs
1755  with the corresponding name (<xref target="RFC5322" x:fmt="," x:sec="3.3"/>).
1756</t>
1757<t anchor="obsolete.date.formats">
1758  <x:anchor-alias value="obs-date"/>
1759  <x:anchor-alias value="rfc850-date"/>
1760  <x:anchor-alias value="asctime-date"/>
1761  <x:anchor-alias value="date1"/>
1762  <x:anchor-alias value="date2"/>
1763  <x:anchor-alias value="date3"/>
1764  <x:anchor-alias value="rfc1123-date"/>
1765  <x:anchor-alias value="day-name-l"/>
1766  Obsolete formats:
1767</t>
1768<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="obs-date"/>
1769  <x:ref>obs-date</x:ref>     = <x:ref>rfc850-date</x:ref> / <x:ref>asctime-date</x:ref> 
1770</artwork></figure>
1771<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="rfc850-date"/>
1772  <x:ref>rfc850-date</x:ref>  = <x:ref>day-name-l</x:ref> "," <x:ref>SP</x:ref> <x:ref>date2</x:ref> <x:ref>SP</x:ref> <x:ref>time-of-day</x:ref> <x:ref>SP</x:ref> <x:ref>GMT</x:ref>
1773  <x:ref>date2</x:ref>        = <x:ref>day</x:ref> "-" <x:ref>month</x:ref> "-" 2<x:ref>DIGIT</x:ref>
1774                 ; day-month-year (e.g., 02-Jun-82)
1775
1776  <x:ref>day-name-l</x:ref>   = <x:abnf-char-sequence>"Monday"</x:abnf-char-sequence> ; "Monday", case-sensitive
1777         / <x:abnf-char-sequence>"Tuesday"</x:abnf-char-sequence> ; "Tuesday", case-sensitive
1778         / <x:abnf-char-sequence>"Wednesday"</x:abnf-char-sequence> ; "Wednesday", case-sensitive
1779         / <x:abnf-char-sequence>"Thursday"</x:abnf-char-sequence> ; "Thursday", case-sensitive
1780         / <x:abnf-char-sequence>"Friday"</x:abnf-char-sequence> ; "Friday", case-sensitive
1781         / <x:abnf-char-sequence>"Saturday"</x:abnf-char-sequence> ; "Saturday", case-sensitive
1782         / <x:abnf-char-sequence>"Sunday"</x:abnf-char-sequence> ; "Sunday", case-sensitive
1783</artwork></figure>
1784<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="asctime-date"/>
1785  <x:ref>asctime-date</x:ref> = <x:ref>day-name</x:ref> <x:ref>SP</x:ref> <x:ref>date3</x:ref> <x:ref>SP</x:ref> <x:ref>time-of-day</x:ref> <x:ref>SP</x:ref> <x:ref>year</x:ref>
1786  <x:ref>date3</x:ref>        = <x:ref>month</x:ref> <x:ref>SP</x:ref> ( 2<x:ref>DIGIT</x:ref> / ( <x:ref>SP</x:ref> 1<x:ref>DIGIT</x:ref> ))
1787                 ; month day (e.g., Jun  2)
1788</artwork></figure>
1789<x:note>
1790  <t>
1791    <x:h>Note:</x:h> Recipients of date values are encouraged to be robust in
1792    accepting date values that may have been sent by non-HTTP
1793    applications, as is sometimes the case when retrieving or posting
1794    messages via proxies/gateways to SMTP or NNTP.
1795  </t>
1796</x:note>
1797<x:note>
1798  <t>
1799    <x:h>Note:</x:h> HTTP requirements for the date/time stamp format apply only
1800    to their usage within the protocol stream. Clients and servers are
1801    not required to use these formats for user presentation, request
1802    logging, etc.
1803  </t>
1804</x:note>
1805</section>
1806
1807<section title="Transfer Codings" anchor="transfer.codings">
1808  <x:anchor-alias value="transfer-coding"/>
1809  <x:anchor-alias value="transfer-extension"/>
1810<t>
1811   Transfer-coding values are used to indicate an encoding
1812   transformation that has been, can be, or may need to be applied to an
1813   entity-body in order to ensure "safe transport" through the network.
1814   This differs from a content coding in that the transfer-coding is a
1815   property of the message, not of the original entity.
1816</t>
1817<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="transfer-coding"/><iref primary="true" item="Grammar" subitem="transfer-extension"/>
[673]1818  <x:ref>transfer-coding</x:ref>         = "chunked" ; <xref target="chunked.encoding"/>
1819                          / "compress" ; <xref target="compress.coding"/>
1820                          / "deflate" ; <xref target="deflate.coding"/>
1821                          / "gzip" ; <xref target="gzip.coding"/>
1822                          / <x:ref>transfer-extension</x:ref>
[623]1823  <x:ref>transfer-extension</x:ref>      = <x:ref>token</x:ref> *( <x:ref>OWS</x:ref> ";" <x:ref>OWS</x:ref> <x:ref>transfer-parameter</x:ref> )
1824</artwork></figure>
1825<t anchor="rule.parameter">
1826  <x:anchor-alias value="attribute"/>
1827  <x:anchor-alias value="transfer-parameter"/>
1828  <x:anchor-alias value="value"/>
1829   Parameters are in  the form of attribute/value pairs.
1830</t>
1831<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="transfer-parameter"/><iref primary="true" item="Grammar" subitem="attribute"/><iref primary="true" item="Grammar" subitem="value"/><iref primary="true" item="Grammar" subitem="date2"/><iref primary="true" item="Grammar" subitem="date3"/>
1832  <x:ref>transfer-parameter</x:ref>      = <x:ref>attribute</x:ref> <x:ref>BWS</x:ref> "=" <x:ref>BWS</x:ref> <x:ref>value</x:ref>
1833  <x:ref>attribute</x:ref>               = <x:ref>token</x:ref>
1834  <x:ref>value</x:ref>                   = <x:ref>token</x:ref> / <x:ref>quoted-string</x:ref>
1835</artwork></figure>
1836<t>
1837   All transfer-coding values are case-insensitive. HTTP/1.1 uses
1838   transfer-coding values in the TE header field (<xref target="header.te"/>) and in
1839   the Transfer-Encoding header field (<xref target="header.transfer-encoding"/>).
1840</t>
1841<t>
1842   Whenever a transfer-coding is applied to a message-body, the set of
1843   transfer-codings &MUST; include "chunked", unless the message indicates it
1844   is terminated by closing the connection. When the "chunked" transfer-coding
1845   is used, it &MUST; be the last transfer-coding applied to the
1846   message-body. The "chunked" transfer-coding &MUST-NOT; be applied more
1847   than once to a message-body. These rules allow the recipient to
1848   determine the transfer-length of the message (<xref target="message.length"/>).
1849</t>
1850<t>
[641]1851   Transfer-codings are analogous to the Content-Transfer-Encoding values of
1852   MIME, which were designed to enable safe transport of binary data over a
1853   7-bit transport service (<xref target="RFC2045" x:fmt="," x:sec="6"/>).
1854   However, safe transport
[623]1855   has a different focus for an 8bit-clean transfer protocol. In HTTP,
1856   the only unsafe characteristic of message-bodies is the difficulty in
1857   determining the exact body length (<xref target="message.length"/>), or the desire to
1858   encrypt data over a shared transport.
1859</t>
1860<t>
1861   A server which receives an entity-body with a transfer-coding it does
1862   not understand &SHOULD; return 501 (Not Implemented), and close the
1863   connection. A server &MUST-NOT; send transfer-codings to an HTTP/1.0
1864   client.
1865</t>
1866
[673]1867<section title="Chunked Transfer Coding" anchor="chunked.encoding">
1868  <iref item="chunked (Coding Format)"/>
1869  <iref item="Coding Format" subitem="chunked"/>
[623]1870  <x:anchor-alias value="chunk"/>
1871  <x:anchor-alias value="Chunked-Body"/>
1872  <x:anchor-alias value="chunk-data"/>
1873  <x:anchor-alias value="chunk-ext"/>
1874  <x:anchor-alias value="chunk-ext-name"/>
1875  <x:anchor-alias value="chunk-ext-val"/>
1876  <x:anchor-alias value="chunk-size"/>
1877  <x:anchor-alias value="last-chunk"/>
1878  <x:anchor-alias value="trailer-part"/>
[707]1879  <x:anchor-alias value="quoted-str-nf"/>
1880  <x:anchor-alias value="qdtext-nf"/>
[623]1881<t>
1882   The chunked encoding modifies the body of a message in order to
1883   transfer it as a series of chunks, each with its own size indicator,
1884   followed by an &OPTIONAL; trailer containing entity-header fields. This
1885   allows dynamically produced content to be transferred along with the
1886   information necessary for the recipient to verify that it has
1887   received the full message.
1888</t>
[707]1889<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Chunked-Body"/><iref primary="true" item="Grammar" subitem="chunk"/><iref primary="true" item="Grammar" subitem="chunk-size"/><iref primary="true" item="Grammar" subitem="last-chunk"/><iref primary="true" item="Grammar" subitem="chunk-ext"/><iref primary="true" item="Grammar" subitem="chunk-ext-name"/><iref primary="true" item="Grammar" subitem="chunk-ext-val"/><iref primary="true" item="Grammar" subitem="chunk-data"/><iref primary="true" item="Grammar" subitem="trailer-part"/><iref primary="true" item="Grammar" subitem="quoted-str-nf"/><iref primary="true" item="Grammar" subitem="qdtext-nf"/>
[623]1890  <x:ref>Chunked-Body</x:ref>   = *<x:ref>chunk</x:ref>
1891                   <x:ref>last-chunk</x:ref>
1892                   <x:ref>trailer-part</x:ref>
1893                   <x:ref>CRLF</x:ref>
1894 
1895  <x:ref>chunk</x:ref>          = <x:ref>chunk-size</x:ref> *WSP [ <x:ref>chunk-ext</x:ref> ] <x:ref>CRLF</x:ref>
1896                   <x:ref>chunk-data</x:ref> <x:ref>CRLF</x:ref>
1897  <x:ref>chunk-size</x:ref>     = 1*<x:ref>HEXDIG</x:ref>
1898  <x:ref>last-chunk</x:ref>     = 1*("0") *WSP [ <x:ref>chunk-ext</x:ref> ] <x:ref>CRLF</x:ref>
1899 
1900  <x:ref>chunk-ext</x:ref>      = *( ";" *WSP <x:ref>chunk-ext-name</x:ref>
1901                      [ "=" <x:ref>chunk-ext-val</x:ref> ] *WSP )
1902  <x:ref>chunk-ext-name</x:ref> = <x:ref>token</x:ref>
[707]1903  <x:ref>chunk-ext-val</x:ref>  = <x:ref>token</x:ref> / <x:ref>quoted-str-nf</x:ref>
[623]1904  <x:ref>chunk-data</x:ref>     = 1*<x:ref>OCTET</x:ref> ; a sequence of chunk-size octets
1905  <x:ref>trailer-part</x:ref>   = *( <x:ref>entity-header</x:ref> <x:ref>CRLF</x:ref> )
[707]1906 
1907  <x:ref>quoted-str-nf</x:ref>  = <x:ref>DQUOTE</x:ref> *( <x:ref>qdtext-nf</x:ref> / <x:ref>quoted-pair</x:ref> ) <x:ref>DQUOTE</x:ref>
1908                 ; like <x:ref>quoted-string</x:ref>, but disallowing line folding
1909  <x:ref>qdtext-nf</x:ref>      = <x:ref>WSP</x:ref> / %x21 / %x23-5B / %x5D-7E / <x:ref>obs-text</x:ref>
1910                 ; <x:ref>WSP</x:ref> / &lt;<x:ref>VCHAR</x:ref> except <x:ref>DQUOTE</x:ref> and "\"&gt; / <x:ref>obs-text</x:ref> 
[623]1911</artwork></figure>
1912<t>
1913   The chunk-size field is a string of hex digits indicating the size of
1914   the chunk-data in octets. The chunked encoding is ended by any chunk whose size is
1915   zero, followed by the trailer, which is terminated by an empty line.
1916</t>
1917<t>
1918   The trailer allows the sender to include additional HTTP header
1919   fields at the end of the message. The Trailer header field can be
1920   used to indicate which header fields are included in a trailer (see
1921   <xref target="header.trailer"/>).
1922</t>
1923<t>
1924   A server using chunked transfer-coding in a response &MUST-NOT; use the
1925   trailer for any header fields unless at least one of the following is
1926   true:
1927  <list style="numbers">
1928    <t>the request included a TE header field that indicates "trailers" is
1929     acceptable in the transfer-coding of the  response, as described in
1930     <xref target="header.te"/>; or,</t>
1931
1932    <t>the server is the origin server for the response, the trailer
1933     fields consist entirely of optional metadata, and the recipient
1934     could use the message (in a manner acceptable to the origin server)
1935     without receiving this metadata.  In other words, the origin server
1936     is willing to accept the possibility that the trailer fields might
1937     be silently discarded along the path to the client.</t>
1938  </list>
1939</t>
1940<t>
1941   This requirement prevents an interoperability failure when the
1942   message is being received by an HTTP/1.1 (or later) proxy and
1943   forwarded to an HTTP/1.0 recipient. It avoids a situation where
1944   compliance with the protocol would have necessitated a possibly
1945   infinite buffer on the proxy.
1946</t>
1947<t>
1948   A process for decoding the "chunked" transfer-coding
1949   can be represented in pseudo-code as:
1950</t>
1951<figure><artwork type="code">
1952  length := 0
1953  read chunk-size, chunk-ext (if any) and CRLF
1954  while (chunk-size &gt; 0) {
1955     read chunk-data and CRLF
1956     append chunk-data to entity-body
1957     length := length + chunk-size
1958     read chunk-size and CRLF
1959  }
1960  read entity-header
1961  while (entity-header not empty) {
1962     append entity-header to existing header fields
1963     read entity-header
1964  }
1965  Content-Length := length
1966  Remove "chunked" from Transfer-Encoding
1967</artwork></figure>
1968<t>
1969   All HTTP/1.1 applications &MUST; be able to receive and decode the
1970   "chunked" transfer-coding, and &MUST; ignore chunk-ext extensions
1971   they do not understand.
1972</t>
1973</section>
[670]1974
[673]1975<section title="Compression Codings" anchor="compression.codings">
1976<t>
1977   The codings defined below can be used to compress the payload of a
1978   message.
1979</t>
1980<x:note><t>
1981   <x:h>Note:</x:h> Use of program names for the identification of encoding formats
1982   is not desirable and is discouraged for future encodings. Their
1983   use here is representative of historical practice, not good
1984   design.
1985</t></x:note>
1986<x:note><t>
1987   <x:h>Note:</x:h> For compatibility with previous implementations of HTTP,
1988   applications &SHOULD; consider "x-gzip" and "x-compress" to be
1989   equivalent to "gzip" and "compress" respectively.
1990</t></x:note>
1991
1992<section title="Compress Coding" anchor="compress.coding">
1993<iref item="compress (Coding Format)"/>
1994<iref item="Coding Format" subitem="compress"/>
1995<t>
1996   The "compress" format is produced by the common UNIX file compression
1997   program "compress". This format is an adaptive Lempel-Ziv-Welch
1998   coding (LZW).
1999</t>
2000</section>
2001
2002<section title="Deflate Coding" anchor="deflate.coding">
2003<iref item="deflate (Coding Format)"/>
2004<iref item="Coding Format" subitem="deflate"/>
2005<t>
2006   The "zlib" format is defined in <xref target="RFC1950"/> in combination with
2007   the "deflate" compression mechanism described in <xref target="RFC1951"/>.
2008</t>
2009</section>
2010
2011<section title="Gzip Coding" anchor="gzip.coding">
2012<iref item="gzip (Coding Format)"/>
2013<iref item="Coding Format" subitem="gzip"/>
2014<t>
2015   The "gzip" format is produced by the file compression program
2016   "gzip" (GNU zip), as described in <xref target="RFC1952"/>. This format is a
2017   Lempel-Ziv coding (LZ77) with a 32 bit CRC.
2018</t>
2019</section>
2020
2021</section>
2022
[670]2023<section title="Transfer Coding Registry" anchor="transfer.coding.registry">
2024<t>
2025   The HTTP Transfer Coding Registry defines the name space for the transfer
2026   coding names.
2027</t>
2028<t>
2029   Registrations &MUST; include the following fields:
2030   <list style="symbols">
2031     <t>Name</t>
2032     <t>Description</t>
2033     <t>Pointer to specification text</t>
2034   </list>
2035</t>
2036<t>
2037   Values to be added to this name space require expert review and a specification
2038   (see "Expert Review" and "Specification Required" in
2039   <xref target="RFC5226" x:fmt="of" x:sec="4.1"/>), and &MUST;
2040   conform to the purpose of transfer coding defined in this section.
2041</t>
2042<t>
2043   The registry itself is maintained at
2044   <eref target="http://www.iana.org/assignments/http-parameters"/>.
2045</t>
[623]2046</section>
[670]2047</section>
[623]2048
2049<section title="Product Tokens" anchor="product.tokens">
2050  <x:anchor-alias value="product"/>
2051  <x:anchor-alias value="product-version"/>
2052<t>
2053   Product tokens are used to allow communicating applications to
2054   identify themselves by software name and version. Most fields using
2055   product tokens also allow sub-products which form a significant part
2056   of the application to be listed, separated by whitespace. By
2057   convention, the products are listed in order of their significance
2058   for identifying the application.
2059</t>
2060<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="product"/><iref primary="true" item="Grammar" subitem="product-version"/>
2061  <x:ref>product</x:ref>         = <x:ref>token</x:ref> ["/" <x:ref>product-version</x:ref>]
2062  <x:ref>product-version</x:ref> = <x:ref>token</x:ref>
2063</artwork></figure>
2064<t>
2065   Examples:
2066</t>
2067<figure><artwork type="example">
2068  User-Agent: CERN-LineMode/2.15 libwww/2.17b3
2069  Server: Apache/0.8.4
2070</artwork></figure>
2071<t>
2072   Product tokens &SHOULD; be short and to the point. They &MUST-NOT; be
2073   used for advertising or other non-essential information. Although any
2074   token character &MAY; appear in a product-version, this token &SHOULD;
2075   only be used for a version identifier (i.e., successive versions of
2076   the same product &SHOULD; only differ in the product-version portion of
2077   the product value).
2078</t>
2079</section>
2080
2081<section title="Quality Values" anchor="quality.values">
2082  <x:anchor-alias value="qvalue"/>
2083<t>
2084   Both transfer codings (TE request header, <xref target="header.te"/>)
2085   and content negotiation (&content.negotiation;) use short "floating point"
2086   numbers to indicate the relative importance ("weight") of various
2087   negotiable parameters.  A weight is normalized to a real number in
2088   the range 0 through 1, where 0 is the minimum and 1 the maximum
2089   value. If a parameter has a quality value of 0, then content with
[746]2090   this parameter is "not acceptable" for the client. HTTP/1.1
[623]2091   applications &MUST-NOT; generate more than three digits after the
2092   decimal point. User configuration of these values &SHOULD; also be
2093   limited in this fashion.
2094</t>
2095<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="qvalue"/>
2096  <x:ref>qvalue</x:ref>         = ( "0" [ "." 0*3<x:ref>DIGIT</x:ref> ] )
2097                 / ( "1" [ "." 0*3("0") ] )
2098</artwork></figure>
2099<x:note>
2100  <t>
2101     <x:h>Note:</x:h> "Quality values" is a misnomer, since these values merely represent
2102     relative degradation in desired quality.
2103  </t>
2104</x:note>
2105</section>
2106
2107</section>
2108
[8]2109<section title="Connections" anchor="connections">
2110
2111<section title="Persistent Connections" anchor="persistent.connections">
2112
2113<section title="Purpose" anchor="persistent.purpose">
2114<t>
2115   Prior to persistent connections, a separate TCP connection was
2116   established to fetch each URL, increasing the load on HTTP servers
2117   and causing congestion on the Internet. The use of inline images and
2118   other associated data often require a client to make multiple
2119   requests of the same server in a short amount of time. Analysis of
2120   these performance problems and results from a prototype
2121   implementation are available <xref target="Pad1995"/> <xref target="Spe"/>. Implementation experience and
[578]2122   measurements of actual HTTP/1.1 implementations show good
[8]2123   results <xref target="Nie1997"/>. Alternatives have also been explored, for example,
2124   T/TCP <xref target="Tou1998"/>.
2125</t>
2126<t>
2127   Persistent HTTP connections have a number of advantages:
2128  <list style="symbols">
2129      <t>
2130        By opening and closing fewer TCP connections, CPU time is saved
2131        in routers and hosts (clients, servers, proxies, gateways,
2132        tunnels, or caches), and memory used for TCP protocol control
2133        blocks can be saved in hosts.
2134      </t>
2135      <t>
2136        HTTP requests and responses can be pipelined on a connection.
2137        Pipelining allows a client to make multiple requests without
2138        waiting for each response, allowing a single TCP connection to
2139        be used much more efficiently, with much lower elapsed time.
2140      </t>
2141      <t>
2142        Network congestion is reduced by reducing the number of packets
2143        caused by TCP opens, and by allowing TCP sufficient time to
2144        determine the congestion state of the network.
2145      </t>
2146      <t>
2147        Latency on subsequent requests is reduced since there is no time
2148        spent in TCP's connection opening handshake.
2149      </t>
2150      <t>
2151        HTTP can evolve more gracefully, since errors can be reported
2152        without the penalty of closing the TCP connection. Clients using
2153        future versions of HTTP might optimistically try a new feature,
2154        but if communicating with an older server, retry with old
2155        semantics after an error is reported.
2156      </t>
2157    </list>
2158</t>
2159<t>
2160   HTTP implementations &SHOULD; implement persistent connections.
2161</t>
2162</section>
2163
2164<section title="Overall Operation" anchor="persistent.overall">
2165<t>
2166   A significant difference between HTTP/1.1 and earlier versions of
2167   HTTP is that persistent connections are the default behavior of any
2168   HTTP connection. That is, unless otherwise indicated, the client
2169   &SHOULD; assume that the server will maintain a persistent connection,
2170   even after error responses from the server.
2171</t>
2172<t>
2173   Persistent connections provide a mechanism by which a client and a
2174   server can signal the close of a TCP connection. This signaling takes
2175   place using the Connection header field (<xref target="header.connection"/>). Once a close
2176   has been signaled, the client &MUST-NOT; send any more requests on that
2177   connection.
2178</t>
2179
2180<section title="Negotiation" anchor="persistent.negotiation">
2181<t>
2182   An HTTP/1.1 server &MAY; assume that a HTTP/1.1 client intends to
2183   maintain a persistent connection unless a Connection header including
2184   the connection-token "close" was sent in the request. If the server
2185   chooses to close the connection immediately after sending the
2186   response, it &SHOULD; send a Connection header including the
2187   connection-token close.
2188</t>
2189<t>
2190   An HTTP/1.1 client &MAY; expect a connection to remain open, but would
2191   decide to keep it open based on whether the response from a server
2192   contains a Connection header with the connection-token close. In case
2193   the client does not want to maintain a connection for more than that
2194   request, it &SHOULD; send a Connection header including the
2195   connection-token close.
2196</t>
2197<t>
2198   If either the client or the server sends the close token in the
2199   Connection header, that request becomes the last one for the
2200   connection.
2201</t>
2202<t>
2203   Clients and servers &SHOULD-NOT;  assume that a persistent connection is
2204   maintained for HTTP versions less than 1.1 unless it is explicitly
2205   signaled. See <xref target="compatibility.with.http.1.0.persistent.connections"/> for more information on backward
2206   compatibility with HTTP/1.0 clients.
2207</t>
2208<t>
2209   In order to remain persistent, all messages on the connection &MUST;
2210   have a self-defined message length (i.e., one not defined by closure
2211   of the connection), as described in <xref target="message.length"/>.
2212</t>
2213</section>
2214
2215<section title="Pipelining" anchor="pipelining">
2216<t>
2217   A client that supports persistent connections &MAY; "pipeline" its
2218   requests (i.e., send multiple requests without waiting for each
2219   response). A server &MUST; send its responses to those requests in the
2220   same order that the requests were received.
2221</t>
2222<t>
2223   Clients which assume persistent connections and pipeline immediately
2224   after connection establishment &SHOULD; be prepared to retry their
2225   connection if the first pipelined attempt fails. If a client does
2226   such a retry, it &MUST-NOT; pipeline before it knows the connection is
2227   persistent. Clients &MUST; also be prepared to resend their requests if
2228   the server closes the connection before sending all of the
2229   corresponding responses.
2230</t>
2231<t>
2232   Clients &SHOULD-NOT;  pipeline requests using non-idempotent methods or
[29]2233   non-idempotent sequences of methods (see &idempotent-methods;). Otherwise, a
[8]2234   premature termination of the transport connection could lead to
2235   indeterminate results. A client wishing to send a non-idempotent
2236   request &SHOULD; wait to send that request until it has received the
2237   response status for the previous request.
2238</t>
2239</section>
2240</section>
2241
2242<section title="Proxy Servers" anchor="persistent.proxy">
2243<t>
2244   It is especially important that proxies correctly implement the
2245   properties of the Connection header field as specified in <xref target="header.connection"/>.
2246</t>
2247<t>
2248   The proxy server &MUST; signal persistent connections separately with
2249   its clients and the origin servers (or other proxy servers) that it
2250   connects to. Each persistent connection applies to only one transport
2251   link.
2252</t>
2253<t>
2254   A proxy server &MUST-NOT; establish a HTTP/1.1 persistent connection
[578]2255   with an HTTP/1.0 client (but see <xref x:sec="19.7.1" x:fmt="of" target="RFC2068"/>
2256   for information and discussion of the problems with the Keep-Alive header
2257   implemented by many HTTP/1.0 clients).
[8]2258</t>
2259</section>
2260
2261<section title="Practical Considerations" anchor="persistent.practical">
2262<t>
2263   Servers will usually have some time-out value beyond which they will
2264   no longer maintain an inactive connection. Proxy servers might make
2265   this a higher value since it is likely that the client will be making
2266   more connections through the same server. The use of persistent
2267   connections places no requirements on the length (or existence) of
2268   this time-out for either the client or the server.
2269</t>
2270<t>
2271   When a client or server wishes to time-out it &SHOULD; issue a graceful
2272   close on the transport connection. Clients and servers &SHOULD; both
2273   constantly watch for the other side of the transport close, and
2274   respond to it as appropriate. If a client or server does not detect
2275   the other side's close promptly it could cause unnecessary resource
2276   drain on the network.
2277</t>
2278<t>
2279   A client, server, or proxy &MAY; close the transport connection at any
2280   time. For example, a client might have started to send a new request
2281   at the same time that the server has decided to close the "idle"
2282   connection. From the server's point of view, the connection is being
2283   closed while it was idle, but from the client's point of view, a
2284   request is in progress.
2285</t>
2286<t>
2287   This means that clients, servers, and proxies &MUST; be able to recover
2288   from asynchronous close events. Client software &SHOULD; reopen the
2289   transport connection and retransmit the aborted sequence of requests
2290   without user interaction so long as the request sequence is
[29]2291   idempotent (see &idempotent-methods;). Non-idempotent methods or sequences
[8]2292   &MUST-NOT; be automatically retried, although user agents &MAY; offer a
2293   human operator the choice of retrying the request(s). Confirmation by
2294   user-agent software with semantic understanding of the application
2295   &MAY; substitute for user confirmation. The automatic retry &SHOULD-NOT; 
2296   be repeated if the second sequence of requests fails.
2297</t>
2298<t>
2299   Servers &SHOULD; always respond to at least one request per connection,
2300   if at all possible. Servers &SHOULD-NOT;  close a connection in the
2301   middle of transmitting a response, unless a network or client failure
2302   is suspected.
2303</t>
2304<t>
[715]2305   Clients (including proxies) &SHOULD; limit the number of simultaneous
2306   connections that they maintain to a given server (including proxies).
[8]2307</t>
[715]2308<t>
2309   Previous revisions of HTTP gave a specific number of connections as a
2310   ceiling, but this was found to be impractical for many applications. As a
2311   result, this specification does not mandate a particular maximum number of
2312   connections, but instead encourages clients to be conservative when opening
2313   multiple connections.
2314</t>
2315<t>
2316   In particular, while using multiple connections avoids the "head-of-line
2317   blocking" problem (whereby a request that takes significant server-side
2318   processing and/or has a large payload can block subsequent requests on the
2319   same connection), each connection used consumes server resources (sometimes
2320   significantly), and furthermore using multiple connections can cause
2321   undesirable side effects in congested networks.
2322</t>
2323<t>
2324   Note that servers might reject traffic that they deem abusive, including an
2325   excessive number of connections from a client.
2326</t>
[8]2327</section>
2328</section>
2329
2330<section title="Message Transmission Requirements" anchor="message.transmission.requirements">
2331
2332<section title="Persistent Connections and Flow Control" anchor="persistent.flow">
2333<t>
2334   HTTP/1.1 servers &SHOULD; maintain persistent connections and use TCP's
2335   flow control mechanisms to resolve temporary overloads, rather than
2336   terminating connections with the expectation that clients will retry.
2337   The latter technique can exacerbate network congestion.
2338</t>
2339</section>
2340
2341<section title="Monitoring Connections for Error Status Messages" anchor="persistent.monitor">
2342<t>
2343   An HTTP/1.1 (or later) client sending a message-body &SHOULD; monitor
2344   the network connection for an error status while it is transmitting
2345   the request. If the client sees an error status, it &SHOULD;
2346   immediately cease transmitting the body. If the body is being sent
2347   using a "chunked" encoding (<xref target="transfer.codings"/>), a zero length chunk and
2348   empty trailer &MAY; be used to prematurely mark the end of the message.
2349   If the body was preceded by a Content-Length header, the client &MUST;
2350   close the connection.
2351</t>
2352</section>
2353
2354<section title="Use of the 100 (Continue) Status" anchor="use.of.the.100.status">
2355<t>
[29]2356   The purpose of the 100 (Continue) status (see &status-100;) is to
[8]2357   allow a client that is sending a request message with a request body
2358   to determine if the origin server is willing to accept the request
2359   (based on the request headers) before the client sends the request
2360   body. In some cases, it might either be inappropriate or highly
2361   inefficient for the client to send the body if the server will reject
2362   the message without looking at the body.
2363</t>
2364<t>
2365   Requirements for HTTP/1.1 clients:
2366  <list style="symbols">
2367    <t>
2368        If a client will wait for a 100 (Continue) response before
2369        sending the request body, it &MUST; send an Expect request-header
[29]2370        field (&header-expect;) with the "100-continue" expectation.
[8]2371    </t>
2372    <t>
[29]2373        A client &MUST-NOT; send an Expect request-header field (&header-expect;)
[8]2374        with the "100-continue" expectation if it does not intend
2375        to send a request body.
2376    </t>
2377  </list>
2378</t>
2379<t>
2380   Because of the presence of older implementations, the protocol allows
2381   ambiguous situations in which a client may send "Expect: 100-continue"
2382   without receiving either a 417 (Expectation Failed) status
2383   or a 100 (Continue) status. Therefore, when a client sends this
2384   header field to an origin server (possibly via a proxy) from which it
2385   has never seen a 100 (Continue) status, the client &SHOULD-NOT;  wait
2386   for an indefinite period before sending the request body.
2387</t>
2388<t>
2389   Requirements for HTTP/1.1 origin servers:
2390  <list style="symbols">
2391    <t> Upon receiving a request which includes an Expect request-header
2392        field with the "100-continue" expectation, an origin server &MUST;
2393        either respond with 100 (Continue) status and continue to read
2394        from the input stream, or respond with a final status code. The
2395        origin server &MUST-NOT; wait for the request body before sending
2396        the 100 (Continue) response. If it responds with a final status
2397        code, it &MAY; close the transport connection or it &MAY; continue
2398        to read and discard the rest of the request.  It &MUST-NOT;
2399        perform the requested method if it returns a final status code.
2400    </t>
2401    <t> An origin server &SHOULD-NOT;  send a 100 (Continue) response if
2402        the request message does not include an Expect request-header
2403        field with the "100-continue" expectation, and &MUST-NOT; send a
2404        100 (Continue) response if such a request comes from an HTTP/1.0
2405        (or earlier) client. There is an exception to this rule: for
[97]2406        compatibility with <xref target="RFC2068"/>, a server &MAY; send a 100 (Continue)
[8]2407        status in response to an HTTP/1.1 PUT or POST request that does
2408        not include an Expect request-header field with the "100-continue"
2409        expectation. This exception, the purpose of which is
2410        to minimize any client processing delays associated with an
2411        undeclared wait for 100 (Continue) status, applies only to
2412        HTTP/1.1 requests, and not to requests with any other HTTP-version
2413        value.
2414    </t>
2415    <t> An origin server &MAY; omit a 100 (Continue) response if it has
2416        already received some or all of the request body for the
2417        corresponding request.
2418    </t>
2419    <t> An origin server that sends a 100 (Continue) response &MUST;
2420    ultimately send a final status code, once the request body is
2421        received and processed, unless it terminates the transport
2422        connection prematurely.
2423    </t>
2424    <t> If an origin server receives a request that does not include an
2425        Expect request-header field with the "100-continue" expectation,
2426        the request includes a request body, and the server responds
2427        with a final status code before reading the entire request body
2428        from the transport connection, then the server &SHOULD-NOT;  close
2429        the transport connection until it has read the entire request,
2430        or until the client closes the connection. Otherwise, the client
2431        might not reliably receive the response message. However, this
2432        requirement is not be construed as preventing a server from
2433        defending itself against denial-of-service attacks, or from
2434        badly broken client implementations.
2435      </t>
2436    </list>
2437</t>
2438<t>
2439   Requirements for HTTP/1.1 proxies:
2440  <list style="symbols">
2441    <t> If a proxy receives a request that includes an Expect request-header
2442        field with the "100-continue" expectation, and the proxy
2443        either knows that the next-hop server complies with HTTP/1.1 or
2444        higher, or does not know the HTTP version of the next-hop
2445        server, it &MUST; forward the request, including the Expect header
2446        field.
2447    </t>
2448    <t> If the proxy knows that the version of the next-hop server is
2449        HTTP/1.0 or lower, it &MUST-NOT; forward the request, and it &MUST;
2450        respond with a 417 (Expectation Failed) status.
2451    </t>
2452    <t> Proxies &SHOULD; maintain a cache recording the HTTP version
2453        numbers received from recently-referenced next-hop servers.
2454    </t>
2455    <t> A proxy &MUST-NOT; forward a 100 (Continue) response if the
2456        request message was received from an HTTP/1.0 (or earlier)
2457        client and did not include an Expect request-header field with
2458        the "100-continue" expectation. This requirement overrides the
[29]2459        general rule for forwarding of 1xx responses (see &status-1xx;).
[8]2460    </t>
2461  </list>
2462</t>
2463</section>
2464
2465<section title="Client Behavior if Server Prematurely Closes Connection" anchor="connection.premature">
2466<t>
2467   If an HTTP/1.1 client sends a request which includes a request body,
2468   but which does not include an Expect request-header field with the
2469   "100-continue" expectation, and if the client is not directly
2470   connected to an HTTP/1.1 origin server, and if the client sees the
2471   connection close before receiving any status from the server, the
2472   client &SHOULD; retry the request.  If the client does retry this
2473   request, it &MAY; use the following "binary exponential backoff"
2474   algorithm to be assured of obtaining a reliable response:
2475  <list style="numbers">
2476    <t>
2477      Initiate a new connection to the server
2478    </t>
2479    <t>
2480      Transmit the request-headers
2481    </t>
2482    <t>
2483      Initialize a variable R to the estimated round-trip time to the
2484         server (e.g., based on the time it took to establish the
2485         connection), or to a constant value of 5 seconds if the round-trip
2486         time is not available.
2487    </t>
2488    <t>
2489       Compute T = R * (2**N), where N is the number of previous
2490         retries of this request.
2491    </t>
2492    <t>
2493       Wait either for an error response from the server, or for T
2494         seconds (whichever comes first)
2495    </t>
2496    <t>
2497       If no error response is received, after T seconds transmit the
2498         body of the request.
2499    </t>
2500    <t>
2501       If client sees that the connection is closed prematurely,
2502         repeat from step 1 until the request is accepted, an error
2503         response is received, or the user becomes impatient and
2504         terminates the retry process.
2505    </t>
2506  </list>
2507</t>
2508<t>
2509   If at any point an error status is received, the client
2510  <list style="symbols">
2511      <t>&SHOULD-NOT;  continue and</t>
2512
2513      <t>&SHOULD; close the connection if it has not completed sending the
2514        request message.</t>
2515    </list>
2516</t>
2517</section>
2518</section>
2519</section>
2520
2521
[651]2522<section title="Miscellaneous notes that may disappear" anchor="misc">
2523<section title="Scheme aliases considered harmful" anchor="scheme.aliases">
2524<t>
2525   <cref>TBS: describe why aliases like webcal are harmful.</cref>
2526</t>
2527</section>
2528
2529<section title="Use of HTTP for proxy communication" anchor="http.proxy">
2530<t>
2531   <cref>TBD: Configured to use HTTP to proxy HTTP or other protocols.</cref>
2532</t>
2533</section>
[676]2534
[651]2535<section title="Interception of HTTP for access control" anchor="http.intercept">
2536<t>
2537   <cref>TBD: Interception of HTTP traffic for initiating access control.</cref>
2538</t>
2539</section>
[676]2540
[651]2541<section title="Use of HTTP by other protocols" anchor="http.others">
2542<t>
2543   <cref>TBD: Profiles of HTTP defined by other protocol.
2544   Extensions of HTTP like WebDAV.</cref>
2545</t>
[676]2546
[651]2547</section>
2548<section title="Use of HTTP by media type specification" anchor="http.media">
2549<t>
2550   <cref>TBD: Instructions on composing HTTP requests via hypertext formats.</cref>
2551</t>
2552</section>
2553</section>
2554
[647]2555<section title="Header Field Definitions" anchor="header.field.definitions">
[8]2556<t>
[117]2557   This section defines the syntax and semantics of HTTP/1.1 header fields
2558   related to message framing and transport protocols.
[8]2559</t>
[117]2560<t>
2561   For entity-header fields, both sender and recipient refer to either the
2562   client or the server, depending on who sends and who receives the entity.
2563</t>
[8]2564
2565<section title="Connection" anchor="header.connection">
2566  <iref primary="true" item="Connection header" x:for-anchor=""/>
2567  <iref primary="true" item="Headers" subitem="Connection" x:for-anchor=""/>
[229]2568  <x:anchor-alias value="Connection"/>
2569  <x:anchor-alias value="connection-token"/>
[354]2570  <x:anchor-alias value="Connection-v"/>
[8]2571<t>
[697]2572   The "Connection" general-header field allows the sender to specify
[8]2573   options that are desired for that particular connection and &MUST-NOT;
2574   be communicated by proxies over further connections.
2575</t>
2576<t>
[354]2577   The Connection header's value has the following grammar:
[8]2578</t>
[354]2579<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Connection"/><iref primary="true" item="Grammar" subitem="Connection-v"/><iref primary="true" item="Grammar" subitem="connection-token"/>
[366]2580  <x:ref>Connection</x:ref>       = "Connection" ":" <x:ref>OWS</x:ref> <x:ref>Connection-v</x:ref>
[354]2581  <x:ref>Connection-v</x:ref>     = 1#<x:ref>connection-token</x:ref>
2582  <x:ref>connection-token</x:ref> = <x:ref>token</x:ref>
[8]2583</artwork></figure>
2584<t>
2585   HTTP/1.1 proxies &MUST; parse the Connection header field before a
2586   message is forwarded and, for each connection-token in this field,
2587   remove any header field(s) from the message with the same name as the
2588   connection-token. Connection options are signaled by the presence of
2589   a connection-token in the Connection header field, not by any
2590   corresponding additional header field(s), since the additional header
2591   field may not be sent if there are no parameters associated with that
2592   connection option.
2593</t>
2594<t>
2595   Message headers listed in the Connection header &MUST-NOT; include
2596   end-to-end headers, such as Cache-Control.
2597</t>
2598<t>
2599   HTTP/1.1 defines the "close" connection option for the sender to
2600   signal that the connection will be closed after completion of the
2601   response. For example,
2602</t>
2603<figure><artwork type="example">
[354]2604  Connection: close
[8]2605</artwork></figure>
2606<t>
2607   in either the request or the response header fields indicates that
[746]2608   the connection &SHOULD-NOT;  be considered "persistent" (<xref target="persistent.connections"/>)
[8]2609   after the current request/response is complete.
2610</t>
2611<t>
[86]2612   An HTTP/1.1 client that does not support persistent connections &MUST;
2613   include the "close" connection option in every request message.
[8]2614</t>
2615<t>
[86]2616   An HTTP/1.1 server that does not support persistent connections &MUST;
2617   include the "close" connection option in every response message that
[753]2618   does not have a 1xx (Informational) status code.
[86]2619</t>
2620<t>
[8]2621   A system receiving an HTTP/1.0 (or lower-version) message that
[96]2622   includes a Connection header &MUST;, for each connection-token in this
[8]2623   field, remove and ignore any header field(s) from the message with
2624   the same name as the connection-token. This protects against mistaken
2625   forwarding of such header fields by pre-HTTP/1.1 proxies. See <xref target="compatibility.with.http.1.0.persistent.connections"/>.
2626</t>
2627</section>
2628
2629<section title="Content-Length" anchor="header.content-length">
2630  <iref primary="true" item="Content-Length header" x:for-anchor=""/>
2631  <iref primary="true" item="Headers" subitem="Content-Length" x:for-anchor=""/>
[229]2632  <x:anchor-alias value="Content-Length"/>
[354]2633  <x:anchor-alias value="Content-Length-v"/>
[8]2634<t>
[697]2635   The "Content-Length" entity-header field indicates the size of the
[698]2636   entity-body, in number of OCTETs. In the case of responses to the HEAD
2637   method, it indicates the size of the entity-body that would have been sent
2638   had the request been a GET.
[8]2639</t>
[354]2640<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Content-Length"/><iref primary="true" item="Grammar" subitem="Content-Length-v"/>
[366]2641  <x:ref>Content-Length</x:ref>   = "Content-Length" ":" <x:ref>OWS</x:ref> 1*<x:ref>Content-Length-v</x:ref>
[354]2642  <x:ref>Content-Length-v</x:ref> = 1*<x:ref>DIGIT</x:ref>
[8]2643</artwork></figure>
2644<t>
2645   An example is
2646</t>
2647<figure><artwork type="example">
[354]2648  Content-Length: 3495
[8]2649</artwork></figure>
2650<t>
2651   Applications &SHOULD; use this field to indicate the transfer-length of
2652   the message-body, unless this is prohibited by the rules in <xref target="message.length"/>.
2653</t>
2654<t>
2655   Any Content-Length greater than or equal to zero is a valid value.
2656   <xref target="message.length"/> describes how to determine the length of a message-body
2657   if a Content-Length is not given.
2658</t>
2659<t>
2660   Note that the meaning of this field is significantly different from
2661   the corresponding definition in MIME, where it is an optional field
2662   used within the "message/external-body" content-type. In HTTP, it
2663   &SHOULD; be sent whenever the message's length can be determined prior
2664   to being transferred, unless this is prohibited by the rules in
2665   <xref target="message.length"/>.
2666</t>
2667</section>
2668
2669<section title="Date" anchor="header.date">
2670  <iref primary="true" item="Date header" x:for-anchor=""/>
2671  <iref primary="true" item="Headers" subitem="Date" x:for-anchor=""/>
[229]2672  <x:anchor-alias value="Date"/>
[354]2673  <x:anchor-alias value="Date-v"/>
[8]2674<t>
[697]2675   The "Date" general-header field represents the date and time at which
[727]2676   the message was originated, having the same semantics as the Origination
2677   Date Field (orig-date) defined in <xref target="RFC5322" x:fmt="of" x:sec="3.6.1"/>.
2678   The field value is an HTTP-date, as described in <xref target="date.time.formats.full.date"/>;
[84]2679   it &MUST; be sent in rfc1123-date format.
[8]2680</t>
[354]2681<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Date"/><iref primary="true" item="Grammar" subitem="Date-v"/>
[366]2682  <x:ref>Date</x:ref>   = "Date" ":" <x:ref>OWS</x:ref> <x:ref>Date-v</x:ref>
[354]2683  <x:ref>Date-v</x:ref> = <x:ref>HTTP-date</x:ref>
[8]2684</artwork></figure>
2685<t>
2686   An example is
2687</t>
2688<figure><artwork type="example">
[354]2689  Date: Tue, 15 Nov 1994 08:12:31 GMT
[8]2690</artwork></figure>
2691<t>
2692   Origin servers &MUST; include a Date header field in all responses,
2693   except in these cases:
2694  <list style="numbers">
2695      <t>If the response status code is 100 (Continue) or 101 (Switching
2696         Protocols), the response &MAY; include a Date header field, at
2697         the server's option.</t>
2698
2699      <t>If the response status code conveys a server error, e.g. 500
2700         (Internal Server Error) or 503 (Service Unavailable), and it is
2701         inconvenient or impossible to generate a valid Date.</t>
2702
2703      <t>If the server does not have a clock that can provide a
2704         reasonable approximation of the current time, its responses
2705         &MUST-NOT; include a Date header field. In this case, the rules
2706         in <xref target="clockless.origin.server.operation"/> &MUST; be followed.</t>
2707  </list>
2708</t>
2709<t>
2710   A received message that does not have a Date header field &MUST; be
2711   assigned one by the recipient if the message will be cached by that
2712   recipient or gatewayed via a protocol which requires a Date. An HTTP
2713   implementation without a clock &MUST-NOT; cache responses without
2714   revalidating them on every use. An HTTP cache, especially a shared
2715   cache, &SHOULD; use a mechanism, such as NTP <xref target="RFC1305"/>, to synchronize its
2716   clock with a reliable external standard.
2717</t>
2718<t>
2719   Clients &SHOULD; only send a Date header field in messages that include
2720   an entity-body, as in the case of the PUT and POST requests, and even
2721   then it is optional. A client without a clock &MUST-NOT; send a Date
2722   header field in a request.
2723</t>
2724<t>
2725   The HTTP-date sent in a Date header &SHOULD-NOT;  represent a date and
2726   time subsequent to the generation of the message. It &SHOULD; represent
2727   the best available approximation of the date and time of message
2728   generation, unless the implementation has no means of generating a
2729   reasonably accurate date and time. In theory, the date ought to
2730   represent the moment just before the entity is generated. In
2731   practice, the date can be generated at any time during the message
2732   origination without affecting its semantic value.
2733</t>
2734
2735<section title="Clockless Origin Server Operation" anchor="clockless.origin.server.operation">
2736<t>
2737   Some origin server implementations might not have a clock available.
2738   An origin server without a clock &MUST-NOT; assign Expires or Last-Modified
2739   values to a response, unless these values were associated
2740   with the resource by a system or user with a reliable clock. It &MAY;
2741   assign an Expires value that is known, at or before server
2742   configuration time, to be in the past (this allows "pre-expiration"
2743   of responses without storing separate Expires values for each
2744   resource).
2745</t>
2746</section>
2747</section>
2748
2749<section title="Host" anchor="header.host">
2750  <iref primary="true" item="Host header" x:for-anchor=""/>
2751  <iref primary="true" item="Headers" subitem="Host" x:for-anchor=""/>
[229]2752  <x:anchor-alias value="Host"/>
[354]2753  <x:anchor-alias value="Host-v"/>
[8]2754<t>
[697]2755   The "Host" request-header field specifies the Internet host and port
[698]2756   number of the resource being requested, allowing the origin server or
2757   gateway to differentiate between internally-ambiguous URLs, such as the root
2758   "/" URL of a server for multiple host names on a single IP address.
[8]2759</t>
[698]2760<t>   
2761   The Host field value &MUST; represent the naming authority of the origin
2762   server or gateway given by the original URL obtained from the user or
2763   referring resource (generally an http URI, as described in
2764   <xref target="http.uri"/>).
2765</t>
[354]2766<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Host"/><iref primary="true" item="Grammar" subitem="Host-v"/>
[366]2767  <x:ref>Host</x:ref>   = "Host" ":" <x:ref>OWS</x:ref> <x:ref>Host-v</x:ref>
[374]2768  <x:ref>Host-v</x:ref> = <x:ref>uri-host</x:ref> [ ":" <x:ref>port</x:ref> ] ; <xref target="http.uri"/>
[8]2769</artwork></figure>
2770<t>
2771   A "host" without any trailing port information implies the default
2772   port for the service requested (e.g., "80" for an HTTP URL). For
2773   example, a request on the origin server for
[90]2774   &lt;http://www.example.org/pub/WWW/&gt; would properly include:
[8]2775</t>
2776<figure><artwork type="example">
[354]2777  GET /pub/WWW/ HTTP/1.1
2778  Host: www.example.org
[8]2779</artwork></figure>
2780<t>
2781   A client &MUST; include a Host header field in all HTTP/1.1 request
[148]2782   messages. If the requested URI does not include an Internet host
[8]2783   name for the service being requested, then the Host header field &MUST;
2784   be given with an empty value. An HTTP/1.1 proxy &MUST; ensure that any
2785   request message it forwards does contain an appropriate Host header
2786   field that identifies the service being requested by the proxy. All
2787   Internet-based HTTP/1.1 servers &MUST; respond with a 400 (Bad Request)
2788   status code to any HTTP/1.1 request message which lacks a Host header
2789   field.
2790</t>
2791<t>
[97]2792   See Sections <xref target="the.resource.identified.by.a.request" format="counter"/>
[8]2793   and <xref target="changes.to.simplify.multi-homed.web.servers.and.conserve.ip.addresses" format="counter"/>
2794   for other requirements relating to Host.
2795</t>
2796</section>
2797
2798<section title="TE" anchor="header.te">
2799  <iref primary="true" item="TE header" x:for-anchor=""/>
2800  <iref primary="true" item="Headers" subitem="TE" x:for-anchor=""/>
[229]2801  <x:anchor-alias value="TE"/>
[354]2802  <x:anchor-alias value="TE-v"/>
[229]2803  <x:anchor-alias value="t-codings"/>
[457]2804  <x:anchor-alias value="te-params"/>
2805  <x:anchor-alias value="te-ext"/>
[8]2806<t>
[697]2807   The "TE" request-header field indicates what extension transfer-codings
[698]2808   it is willing to accept in the response, and whether or not it is
2809   willing to accept trailer fields in a chunked transfer-coding.
2810</t>
2811<t>
2812   Its value may consist of the keyword "trailers" and/or a comma-separated
[8]2813   list of extension transfer-coding names with optional accept
2814   parameters (as described in <xref target="transfer.codings"/>).
2815</t>
[457]2816<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="TE"/><iref primary="true" item="Grammar" subitem="TE-v"/><iref primary="true" item="Grammar" subitem="t-codings"/><iref primary="true" item="Grammar" subitem="te-params"/><iref primary="true" item="Grammar" subitem="te-ext"/>
[366]2817  <x:ref>TE</x:ref>        = "TE" ":" <x:ref>OWS</x:ref> <x:ref>TE-v</x:ref>
[354]2818  <x:ref>TE-v</x:ref>      = #<x:ref>t-codings</x:ref>
[457]2819  <x:ref>t-codings</x:ref> = "trailers" / ( <x:ref>transfer-extension</x:ref> [ <x:ref>te-params</x:ref> ] )
2820  <x:ref>te-params</x:ref> = <x:ref>OWS</x:ref> ";" <x:ref>OWS</x:ref> "q=" <x:ref>qvalue</x:ref> *( <x:ref>te-ext</x:ref> )
2821  <x:ref>te-ext</x:ref>    = <x:ref>OWS</x:ref> ";" <x:ref>OWS</x:ref> <x:ref>token</x:ref> [ "=" ( <x:ref>token</x:ref> / <x:ref>quoted-string</x:ref> ) ]
[8]2822</artwork></figure>
2823<t>
2824   The presence of the keyword "trailers" indicates that the client is
2825   willing to accept trailer fields in a chunked transfer-coding, as
[673]2826   defined in <xref target="chunked.encoding"/>. This keyword is reserved for use with
[8]2827   transfer-coding values even though it does not itself represent a
2828   transfer-coding.
2829</t>
2830<t>
2831   Examples of its use are:
2832</t>
2833<figure><artwork type="example">
[354]2834  TE: deflate
2835  TE:
2836  TE: trailers, deflate;q=0.5
[8]2837</artwork></figure>
2838<t>
2839   The TE header field only applies to the immediate connection.
2840   Therefore, the keyword &MUST; be supplied within a Connection header
2841   field (<xref target="header.connection"/>) whenever TE is present in an HTTP/1.1 message.
2842</t>
2843<t>
2844   A server tests whether a transfer-coding is acceptable, according to
2845   a TE field, using these rules:
2846  <list style="numbers">
2847    <x:lt>
2848      <t>The "chunked" transfer-coding is always acceptable. If the
2849         keyword "trailers" is listed, the client indicates that it is
2850         willing to accept trailer fields in the chunked response on
2851         behalf of itself and any downstream clients. The implication is
2852         that, if given, the client is stating that either all
2853         downstream clients are willing to accept trailer fields in the
2854         forwarded response, or that it will attempt to buffer the
2855         response on behalf of downstream recipients.
2856      </t><t>
2857         <x:h>Note:</x:h> HTTP/1.1 does not define any means to limit the size of a
2858         chunked response such that a client can be assured of buffering
2859         the entire response.</t>
2860    </x:lt>
2861    <x:lt>
2862      <t>If the transfer-coding being tested is one of the transfer-codings
2863         listed in the TE field, then it is acceptable unless it
[457]2864         is accompanied by a qvalue of 0. (As defined in <xref target="quality.values"/>, a
[8]2865         qvalue of 0 means "not acceptable.")</t>
2866    </x:lt>
2867    <x:lt>
2868      <t>If multiple transfer-codings are acceptable, then the
2869         acceptable transfer-coding with the highest non-zero qvalue is
2870         preferred.  The "chunked" transfer-coding always has a qvalue
2871         of 1.</t>
2872    </x:lt>
2873  </list>
2874</t>
2875<t>
2876   If the TE field-value is empty or if no TE field is present, the only
[457]2877   transfer-coding is "chunked". A message with no transfer-coding is
[8]2878   always acceptable.
2879</t>
2880</section>
2881
2882<section title="Trailer" anchor="header.trailer">
2883  <iref primary="true" item="Trailer header" x:for-anchor=""/>
2884  <iref primary="true" item="Headers" subitem="Trailer" x:for-anchor=""/>
[229]2885  <x:anchor-alias value="Trailer"/>
[354]2886  <x:anchor-alias value="Trailer-v"/>
[8]2887<t>
[697]2888   The "Trailer" general-header field indicates that the given set of
[8]2889   header fields is present in the trailer of a message encoded with
2890   chunked transfer-coding.
2891</t>
[354]2892<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Trailer"/><iref primary="true" item="Grammar" subitem="Trailer-v"/>
[366]2893  <x:ref>Trailer</x:ref>   = "Trailer" ":" <x:ref>OWS</x:ref> <x:ref>Trailer-v</x:ref>
[354]2894  <x:ref>Trailer-v</x:ref> = 1#<x:ref>field-name</x:ref>
[8]2895</artwork></figure>
2896<t>
2897   An HTTP/1.1 message &SHOULD; include a Trailer header field in a
2898   message using chunked transfer-coding with a non-empty trailer. Doing
2899   so allows the recipient to know which header fields to expect in the
2900   trailer.
2901</t>
2902<t>
2903   If no Trailer header field is present, the trailer &SHOULD-NOT;  include
[673]2904   any header fields. See <xref target="chunked.encoding"/> for restrictions on the use of
[8]2905   trailer fields in a "chunked" transfer-coding.
2906</t>
2907<t>
2908   Message header fields listed in the Trailer header field &MUST-NOT;
2909   include the following header fields:
2910  <list style="symbols">
2911    <t>Transfer-Encoding</t>
2912    <t>Content-Length</t>
2913    <t>Trailer</t>
2914  </list>
2915</t>
2916</section>
2917
2918<section title="Transfer-Encoding" anchor="header.transfer-encoding">
2919  <iref primary="true" item="Transfer-Encoding header" x:for-anchor=""/>
2920  <iref primary="true" item="Headers" subitem="Transfer-Encoding" x:for-anchor=""/>
[229]2921  <x:anchor-alias value="Transfer-Encoding"/>
[354]2922  <x:anchor-alias value="Transfer-Encoding-v"/>
[8]2923<t>
[698]2924   The "Transfer-Encoding" general-header field indicates what transfer-codings
2925   (if any) have been applied to the message body. It differs from
2926   Content-Encoding (&content-codings;) in that transfer-codings are a property
2927   of the message (and therefore are removed by intermediaries), whereas
2928   content-codings are not.
[8]2929</t>
[354]2930<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Transfer-Encoding"/><iref primary="true" item="Grammar" subitem="Transfer-Encoding-v"/>
[376]2931  <x:ref>Transfer-Encoding</x:ref>   = "Transfer-Encoding" ":" <x:ref>OWS</x:ref>
2932                        <x:ref>Transfer-Encoding-v</x:ref>
[354]2933  <x:ref>Transfer-Encoding-v</x:ref> = 1#<x:ref>transfer-coding</x:ref>
[8]2934</artwork></figure>
2935<t>
2936   Transfer-codings are defined in <xref target="transfer.codings"/>. An example is:
2937</t>
2938<figure><artwork type="example">
2939  Transfer-Encoding: chunked
2940</artwork></figure>
2941<t>
2942   If multiple encodings have been applied to an entity, the transfer-codings
2943   &MUST; be listed in the order in which they were applied.
2944   Additional information about the encoding parameters &MAY; be provided
2945   by other entity-header fields not defined by this specification.
2946</t>
2947<t>
2948   Many older HTTP/1.0 applications do not understand the Transfer-Encoding
2949   header.
2950</t>
2951</section>
2952
2953<section title="Upgrade" anchor="header.upgrade">
2954  <iref primary="true" item="Upgrade header" x:for-anchor=""/>
2955  <iref primary="true" item="Headers" subitem="Upgrade" x:for-anchor=""/>
[229]2956  <x:anchor-alias value="Upgrade"/>
[354]2957  <x:anchor-alias value="Upgrade-v"/>
[8]2958<t>
[697]2959   The "Upgrade" general-header field allows the client to specify what
[698]2960   additional communication protocols it would like to use, if the server
2961   chooses to switch protocols. Additionally, the server &MUST; use the Upgrade
2962   header field within a 101 (Switching Protocols) response to indicate which
2963   protocol(s) are being switched to.
[8]2964</t>
[354]2965<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Upgrade"/><iref primary="true" item="Grammar" subitem="Upgrade-v"/>
[366]2966  <x:ref>Upgrade</x:ref>   = "Upgrade" ":" <x:ref>OWS</x:ref> <x:ref>Upgrade-v</x:ref>
[354]2967  <x:ref>Upgrade-v</x:ref> = 1#<x:ref>product</x:ref>
[8]2968</artwork></figure>
2969<t>
2970   For example,
2971</t>
2972<figure><artwork type="example">
[354]2973  Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
[8]2974</artwork></figure>
2975<t>
2976   The Upgrade header field is intended to provide a simple mechanism
2977   for transition from HTTP/1.1 to some other, incompatible protocol. It
2978   does so by allowing the client to advertise its desire to use another
2979   protocol, such as a later version of HTTP with a higher major version
2980   number, even though the current request has been made using HTTP/1.1.
2981   This eases the difficult transition between incompatible protocols by
2982   allowing the client to initiate a request in the more commonly
2983   supported protocol while indicating to the server that it would like
2984   to use a "better" protocol if available (where "better" is determined
2985   by the server, possibly according to the nature of the method and/or
2986   resource being requested).
2987</t>
2988<t>
2989   The Upgrade header field only applies to switching application-layer
2990   protocols upon the existing transport-layer connection. Upgrade
2991   cannot be used to insist on a protocol change; its acceptance and use
2992   by the server is optional. The capabilities and nature of the
2993   application-layer communication after the protocol change is entirely
2994   dependent upon the new protocol chosen, although the first action
2995   after changing the protocol &MUST; be a response to the initial HTTP
2996   request containing the Upgrade header field.
2997</t>
2998<t>
2999   The Upgrade header field only applies to the immediate connection.
3000   Therefore, the upgrade keyword &MUST; be supplied within a Connection
3001   header field (<xref target="header.connection"/>) whenever Upgrade is present in an
3002   HTTP/1.1 message.
3003</t>
3004<t>
3005   The Upgrade header field cannot be used to indicate a switch to a
3006   protocol on a different connection. For that purpose, it is more
3007   appropriate to use a 301, 302, 303, or 305 redirection response.
3008</t>
3009<t>
3010   This specification only defines the protocol name "HTTP" for use by
3011   the family of Hypertext Transfer Protocols, as defined by the HTTP
3012   version rules of <xref target="http.version"/> and future updates to this
[684]3013   specification. Additional tokens can be registered with IANA using the
3014   registration procedure defined below. 
[8]3015</t>
[684]3016
3017<section title="Upgrade Token Registry" anchor="upgrade.token.registry">
3018<t>
3019   The HTTP Upgrade Token Registry defines the name space for product
3020   tokens used to identify protocols in the Upgrade header field.
3021   Each registered token should be associated with one or a set of
3022   specifications, and with contact information.
3023</t>
3024<t>
3025   Registrations should be allowed on a First Come First Served basis as
3026   described in <xref target="RFC5226" x:sec="4.1" x:fmt="of"/>. These
3027   specifications need not be IETF documents or be subject to IESG review, but
3028   should obey the following rules:
3029  <list style="numbers">
3030    <t>A token, once registered, stays registered forever.</t>
3031    <t>The registration &MUST; name a responsible party for the
3032       registration.</t>
3033    <t>The registration &MUST; name a point of contact.</t>
3034    <t>The registration &MAY; name the documentation required for the
3035       token.</t>
3036    <t>The responsible party &MAY; change the registration at any time.
3037       The IANA will keep a record of all such changes, and make them
3038       available upon request.</t>
3039    <t>The responsible party for the first registration of a "product"
3040       token &MUST; approve later registrations of a "version" token
3041       together with that "product" token before they can be registered.</t>
3042    <t>If absolutely required, the IESG &MAY; reassign the responsibility
3043       for a token. This will normally only be used in the case when a
3044       responsible party cannot be contacted.</t>
3045  </list>
3046</t>
3047<t>
3048   It is not required that specifications for upgrade tokens be made
3049   publicly available, but the contact information for the registration
3050   should be.
3051</t>
[8]3052</section>
3053
[684]3054
3055</section>
3056
[8]3057<section title="Via" anchor="header.via">
3058  <iref primary="true" item="Via header" x:for-anchor=""/>
3059  <iref primary="true" item="Headers" subitem="Via" x:for-anchor=""/>
[229]3060  <x:anchor-alias value="protocol-name"/>
3061  <x:anchor-alias value="protocol-version"/>
3062  <x:anchor-alias value="pseudonym"/>
3063  <x:anchor-alias value="received-by"/>
3064  <x:anchor-alias value="received-protocol"/>
3065  <x:anchor-alias value="Via"/>
[354]3066  <x:anchor-alias value="Via-v"/>
[8]3067<t>
[697]3068   The "Via" general-header field &MUST; be used by gateways and proxies to
[8]3069   indicate the intermediate protocols and recipients between the user
3070   agent and the server on requests, and between the origin server and
[257]3071   the client on responses. It is analogous to the "Received" field defined in
[327]3072   <xref target="RFC5322" x:fmt="of" x:sec="3.6.7"/> and is intended to be used for tracking message forwards,
[8]3073   avoiding request loops, and identifying the protocol capabilities of
3074   all senders along the request/response chain.
3075</t>
[354]3076<figure><artwork type="abnf2616"><iref primary="true" item="Grammar" subitem="Via"/><iref primary="true" item="Grammar" subitem="Via-v"/><iref primary="true" item="Grammar" subitem="received-protocol"/><iref primary="true" item="Grammar" subitem="protocol-name"/><iref primary="true" item="Grammar" subitem="protocol-version"/><iref primary="true" item="Grammar" subitem="received-by"/><iref primary="true" item="Grammar" subitem="pseudonym"/>
[366]3077  <x:ref>Via</x:ref>               = "Via" ":" <x:ref>OWS</x:ref> <x:ref>Via-v</x:ref>
[376]3078  <x:ref>Via-v</x:ref>             = 1#( <x:ref>received-protocol</x:ref> <x:ref>RWS</x:ref> <x:ref>received-by</x:ref>
3079                          [ <x:ref>RWS</x:ref> <x:ref>comment</x:ref> ] )
[229]3080  <x:ref>received-protocol</x:ref> = [ <x:ref>protocol-name</x:ref> "/" ] <x:ref>protocol-version</x:ref>
3081  <x:ref>protocol-name</x:ref>     = <x:ref>token</x:ref>
3082  <x:ref>protocol-version</x:ref>  = <x:ref>token</x:ref>
[334]3083  <x:ref>received-by</x:ref>       = ( <x:ref>uri-host</x:ref> [ ":" <x:ref>port</x:ref> ] ) / <x:ref>pseudonym</x:ref>
[229]3084  <x:ref>pseudonym</x:ref>         = <x:ref>token</x:ref>
[8]3085</artwork></figure>
3086<t>
3087   The received-protocol indicates the protocol version of the message
3088   received by the server or client along each segment of the
3089   request/response chain. The received-protocol version is appended to
3090   the Via field value when the message is forwarded so that information
3091   about the protocol capabilities of upstream applications remains
3092   visible to all recipients.
3093</t>
3094<t>
3095   The protocol-name is optional if and only if it would be "HTTP". The
3096   received-by field is normally the host and optional port number of a
3097   recipient server or client that subsequently forwarded the message.
3098   However, if the real host is considered to be sensitive information,
3099   it &MAY; be replaced by a pseudonym. If the port is not given, it &MAY;
3100   be assumed to be the default port of the received-protocol.
3101</t>
3102<t>
3103   Multiple Via field values represents each proxy or gateway that has
3104   forwarded the message. Each recipient &MUST; append its information
3105   such that the end result is ordered according to the sequence of
3106   forwarding applications.
3107</t>
3108<t>
3109   Comments &MAY; be used in the Via header field to identify the software
3110   of the recipient proxy or gateway, analogous to the User-Agent and
3111   Server header fields. However, all comments in the Via field are
3112   optional and &MAY; be removed by any recipient prior to forwarding the
3113   message.
3114</t>
3115<t>
3116   For example, a request message could be sent from an HTTP/1.0 user
3117   agent to an internal proxy code-named "fred", which uses HTTP/1.1 to
[90]3118   forward the request to a public proxy at p.example.net, which completes
3119   the request by forwarding it to the origin server at www.example.com.
3120   The request received by www.example.com would then have the following
[8]3121   Via header field:
3122</t>
3123<figure><artwork type="example">
[354]3124  Via: 1.0 fred, 1.1 p.example.net (Apache/1.1)
[8]3125</artwork></figure>
3126<t>
3127   Proxies and gateways used as a portal through a network firewall
3128   &SHOULD-NOT;, by default, forward the names and ports of hosts within
3129   the firewall region. This information &SHOULD; only be propagated if
3130   explicitly enabled. If not enabled, the received-by host of any host
3131   behind the firewall &SHOULD; be replaced by an appropriate pseudonym
3132   for that host.
3133</t>
3134<t>
3135   For organizations that have strong privacy requirements for hiding
3136   internal structures, a proxy &MAY; combine an ordered subsequence of
3137   Via header field entries with identical received-protocol values into
3138   a single such entry. For example,
3139</t>
3140<figure><artwork type="example">
[354]3141  Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy
[8]3142</artwork></figure>
3143<t>
3144        could be collapsed to
3145</t>
3146<figure><artwork type="example">
[354]3147  Via: 1.0 ricky, 1.1 mertz, 1.0 lucy
[8]3148</artwork></figure>
3149<t>
3150   Applications &SHOULD-NOT;  combine multiple entries unless they are all
3151   under the same organizational control and the hosts have already been
3152   replaced by pseudonyms. Applications &MUST-NOT; combine entries which
3153   have different received-protocol values.
3154</t>
3155</section>
3156
3157</section>
3158
[29]3159<section title="IANA Considerations" anchor="IANA.considerations">
[680]3160
[253]3161<section title="Message Header Registration" anchor="message.header.registration">
[8]3162<t>
[290]3163   The Message Header Registry located at <eref target="http://www.iana.org/assignments/message-headers/message-header-index.html"/> should be updated
3164   with the permanent registrations below (see <xref target="RFC3864"/>):
[8]3165</t>
[680]3166<?BEGININC p1-messaging.iana-headers ?>
[290]3167<!--AUTOGENERATED FROM extract-header-defs.xslt, do not edit manually-->
3168<texttable align="left" suppress-title="true" anchor="iana.header.registration.table">
[253]3169   <ttcol>Header Field Name</ttcol>
3170   <ttcol>Protocol</ttcol>
3171   <ttcol>Status</ttcol>
3172   <ttcol>Reference</ttcol>
3173
3174   <c>Connection</c>
3175   <c>http</c>
3176   <c>standard</c>
3177   <c>
3178      <xref target="header.connection"/>
3179   </c>
3180   <c>Content-Length</c>
3181   <c>http</c>
3182   <c>standard</c>
3183   <c>
3184      <xref target="header.content-length"/>
3185   </c>
3186   <c>Date</c>
3187   <c>http</c>
3188   <c>standard</c>
3189   <c>
3190      <xref target="header.date"/>
3191   </c>
3192   <c>Host</c>
3193   <c>http</c>
3194   <c>standard</c>
3195   <c>
3196      <xref target="header.host"/>
3197   </c>
3198   <c>TE</c>
3199   <c>http</c>
3200   <c>standard</c>
3201   <c>
3202      <xref target="header.te"/>
3203   </c>
3204   <c>Trailer</c>
3205   <c>http</c>
3206   <c>standard</c>
3207   <c>
3208      <xref target="header.trailer"/>
3209   </c>
3210   <c>Transfer-Encoding</c>
3211   <c>http</c>
3212   <c>standard</c>
3213   <c>
3214      <xref target="header.transfer-encoding"/>
3215   </c>
3216   <c>Upgrade</c>
3217   <c>http</c>
3218   <c>standard</c>
3219   <c>
3220      <xref target="header.upgrade"/>
3221   </c>
3222   <c>Via</c>
3223   <c>http</c>
3224   <c>standard</c>
3225   <c>
3226      <xref target="header.via"/>
3227   </c>
3228</texttable>
[290]3229<!--(END)-->
[680]3230<?ENDINC p1-messaging.iana-headers ?>
[253]3231<t>
[290]3232   The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force".
[253]3233</t>
[8]3234</section>
[307]3235
3236<section title="URI Scheme Registration" anchor="uri.scheme.registration">
3237<t>
[646]3238   The entries for the "http" and "https" URI Schemes in the registry located at
[307]3239   <eref target="http://www.iana.org/assignments/uri-schemes.html"/>
[646]3240   should be updated to point to Sections <xref target="http.uri" format="counter"/>
3241   and <xref target="https.uri" format="counter"/> of this document
[307]3242   (see <xref target="RFC4395"/>).
3243</t>
3244</section>
3245
[296]3246<section title="Internet Media Type Registrations" anchor="internet.media.type.http">
3247<t>
3248   This document serves as the specification for the Internet media types
3249   "message/http" and "application/http". The following is to be registered with
3250   IANA (see <xref target="RFC4288"/>).
3251</t>
3252<section title="Internet Media Type message/http" anchor="internet.media.type.message.http">
3253<iref item="Media Type" subitem="message/http" primary="true"/>
3254<iref item="message/http Media Type" primary="true"/>
3255<t>
3256   The message/http type can be used to enclose a single HTTP request or
3257   response message, provided that it obeys the MIME restrictions for all
3258   "message" types regarding line length and encodings.
3259</t>
3260<t>
3261  <list style="hanging" x:indent="12em">
3262    <t hangText="Type name:">
3263      message
3264    </t>
3265    <t hangText="Subtype name:">
3266      http
3267    </t>
3268    <t hangText="Required parameters:">
3269      none
3270    </t>
3271    <t hangText="Optional parameters:">
3272      version, msgtype
3273      <list style="hanging">
3274        <t hangText="version:">
3275          The HTTP-Version number of the enclosed message
3276          (e.g., "1.1"). If not present, the version can be
3277          determined from the first line of the body.
3278        </t>
3279        <t hangText="msgtype:">
3280          The message type -- "request" or "response". If not
3281          present, the type can be determined from the first
3282          line of the body.
3283        </t>
3284      </list>
3285    </t>
3286    <t hangText="Encoding considerations:">
3287      only "7bit", "8bit", or "binary" are permitted
3288    </t>
3289    <t hangText="Security considerations:">
3290      none
3291    </t>
3292    <t hangText="Interoperability considerations:">
3293      none
3294    </t>
3295    <t hangText="Published specification:">
3296      This specification (see <xref target="internet.media.type.message.http"/>).
3297    </t>
3298    <t hangText="Applications that use this media type:">
3299    </t>
3300    <t hangText="Additional information:">
3301      <list style="hanging">
3302        <t hangText="Magic number(s):">none</t>
3303        <t hangText="File extension(s):">none</t>
3304        <t hangText="Macintosh file type code(s):">none</t>
3305      </list>
3306    </t>
3307    <t hangText="Person and email address to contact for further information:">
3308      See Authors Section.
3309    </t>
[609]3310    <t hangText="Intended usage:">
3311      COMMON
[296]3312    </t>
[609]3313    <t hangText="Restrictions on usage:">
3314      none
[296]3315    </t>
3316    <t hangText="Author/Change controller:">
3317      IESG
3318    </t>
3319  </list>
3320</t>
[253]3321</section>
[296]3322<section title="Internet Media Type application/http" anchor="internet.media.type.application.http">
3323<iref item="Media Type" subitem="application/http" primary="true"/>
3324<iref item="application/http Media Type" primary="true"/>
3325<t>
3326   The application/http type can be used to enclose a pipeline of one or more
3327   HTTP request or response messages (not intermixed).
3328</t>
3329<t>
3330  <list style="hanging" x:indent="12em">
3331    <t hangText="Type name:">
3332      application
3333    </t>
3334    <t hangText="Subtype name:">
3335      http
3336    </t>
3337    <t hangText="Required parameters:">
3338      none
3339    </t>
3340    <t hangText="Optional parameters:">
3341      version, msgtype
3342      <list style="hanging">
3343        <t hangText="version:">
3344          The HTTP-Version number of the enclosed messages
3345          (e.g., "1.1"). If not present, the version can be
3346          determined from the first line of the body.
3347        </t>
3348        <t hangText="msgtype:">
3349          The message type -- "request" or "response". If not
3350          present, the type can be determined from the first
3351          line of the body.
3352        </t>
3353      </list>
3354    </t>
3355    <t hangText="Encoding considerations:">
3356      HTTP messages enclosed by this type
3357      are in "binary" format; use of an appropriate
3358      Content-Transfer-Encoding is required when
3359      transmitted via E-mail.
3360    </t>
3361    <t hangText="Security considerations:">
3362      none
3363    </t>
3364    <t hangText="Interoperability considerations:">
3365      none
3366    </t>
3367    <t hangText="Published specification:">
3368      This specification (see <xref target="internet.media.type.application.http"/>).
3369    </t>
3370    <t hangText="Applications that use this media type:">
3371    </t>
3372    <t hangText="Additional information:">
3373      <list style="hanging">
3374        <t hangText="Magic number(s):">none</t>
3375        <t hangText="File extension(s):">none</t>
3376        <t hangText="Macintosh file type code(s):">none</t>
3377      </list>
3378    </t>
3379    <t hangText="Person and email address to contact for further information:">
3380      See Authors Section.
3381    </t>
[609]3382    <t hangText="Intended usage:">
3383      COMMON
[296]3384    </t>
[609]3385    <t hangText="Restrictions on usage:">
3386      none
[296]3387    </t>
3388    <t hangText="Author/Change controller:">
3389      IESG
3390    </t>
3391  </list>
3392</t>
3393</section>
3394</section>
[307]3395
[650]3396<section title="Transfer Coding Registry" anchor="transfer.coding.registration">
3397<t>
[673]3398   The registration procedure for HTTP Transfer Codings is now defined by
3399   <xref target="transfer.coding.registry"/> of this document.
[650]3400</t>
3401<t>
3402   The HTTP Transfer Codings Registry located at <eref target="http://www.iana.org/assignments/http-parameters"/>
[673]3403   should be updated with the registrations below:
[650]3404</t>
3405<texttable align="left" suppress-title="true" anchor="iana.transfer.coding.registration.table">
[670]3406   <ttcol>Name</ttcol>
[650]3407   <ttcol>Description</ttcol>
3408   <ttcol>Reference</ttcol>
[673]3409   <c>chunked</c>
[650]3410   <c>Transfer in a series of chunks</c>
3411   <c>
[673]3412      <xref target="chunked.encoding"/>
[650]3413   </c>
[673]3414   <c>compress</c>
3415   <c>UNIX "compress" program method</c>
3416   <c>
3417      <xref target="compress.coding"/>
3418   </c>
3419   <c>deflate</c>
3420   <c>"zlib" format <xref target="RFC1950"/> with "deflate" compression</c>
3421   <c>
3422      <xref target="deflate.coding"/>
3423   </c>
3424   <c>gzip</c>
3425   <c>Same as GNU zip <xref target="RFC1952"/></c>
3426   <c>
3427      <xref target="gzip.coding"/>
3428   </c>
[650]3429</texttable>
[296]3430</section>
[8]3431
[684]3432<section title="Upgrade Token Registration" anchor="upgrade.token.registration">
3433<t>
3434   The registration procedure for HTTP Upgrade Tokens -- previously defined
3435   in <xref target="RFC2817" x:fmt="of" x:sec="7.2"/> -- is now defined
3436   by <xref target="upgrade.token.registry"/> of this document.
3437</t>
3438<t>
3439   The HTTP Status Code Registry located at <eref target="http://www.iana.org/assignments/http-upgrade-tokens/"/>
3440   should be updated with the registration below:
3441</t>
3442<texttable align="left" suppress-title="true">
3443   <ttcol>Value</ttcol>
3444   <ttcol>Description</ttcol>
3445   <ttcol>Reference</ttcol>
3446
3447   <c>HTTP</c>
3448   <c>Hypertext Transfer Protocol</c> 
3449   <c><xref target="http.version"/> of this specification</c>
3450<!-- IANA should add this without our instructions; emailed on June 05, 2009
3451   <c>TLS/1.0</c>
3452   <c>Transport Layer Security</c>
3453   <c><xref target="RFC2817"/></c> -->
3454
3455</texttable>
[650]3456</section>
3457
[684]3458</section>
3459
[8]3460<section title="Security Considerations" anchor="security.considerations">
3461<t>
3462   This section is meant to inform application developers, information
3463   providers, and users of the security limitations in HTTP/1.1 as
3464   described by this document. The discussion does not include
3465   definitive solutions to the problems revealed, though it does make
3466   some suggestions for reducing security risks.
3467</t>
3468
3469<section title="Personal Information" anchor="personal.information">
3470<t>
3471   HTTP clients are often privy to large amounts of personal information
3472   (e.g. the user's name, location, mail address, passwords, encryption
3473   keys, etc.), and &SHOULD; be very careful to prevent unintentional
[172]3474   leakage of this information.
[8]3475   We very strongly recommend that a convenient interface be provided
3476   for the user to control dissemination of such information, and that
3477   designers and implementors be particularly careful in this area.
3478   History shows that errors in this area often create serious security
3479   and/or privacy problems and generate highly adverse publicity for the
3480   implementor's company.
3481</t>
[29]3482</section>
[8]3483
3484<section title="Abuse of Server Log Information" anchor="abuse.of.server.log.information">
3485<t>
3486   A server is in the position to save personal data about a user's
3487   requests which might identify their reading patterns or subjects of
3488   interest. This information is clearly confidential in nature and its
3489   handling can be constrained by law in certain countries. People using
[172]3490   HTTP to provide data are responsible for ensuring that
[8]3491   such material is not distributed without the permission of any
3492   individuals that are identifiable by the published results.
3493</t>
3494</section>
3495
3496<section title="Attacks Based On File and Path Names" anchor="attack.pathname">
3497<t>
3498   Implementations of HTTP origin servers &SHOULD; be careful to restrict
3499   the documents returned by HTTP requests to be only those that were
3500   intended by the server administrators. If an HTTP server translates
3501   HTTP URIs directly into file system calls, the server &MUST; take
3502   special care not to serve files that were not intended to be
3503   delivered to HTTP clients. For example, UNIX, Microsoft Windows, and
3504   other operating systems use ".." as a path component to indicate a
3505   directory level above the current one. On such a system, an HTTP
[391]3506   server &MUST; disallow any such construct in the request-target if it
[8]3507   would otherwise allow access to a resource outside those intended to
3508   be accessible via the HTTP server. Similarly, files intended for
3509   reference only internally to the server (such as access control
3510   files, configuration files, and script code) &MUST; be protected from
3511   inappropriate retrieval, since they might contain sensitive
3512   information. Experience has shown that minor bugs in such HTTP server
3513   implementations have turned into security risks.
3514</t>
3515</section>
3516
3517<section title="DNS Spoofing" anchor="dns.spoofing">
3518<t>
3519   Clients using HTTP rely heavily on the Domain Name Service, and are
3520   thus generally prone to security attacks based on the deliberate
3521   mis-association of IP addresses and DNS names. Clients need to be
3522   cautious in assuming the continuing validity of an IP number/DNS name
3523   association.
3524</t>
3525<t>
3526   In particular, HTTP clients &SHOULD; rely on their name resolver for
3527   confirmation of an IP number/DNS name association, rather than
3528   caching the result of previous host name lookups. Many platforms
3529   already can cache host name lookups locally when appropriate, and
3530   they &SHOULD; be configured to do so. It is proper for these lookups to
3531   be cached, however, only when the TTL (Time To Live) information
3532   reported by the name server makes it likely that the cached
3533   information will remain useful.
3534</t>
3535<t>
3536   If HTTP clients cache the results of host name lookups in order to
3537   achieve a performance improvement, they &MUST; observe the TTL
3538   information reported by DNS.
3539</t>
3540<t>
3541   If HTTP clients do not observe this rule, they could be spoofed when
3542   a previously-accessed server's IP address changes. As network
3543   renumbering is expected to become increasingly common <xref target="RFC1900"/>, the
3544   possibility of this form of attack will grow. Observing this
3545   requirement thus reduces this potential security vulnerability.
3546</t>
3547<t>
3548   This requirement also improves the load-balancing behavior of clients
3549   for replicated servers using the same DNS name and reduces the
3550   likelihood of a user's experiencing failure in accessing sites which
3551   use that strategy.
3552</t>
3553</section>
3554
3555<section title="Proxies and Caching" anchor="attack.proxies">
3556<t>
3557   By their very nature, HTTP proxies are men-in-the-middle, and
3558   represent an opportunity for man-in-the-middle attacks. Compromise of
3559   the systems on which the proxies run can result in serious security
3560   and privacy problems. Proxies have access to security-related
3561   information, personal information about individual users and
3562   organizations, and proprietary information belonging to users and
3563   content providers. A compromised proxy, or a proxy implemented or
3564   configured without regard to security and privacy considerations,
3565   might be used in the commission of a wide range of potential attacks.
3566</t>
3567<t>
3568   Proxy operators should protect the systems on which proxies run as
3569   they would protect any system that contains or transports sensitive
3570   information. In particular, log information gathered at proxies often
3571   contains highly sensitive personal information, and/or information
3572   about organizations. Log information should be carefully guarded, and
3573   appropriate guidelines for use developed and followed. (<xref target="abuse.of.server.log.information"/>).
3574</t>
3575<t>
3576   Proxy implementors should consider the privacy and security
3577   implications of their design and coding decisions, and of the
3578   configuration options they provide to proxy operators (especially the
3579   default configuration).
3580</t>
3581<t>
3582   Users of a proxy need to be aware that they are no trustworthier than
3583   the people who run the proxy; HTTP itself cannot solve this problem.
3584</t>
3585<t>
3586   The judicious use of cryptography, when appropriate, may suffice to
3587   protect against a broad range of security and privacy attacks. Such
3588   cryptography is beyond the scope of the HTTP/1.1 specification.
3589</t>
[29]3590</section>
[8]3591
3592<section title="Denial of Service Attacks on Proxies" anchor="attack.DoS">
3593<t>
3594   They exist. They are hard to defend against. Research continues.
3595   Beware.
3596</t>
3597</section>
3598</section>
3599
3600<section title="Acknowledgments" anchor="ack">
3601<t>
[172]3602   HTTP has evolved considerably over the years. It has
[8]3603   benefited from a large and active developer community--the many
3604   people who have participated on the www-talk mailing list--and it is
3605   that community which has been most responsible for the success of
3606   HTTP and of the World-Wide Web in general. Marc Andreessen, Robert
3607   Cailliau, Daniel W. Connolly, Bob Denny, John Franks, Jean-Francois
3608   Groff, Phillip M. Hallam-Baker, Hakon W. Lie, Ari Luotonen, Rob
3609   McCool, Lou Montulli, Dave Raggett, Tony Sanders, and Marc
3610   VanHeyningen deserve special recognition for their efforts in
3611   defining early aspects of the protocol.
3612</t>
3613<t>
3614   This document has benefited greatly from the comments of all those
3615   participating in the HTTP-WG. In addition to those already mentioned,
3616   the following individuals have contributed to this specification:
3617</t>
3618<t>
[98]3619   Gary Adams, Harald Tveit Alvestrand, Keith Ball, Brian Behlendorf,
3620   Paul Burchard, Maurizio Codogno, Mike Cowlishaw, Roman Czyborra,
3621   Michael A. Dolan, Daniel DuBois, David J. Fiander, Alan Freier, Marc Hedlund, Greg Herlihy,
3622   Koen Holtman, Alex Hopmann, Bob Jernigan, Shel Kaphan, Rohit Khare,
3623   John Klensin, Martijn Koster, Alexei Kosut, David M. Kristol,
3624   Daniel LaLiberte, Ben Laurie, Paul J. Leach, Albert Lunde,
3625   John C. Mallery, Jean-Philippe Martin-Flatin, Mitra, David Morris,
3626   Gavin Nicol, Ross Patterson, Bill Perry, Jeffrey Perry, Scott Powers, Owen Rees,
3627   Luigi Rizzo, David Robinson, Marc Salomon, Rich Salz,
3628   Allan M. Schiffman, Jim Seidman, Chuck Shotton, Eric W. Sink,
3629   Simon E. Spero, Richard N. Taylor, Robert S. Thau,
3630   Bill (BearHeart) Weinman, Francois Yergeau, Mary Ellen Zurko,
3631   Josh Cohen.
3632</t>
3633<t>
[33]3634   Thanks to the "cave men" of Palo Alto. You know who you are.
3635</t>
3636<t>
[115]3637   Jim Gettys (the editor of <xref target="RFC2616"/>) wishes particularly
3638   to thank Roy Fielding, the editor of <xref target="RFC2068"/>, along
[33]3639   with John Klensin, Jeff Mogul, Paul Leach, Dave Kristol, Koen
3640   Holtman, John Franks, Josh Cohen, Alex Hopmann, Scott Lawrence, and
3641   Larry Masinter for their help. And thanks go particularly to Jeff
3642   Mogul and Scott Lawrence for performing the "MUST/MAY/SHOULD" audit.
3643</t>
3644<t>
3645   The Apache Group, Anselm Baird-Smith, author of Jigsaw, and Henrik
3646   Frystyk implemented RFC 2068 early, and we wish to thank them for the
3647   discovery of many of the problems that this document attempts to
3648   rectify.
3649</t>
[374]3650<t>
3651   This specification makes heavy use of the augmented BNF and generic
3652   constructs defined by David H. Crocker for <xref target="RFC5234"/>. Similarly, it
3653   reuses many of the definitions provided by Nathaniel Borenstein and
3654   Ned Freed for MIME <xref target="RFC2045"/>. We hope that their inclusion in this
3655   specification will help reduce past confusion over the relationship
3656   between HTTP and Internet mail message formats.
3657</t>
[8]3658</section>
3659
3660</middle>
3661<back>
3662
[119]3663<references title="Normative References">
3664
[121]3665<reference anchor="ISO-8859-1">
3666  <front>
3667    <title>
3668     Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1
3669    </title>
3670    <author>
3671      <organization>International Organization for Standardization</organization>
3672    </author>
3673    <date year="1998"/>
3674  </front>
3675  <seriesInfo name="ISO/IEC" value="8859-1:1998"/>
3676</reference>
3677
[31]3678<reference anchor="Part2">
[119]3679  <front>
3680    <title abbrev="HTTP/1.1">HTTP/1.1, part 2: Message Semantics</title>
3681    <author initials="R." surname="Fielding" fullname="Roy T. Fielding" role="editor">
3682      <organization abbrev="Day Software">Day Software</organization>
3683      <address><email>fielding@gbiv.com</email></address>
3684    </author>
3685    <author initials="J." surname="Gettys" fullname="Jim Gettys">
3686      <organization>One Laptop per Child</organization>
3687      <address><email>jg@laptop.org</email></address>
3688    </author>
3689    <author initials="J." surname="Mogul" fullname="Jeffrey C. Mogul">
3690      <organization abbrev="HP">Hewlett-Packard Company</organization>
3691      <address><email>JeffMogul@acm.org</email></address>
3692    </author>
3693    <author initials="H." surname="Frystyk" fullname="Henrik Frystyk Nielsen">
3694      <organization abbrev="Microsoft">Microsoft Corporation</organization>
3695      <address><email>henrikn@microsoft.com</email></address>
3696    </author>
3697    <author initials="L." surname="Masinter" fullname="Larry Masinter">
3698      <organization abbrev="Adobe Systems">Adobe Systems, Incorporated</organization>
3699      <address><email>LMM@acm.org</email></address>
3700    </author>
3701    <author initials="P." surname="Leach" fullname="Paul J. Leach">
3702      <organization abbrev="Microsoft">Microsoft Corporation</organization>
3703      <address><email>paulle@microsoft.com</email></address>
3704    </author>
3705    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
3706      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
3707      <address><email>timbl@w3.org</email></address>
3708    </author>
3709    <author initials="Y." surname="Lafon" fullname="Yves Lafon" role="editor">