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

Last change on this file since 877 was 877, checked in by fielding@…, 9 years ago

Addresses #159: HTTP(s) URI scheme definitions

Make clear that userinfo is not allowed.
Clarify the differences between "http" and "https".

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