Network Working GroupR. Fielding
Internet DraftDay Software
<draft-lafon-rfc2616bis-latest> J. Gettys
Obsoletes: 2616 (if approved)One Laptop per Child
Intended status: Standards TrackJ. Mogul
Expires: June 2008HP
H. Frystyk
Microsoft
L. Masinter
Adobe Systems
P. Leach
Microsoft
T. Berners-Lee
W3C/MIT
Y. Lafon, Editor
W3C
J. F. Reschke, Editor
greenbytes
December 2007

Hypertext Transfer Protocol -- HTTP/1.1
draft-lafon-rfc2616bis-latest

Status of this Memo

By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as “work in progress”.

The list of current Internet-Drafts can be accessed at <http://www.ietf.org/ietf/1id-abstracts.txt>.

The list of Internet-Draft Shadow Directories can be accessed at <http://www.ietf.org/shadow.html>.

This Internet-Draft will expire in June 2008.

Copyright Notice

Copyright © The IETF Trust (2007). All Rights Reserved.

Abstract

The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers [RFC2324]. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred.

HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as "HTTP/1.1", and is an update to RFC2616.

Editorial Note (To be removed by RFC Editor before publication)

Distribution of this document is unlimited. Please send comments to the Hypertext Transfer Protocol (HTTP) mailing list at ietf-http-wg@w3.org, which may be joined by sending a message with subject "subscribe" to ietf-http-wg-request@w3.org. Discussions of the HTTP working group are archived at <http://lists.w3.org/Archives/Public/ietf-http-wg/>. XML versions, latest edits and the issues list for this document are available from <http://www.w3.org/Protocols/HTTP/1.1/rfc2616bis/>.

The purpose of this document is to revise [RFC2616], doing only minimal corrections. For now, it is not planned to advance the standards level of HTTP, thus - if published - the specification will still be a "Proposed Standard" (see [RFC2026]).

The current plan is to incorporate known errata, and to update the specification text according to the current IETF publication guidelines. In particular:

This document is based on a variant of the original RFC2616 specification formatted using Marshall T. Rose's "xml2rfc" tool (see <http://xml.resource.org>) and therefore deviates from the original text in word wrapping, page breaks, list formatting, reference formatting, whitespace usage and appendix numbering. Otherwise, it is supposed to contain an accurate copy of the original specification text. See <http://www.w3.org/Protocols/HTTP/1.1/rfc2616bis-00-from-rfc2616.diff.html> for a comparison between both documents, as generated by "rfcdiff" (<http://tools.ietf.org/tools/rfcdiff/>).


Table of Contents

Issues list

IdTypeStatusDateRaised By
abnf-case-insensitiveeditclosed2007-11-20julian.reschke@greenbytes.de
abnf-chunk-datachangeclosed2007-11-22julian.reschke@greenbytes.de
abnf-dquoteeditclosed2007-11-20julian.reschke@greenbytes.de
abnf-prose-creditclosed2007-11-20julian.reschke@greenbytes.de
abnf-rule-nameseditclosed2007-11-22julian.reschke@greenbytes.de
i70-cacheability-of-303changeclosed2007-07-12fielding@gbiv.com
i82-rel_path-not-usedchangeclosed2007-10-07julian.reschke@gmx.de
14.11-content-encoding_response_vs_messagechangeopen2006-12-14a-travis@microsoft.com
abnfchangeopen2006-12-03julian.reschke@greenbytes.de
abnf-avoid-prosechangeopen2007-11-23julian.reschke@greenbytes.de
editeditopen2006-10-08julian.reschke@greenbytes.de
fragment-combinationchangeopen1999-08-06fielding@kiwi.ics.uci.edu
i19-bodies-on-GETchangeopen2006-06-22Jeff.Mogul@hp.com
i20-default-charsets-for-text-media-typeschangeopen2006-05-01mnot@yahoo-inc.com
i21-put-side-effectschangeopen2006-04-03mnot@yahoo-inc.com
i22-etag-and-other-metadata-in-status-messageschangeopen2006-08-09julian.reschke@gmx.de
i23-no-store-invalidationchangeopen2005-07-26rousskov@measurement-factory.com
i24-requiring-allow-in-405-responseschangeopen2005-06-23fielding@gbiv.com
i27-put-idempotencychangeopen2005-03-16mnot@yahoo-inc.com
i28-connection-closingchangeopen2005-02-26joe@manyfish.co.uk
i29-age-calculationchangeopen2002-08-30rousskov@measurement-factory.com
i30-header-lwschangeopen2004-03-15jamie@shareable.org
i32-options-asteriskchangeopen2003-11-24julian.reschke@gmx.de
i33-trace-security-considerationschangeopen2003-02-14rousskov@measurement-factory.com
i34-updated-reference-for-urischangeopen2006-11-14julian.reschke@greenbytes.de
i35-split-normative-and-informative-referenceschangeopen
i37-vary-and-non-existant-headerschangeopen2004-02-23jamie@shareable.org
i38-mismatched-varychangeopen2006-10-20hno@squid-cache.org
i39-etag-uniquenesschangeopen2006-10-19henrik@henriknordstrom.net
i40-header-registrationchangeopen
i41-security-considerationschangeopen
i50-misc-typoseditopen2006-12-18a-travis@microsoft.com
i51-http-date-vs-rfc1123-datechangeopen2006-12-18a-travis@microsoft.com
i52-sort-1.3-terminologyeditopen2006-12-21a-travis@microsoft.com
i53-allow-is-not-in-13.5.2changeopen2006-12-20a-travis@microsoft.com
i54-definition-of-1xx-warn-codeschangeopen2006-12-22a-travis@microsoft.com
i55-updating-to-rfc4288editopen2007-01-05julian.reschke@gmx.de
i56-6.1.1-can-be-misread-as-a-complete-listeditopen2007-01-11henrik@henriknordstrom.net
i57-status-code-and-reason-phrasechangeopen2007-01-11henrik@henriknordstrom.net
i58-what-identifies-an-http-resourcechangeopen2007-01-23julian.reschke@gmx.de
i59-status-code-registryeditopen2007-02-18henrik@henriknordstrom.net
i60-13.5.1-and-13.5.2editopen2007-03-30mnot@yahoo-inc.com
i61-redirection-vs-locationeditopen2007-04-19julian.reschke@gmx.de
i63-header-length-limit-with-encoded-wordschangeopen2007-05-14derhoermi@gmx.net
i64-ws-in-quoted-pairchangeopen2007-04-20dan.winship@gmail.com
i67-quoting-charsetschangeopen2007-05-23maiera@de.ibm.com
i69-clarify-requested-variantchangeopen2007-07-13julian.reschke@gmx.de
i71-examples-for-etag-matchingchangeopen2006-12-02julian.reschke@greenbytes.de
i72-request-method-registrychangeopen2007-08-06henrik@henriknordstrom.net
i73-clarification-of-the-term-deflatechangeopen2007-08-07paul_marquess@yahoo.co.uk
i74-character-encodings-for-headerschangeopen2007-07-10duerst@it.aoyama.ac.jp
i75-rfc2145-normativechangeopen2007-06-07Jeff.Mogul@hp.com
i76-deprecate-305-use-proxychangeopen2007-06-15adrien@qbik.com
i77-line-foldingchangeopen2007-01-19fielding@gbiv.com
i78-relationship-between-401-authorization-and-www-authenticatechangeopen2007-07-25hugo@yahoo-inc.com
i79-content-headers-vs-putchangeopen2007-07-25julian.reschke@greenbytes.de
i80-content-location-is-not-specialchangeopen2007-07-31julian.reschke@greenbytes.de
i81-content-negotiation-for-media-typeschangeopen2006-04-11lmm@acm.org
i83-options-asterisk-and-proxieschangeopen2007-10-01hno@squid-cache.org
i85-custom-rangeschangeopen2007-08-25kornel@geekhood.net
i88-205-bodieschangeopen2007-11-29julian.reschke@greenbytes.de
i89-if-dash-and-entitieschangeopen2007-10-31henrik@henriknordstrom.net
i90-delimiting-messages-with-multipart-byterangeschangeopen2007-11-18derhoermi@gmx.net
i91-duplicate-host-header-requirementschangeopen2007-11-14julian.reschke@gmx.de
i92-empty-host-headerschangeopen2007-11-21derhoermi@gmx.net
i93-repeating-single-value-headerschangeopen2007-11-20julian.reschke@gmx.de
i94-reason-phrase-bnfchangeopen2007-11-23julian.reschke@gmx.de
languagetagchangeopen2006-10-14julian.reschke@greenbytes.de
link-headerchangeopen2007-09-02julian.reschke@gmx.de
need_iana_considerationschangeopen2006-10-24julian.reschke@greenbytes.de
rfc1737_informative_and_obsoletechangeopen2006-10-27julian.reschke@greenbytes.de
rfc2048_informative_and_obsoleteeditopen2006-11-15julian.reschke@greenbytes.de
rfc2616biseditopen2006-10-10julian.reschke@greenbytes.de
rfc2822_normativechangeopen2006-12-03julian.reschke@greenbytes.de
uri_vs_request_urichangeopen2007-01-24julian.reschke@greenbytes.de
 I  rfc2616bis   (type: edit, status: open)
julian.reschke@greenbytes.de2006-10-10 Umbrella issue for changes with respect to the revision process itself.
Associated changes in this document: <#rfc.change.rfc2616bis.1>.
 I  i35-split-normative-and-informative-references   (type: change, status: open)
References are now required to be split into "Normative" and "Informative".
julian.reschke@gmx.de2007-10-12 See related issues: i65-informative-references, i68-encoding-references-normative, i75-rfc2145-normative, rfc1737_informative_and_obsolete, rfc1766_normative, i86-normative-up-to-date-references, rfc2048_informative_and_obsolete, rfc2396_normative, rfc2616bis, rfc2822_normative, unneeded_references, uri_vs_request_uri and usascii_normative.
 I  i40-header-registration   (type: change, status: open)
A revision of RFC2616 should mention BCP 90 (Registration Procedures for Message Header Fields) and should take over as the authoritative reference for the headers it contains.
 I  need_iana_considerations   (type: change, status: open)
julian.reschke@greenbytes.de2006-10-24 We need an IANA Considerations section. Include update to HTTP header registration there? (Also: do we need a method name registry?)
 I  edit   (type: edit, status: open)
julian.reschke@greenbytes.de2006-10-08 Umbrella issue for editorial fixes/enhancements.
Associated changes in this document: 3.1, 3.1, 13.1, G.
 I  abnf-dquote   (type: edit, status: closed)
julian.reschke@greenbytes.de2007-11-20 Use DQUOTE instead of <"> in BNF.
2007-11-20Resolution: Done.
Associated changes in this document: 2.2, 2.2, 2.2, 2.2, 2.2, del-, 2.2, 14.9, 14.9, 14.9, 14.9, 14.9, 14.9, 14.46, 14.46.
 I  abnf-avoid-prose   (type: change, status: open)
julian.reschke@greenbytes.de2007-11-23 Avoid prose when an exact rule can be specified.
Associated changes in this document: 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 6.1.1.
 I  abnf-rule-names   (type: edit, status: closed)
julian.reschke@greenbytes.de2007-11-22 Fix invalid rule names: "http_URL" and "abs_path".
2007-11-22Resolution: Replace "http_URL" by "http-URL" and "abs-path" by "path-absolute" (which is the name used in RFC3986). Also add BNF rules for the other rules imported from RFC2396.
Associated changes in this document: 3.2.1, 3.2.1, 3.2.2, 3.2.2, 3.2.2, 3.2.2, 3.2.2, 3.2.3, 3.2.3, 5.1.2, 5.1.2, 5.1.2, 5.1.2.
 I  abnf-prose-cr   (type: edit, status: closed)
julian.reschke@greenbytes.de2007-11-20 Change BNF prose values to not contain line breaks.
2007-11-20Resolution: Done.
Associated changes in this document: 2.2, 2.2, 4.2.
 I  abnf-case-insensitive   (type: edit, status: closed)
julian.reschke@greenbytes.de2007-11-20 Rule names are case-insensitive. Fix name collisions.
julian.reschke@greenbytes.de2007-11-22 Proposal: replace "host" by "uri-host", "trailer" by "trailer-part".
2007-11-22Resolution: Done.
Associated changes in this document: 3.2.2, 3.6.1, 3.6.1, 3.6.1, 14.23, 14.45, 14.46.
 I  abnf   (type: change, status: open)
julian.reschke@greenbytes.de2006-12-03 Update BNF to RFC4234 (plan to be added).
julian.reschke@greenbytes.de2007-07-24 See <http://www.w3.org/mid/45FBAB8C.6010809@gmx.de> for a to-do list.
julian.reschke@greenbytes.de2007-11-13 See <http://www.w3.org/mid/4739C417.2040203@gmx.de> for a summary of issues with the current ABNF.
 I  rfc2822_normative   (type: change, status: open)
julian.reschke@greenbytes.de2006-12-03 RFC822 ("STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES") has been obsoleted by RFC2822 ("Internet Message Format"). Some of the references from RFC822 can be upgraded, some others are historical notes and should stay as they are. Also, RFC822 is the base for RFC2616's ABNF; as long as it has not been upgraded to RFC4234 format, we need to keep RFC822 as normative reference. See issue abnf.
julian.reschke@greenbytes.de2007-06-16 RFC4897 requires us to add a note to the references explaining why the downref was made (see <http://tools.ietf.org/html/rfc4897#section-3.1>).
 I  rfc1737_informative_and_obsolete   (type: change, status: open)
julian.reschke@greenbytes.de2006-10-27 Classify RFC1737 ("Functional Requirements for Uniform Resource Names") as informative and update to RFC2141 ("URN Syntax") which seems to be a better reference.
Associated changes in this document: del-, 17.3.
 I  rfc2048_informative_and_obsolete   (type: edit, status: open)
julian.reschke@greenbytes.de2006-11-15 Classify RFC2048 ("Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures") as informative, update to RFC4288, potentially update the application/http and multipart/byteranges MIME type registration. Also, in Section 3.7 fix first reference to refer to RFC2046 (it's about media types in general, not the registration procedure).
julian.reschke@greenbytes.de2007-04-20 Separate issue for updating the registration template: i55-updating-to-rfc4288.
Associated changes in this document: 3.7, 3.7, del-, 17.2, A.
 I  i34-updated-reference-for-uris   (type: change, status: open)
julian.reschke@greenbytes.de2006-11-14 Update RFC2396 ("Uniform Resource Identifiers (URI): Generic Syntax") to RFC3986.
 I  i50-misc-typos   (type: edit, status: open)
a-travis@microsoft.com2006-12-18 (See <http://lists.w3.org/Archives/Public/ietf-http-wg/2006OctDec/0275.html>).
julian.reschke@greenbytes.de2007-06-29 Some of the strictly editorial issues have been resolves as part of issue "edit".

1. Introduction

1.1 Purpose

The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. HTTP has been in use by the World-Wide Web global information initiative since 1990. The first version of HTTP, referred to as HTTP/0.9, was a simple protocol for raw data transfer across the Internet. HTTP/1.0, as defined by [RFC1945], improved the protocol by allowing messages to be in the format of MIME-like messages, containing metainformation about the data transferred and modifiers on the request/response semantics. However, HTTP/1.0 does not sufficiently take into consideration the effects of hierarchical proxies, caching, the need for persistent connections, or virtual hosts. In addition, the proliferation of incompletely-implemented applications calling themselves "HTTP/1.0" has necessitated a protocol version change in order for two communicating applications to determine each other's true capabilities.

This specification defines the protocol referred to as "HTTP/1.1". This protocol includes more stringent requirements than HTTP/1.0 in order to ensure reliable implementation of its features.

Practical information systems require more functionality than simple retrieval, including search, front-end update, and annotation. HTTP allows an open-ended set of methods and headers that indicate the purpose of a request [RFC2324]. It builds on the discipline of reference provided by the Uniform Resource Identifier (URI) [RFC1630], as a location (URL) [RFC1738] or name (URN) [RFC1737], for indicating the resource to which a method is to be applied. Messages are passed in a format similar to that used by Internet mail [RFC2822] as defined by the Multipurpose Internet Mail Extensions (MIME) [RFC2045].

HTTP is also used as a generic protocol for communication between user agents and proxies/gateways to other Internet systems, including those supported by the SMTP [RFC2821], NNTP [RFC3977], FTP [RFC959], Gopher [RFC1436], and WAIS [WAIS] protocols. In this way, HTTP allows basic hypermedia access to resources available from diverse applications.

1.2 Requirements

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

An implementation is not compliant if it fails to satisfy one or more of the MUST or REQUIRED level requirements for the protocols it implements. An implementation that satisfies all the MUST or REQUIRED level and all the SHOULD level requirements for its protocols is said to be "unconditionally compliant"; one that satisfies all the MUST level requirements but not all the SHOULD level requirements for its protocols is said to be "conditionally compliant."

1.3 Terminology

This specification uses a number of terms to refer to the roles played by participants in, and objects of, the HTTP communication.

 I  i52-sort-1.3-terminology   (type: edit, status: open)
a-travis@microsoft.com2006-12-21 It's irritating to try and look up definitions in section 1.3. IMHO, the entries really should be sorted alphabetically, despite the fact that the terms have dependencies on one another.
julian.reschke@greenytes.de2006-06-15 See action item <http://www.w3.org/2007/03/18-rfc2616-minutes.html#action23> and proposal in <http://lists.w3.org/Archives/Public/ietf-http-wg/2007AprJun/0350.html>.
julian.reschke@greenytes.de2006-06-15 I personally think we should not do this change:
(1) Sorting paragraphs makes it very hard to verify the changes; in essence, a reviewer would either need to trust us, or re-do the shuffling to control whether it's correct (nothing lost, no change in the definitions).
(2) In the RFC2616 ordering, things that belong together (such as "client", "user agent", "server" ...) are close to each other.
(3) Contrary to RFC2616, the text version of new spec will contain an alphabetical index section anyway (unless it's removed upon publication :-).

connection

A transport layer virtual circuit established between two programs for the purpose of communication.

message

The basic unit of HTTP communication, consisting of a structured sequence of octets matching the syntax defined in Section 4 and transmitted via the connection.

request

An HTTP request message, as defined in Section 5.

response

An HTTP response message, as defined in Section 6.

resource

A network data object or service that can be identified by a URI, as defined in Section 3.2. Resources may be available in multiple representations (e.g. multiple languages, data formats, size, and resolutions) or vary in other ways.

entity

The information transferred as the payload of a request or response. An entity consists of metainformation in the form of entity-header fields and content in the form of an entity-body, as described in Section 7.

representation

An entity included with a response that is subject to content negotiation, as described in Section 12. There may exist multiple representations associated with a particular response status.

content negotiation

The mechanism for selecting the appropriate representation when servicing a request, as described in Section 12. The representation of entities in any response can be negotiated (including error responses).

variant

A resource may have one, or more than one, representation(s) associated with it at any given instant. Each of these representations is termed a `variant'. Use of the term `variant' does not necessarily imply that the resource is subject to content negotiation.

client

A program that establishes connections for the purpose of sending requests.

user agent

The client which initiates a request. These are often browsers, editors, spiders (web-traversing robots), or other end user tools.

server

An application program that accepts connections in order to service requests by sending back responses. Any given program may be capable of being both a client and a server; our use of these terms refers only to the role being performed by the program for a particular connection, rather than to the program's capabilities in general. Likewise, any server may act as an origin server, proxy, gateway, or tunnel, switching behavior based on the nature of each request.

origin server

The server on which a given resource resides or is to be created.

proxy

An intermediary program which acts as both a server and a client for the purpose of making requests on behalf of other clients. Requests are serviced internally or by passing them on, with possible translation, to other servers. A proxy MUST implement both the client and server requirements of this specification. A "transparent proxy" is a proxy that does not modify the request or response beyond what is required for proxy authentication and identification. A "non-transparent proxy" is a proxy that modifies the request or response in order to provide some added service to the user agent, such as group annotation services, media type transformation, protocol reduction, or anonymity filtering. Except where either transparent or non-transparent behavior is explicitly stated, the HTTP proxy requirements apply to both types of proxies.

gateway

A server which acts as an intermediary for some other server. Unlike a proxy, a gateway receives requests as if it were the origin server for the requested resource; the requesting client may not be aware that it is communicating with a gateway.

tunnel

An intermediary program which is acting as a blind relay between two connections. Once active, a tunnel is not considered a party to the HTTP communication, though the tunnel may have been initiated by an HTTP request. The tunnel ceases to exist when both ends of the relayed connections are closed.

cache

A program's local store of response messages and the subsystem that controls its message storage, retrieval, and deletion. A cache stores cacheable responses in order to reduce the response time and network bandwidth consumption on future, equivalent requests. Any client or server may include a cache, though a cache cannot be used by a server that is acting as a tunnel.

cacheable

A response is cacheable if a cache is allowed to store a copy of the response message for use in answering subsequent requests. The rules for determining the cacheability of HTTP responses are defined in Section 13. Even if a resource is cacheable, there may be additional constraints on whether a cache can use the cached copy for a particular request.

first-hand

A response is first-hand if it comes directly and without unnecessary delay from the origin server, perhaps via one or more proxies. A response is also first-hand if its validity has just been checked directly with the origin server.

explicit expiration time

The time at which the origin server intends that an entity should no longer be returned by a cache without further validation.

heuristic expiration time

An expiration time assigned by a cache when no explicit expiration time is available.

age

The age of a response is the time since it was sent by, or successfully validated with, the origin server.

freshness lifetime

The length of time between the generation of a response and its expiration time.

fresh

A response is fresh if its age has not yet exceeded its freshness lifetime.

stale

A response is stale if its age has passed its freshness lifetime.

semantically transparent

A cache behaves in a "semantically transparent" manner, with respect to a particular response, when its use affects neither the requesting client nor the origin server, except to improve performance. When a cache is semantically transparent, the client receives exactly the same response (except for hop-by-hop headers) that it would have received had its request been handled directly by the origin server.

validator

A protocol element (e.g., an entity tag or a Last-Modified time) that is used to find out whether a cache entry is an equivalent copy of an entity.

upstream/downstream

Upstream and downstream describe the flow of a message: all messages flow from upstream to downstream.

inbound/outbound

Inbound and outbound refer to the request and response paths for messages: "inbound" means "traveling toward the origin server", and "outbound" means "traveling toward the user agent"

1.4 Overall Operation

The HTTP protocol is a request/response protocol. A client sends a request to the server in the form of a request method, URI, and protocol version, followed by a MIME-like message containing request modifiers, client information, and possible body content over a connection with a server. The server responds with a status line, including the message's protocol version and a success or error code, followed by a MIME-like message containing server information, entity metainformation, and possible entity-body content. The relationship between HTTP and MIME is described in Appendix D.

Most HTTP communication is initiated by a user agent and consists of a request to be applied to a resource on some origin server. In the simplest case, this may be accomplished via a single connection (v) between the user agent (UA) and the origin server (O).

       request chain ------------------------>
    UA -------------------v------------------- O
       <----------------------- response chain

A more complicated situation occurs when one or more intermediaries are present in the request/response chain. There are three common forms of intermediary: proxy, gateway, and tunnel. A proxy is a forwarding agent, receiving requests for a URI in its absolute form, rewriting all or part of the message, and forwarding the reformatted request toward the server identified by the URI. A gateway is a receiving agent, acting as a layer above some other server(s) and, if necessary, translating the requests to the underlying server's protocol. A tunnel acts as a relay point between two connections without changing the messages; tunnels are used when the communication needs to pass through an intermediary (such as a firewall) even when the intermediary cannot understand the contents of the messages.

       request chain -------------------------------------->
    UA -----v----- A -----v----- B -----v----- C -----v----- O
       <------------------------------------- response chain

The figure above shows three intermediaries (A, B, and C) between the user agent and origin server. A request or response message that travels the whole chain will pass through four separate connections. This distinction is important because some HTTP communication options may apply only to the connection with the nearest, non-tunnel neighbor, only to the end-points of the chain, or to all connections along the chain. Although the diagram is linear, each participant may be engaged in multiple, simultaneous communications. For example, B may be receiving requests from many clients other than A, and/or forwarding requests to servers other than C, at the same time that it is handling A's request.

Any party to the communication which is not acting as a tunnel may employ an internal cache for handling requests. The effect of a cache is that the request/response chain is shortened if one of the participants along the chain has a cached response applicable to that request. The following illustrates the resulting chain if B has a cached copy of an earlier response from O (via C) for a request which has not been cached by UA or A.

          request chain ---------->
       UA -----v----- A -----v----- B - - - - - - C - - - - - - O
          <--------- response chain

Not all responses are usefully cacheable, and some requests may contain modifiers which place special requirements on cache behavior. HTTP requirements for cache behavior and cacheable responses are defined in Section 13.

In fact, there are a wide variety of architectures and configurations of caches and proxies currently being experimented with or deployed across the World Wide Web. These systems include national hierarchies of proxy caches to save transoceanic bandwidth, systems that broadcast or multicast cache entries, organizations that distribute subsets of cached data via CD-ROM, and so on. HTTP systems are used in corporate intranets over high-bandwidth links, and for access via PDAs with low-power radio links and intermittent connectivity. The goal of HTTP/1.1 is to support the wide diversity of configurations already deployed while introducing protocol constructs that meet the needs of those who build web applications that require high reliability and, failing that, at least reliable indications of failure.

HTTP communication usually takes place over TCP/IP connections. The default port is TCP 80 (<http://www.iana.org/assignments/port-numbers>), but other ports can be used. This does not preclude HTTP from being implemented on top of any other protocol on the Internet, or on other networks. HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used; the mapping of the HTTP/1.1 request and response structures onto the transport data units of the protocol in question is outside the scope of this specification.

In HTTP/1.0, most implementations used a new connection for each request/response exchange. In HTTP/1.1, a connection may be used for one or more request/response exchanges, although connections may be closed for a variety of reasons (see Section 8.1).


2. Notational Conventions and Generic Grammar

2.1 Augmented BNF

All of the mechanisms specified in this document are described in both prose and an augmented Backus-Naur Form (BNF) similar to that used by [RFC822ABNF]. Implementors will need to be familiar with the notation in order to understand this specification. The augmented BNF includes the following constructs:

name = definition

The name of a rule is simply the name itself (without any enclosing "<" and ">") and is separated from its definition by the equal "=" character. White space is only significant in that indentation of continuation lines is used to indicate a rule definition that spans more than one line. Certain basic rules are in uppercase, such as SP, LWS, HT, CRLF, DIGIT, ALPHA, etc. Angle brackets are used within definitions whenever their presence will facilitate discerning the use of rule names.

"literal"

Quotation marks surround literal text. Unless stated otherwise, the text is case-insensitive.

rule1 | rule2

Elements separated by a bar ("|") are alternatives, e.g., "yes | no" will accept yes or no.

(rule1 rule2)

Elements enclosed in parentheses are treated as a single element. Thus, "(elem (foo | bar) elem)" allows the token sequences "elem foo elem" and "elem bar elem".

*rule

The character "*" preceding an element indicates repetition. The full form is "<n>*<m>element" indicating at least <n> and at most <m> occurrences of element. Default values are 0 and infinity so that "*(element)" allows any number, including zero; "1*element" requires at least one; and "1*2element" allows one or two.

[rule]

Square brackets enclose optional elements; "[foo bar]" is equivalent to "*1(foo bar)".

N rule

Specific repetition: "<n>(element)" is equivalent to "<n>*<n>(element)"; that is, exactly <n> occurrences of (element). Thus 2DIGIT is a 2-digit number, and 3ALPHA is a string of three alphabetic characters.

#rule

A construct "#" is defined, similar to "*", for defining lists of elements. The full form is "<n>#<m>element" indicating at least <n> and at most <m> elements, each separated by one or more commas (",") and OPTIONAL linear white space (LWS). This makes the usual form of lists very easy; a rule such as
   ( *LWS element *( *LWS "," *LWS element ))
can be shown as
   1#element
Wherever this construct is used, null elements are allowed, but do not contribute to the count of elements present. That is, "(element), , (element) " is permitted, but counts as only two elements. Therefore, where at least one element is required, at least one non-null element MUST be present. Default values are 0 and infinity so that "#element" allows any number, including zero; "1#element" requires at least one; and "1#2element" allows one or two.

; comment

A semi-colon, set off some distance to the right of rule text, starts a comment that continues to the end of line. This is a simple way of including useful notes in parallel with the specifications.

implied *LWS

The grammar described by this specification is word-based. Except where noted otherwise, linear white space (LWS) can be included between any two adjacent words (token or quoted-string), and between adjacent words and separators, without changing the interpretation of a field. At least one delimiter (LWS and/or separators) MUST exist between any two tokens (for the definition of "token" below), since they would otherwise be interpreted as a single token.

2.2 Basic Rules

The following rules are used throughout this specification to describe basic parsing constructs. The US-ASCII coded character set is defined by ANSI X3.4-1986 [USASCII].

 I   OCTET          = <any 8-bit sequence of data>
  CHAR           = <any US-ASCII character (octets 0 - 127)>
  UPALPHA        = <any US-ASCII uppercase letter "A".."Z">
  LOALPHA        = <any US-ASCII lowercase letter "a".."z">
  ALPHA          = UPALPHA | LOALPHA
  DIGIT          = <any US-ASCII digit "0".."9">
  CTL            =  I <any US-ASCII control character
                   (octets 0 - 31) and DEL (127)>%x00-1F | %x7F
                   ; (octets 0 - 31) and DEL (127)
  CR             = <US-ASCII CR, carriage return (13)>
  LF             = <US-ASCII LF, linefeed (10)>
  SP             = <US-ASCII SP, space (32)>
  HT             = <US-ASCII HT, horizontal-tab (9)>
   I <">   DQUOTE         = <US-ASCII double-quote mark (34)>

HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all protocol elements except the entity-body (see Appendix C for tolerant applications). The end-of-line marker within an entity-body is defined by its associated media type, as described in Section 3.7.

  CRLF           = CR LF

HTTP/1.1 header field values can be folded onto multiple lines if the continuation line begins with a space or horizontal tab. All linear white space, including folding, has the same semantics as SP. A recipient MAY replace any linear white space with a single SP before interpreting the field value or forwarding the message downstream.

  LWS            = [CRLF] 1*( SP | HT )
 I  i63-header-length-limit-with-encoded-words   (type: change, status: open)
derhoermi@gmx.net2007-05-14 (See <http://lists.w3.org/Archives/Public/ietf-http-wg/2007AprJun/0050.html>).
 I  i74-character-encodings-for-headers   (type: change, status: open)
duerst@it.aoyama.ac.jp2007-07-10 RFC 2616 prescribes that headers containing non-ASCII have to use either iso-8859-1 or RFC 2047. This is unnecessarily complex and not necessarily followed. At the least, new extensions should be allowed to specify that UTF-8 is used.

The TEXT rule is only used for descriptive field contents and values that are not intended to be interpreted by the message parser. Words of *TEXT MAY contain characters from character sets other than ISO-8859-1 [ISO-8859-1] only when encoded according to the rules of [RFC2047].

  TEXT           =  I <any OCTET except CTLs,
                   but including LWS>%x20-7E | %x80-FF | LWS
                   ; any OCTET except CTLs, but including LWS

A CRLF is allowed in the definition of TEXT only as part of a header field continuation. It is expected that the folding LWS will be replaced with a single SP before interpretation of the TEXT value.

Hexadecimal numeric characters are used in several protocol elements.

  HEX            = "A" | "B" | "C" | "D" | "E" | "F"
                 | "a" | "b" | "c" | "d" | "e" | "f" | DIGIT

 I  Many HTTP/1.1 header field values consist of words separated by LWS or special characters. These special characters MUST be in a quoted string to be used within a parameter value (as defined in Section 3.6).

 I    I token          = 1*<any CHAR except CTLs or separators>
  separators     = "(" | ")" | "<" | ">" | "@"
                 | "," | ";" | ":" | "\" |  I <">DQUOTE
                 | "/" | "[" | "]" | "?" | "="
                 | "{" | "}" | SP | HT I 
                 
  tchar          = "!" | "#" | "$" | "%" | "&" | "'" | "*" | "+" | "-"
                 | "." | "^" | "_" | "`" | "|" | "~" | DIGIT | ALPHA
                   ; any CHAR except CTLs or separators
  token          = 1*tchar

Comments can be included in some HTTP header fields by surrounding the comment text with parentheses. Comments are only allowed in fields containing "comment" as part of their field value definition. In all other fields, parentheses are considered part of the field value.

  comment        = "(" *( ctext | quoted-pair | comment ) ")"
  ctext          =  I <any TEXT excluding "(" and ")">%x20-27 | %x2A-7E | %x80-FF | LWS
                   ; any TEXT excluding "(" and ")"

A string of text is parsed as a single word if it is quoted using double-quote marks.

  quoted-string  = (  I <">DQUOTE *(qdtext | quoted-pair )  I <">DQUOTE )
  qdtext         =  I <any TEXT excluding  I <">DQUOTE and "\">%x20-21 | %x23-5B | %x5D-7E | %x80-FF | LWS
                   ; any TEXT excluding  I <">DQUOTE and "\"