view Side-By-Side changes
HTTP Working Group R. Fielding, UC Irvine INTERNET-DRAFT H. Frystyk, MIT/LCS<draft-ietf-http-v11-spec-03.html><draft-ietf-http-v11-spec-04> T. Berners-Lee, MIT/LCS J. Gettys, DEC J. C. Mogul, DEC Expires October2,3, 1996May 2,June 3, 1996 Hypertext Transfer Protocol -- HTTP/1.11Status of this Memo This document is an Internet-Draft. 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 made obsolete 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". To learn the current status of any Internet-Draft, please check the "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe), munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast). Distribution of this document is unlimited. Please send comments to the HTTP working group at <http-wg@cuckoo.hpl.hp.com>. Discussions of the working group are archived at <URL:http://www.ics.uci.edu/pub/ietf/http/>. General discussions about HTTP and the applications which use HTTP should take place on the <www- talk@w3.org> mailing list.NOTE: This specification is for discussion purposes only. It is not claimed to represent the consensus of the HTTP working group, and contains a number of proposals that either have not been discussed or are controversial. The working group is discussing significant changes in many areas, including - support for caching, persistent connections, range retrieval, content negotiation, MIME compatibility, authentication, timing of the PUT operation. 2Abstract The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, object-oriented protocol which can be used for many tasks, such as name servers and distributed object management systems, through extension of its requestmethods (commands).methods. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred.Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 1] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996HTTP 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".3 Note to Readers of This Document We believe this draft to be very close to consensus of the working group in terms of functionality for HTTP/1.1, and the text substantially correct. One final technical change NOT reflected in this draft is to make persistent connections the default behavior for HTTP/1.1; editorial changes to reflect this in the next, and we hope final draft, are being circulated in the working group mailing list. This draft has undergone extensive reorganization to improve presentation. Let us know if there are remaining problems. The terminology used in this draft has changed to reduce confusion. While we are converging on a shared set of terminology and definitions, it is possible there will be a final set of terminology adopted in the next draft. Despite any terminology changes that may occur to improve the presentation of the specification, we do not expect to change the name of any header field or parameter name. There are a very few remaining issues indicated by Editor's Note: in bold font.Fielding, Frystyk, Berners-Lee,Gettys,Gettys and Mogul [Page2] 41] Table of Contents HYPERTEXT TRANSFER PROTOCOL --HTTP/1.1HTTP/1.1................................1 1Status of this Memo 2 Abstract 3 Note to Readers of This Document 4 Table of Contents 5 Introduction 5.1Introduction.........................................................7 1.1 Purpose5.2..........................................................7 1.2 Requirements5.3.....................................................7 1.3 Terminology5.4......................................................8 1.4 Overall Operation5.5 HTTP and MIME 6...............................................11 2 Notational Conventions and GenericGrammar 6.1Grammar..........................13 2.1 Augmented BNF6.2...................................................13 2.2 Basic Rules7.....................................................14 3 ProtocolParameters 7.1Parameters.................................................16 3.1 HTTP Version7.2....................................................16 3.2 Uniform Resource Identifiers7.3....................................17 3.3 Date/Time Formats7.4...............................................19 3.4 Character Sets7.5..................................................21 3.5 Content Codings7.6.................................................21 3.6 Transfer Codings7.7................................................22 3.7 Media Types7.8.....................................................24 3.8 Product Tokens7.9..................................................26 3.9 Quality Values7.10..................................................26 3.10 Language Tags7.11..................................................26 3.11 Entity Tags7.12 Variant IDs 7.13 Variant Sets 7.14....................................................27 3.12 RangeProtocol Parameters 8Units ....................................................28 4 HTTPMessage 8.1Message........................................................28 4.1 Message Types8.2...................................................28 4.2 Message Headers8.3.................................................29 4.3 Message Body ....................................................29 4.4 Message Length ..................................................30 4.5 General Header Fields9 Request 9.1...........................................31 5 Request.............................................................32 5.1 Request-Line9.2....................................................32 5.2 The Resource Identified by a Request9.3............................34 5.3 Request Header Fields10 Response 10.1...........................................35 6 Response............................................................35 6.1 Status-Line10.2.....................................................36 6.2 Response Header Fields ..........................................38 7 Entity..............................................................38 7.1 Entity Header Fields ............................................38 7.2 Entity Body .....................................................39 8 Connections.........................................................40 Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 3] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199611 Entity 11.1 Entity Header Fields 11.2 Entity Body 128.1 Persistent Connections ..........................................40 8.2 Message Transmission Requirements ...............................43 9 Method Definitions..................................................44 9.2 OPTIONS .........................................................45 9.3 GET .............................................................46 9.4 HEAD ............................................................46 9.5 POST ............................................................47 9.6 PUT .............................................................47 9.7 DELETE ..........................................................48 9.8 TRACE ...........................................................49 10 Status CodeDefinitions 12.1Definitions............................................49 10.1 Informational 1xx12.2..............................................49 10.2 Successful 2xx12.3.................................................50 10.3 Redirection 3xx12.4................................................52 10.4 Client Error 4xx12.5...............................................55 10.5 Server Error 5xx13 Method Definitions 13.1 OPTIONS 13.2 GET 13.3 HEAD 13.4 POST 13.5 PUT 13.6 DELETE 13.7 TRACE 14...............................................59 11 AccessAuthentication 14.1Authentication..............................................60 11.1 Basic Authentication Scheme14.2....................................61 11.2 Digest Authentication Scheme15...................................62 12 Content Negotiation................................................62 12.1 Server-driven Negotiation15.1......................................63 12.2 Agent-driven NegotiationFacilities Defined in this Specification 16.......................................64 12.3 Transparent Negotiation ........................................65 13 Caching inHTTP 16.1 Semantic Transparency 16.2HTTP....................................................65 13.2 Expiration Model16.3...............................................69 13.3 Validation Model16.4...............................................75 13.4 Constructing Responses From Caches16.5.............................80 13.5 Cachingand Generic Resources 16.6Negotiated Responses ...................................82 13.6 Shared and Non-Shared Caches16.7 Selecting a Cached Response 16.8...................................83 13.7 Errors or Incomplete Response Cache Behavior16.9 Side Effects of GET and HEAD 16.10...................83 13.8 Invalidation After Updates or Deletions16.11........................84 13.9 Write-Through Mandatory16.12 Generic Resources and HTTP/1.0 Proxy Caches 16.13........................................85 13.10 Cache Replacement16.14 Caching of Negative Responses 16.15.............................................85 13.11 History Lists17 Persistent Connections 17.1 Purpose 17.2 Overall Operation 17.3 Proxy Servers 17.4 Interaction with Security Protocols 17.5 Practical Considerations 18.................................................85 14 Header FieldDefinitions 18.1Definitions...........................................86 14.1 Accept18.2.........................................................86 14.2 Accept-Charset .................................................88 14.3 Accept-Encoding ................................................89 14.4 Accept-Language ................................................89 14.5 Accept-Ranges ..................................................90 14.6 Age ............................................................91 14.7 Allow ..........................................................91 14.8 Authorization ..................................................92 14.9 Cache-Control ..................................................92 14.10 Connection ....................................................99 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 4] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199618.3 Accept-Encoding 18.4 Accept-Language 18.5 Accept-Ranges 18.6 Age 18.7 Allow 18.8 Alternates 18.9 Authorization 18.10 Cache-Control 18.11 Connection 18.1214.11 Content-Base18.13..................................................99 14.12 Content-Encoding18.14..............................................99 14.13 Content-Language18.15.............................................100 14.14 Content-Length18.16...............................................101 14.15 Content-Location18.17.............................................101 14.16 Content-MD518.18..................................................102 14.17 Content-Range18.19................................................103 14.18 Content-Type18.20.................................................105 14.19 Date18.21.........................................................105 14.20 ETag18.22.........................................................106 14.21 Expires18.23......................................................106 14.22 From18.24.........................................................107 14.23 Host18.25.........................................................107 14.24 If-Modified-Since18.26............................................108 14.25 If-Match18.27 If-NoneMatch 18.28.....................................................109 14.26 If-None-Match ................................................110 14.27 If-Range18.29.....................................................112 14.28 If-Unmodified-Since18.30..........................................112 14.29 Last-Modified18.31................................................113 14.30 Location18.32.....................................................113 14.31 Max-Forwards18.33 Persist 18.34.................................................114 14.32 Pragma18.35.......................................................114 14.33 Proxy-Authenticate18.36...........................................115 14.34 Proxy-Authorization18.37..........................................115 14.35 Public18.38.......................................................116 14.36 Range18.39........................................................116 14.37 Referer18.40......................................................119 14.38 Retry-After18.41..................................................119 14.39 Server18.42 Title 18.43.......................................................120 14.40 Transfer Encoding18.44............................................120 14.41 Upgrade18.45......................................................120 14.42 User-Agent18.46...................................................121 14.43 Vary18.47.........................................................122 14.44 Via18.48..........................................................123 14.45 Warning18.49......................................................124 14.46 WWW-Authenticate19.............................................126 15 SecurityConsiderations 19.1Considerations...........................................126 15.1 Authentication of Clients19.2 Safe Methods 19.3.....................................126 15.2 Offering a Choice of Authentication Schemes ...................127 15.3 Abuse of Server Log Information19.4...............................128 15.4 Transfer of Sensitive Information19.5.............................128 15.5 Attacks Based On File and Path NamesFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 5] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 19.6..........................129 15.6 Personal Information19.7..........................................130 15.7 Privacy Issues Connected to Acceptheaders 19.8Headers ....................130 15.8 DNS Spoofing19.9..................................................131 15.9 Location Headers and Spoofing20 Acknowledgments 21 References 22.................................131 16 Acknowledgments...................................................131 17 References........................................................133 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 5] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 18 Authors'Addresses 23 Appendices 23.1Addresses................................................136 19 Appendices........................................................137 19.1 Internet Media Type message/http23.2..............................137 19.2 Internet Media Type multipart/byteranges ......................138 19.3 Tolerant Applications23.3.........................................139 19.4 Differences Between HTTPBodiesEntities and RFC 1521Internet Message Bodies 23.4Entities .......140 19.5 Changes from HTTP/1.023.5.........................................142 19.6 Additional Features ...........................................143 19.7 Compatibility with Previous Versions ..........................147 19.8 Notes to RFC Editor and IANA ..................................149 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 6]51 Introduction5.11.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 RFCxxxx1945 [6] , improved the protocol by allowing messages to be in the format of MIME-likeentities,messages, containing metainformation about the data transferred and modifiers on the request/response semantics. However, HTTP/1.0 does not sufficiently take into consideration theeffecteffects of hierarchicalproxies ,proxies, caching, the need for persistentconnectionsconnections, and virtualhosts..hosts. In addition, the proliferation ofincompletely- implementedincompletely-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 protocolis backwards-compatible with HTTP/1.0, butincludes 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 that indicate the purpose of a request. It builds on the discipline of reference provided by the Uniform Resource Identifier (URI),[3][20], as a location (URL) [4] or name (URN) , for indicating the resource to which a method is to be applied. Messages are passed in a format similar to that used by InternetMail andmail as defined by the Multipurpose Internet Mail Extensions (MIME) . HTTP is also used as a generic protocol for communication between user agents and proxies/gateways to other Internetprotocols, such assystems, including those supported by the SMTP,[16], NNTP,[13], FTP,[18], Gopher,[2], and WAIS, allowing[10] protocols. In this way, HTTP allows basic hypermedia access to resources available from diverseapplications and simplifying the implementation of user agents. 5.2applications. 1.2 Requirements This specification uses the same words as RFC 1123 [8] for defining the significance of each particular requirement. These words are: MUST This word or the adjective "required" means that the item is an absolute requirement of the specification. Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 7] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 SHOULD This word or the adjective "recommended" means that there may exist valid reasons in particular circumstances to ignore this item, but the full implications should be understood and the case carefully weighed before choosing a different course.Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 7] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996MAY This word or the adjective "optional" means that this item is truly optional. One vendor may choose to include the item because a particular marketplace requires it or because it enhances the product, for example; another vendor may omit the same item. An implementation is not compliant if it fails to satisfy one or more of the MUST requirements for the protocols it implements. An implementation that satisfies all the MUST and all the SHOULD requirements for its protocols is said to be "unconditionally compliant"; one that satisfies all the MUST requirements but not all the SHOULD requirements for its protocols is said to be "conditionallycompliant". 5.3compliant." 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. 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 section84 and transmitted via the connection. request An HTTP requestmessagemessage, as defined in section9.5. response An HTTP responsemessagemessage, as defined in section10.6. resource A network data object or service that can be identified by aURI (section 7.2). At any pointURI, as defined intime, a resource may be either a plain resource, which corresponds to only one possible representation, or a generic resource. generic resource A resource that is a set of closely related representations of the same document, form, applet, etc. A generic resource is always identified by a URI. The individual representationssection 3.2. Resources mayeachbeidentified by a unique URI, or by the combination of the generic resource's URI and a variant-ID,available in multiple languages, data formats, size, resolutions, orby the combination of the generic resource's URI and some "content-negotiation" mechanism. In this case,vary in otherURIs may exist which identify a resource more specifically. plain resource A resource that is not a generic resource. A plain resource is always identified by a URI. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 8] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996ways. entity Theset ofinformation transferred as the payload of a request orresponseresponse. An entity consists of metainformation in the form ofEntity-Headerentity-header fields and content in the form of anEntity-Body,entity-body, as described in section11. resource entity A specific representation, rendition, encoding, or presentation of a network data object or service, either a plain resource or a specific member of a generic resource. A resource entity might be identified by a URI, or by the combination of a URI and a variant-ID, or by the combination of a URI7. Fielding, Frystyk, Berners-Lee, Gettys, andsome other mechanism.Mogul [Page 8] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 representation Anplain resource MUST be bound to a single resource entity at any instant in time. variant A resourceentitythat is a member of at least one generic resource. Sometimes calledincluded with aresource variant. Noteresponse thatthe set of variants of a generic resource may change over timeis subject to content negotiation, aswell.described in section 12. There may exist multiple representations associated with a particular response status. content negotiation The mechanism for selecting the appropriatevariant of a generic resourcerepresentation when servicing a request, as described in section15. entity tag An opaque string associated with an entity and used to distinguish it from other entities12. The representation ofthe requested resource . A "strong entity tag" is one that mayentities in any response can beshared by twonegotiated (including error responses), as well as entities derived from resources. variant Each representation ofathat resourceonly if they are equivalent by octet equality. A "weak entity tag" is onethatmay be shared by two entities ofcorresponds to aresource if they are equivalent anddifferent sequence of entities that could besubstitutedreturned foreach other with no significant change in semantics.a requested resource is termed a variant. client Agiven entity tag value may be used for entities obtained by requests on different URIs without implying anything about the equivalence of these entities. client An application program that establishes connectionsprogram 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 programMAYmay 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 serverMAYmay 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.Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 9] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996proxy 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 proxyMUST interpret and, if necessary, rewrite a request message before forwarding it. Proxies are often used as client-side portals through network firewalls and as helper applications for handling requests via protocols not implemented bymust implement both theuser agent.client and server requirements of this specification. 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.Gateways are often used as server-side portals through network firewalls and as protocol translators for access to resources stored on non-HTTP systems.tunnel An intermediary program which is acting as a blind relay between two Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 9] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 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.Tunnels are used when a portal is necessary and the intermediary cannot, or should not, interpret the relayed communication.cache A program's local store of response messages and the subsystem that controls its message storage, retrieval, and deletion. A cache stores cachable responses in order to reduce the response time and network bandwidth consumption on future, equivalent requests. Any client or serverMAYmay include a cache, though a cache cannot be used by a server thatactsis acting as a tunnel. cachable A response is cachable if a cache is allowed to store a copy of the response message for use in answering subsequent requests. The rules for determining the cachability of HTTP responses are defined inSection 16.section 13. Even if a resource is cachable, there may be additional constraints onwhen and ifwhether a cache can use the cached copy for a particular request.firsthandfirst-hand A response isfirsthandfirst-hand if it comes directly and without unnecessary delay from the origin server, perhaps via one or more proxies. A response is alsofirsthandfirst-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.Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 10] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996heuristic 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 wasgeneratedsent 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. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 10] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 semantically transparent A cachemay use a fresh response without validating it, but "normally" maythat does notuse a stale response without first validating it. ("Normally" means "unless configured to provide better performance ataffect theexpensesemantics oftransparency.") Therefore, what expires is the cache's authority to useacached response, without validation, in its replyrequest and the resulting response. A response is considered toa subsequent request. semantically transparent Ideally, an HTTP/1.1 cache wouldbe"semantically transparent." That is, use ofunaffected by the cachewould not affect either the clients orwhen theservers in any way except to improve performance. When aclientmakes a request via a semantically transparent cache, itreceivesexactly the same entity headers and entity bodya response equivalent to what it would have received if it had made thesamerequest directly to the originserver, at the same time.server. validatorAnA protocol element (e.g., an entitytag,tag or a Last-Modifiedtime, whichtime) that is used to find out whether a cache entry isa semantically transparentan equivalent copy ofa resource entity. A cache entry is semantically transparent if its validator exactly matches the validator that the server would provide for current instance of that resourcean entity.5.41.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 possibleentity bodyentity-body content. The relationship between HTTP and MIME is described in appendix 19.4. 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).Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 11] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996request 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 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 11] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 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 chainMUSTwill 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 cachable, and some requests may contain modifiers which place special requirements on cache behavior. HTTP requirements for cache behavior and cachable responses are defined in section16.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 TCP80 ,80, 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 dataFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 12] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996units of the protocol in question is outside the scope of this specification.However,Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 12] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 In HTTP/1.0, most implementationsSHOULD implement persistent connections (See section 17). Both clients and servers MUST be capable of handling cases where either party closes theused a new connectionprematurely, due to user action, automated time-out, or program failure.for each request/response exchange. Inany case, the closing of theHTTP/1.1, a connectionby either or both parties always terminates the current request, regardless of its status. 5.5 HTTP and MIME HTTP/1.1 uses many of the constructs definedmay be used forMIME, as defined in RFC 1521 . Appendix 23.3 describes the ways in which the context of HTTP allowsone or more request/response exchanges, although connections may be closed fordifferent usea variety ofInternet Media Types than is typically found in Internet mail, and gives the rationale for those differences. 6reasons (see section 8.1). 2 Notational Conventions and Generic Grammar6.12.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 RFC 822.[9]. Implementers 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 equalcharacter "="."=" character. Whitespace 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("I")("|") 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 mostFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 13] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996<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. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 13] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 [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 whitespace (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 elementMUSTmust be present. Default values are 0 and infinity so that"#(element) ""#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 whitespace (LWS) can be included between any two adjacent words (token or quoted-string), and between adjacent tokens and delimiters (tspecials), without changing the interpretation of a field. At least one delimiter (tspecials)MUSTmust exist between any two tokens, since they would otherwise be interpreted as a single token.However, applications SHOULD attempt to follow "common form" when generating HTTP constructs, since there exist some implementations that fail to accept anything beyond the common forms. 6.22.2 Basic Rules The following rules are used throughout this specification to describe basic parsing constructs. The US-ASCII coded character set is definedby.by ANSI X3.4-1986 [21]. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 14] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 OCTET = <any 8-bit sequence of data> CHAR = <any US-ASCII character (octets 0 - 127)>Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 14] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996UPALPHA = <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 = <any US-ASCII control character (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)> <"> = <US-ASCII double-quote mark (34)> HTTP/1.1 defines theoctetsequence CR LF as the end-of-line marker for all protocol elements except theEntity-Bodyentity-body (see appendix23.219.3 for tolerant applications). The end-of-line marker within anEntity-Bodyentity-body is defined by its associated media type, as described in section7.7.3.7. CRLF = CR LF HTTP/1.1 headers can be folded onto multiple lines if the continuation line begins with a space or horizontal tab. All linearwhitespace,white space, including folding, has the same semantics as SP. LWS = [CRLF] 1*( SP | HT ) 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 *TEXTMAYmay containoctetscharacters from character sets other thanUS-ASCIIISO 8859-1 [22] only when encoded according to the rules of RFC 1522.[14]. TEXT = <any OCTET except CTLs, but including LWS>Recipients of header field TEXT containing octets outside the US-ASCII character set range MAY assume that they represent ISO-8859-1 characters if there is no other encoding indicated by an RFC 1522 mechanism.Hexadecimal numeric characters are used in several protocol elements. HEX = "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f" | DIGIT 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.word = token | quoted-stringtoken = 1*<any CHAR except CTLs or tspecials> tspecials = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 15] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996 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 | comment ) ")" ctext = <any TEXT excluding "(" and ")"> A string of text is parsed as a single word if it is quoted using double-quote marks. quoted-string = ( <"> *(qdtext) <"> ) qdtext = <anyCHARTEXT except<"> and CTLs, but including LWS><">> The backslash character ("\") may be used as a single-character quoting mechanism only within quoted-string and comment constructs. quoted-pair = "\" CHAR73 Protocol Parameters7.13.1 HTTP Version HTTP uses a "<major>.<minor>" numbering scheme to indicate versions of the protocol. The protocol versioning policy is intended to allow the sender to indicate the format of a message and its capacity for understanding further HTTP communication, rather than the features obtained via that communication. No change is made to the version number for the addition of message components which do not affect communication behavior or which only add to extensible field values. The <minor> number is incremented when the changes made to the protocol add features which do not change the general message parsing algorithm, but which may add to the message semantics and imply additional capabilities of the sender. The <major> number is incremented when the format of a message within the protocol is changed. The version of an HTTP message is indicated by an HTTP-Version field in the first line of the message.If the protocol version is not specified, the recipient MUST assume that the message is in the simple HTTP/0.9 format .HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT Note that the major and minor numbersSHOULDMUST be treated as separate integers and that eachMAYmay be incremented higher than a single digit. Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is lower than HTTP/12.3. Leading zerosSHOULDMUST be ignored by recipients andnever generated by senders.MUST NOT be sent. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 16] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 Applications sendingFull-RequestRequest orFull-ResponseResponse messages, as defined by this specification, MUST include an HTTP-Version of "HTTP/1.1". UseFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 16] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996of this version number indicates that the sending application is at least conditionally compliant with this specification. The HTTP version of an application is the highest HTTP version for which the application is at least conditionally compliant. Proxy and gateway applicationsMUSTmust be carefulinwhen forwardingrequests that are receivedmessages ina formatprotocol versions different from that of theapplication's native HTTP version.application. Since the protocol version indicates the protocol capability of the sender, a proxy/gateway MUST never send a message with a version indicator which is greater than itsnativeactual version; if a higher version request is received, the proxy/gateway MUST either downgrade the request version, respond with an error, or switch to tunnel behavior. Requests with a version lower than that of theapplication's native formatproxy/gateway's version MAY be upgraded before being forwarded; the proxy/gateway's response to that request MUSTfollowbe in theserver requirements listed above.same major version as the request. Note: Converting between versions of HTTP may involveaddition or deletionmodification ofheadersheader fields required or forbidden by theversionversions involved.It is likely more involved than just changing the version indicator. 7.23.2 Uniform Resource Identifiers URIs have been known by many names: WWW addresses, Universal Document Identifiers, Universal Resource Identifiers , and finally the combination of Uniform Resource Locators (URL) and Names (URN) . As far as HTTP is concerned, Uniform Resource Identifiers are simply formatted strings which identify--via name, location, or any othercharacteristic-- a networkcharacteristic- -a resource.7.2.13.2.1 General Syntax URIs in HTTP can be represented in absolute form or relative to some known base URI , depending upon the context of their use. The two forms are differentiated by the fact that absolute URIs always begin with a scheme name followed by a colon. URI = ( absoluteURI | relativeURI ) [ "#" fragment ] absoluteURI = scheme ":" *( uchar | reserved ) relativeURI = net_path | abs_path | rel_path net_path = "//" net_loc [ abs_path ] abs_path = "/" rel_path rel_path = [ path ] [ ";" params ] [ "?" query ] Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 17] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 path = fsegment *( "/" segment ) fsegment = 1*pchar segment = *pchar params = param *( ";" param ) param = *( pchar | "/" )Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 17] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996scheme = 1*( ALPHA | DIGIT | "+" | "-" | "." ) net_loc = *( pchar | ";" | "?" ) query = *( uchar | reserved ) fragment = *( uchar | reserved ) pchar = uchar | ":" | "@" |"&""&" | "=" | "+" uchar = unreserved | escape unreserved = ALPHA | DIGIT | safe | extra | national escape = "%" HEX HEX reserved = ";" | "/" | "?" | ":" | "@" |"&""&" | "=" | "+" extra = "!" | "*" | "'" | "(" | ")" | "," safe = "$" | "-" | "_" | "." unsafe = CTL | SP | <"> | "#" | "%" | "<" | ">" national = <any OCTET excluding ALPHA, DIGIT, reserved, extra, safe, and unsafe> For definitive information on URL syntax and semantics, see RFC 1738 [4] and RFC 1808.[11]. The BNF above includes national characters not allowed in valid URLs as specified by RFC 1738, since HTTP servers are not restricted in the set of unreserved characters allowed to represent the rel_path part of addresses, and HTTP proxies may receive requests for URIs not defined by RFC 1738. The HTTP protocol does not place any a priori limit on the length of a URI. Servers MUST be able to handle the URI of any resource they serve, and SHOULD be able to handle URIs of unbounded length if they provide GET-based forms that could generate such URIs. A server SHOULD returna status code of414Request-URI(Request-URI TooLargeLong) status if a URI is longer than the server canhandle. Seehandle (see section12.4.1.15.10.4.15). Note: Servers should be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations may not properly supportthese. All client and proxy implementations MUST be able to handle a URI of any finite length. 7.2.2these lengths. 3.2.2 http URL The "http" scheme is used to locate network resources via the HTTP protocol. This section defines the scheme-specific syntax and semantics for http URLs. http_URL = "http:" "//" host [ ":" port ] [ abs_path ] Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 18] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 host = <A legal Internet host domain name or IP address (in dotted-decimal form), as defined by Section 2.1 of RFC 1123> port = *DIGITFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 18] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996If the port is empty or not given, port 80 is assumed. The semantics are that the identified resource is located at the server listening for TCP connections on that port of that host, and the Request-URI for the resource is abs_path. The use of IP addresses in URL's SHOULD be avoided wheneverpossible. Seepossible (see RFC1900.1900 [24]). If the abs_path is not present in the URL, it MUST be given as "/" when used as a Request-URI for a resource (section9.1.2). Note: Although the HTTP protocol is independent of the transport layer protocol, the http URL only identifies resources by their TCP location, and thus non-TCP resources MUST be identified by some other URI scheme. The canonical form for "http" URLs is obtained by converting any UPALPHA characters in host to their LOALPHA equivalent (hostnames are case- insensitive), eliding the [ ":" port ] if the port is 80, and replacing an empty abs_path with "/". 7.2.3 URI Canonicalization A cache, when comparing two URIs to decide if they match or not, a cache MUST use a case-sensitive octet-by-octet comparison5.1.2). 3.2.3 URI Comparison When comparing two URIs to decide if they match or not, a client SHOULD use a case-sensitive octet-by-octet comparison of the entire URIs, with these exceptions:Following the rules from section 7.2.2:. A port that is empty or not given is equivalent to the default port80.for that URI; . Comparisons of host names MUST becase-insensitive.case-insensitive; . Comparisons of scheme names MUST becase-insensitive.case-insensitive; . An empty abs_path is equivalent to an abs_path of"/""/". Charactersexceptother than those in thereserved set"reserved" andthe unsafe set"unsafe" sets (see section7.2)3.2) are equivalent to their ""%" HEX HEX" encodings. For example, the following three URIs are equivalent: http://abc.com:80/~smith/home.html http://ABC.com/%7Esmith/home.html http://ABC.com:/%7esmith/home.html7.33.3 Date/Time Formats7.3.13.3.1 Full Date HTTP applications have historically allowed three different formats for the representation of date/time stamps: Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format The first format is preferred as an Internet standard and represents a fixed-length subset of that defined by RFC 1123 (an update to RFC822). Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 19] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996822 ). The second format is in common use, but is based on the obsolete RFC Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 19] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 850 date format and lacks a four-digit year. HTTP/1.1 clients and servers that parse the date value MUST accept all threeformats,formats (for compatibility with HTTP/1.0), though they MUSTgenerateonly generate the RFC 1123 format for representingdate/time stampsHTTP-date values inHTTP messageheader fields. Note: Recipients of date values are encouraged to be robust in accepting date values that may have beengeneratedsent by non-HTTP applications, as is sometimes the case when retrieving or posting messages via proxies/gateways to SMTP or NNTP. All HTTP date/time stamps MUST be represented inUniversal Time (UT), also known asGreenwich Mean Time (GMT), without exception. This is indicated in the first two formats by the inclusion of "GMT" as the three-letter abbreviation for time zone, andSHOULDMUST be assumed when reading the asctime format. HTTP-date = rfc1123-date | rfc850-date | asctime-date rfc1123-date = wkday "," SP date1 SP time SP "GMT" rfc850-date = weekday "," SP date2 SP time SP "GMT" asctime-date = wkday SP date3 SP time SP 4DIGIT date1 = 2DIGIT SP month SP 4DIGIT ; day month year (e.g., 02 Jun 1982) date2 = 2DIGIT "-" month "-" 2DIGIT ; day-month-year (e.g., 02-Jun-82) date3 = month SP ( 2DIGIT | ( SP 1DIGIT )) ; month day (e.g., Jun 2) time = 2DIGIT ":" 2DIGIT ":" 2DIGIT ; 00:00:00 - 23:59:59 wkday = "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun" weekday = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday" month = "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec" Note: HTTP requirements for the date/time stamp format apply only to their usage within the protocol stream. Clients and servers are not required to use these formats for user presentation, request logging, etc.Additional rules for requirements on parsing and representation of dates and other potential problems with date representations include: . HTTP/1.1 clients and caches should assume that an RFC-850 date which appears to be more than 50 years in the future is in fact in the past (this helps solve the "year 2000" problem).Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 20] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996. An HTTP/1.1 implementation may internally represent a parsed Expires date as earlier than the proper value, but MUST NOT internally represent a parsed Expires date as later than the proper value. . All expiration-related calculations must be done in Universal Time (GMT). The local time zone MUST NOT influence the calculation or comparison of an age or expiration time. . If an HTTP header incorrectly carries a date value with a time zone other than GMT, it must be converted into GMT using the most conservative possible conversion. 7.3.23.3.2 Delta Seconds Some HTTP header fields allow a time value to be specified as an integer number of seconds, represented in decimal, after the time that the message was received.This format SHOULD only be used to represent short time periods or periods that cannot start until receipt of the message.delta-seconds = 1*DIGIT7.43.4 Character Sets HTTP uses the same definition of the term "character set" as that described for MIME: The term "character set" is used in this document to refer to a method used with one or more tables to convert a sequence of octets into a sequence of characters. Note that unconditional conversion in the other direction is not required, in that not all characters may be available in a given character set and a character set may provide more than one sequence of octets to represent a particular character. This definition is intended to allow various kinds of character encodings, from simple single-table mappings such as US- ASCII to complex table switching methods such as those that use ISO 2022's techniques. However, the definition associated with a MIME character set name MUST fully specify the mapping to be performed from octets to characters. In particular, use of external profiling information to determine the exact mapping is not permitted. Note: This use of the term "character set" is more commonly referred to as a "character encoding." However, since HTTP and MIME share the same registry, it is important that the terminology also be shared. HTTP character sets are identified by case-insensitive tokens. The complete set of tokens is defined by the IANA Character Set registry. However, because that registry does not define a single, consistent token for each character set, we define here the preferred names for those character sets most likely to be used with HTTP entities. These character sets include those registered by RFC 1521 -- the US-ASCII and ISO-8859 character sets -- and other names specifically recommended for use within MIME charset parameters. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 21] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996[19]. charset ="US-ASCII" | "ISO-8859-1" | "ISO-8859-2" | "ISO-8859-3" | "ISO-8859-4" | "ISO-8859-5" | "ISO-8859-6" | "ISO-8859-7" | "ISO-8859-8" | "ISO-8859-9" | "ISO-2022-JP" | "ISO-2022-JP-2" | "ISO-2022-KR" | "UNICODE-1-1" | "UNICODE-1-1-UTF-7" | "UNICODE-1-1-UTF-8" |token Although HTTP allows an arbitrary token to be used as a charset value, any token that has a predefined value within the IANA Character Set registry MUST represent the character set defined by that registry. Applications SHOULD limit their use of character sets to those defined by the IANA registry.The character set of an entity body SHOULD be labeled as the lowest common denominator of the character codes used within that body, with the exception that no label is preferred over the labels US-ASCII or ISO-8859-1. 7.53.5 Content Codings Content coding values indicate an encoding transformation that has been or can be applied toa resourcean entity. Content codings are primarily used to allow a document to be compressed orencryptedotherwise usefully transformed Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 21] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 without losing the identity of its underlying mediatype. Typically,type and without loss of information. Frequently, theresourceentity is stored inthis encodingcoded form, transmitted directly, and only decodedbefore rendering or analogous usage.by the recipient. content-coding ="gzip" | "x-gzip" | "compress" | "x-compress" |tokenNote: For historical reasons, HTTP applications SHOULD consider "x- gzip" and "x-compress" to be equivalent to "gzip" and "compress", respectively.All content-coding values are case-insensitive. HTTP/1.1 uses content- coding values in the Accept-Encoding (section18.3)14.3) and Content-Encoding (section18.13)14.12) header fields. Although the value describes the content- coding, what is more important is that it indicates what decoding mechanism will be required to remove the encoding.Note thatThe Internet Assigned Numbers Authority (IANA) acts as asingle program MAY be capable of decoding multipleregistry for content-codingformats. Two values are defined by this specification:value tokens. Initially, the registry contains the following tokens: gzip An encoding format produced by the file compression program "gzip" (GNU zip)developed by Jean-loup Gailly.as described in RFC 1952 [25]. This format istypicallyaLempel-ZivLempel- Ziv coding (LZ77) with a 32 bit CRC. compress The encoding format produced by the common UNIX file compression program "compress". This format is an adaptive Lempel-Ziv-Welch coding (LZW).Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 22] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996Note: Use of program names for the identification of encoding formats is not desirable and should be discouraged for future encodings. Their use here is representative of historical practice, not good design.HTTP defines a registration process which usesFor compatibility with previous implementations of HTTP, applications should consider "x-gzip" and "x-compress" to be equivalent to "gzip" and "compress" respectively. deflate The "zlib" format defined in RFC 1950[31] in combination with theInternet Assigned Numbers Authority (IANA) as a central registry for content-coding value tokens. Additional"deflate" compression mechanism described in RFC 1951[29]. New content-coding value tokensbeyond the four defined in this document (gzip x-gzip compress x-compress) SHOULDshould beregistered with the IANA. Toregistered; to allow interoperability between clients and servers, specifications of the content coding algorithmsusedneeded to implement a new valueSHOULDshould be publicly available and adequate for independent implementation, andMUSTconform to the purpose of content coding defined in this section.7.63.6 Transfer Codings Transfer coding values are used to indicate an encoding transformation that has been, can be, or may need to be applied to anEntity-Bodyentity-body in order to ensuresafe transport"safe transport" through the network. This differs from a content coding in that the transfer coding is a property of the message, not of the originalresourceentity. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 22] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 transfer-coding = "chunked" | transfer-extension transfer-extension = token All transfer-coding values are case-insensitive. HTTP/1.1 uses transfer coding values in the Transfer-Encoding header field (section18.43).14.40). Transfer codings are analogous to the Content-Transfer-Encoding values of MIME , which were designed to enable safe transport of binary data over a 7-bit transport service. However,"safe transport"safe transport has a different focus for an 8bit-clean transfer protocol. In HTTP, the only unsafe characteristic ofmessage bodiesmessage-bodies is the difficulty in determining the exact body length (section11.2.2),7.2.2), or the desire to encrypt data over a shared transport.All HTTP/1.1 applications MUST be able to receive and decode the "chunked" transfer coding , and MUST ignore transfer coding extensions they do not understand. A server which receives a an entity-body with a transfer-coding it does not understand SHOULD return 501(Unimplemented), and close the connection. A server MUST NOT send transfer-codings to a client that were not defined in the version of HTTP used in the client's request. Clients sending entity-bodies with transfer-codings SHOULD must be prepared for the connection to be closed if the server doesn't understand the transfer-coding.The chunked encoding modifies the body of a message in order to transfer it as a series of chunks, each with its own size indicator, followed by an optional footer containing entity-header fields. This allows dynamically-produced content to be transferred along with the information necessary for the recipient to verify that it has received the full message.Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 23] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996Chunked-Body = *chunk "0" CRLF footer CRLF chunk = chunk-size [ chunk-ext ] CRLF chunk-data CRLF hex-no-zero = <HEX excluding "0"> chunk-size = hex-no-zero *HEX chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-value ] ) chunk-ext-name = token chunk-ext-val = token | quoted-string chunk-data = chunk-size(OCTET) footer =*<<Content-MD5 and future headers that specify they are allowed in footer>> hex-no-zero = <HEX excluding "0"> Note that the chunks are*entity-header The chunked encoding is ended by a zero-sizedchunk,chunk followed by thefooter andfooter, which is terminated by an empty line. The purpose of the footer is to provide an efficient way to supply information about an entity that is generated dynamically; applications MUST NOT send header fields in the footer which are not explicitly defined as being appropriate for the footer, such as Content-MD5 or future extensions to HTTP for digital signatures or other facilities. An example process for decoding a Chunked-Body is presented in appendix23.3.6. 7.719.4.6. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 23] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 All HTTP/1.1 applications MUST be able to receive and decode the "chunked" transfer coding , and MUST ignore transfer coding extensions they do not understand. A server which receives an entity-body with a transfer-coding it does not understand SHOULD return 501 (Unimplemented), and close the connection. A server MUST NOT send transfer-codings to an HTTP/1.0 client. 3.7 Media Types HTTP uses Internet Media Types in the Content-Type (section18.19)14.18) and Accept (section18.1)14.1) header fields in order to provide open and extensible data typing and type negotiation. media-type = type "/" subtype *( ";" parameter ) type = token subtype = token Parameters may follow the type/subtype in the form of attribute/value pairs. parameter = attribute "=" value attribute = token value = token | quoted-string The type, subtype, and parameter attribute names are case-insensitive. Parameter values may or may not be case-sensitive, depending on the semantics of the parameter name.LWSLinear white space (LWS) MUST NOT begeneratedused between the type and subtype, nor between an attribute and its value.Upon receipt of a media type with an unrecognized parameter, aUser agents that recognize the media-type MUST process (or arrange to be processed by any external applications used to process that type/subtype by the useragent SHOULD treatagent) themediaparameters for that MIME type asifdescribed by that type/subtype definition to theunrecognized parameterandits value were not present. Someinform the user of any problems discovered. Note: some older HTTP applications do not recognize media type parameters.HTTP/1.1 applications SHOULDWhen sending data to older HTTP applications, implementations should only use media type parameters when they arenecessary to define the content of a message. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 24] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 Media-type values are registered withrequired by that type/subtype definition. Media-type values are registered with the Internet Assigned Number Authority(IANA ).(IANA). The media type registration process is outlined in RFC 1590.[17]. Use of non-registered media types is discouraged.7.7.13.7.1 Canonicalization and Text Defaults Internet media types are registered with a canonical form. In general, anEntity-Bodyentity-body transferred via HTTP messages MUST be represented in the appropriate canonical form prior to its transmission; the exception is "text" types, as defined in the nextparagraph.. whenparagraph. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 24] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 When in canonicalform ,form, media subtypes of the "text" type use CRLF as the text line break.However,HTTP relaxes this requirement and allows the transport of text media with plain CR or LF alone representing a line break whenifit is done consistently for an entireEntity-Body..entity-body. HTTP applications MUST accept CRLF, bare CR, and bare LF as being representative of a line break in text media received viaHTTP.InHTTP. In addition, if the textmediais represented in a character set that does not use octets 13 and 10 for CR and LF respectively, as is the case for some multi-byte character sets, HTTP allows the use of whatever octet sequences are defined by that character set to represent the equivalent of CR and LF for line breaks. This flexibility regarding line breaks applies only to text media in theEntity-Body;entity-body; a bare CR or LF MUST NOT be substituted for CRLF within any of the HTTP control structures (such as header fields and multipart boundaries). If anEntity-Bodyentity-body is encoded with a Content-Encoding, the underlying data MUST be in a form defined above prior to being encoded. The "charset" parameter is used with some media types to define the character set (section7.4)3.4) of the data. When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default charset value of "ISO-8859-1" when received via HTTP. Data in character sets other than "ISO-8859-1" or its subsets MUST be labeled with an appropriate charsetvalue in order to be consistently interpreted by the recipient. Note: Many current HTTP servers provide data using charsets other than "ISO-8859-1" without proper labeling. This situation reduces interoperability and is not recommended. To compensate for this, some HTTP user agents provide a configuration option to allow the user to change the default interpretation of the media type character set when no charset parameter is given. 7.7.2value. 3.7.2 Multipart Types MIME provides for a number of "multipart" types -- encapsulations of one or more entities within a singlemessage's Entity-Body.message-body. All multipart types share a common syntax, as defined in section 7.2.1 of RFC 1521,[7], and MUST include a boundary parameter as part of the media type value. The message body is itself a protocol element and MUST therefore use only CRLF to represent line breaks between body-parts. Unlike in RFCFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 25] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 19961521, the epilogue of any multipart message MUST be empty; HTTP applications MUST NOT transmit the epilogueeven(even if the originalresource entitymultipart contains anepilogue.epilogue). In HTTP, multipart body-parts MAY contain header fields which are significant to the meaning of that part. A Content-Location header field (section 14.15) SHOULD be included in the body-part of each enclosed entity that can be identified by a URL. In general, an HTTP user agent SHOULD follow the same or similar behavior as a MIME user agent would upon receipt of a multipart type. If an application receives an unrecognized multipart subtype, the application MUST treat it as being equivalent to "multipart/mixed". Note: The "multipart/form-data" type has been specifically defined for carrying form data suitable for processing via the POST request method, as described in RFC 1867. 7.8[15]. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 25] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 3.8 Product Tokens Product tokens are used to allow communicating applications to identify themselvesvia a simple product token, with an optional slashby software name andversion designator.version. Most fields using product tokens also allowsub- productssub-products which form a significant part of the application to be listed, separated by whitespace. By convention, the products are listed in order of their significance for identifying the application. product = token ["/" product-version] product-version = token Examples: User-Agent: CERN-LineMode/2.15 libwww/2.17b3 Server: Apache/0.8.4 Product tokens should be short and to the point -- use of them for advertising or other non-essential information is explicitly forbidden. Although any token character may appear in a product-version, this token SHOULD only be used for a version identifier (i.e., successive versions of the same product SHOULD only differ in the product-version portion of the product value).7.93.9 Quality Values HTTP content negotiation (section15)12) uses short "floating point" numbers to indicate the relative importance ("weight") of various negotiable parameters.The weights areA weight is normalized to a real number in the range 0 through 1, where 0 is the minimum and 1 the maximum value.In order to discourage misuse of this feature,HTTP/1.1 applications MUST NOT generate more than three digits after the decimal point. User configuration of these values SHOULD also be limited in this fashion. qvalue = ( "0" [ "." 0*3DIGIT ] ) | ( "1" [ "." 0*3("0") ] )Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 26] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996"Quality values" is aslightmisnomer, since these valuesactually measuremerely represent relative degradation inperceived quality. Thus, a value of "0.8" represents a 20% degradation from the optimum rather than a statement of 80%desired quality.7.103.10 Language Tags A language tag identifies a natural language spoken, written, or otherwise conveyed by human beings for communication of information to other human beings. Computer languages are explicitly excluded. HTTP uses language tags within theAccept-Language,Accept-Language and Content-Language fields. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 26] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 The syntax and registry of HTTP language tags is the same as that defined by RFC 1766.[1]. In summary, a language tag is composed of 1 or more parts: A primary language tag and a possibly empty series of subtags: language-tag = primary-tag *( "-" subtag ) primary-tag = 1*8ALPHA subtag = 1*8ALPHA Whitespace is not allowed within the tag and all tags are case- insensitive. The name space of language tags is administered by the IANA. Example tags include: en, en-US, en-cockney, i-cherokee, x-pig-latin where any two-letter primary-tag is an ISO 639 language abbreviation and any two-letter initial subtag is an ISO 3166 country code. (The last three tags above are not registered tags; all but the last are examples of tags which could be registered in future.)7.113.11 Entity Tags Entity tags arequoted strings whose internal structure is not visible to clientsused for comparing two orcaches. Entitymore entities from the same requested resource. HTTP/1.1 uses entity tags in the ETag (section 14.20), If-Match (section 14.25), If-None-Match (section 14.26), and If- Range (section 14.27) header fields. The definition of how they are used and compared as cache validators is inHTTP/1.1.section 13.3.3. An entity tag consists of an opaque quoted string, possibly prefixed by a weakness indicator. entity-tag =strong-entity-tag | weak-entity-tag | null-entity-tag strong-entity-tag[ weak ] opaque-tag weak =quoted-string weak-entity-tag"W/" opaque-tag = quoted-string"/W" null-entity-tag = <"> <"> Note that the "/W" tag is considered partA "strong entity tag" may be shared by two entities of aweakresource only if they are equivalent by octet equality. A "weak entitytag; it MUST NOTtag," indicated by the "W/" prefix, may beremovedshared byany cache or client. There aretwocomparison functions on validators: . The strong comparison function:entities of a resource only if the entities are equivalent and could be substituted for each other with no significant change inorder tosemantics. A weak entity tag can only beconsidered equal, both validators mustused for weak comparison. An entity tag MUST beidentical in every way, and neitherunique across all versions of all entities associated with a particular resource. A given entity tag value may beweak.used for entities obtained by requests on different URIs without implying anything about the equivalence of those entities. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 27] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996. The weak comparison function: in order3.12 Range Units HTTP/1.1 allows a client to request that only part (a range of) the response entity beconsidered equal, both validators must be identicalincluded within the response. HTTP/1.1 uses range units inevery way, except forthepresence or absence of a "weak" tag. The weak comparison function MAY be used for simple (non-subrange) GET requests. The strong comparison function MUST be used in all other cases. The null validator is a special value, defined as never matching the current validator of an existing resource entity, and always matching the "current" validator of a resource entity that does not exist. 7.12 Variant IDs A cache stores instances of resource entities, not instances of generic resources per se. Therefore, the URI of a generic resource is not sufficient for use as an identifier for a specific resource entity. In certain interactions between a cache and an origin server, it is convenient to encode that identifier using a more compact representation than the full set of selecting request headers (which may not even be possible if the selection criteria are not known to the cache). For these reasons, the HTTP protocol provides an optional mechanism for identifying a specific entity source of a generic resource, called a variant-ID. Variant-IDs are used to identify specific variants of a generic resource; see section 16.5.3 for how they are used. variant-id = quoted-string Variant-IDs are compared using string octet-equality; case is significant. All responses from generic resources SHOULD include variant-IDs. If these are not present, the resource author can expect caches to correctly handle requests on the generic resource, but cannot expect the caching to be efficient. 7.13 Variant Sets Validator sets are used for doing conditional retrievals on generic resources; see section 16.5.3. variant-set = 1#variant-set-item variant-set-item = opaque-validator ";" variant-id 7.14RangeProtocol Parameters This section defines certain HTTP protocol parameters used in range requests and related responses. Fielding, Frystyk, Berners-Lee, Gettys,(section 14.36), If-Range (section 14.27), andMogul [Page 28] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 7.14.1 Range Units A resourceContent-Range (section 14.17) header fields. An entity may be broken down into subranges according to various structural units. range-unit = bytes-unit | other-range-unit bytes-unit = "bytes" other-range-unit = token The only range unit defined by HTTP/1.1 is "bytes". HTTP/1.1 implementations may ignore ranges specified using other units.7.14.2 Byte Ranges Since allHTTP/1.1 has been designed to allow implementations of applications that do not depend on knowledge of ranges. 4 HTTPentities are represented inMessage 4.1 Message Types HTTP messagesas sequences of bytes, the conceptconsist ofa byte range is meaningful for any HTTP entity. (However, not all clients and servers needrequests from client tosupport byte-range operations.) Byte range specifications in HTTP applyserver and responses from server to client. HTTP-message = Request | Response ; HTTP/1.1 messages Request (section 5) and Response (section 6) messages use thesequencegeneric message format of RFC 822 for transferring entities (the payload ofbytes that would be transferred bytheprotocol if no transfer-coding were being applied. This means that if Content-coding is applied tomessage). Both types of message consist of a start-line, one or more header fields (also known as "headers"), an empty line (i.e., a line with nothing preceding thedata,CRLF) indicating thebyte range specification applies toend of theresulting content-encoded byte stream, not toheader fields, and an optional message-body. generic-message = start-line *message-header CRLF [ message-body ] start-line = Request-Line | Status-Line In theunencoded byte stream. It also means thatinterest of robustness, servers SHOULD ignore any empty line(s) received where a Request-Line is expected. In other words, if theentity-body's media-typeserver isa composite type (e.g., multipart/* and message/rfc822), then the composite's body-parts may have their own content-encoding and content-transfer-encoding, and the byte range applies toreading theresult ofprotocol stream at thethose encodings. A byte range operation may specify a single rangebeginning ofbytes, oraset of ranges withinmessage and receives asingle entity. ranges-specifier = byte-ranges-specifier byte-ranges-specifier = bytes-unit "=" byte-range-set byte-range-setCRLF first, it should ignore the CRLF. Note: certain buggy HTTP/1.0 client implementations and/or scripts generated extra CRLF's before/after a POST request. To restate what Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 28] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 is explicitly forbidden by the BNF, an HTTP/1.1 client must not preface or follow a request with an extra CRLF. 4.2 Message Headers HTTP header fields, which include general-header (section 4.5), request- header (section 5.3), response-header (section 6.2), and entity-header (section 7.1) fields, follow the same generic format as that given in Section 3.1 of RFC 822 [9]. Each header field consists of a name followed by a colon (":") and the field value. Field names are case- insensitive. The field value may be preceded by any amount of LWS, though a single SP is preferred. Header fields can be extended over multiple lines by preceding each extra line with at least one SP or HT. Applications SHOULD follow "common form" when generating HTTP constructs, since there might exist some implementations that fail to accept anything beyond the common forms. message-header =1#( byte-range-spec | suffix-byte-range-spec ) byte-range-specfield-name ":" [ field-value ] CRLF field-name =first-byte-pos "-" [last-byte-pos] first-byte-postoken field-value =1*DIGIT last-byte-pos*( field-content | LWS ) field-content =1*DIGIT<the OCTETs making up the field-value and consisting of either *TEXT or combinations of token, tspecials, and quoted-string> Thefirst-byte-pos valueorder ina byte-range-spec giveswhich header fields with differing field names are received is not significant. However, it is "good practice" to send general- header fields first, followed by request-header or response-header fields, and ending with thebyte-offset ofentity-header fields. Multiple message-header fields with thefirst bytesame field-name may be present in arange. The last-byte-pos value givesmessage if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing thebyte- offsetsemantics of thelast byte inmessage, by appending each subsequent field-value to therange; that is,first, each separated by a comma. The order in which header fields with thebyte positions specifiedsame field-name areinclusive. Byte offsets start at zero. If the last-byte-pos valuereceived ispresent, it must be greater than or equaltherefore significant to thefirst-byte-pos in that byte-range-spec, orinterpretation of thebyte-range-speccombined field value, and thus a proxy MUST NOT change the order of these field values when a message isinvalid.forwarded. 4.3 Message Body Therecipientmessage-body (if any) of aninvalid byte-range-spec must ignore it.HTTP message is used to carry the entity-body associated with the request or response. The message-body differs from the entity-body only when a transfer coding has been applied, as indicated by the Transfer-Encoding header field (section 14.40). Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 29] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996If the last-byte-pos value is absent, it is assumed tomessage-body = entity-body | <entity-body encoded as per Transfer-Encoding> Transfer-Encoding MUST beequalused tothe current lengthindicate any transfer codings applied by an application to ensure safe and proper transfer of theentity in bytes. If the last-byte-pos valuemessage. Transfer-Encoding islarger thana property of thecurrent lengthmessage, not of the entity,it is assumed toand thus can beequal to the current length ofadded or removed by any application along theentity. suffix-byte-range-spec = "-" suffix-length suffix-length = 1*DIGIT A suffix-byte-range-specrequest/response chain. The rules for when a message-body isused to specify the suffixallowed in a message differ for requests and responses. The presence of a message-body in a request is signaled by theentity,inclusion of alength given byContent-Length or Transfer-Encoding header field in thesuffix-length value. (That is, this form specifiesrequest's message-headers. A message-body MAY be included in a request only when thelast N bytes ofrequest method (section 5.1.1) allows anentity.) If the entityentity-body. For response messages, whether or not a message-body isshorter thanincluded with a message is dependent on both thespecified suffix-length,request method and theentire entity is used. Examples of byte-ranges-specifier values (assuming an entityresponse status code (section 6.1.1). All responses to the HEAD request method MUST NOT include a message-body, even though the presence oflength 10000): . The first 500 bytes (byte offsets 0-499, inclusive): bytes=0-499 . The second 500 bytes (byte offsets 500-999, inclusive): bytes=500-999 . The final 500 bytes (byte offsets 9500-9999, inclusive): bytes=-500 . Or bytes=9500- . The first and last bytes only (bytes 0entity-header fields might lead one to believe they do. All 1xx (informational), 204 (no content), and9999): bytes=0-0,-1 . Several legal but not canonical specifications304 (not modified) responses MUST NOT include a message- body. All other responses do include a message-body, although it may be ofthe second 500 bytes (byte offsets 500-999, inclusive): bytes=500-600,601-999 bytes=500-700,601-999 7.14.3 Content Rangeszero length. 4.4 Message Length When aserver returnsmessage-body is included with apartialmessage, the length of that body is determined by one of the following (in order of precedence): 1. Any response message which MUST NOT include a message-body (such as the 1xx, 204, and 304 responses and any response to aclient, it must describe bothHEAD request) is always terminated by theextentfirst empty line after the header fields, regardless of therange covered byentity-header fields present in theresponse,message. 2. If a Transfer-Encoding header field (section 14.40) is present and indicates that the "chunked" transfer coding has been applied, then the length is defined by the chunked encoding (section 3.6). 3. If a Content-Length header field (section 14.14) is present, its value in bytes represents the length of theentire entity. content-range-spec = byte-content-range-spec byte-content-range-spec = bytes-unit SP first-byte-pos "-" last-byte-pos "/" entity-length entity-length = 1*DIGITmessage-body. 4. If the message uses the MIME "multipart/byteranges" Content-Type, which is self-delimiting, then that defines the length. This Content- Type MUST NOT be used unless the sender knows that the recipient can parse it; the presence in a request of a Range header with multiple byte-range specifiers implies that the client can parse multipart/byteranges responses. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 30] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996Unlike byte-ranges-specifier values, a byte-content-range-spec may only specify one range, and must contain absolute byte positions for both5. By thefirst and last byte ofserver closing therange. A byte-content-range-spec whose last-byte-pos value is less than its first-byte-pos value, or whose entity-length value is less than or equalconnection. (Closing the connection cannot be used toits last-byte-pos value, is invalid. The recipient of an invalid byte-content-range-spec MUST ignore it and any content transferred along with it. Examplesindicate the end ofbyte-content-range-spec values, assuminga request body, since that would leave no possibility for theentity contains a total of 1234 bytes: . The first 500 bytes: bytes 0-499/1234 . The second 500 bytes: bytes 500-999/1234 . All except for the first 500 bytes: bytes 500-1233/1234 . The last 500 bytes: bytes 734-1233/1234 8 HTTP Message 8.1 Message Types HTTP messages consist of requests from client to server and responses fromserver toclient. HTTP-message = Full-Request ; HTTP/1.1 messages | Full-Response Full-Request and Full-Response use the generic message format of RFC 822 for transferring entities. Both messages may include optional header fields (also known as "headers") and an entity body. The entity body is separated from the headers by a null line (i.e.,send back alineresponse.) For compatibility withnothing preceding the CRLF). 8.2 Message Headers HTTP header fields, whichHTTP/1.0 applications, HTTP/1.1 requests containing a message-body MUST includeGeneral-Header (Section 8.3), Request- Header (Section 9.2), Response-Header (Section 10.2), and Entity-Header (Section 11.1) fields, follow the same generic format as that given in Section 3.1 of RFC 822 . Eacha valid Content-Length header fieldconsists ofunless the server is known to be HTTP/1.1 compliant. If aname followed byrequest contains acolon (":")message-body andthe field value. Field names are case-insensitive. The field value may be preceded by any amount of LWS, thoughasingle SPContent-Length ispreferred. Header fields can be extended over multiple lines by preceding each extra linenot given, the server SHOULD respond withat least one SP or HT. HTTP-header = field-name ":" [ field-value ] CRLF Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 31] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 field-name = token field-value = *( field-content | LWS ) field-content = <the OCTETs making up400 (bad request) if it cannot determine thefield-value and consistinglength ofeither *TEXTthe message, orcombinations of token, tspecials, and quoted-string> The order in which header fieldswithdiffering field names are received is not significant. However,411 (length required) if itis "good practice"wishes tosend General- Header fields first, followed by Request-Header or Response-Header fields, and ending withinsist on receiving a valid Content-Length. All HTTP/1.1 applications that receive entities MUST accept theEntity-Header fields. Multiple HTTP-header fields with"chunked" transfer coding (section 3.6), thus allowing this mechanism to be used for messages when thesame field-name maymessage length cannot bepresentdetermined in advance. Messages MUST NOT include both amessage if and only if the entire field-value for thatContent-Length header field and the "chunked" transfer coding. If both are received, the Content-Length MUST be ignored. When a Content-Length isdefined asgiven in acomma-separated list [i.e., #(values)]. Itmessage where a message-body is allowed, its field value MUSTbe possible to combine the multiple header fields into one "field-name: field-value" pair, without changingexactly match thesemanticsnumber ofthe message, by appending each subsequent field-value to the first, each separated by a comma. Thus, the orderOCTETs inwhich multiple header fields withthesame field-name are received may be significant to the interpretation ofmessage-body. HTTP/1.1 user agents MUST notify thecombined field- value. 8.3user when an invalid length is received and detected. 4.5 General Header Fields There are a few header fields which have general applicability for both request and response messages, but which do not apply to the entity being transferred. Theseheadersheader fields apply only to the message being transmitted.General-Headergeneral-header = Cache-Control ; Section18.1014.9 | Connection ; Section18.1114.10 | Date ; Section18.2014.19 |ViaPragma ; Section18.4714.32 |Keep-AliveTransfer-Encoding ; Section23.5.2.5.114.40 |PragmaUpgrade ; Section18.3414.41 |UpgradeVia ; Section18.44 General header14.44 General-header field names can be extended reliably only in combination with a change in the protocol version. However, new or experimental header fields may be given the semantics of general header fields if all parties in the communication recognize them to begeneral headergeneral-header fields. Unrecognized header fields are treated asEntity-Headerentity-header fields.9Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 31] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 5 Request A request message from a client to a server includes, within the first line of that message, the method to be applied to the resource, the identifier of the resource, and the protocol version in use.For backwards compatibility with the more limited HTTP/0.9 protocol, there are two valid formats for an HTTP request:Request =Full-Request Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 32] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 Full-Request =Request-Line ; Section9.15.1 *(General-Headergeneral-header ; Section8.34.5 |Request-Headerrequest-header ; Section9.25.3 |Entity-Headerentity-header ) ; Section11.17.1 CRLF [Entity-Bodymessage-body ] ; Section11.2 9.17.2 5.1 Request-Line The Request-Line begins with a method token, followed by the Request-URI and the protocol version, and ending with CRLF. The elements are separated by SP characters. No CR or LF are allowed except in the final CRLF sequence. Request-Line =CRLF |Method SP Request-URI SP HTTP-Version CRLFIn the interest of robustness, HTTP/1.1 servers SHOULD ignore null request lines (ones that comprise just CRLF). An HTTP/1.1 client MUST NOT preface a request with CRLF. 9.1.15.1.1 Method The Method token indicates the method to be performed on the resource identified by the Request-URI. The method is case-sensitive. Method = "OPTIONS" ; Section13.19.1.1 | "GET" ; Section13.29.3 | "HEAD" ; Section13.39.4 | "POST" ; Section13.49.5 | "PUT" ; Section13.59.6 | "DELETE" ; Section13.69.7 | "TRACE" ; Section13.79.8 | extension-method extension-method = token The list of methods acceptable by a plain resource can be specified in an Allow header field (section18.7). However, the client is always notified through the14.7). The return code of the response always notifies the client whether a method is currently allowed on aplainresource, asthiswhich methods are allowed can change dynamically. Servers SHOULD return the status code 405(method not allowed)(Method Not Allowed) if the method is known by the server but not allowed for the requested resource, and 501(not implemented)(Not Implemented) if the method is unrecognized or not implemented by the server. The list of methods known by a server can be listed in a Publicresponse headerresponse-header field (section18.37).14.35). Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 32] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 The methods GET and HEAD MUST be supported by all general-purpose servers.Servers which provide Last-Modified dates for resources MUST also support the conditional GET method.All other methods are optional; however, if the above methods are implemented, they MUST be implemented with the same semantics as those specified in section13. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 33] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 9.1.29. 5.1.2 Request-URI The Request-URI is a Uniform Resource Identifier (section7.2)3.2) and identifies the resource upon which to apply the request. Request-URI = "*" | absoluteURI | abs_path The three options for Request-URI are dependent on the nature of the request. The asterisk "*" means that the request does not apply to a particular resource, but to the server itself, and is only allowed when theMethodmethod used does not necessarily apply to a resource. One example would be OPTIONS * HTTP/1.1 The absoluteURI form is required when the request is being made to a proxy. The proxy is requested to forward the request or service it from a valid cache, and return theresponse..response. Note that the proxy MAY forward the request on to another proxy or directly to the server specified by the absoluteURI. In order to avoid request loops, a proxy MUST be able to recognize all of its server names, including any aliases, local variations, and the numeric IP address. An example Request-Line would be: GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1 To allow for transition to absoluteURIs in all requests in future versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI form in requests, even though HTTP/1.1 clients will only generate them in requests to proxies. TheHost request-header field MUST be ignored in requests using an absoluteURL as the Request-URI. Themost common form of Request-URI is that used to identify a resource on an origin server or gateway. In this case the absolute path of the URI MUST be transmitted (see7.2.1,section 3.2.1, abs_path) as theRequest-URI,Request- URI, and the network location of the URI (net_loc) MUST be transmitted in a Host headerfield..field. For example, a client wishing to retrieve the resource above directly from the origin server would create a TCP connection to port 80 of the host "www.w3.org" and send the lines: GET /pub/WWW/TheProject.html HTTP/1.1Host:www.w3.orgHost: www.w3.org followed by the remainder of theFull-Request.Request. Note that the absolute path cannot be empty; if none is present in the original URI, it MUST be given as "/" (the server root). Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 33] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 If a proxy receives a request without any path in the Request-URI and the method specified is capable of supporting the asterisk form of request, then the last proxy on the request chain MUST forward the request with "*" as the final Request-URI. For example, the request OPTIONS http://www.ics.uci.edu:8001 HTTP/1.1 would be forwarded by the proxy asFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 34] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996OPTIONS * HTTP/1.1 Host: www.ics.uci.edu:8001 after connecting to port 8001 of host "www.ics.uci.edu". The Request-URI is transmittedas an encoded string, where some characters may be escaped usingin the"% HEX HEX" encoding defined by RFC 1738 .format specified in section 3.2.1. The origin server MUST decode the Request-URI in order to properly interpret the request. Servers SHOULD respond to invalid Request-URIs with an appropriate status code. In requests that they forward, proxies MUST NOT rewrite the "abs_path" part of a Request-URI in any way except as noted above to replace a null abs_path with"*". Illegal Request-URIs SHOULD be responded to with an appropriate status code. Proxies MAY transform"*", no matter what theRequest-URI for internal processing purposes, but SHOULD NOT send such a transformed Request-URIproxy does inforwarded requests.its internal implementation. Note: Themain reason for this"no rewrite" ruleis to make sure thatprevents theform of Request-URI is well specified, to enable future extensions without fear that they will break inproxy from changing theface of some rewritings. Another is that one consequencemeaning ofrewritingtheRequest-URI is that integrity or authentication checks byrequest when the origin servermay fail;is improperly using a non-reserved URL character for a reserved purpose, sincerewriting MUST be avoided in this case,itmay as well be proscribed in general.is not feasible to fix all CGI scripts (or script authors) use URI syntax correctly. Implementers should be aware that somepre- HTTP/1.1pre-HTTP/1.1 proxiesdo some rewriting. 9.2have been known to rewrite the Request-URI. 5.2 The Resource Identified by a Request HTTP/1.1 origin servers SHOULD be aware that the exact resource identified by an Internet request is determined by examining both the Request-URI and the Host header field. An origin server that does not allow resources to differ by the requested host MAY ignore the Host headerfield.field value. (But see section 19.5.1 for other requirements on Host support in HTTP/1.1.) An origin server that does differentiate resources based on the host requested (sometimes referred to as virtual hosts or vanity hostnames) MUST use the following rules for determining the requested resource on an HTTP/1.1request:.request: 1. If Request-URI is an absoluteURI, the host isincluded inpart of theRequest-URI.Request- URI. Any Host header field value in the request MUST be ignored. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 34] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 2. If the Request-URI is not an absoluteURI, and the request includes a Host header field, the host is determined by the Host headerfield.field value. 3. If therequest-URI is not an absoluteURI and no Host header fieldhost as determined by rule 1 or 2 ispresent (or doesnotrepresenta valid host onthat server),the server, the response MUST be a 400 (Bad Request) error message. Recipients of an HTTP/1.0 requestlackingthat lacks a Host header field MAY attempt to use heuristics (e.g., examination of the URI path for something unique to a particular host) in order to determine what exact resource is being requested.9.35.3 Request Header Fields Therequest headerrequest-header fields allow the client to pass additional information about the request, and about the client itself, to the server. These fields act as request modifiers, with semantics equivalentFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 35] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996to the parameters on a programming language method(procedure)invocation.Request-Headerrequest-header = Accept ; Section18.114.1 | Accept-Charset ; Section18.214.2 | Accept-Encoding ; Section18.314.3 | Accept-Language ; Section18.414.4 | Authorization ; Section18.814.8 | From ; Section18.2314.22 | Host ; Section18.2414.23 | If-Modified-Since ; Section18.2514.24 | If-Match ; Section 14.25 | If-None-Match ; Section 14.26 | If-Range ; Section18.2814.27 | If-Unmodified-Since ; Section 14.28 | Max-Forwards ; Section 14.31 | Proxy-Authorization ; Section18.3614.34 | Range ; Section18.3814.36 | Referer ; Section18.3914.37 | User-Agent ; Section18.45 | Max-Forwards ; Section 18.32 Request-Header14.42 Request-header field names can be extended reliably only in combination with a change in the protocol version. However, new or experimental header fields MAY be given the semantics ofrequest headerrequest-header fields if all parties in the communication recognize them to berequest headerrequest-header fields. Unrecognized header fields are treated asEntity-Headerentity-header fields.106 Response After receiving and interpreting a request message, a server respondsin the form ofwith an HTTP response message. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 35] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 Response =Full-Response Full-Response =Status-Line ; Section10.16.1 *(General-Headergeneral-header ; Section8.34.5 |Response-Headerresponse-header ; Section10.26.2 |Entity-Headerentity-header ) ; Section11.17.1 CRLF [Entity-Bodymessage-body ] ; Section11.2 10.17.2 6.1 Status-Line The first line of aFull-ResponseResponse message is the Status-Line, consisting of the protocol version followed by a numeric status code and its associated textual phrase, with each element separated by SP characters. No CR or LF is allowed except in the final CRLF sequence. Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF10.1.16.1.1 Status Code and Reason Phrase The Status-Code element is a 3-digit integer result code of the attempt to understand and satisfy the request. These codes are fully defined in section 10. The Reason-Phrase is intended to give a short textual description of the Status-Code. The Status-Code is intended for use by automata and the Reason-Phrase is intended for theFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 36] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996human user. The client is not required to examine or display theReason- Phrase.Reason-Phrase. The first digit of the Status-Code defines the class of response. The last two digits do not have any categorization role. There are 5 values for the first digit: . 1xx: Informational - Request received, continuing process . 2xx: Success - The action was successfully received, understood, and accepted . 3xx: Redirection - Further action must be taken in order to complete the request . 4xx: Client Error - The request contains bad syntax or cannot be fulfilled . 5xx: Server Error - The server failed to fulfill an apparently valid request The individual values of the numeric status codes defined for HTTP/1.1, and an example set of corresponding Reason-Phrase's, are presented below. The reason phrases listed here are only recommended -- they may be replaced by local equivalents without affecting the protocol.These codes are fully defined in section 12.Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 36] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 Status-Code = "100" ; Continue | "101" ; Switching Protocols | "200" ; OK | "201" ; Created | "202" ; Accepted | "203" ; Non-Authoritative Information | "204" ; No Content | "205" ; Reset Content | "206" ; Partial Content | "300" ; Multiple Choices | "301" ; Moved Permanently | "302" ; Moved Temporarily | "303" ; See Other | "304" ; Not Modified | "305" ; Use Proxy | "400" ; Bad Request | "401" ; Unauthorized | "402" ; Payment Required | "403" ; Forbidden | "404" ; Not Found | "405" ; Method Not Allowed | "406" ; Not Acceptable | "407" ; Proxy Authentication Required | "408" ; Request Time-out | "409" ; Conflict | "410" ; Gone | "411" ; Length RequiredFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 37] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996| "412" ; Precondition Failed | "413" ; Request Entity Too Large | "414" ;Request URIRequest-URI Too Large | "415" ; Unsupported Media Type | "500" ; Internal Server Error | "501" ; Not Implemented | "502" ; Bad Gateway | "503" ; Service Unavailable | "504" ; Gateway Time-out | "505" ; HTTP Version not supported | extension-code extension-code = 3DIGIT Reason-Phrase = *<TEXT, excluding CR, LF> HTTP status codes are extensible. HTTP applications are not required to understand the meaning of all registered status codes, though such understanding is obviously desirable. However, applications MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class, with the exception that an unrecognized response MUST NOT be cached. For example, if an unrecognized status code of 431 is received by the client, it can safely assume that there was Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 37] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 something wrong with its request and treat the response as if it had received a 400 status code. In such cases, user agents SHOULD present to the user the entity returned with the response, since that entity is likely to include human-readable information which will explain the unusual status.10.26.2 Response Header Fields Theresponse headerresponse-header fields allow the server to pass additional information about the response which cannot be placed in the Status- Line. These header fields give information about the server and about further access to the resource identified by the Request-URI.Response-Headerresponse-header = Age ; Section 14.6 | Location ; Section18.3114.30 | Proxy-Authenticate ; Section18.3514.33 | Public ; Section18.3714.35 | Retry-After ; Section18.4014.38 | Server ; Section18.4114.39 | Vary ; Section 14.43 | WWW-Authenticate ; Section18.46 Response-Header14.43 Response-header field names can be extended reliably only in combination with a change in the protocol version. However, new or experimental header fields MAY be given the semantics ofresponse headerresponse-header fields if all parties in the communication recognize them to beresponse headerresponse-header fields. Unrecognized header fields are treated asEntity-Headerentity-header fields.117 EntityFull-RequestRequest andFull-ResponseResponse messages MAY transfer an entitywithin some requests and responses.if not otherwise restricted by the request method or response status code. An entity consists ofEntity-Headerentity-header fieldsFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 38] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996and(usually)anEntity-Body.entity-body, although some responses will only include the entity-headers. In this section, both sender and recipient refer to either the client or the server, depending on who sends and who receives the entity.11.17.1 Entity Header FieldsEntity-HeaderEntity-header fields define optional metainformation about theEntity- Bodyentity- body or, if no body is present, about the resource identified by the request.Entity-Headerentity-header = Allow ; Section18.714.7 | Content-Base ; Section18.1214.11 | Content-Encoding ; Section18.314.12 | Content-Language ; Section18.1414.13 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 38] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 | Content-Length ; Section18.1514.14 | Content-Location ; Section18.1614.15 | Content-MD5 ; Section014.16 | Content-Range ; Section18.1814.17 | Content-Type ; Section18.19 | Expires ; Section 18.2214.18 |Last-ModifiedETag ; Section18.3014.20 |TitleExpires ; Section18.4214.21 |Transfer-EncodingLast-Modified ; Section18.4314.29 | extension-header extension-header =HTTP-headermessage-header The extension-header mechanism allows additionalEntity-Headerentity-header fields to be defined without changing the protocol, but these fields cannot be assumed to be recognizable by the recipient. Unrecognized header fields SHOULD be ignored by the recipient and forwarded by proxies.11.27.2 Entity Body Theentity bodyentity-body (if any) sent with an HTTP request or response is in a format and encoding defined by theEntity-Headerentity-header fields.Entity-Bodyentity-body = *OCTET Anentity body MUST ONLY be included withentity-body is only present in arequestmessage whenthe request method calls for one. The presence of an entity body inarequestmessage-body issignaled by the inclusion of a Content-Length and/or Content- Type header fieldpresent, as described inthe request message headers. For response messages, whether or not an entity body is included with a messagesection 4.3. The entity-body isdependent on both the request method and the response code. All responses to the HEAD request method MUST NOT include a body, even thoughobtained from thepresence of entity header fieldsmessage-body by decoding any Transfer-Encoding that maylead onehave been applied tobelieve they do. All 1xx (informational), 204 (no content),ensure safe and304 (not modified) responses MUST NOT include a body. All other responses MUST include an entity body or a Content-Length header field defined with a valueproper transfer ofzero (0). Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 39] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 11.2.1the message. 7.2.1 Type When anentity bodyentity-body is included with a message, the data type of that body is determined via the header fieldsContent-Type, Content-Encoding,Content-Type andTransfer-Encoding.Content- Encoding. These define athree-layer,two-layer, ordered encoding model: entity-body :=Transfer-Encoding(Content-Encoding( Content-Type( data ) )) The default for both encodings is none (i.e., the identity function).Content-Type specifies the media type of the underlying data. Content- Encoding may be used to indicate any additional content codings applied to thetype,data, usually for the purpose of data compression, that are a property of theresource entity requested. Transfer-Encoding may be used to indicate any additional transfer codings applied by an application to ensure safe and proper transfer of the message. Note that Transfer-Encodingrequested resource. There isa property of the message, not of the resource entity.no default encoding. Any HTTP/1.1 message containing anentity bodyentity-body SHOULD include a Content- Type header field defining the media type of that body. If and only if the media type is not given by a Content-Typeheader,field, the recipientmayMAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URL used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream".11.2.2Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 39] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 7.2.2 LengthWhen an entity body is included with a message, theThe length ofthat body may be determined in one of several ways. If a Content-Length header fieldan entity-body ispresent, its value in bytes representsthe length of theentity body. Otherwise,message-body after any transfer codings have been removed. Section 4.4 defines how thebodylength of a message-body isdetermined bydetermined. 8 Connections 8.1 Persistent Connections 8.1.1 Purpose Prior to persistent connections, a separate TCP connection was established to fetch each URL, increasing theTransfer-Encoding (ifload on HTTP servers, and causing congestion on the"chunked" transfer coding has been applied) or byInternet. The use of inline images and other associated data often requires a client to make multiple requests of the same serverclosing the connection. Note: Any response message which MUST NOT include an entity body (such as the 1xx, 204,in a short amount of time. An excellent analysis of these performance problems is available [30]; analysis and304 responsesresults from a prototype implementation are in [26]. Persistent HTTP connections have a number of advantages: . By opening andany responseclosing fewer TCP connections, CPU time is saved, and memory used for TCP protocol control blocks is also saved. . HTTP requests and responses can be pipelined on a connection. Pipelining allows a client to make multiple requests without waiting for each response, allowing aHEAD request)single TCP connection to be used much more efficiently, with much lower elapsed time. . Network congestion isalways terminatedreduced by reducing thefirst empty line after the header fields, regardlessnumber of packets caused by TCP opens, and by allowing TCP sufficient time to determine theentity header fields present in the message. Closingcongestion state of theconnection cannotnetwork. . HTTP can evolve more gracefully; since errors can beused to indicatereported without theendpenalty ofa request body, since it leaves no possibility forclosing theserver to send backTCP connection. Clients using future versions of HTTP might optimistically try aresponse. For compatibilitynew feature, but if communicating withHTTP/1.0 applications, HTTP/1.1 requests containinganentity body MUST include a valid Content-Length header field unless the serverolder server, retry with old semantics after an error isknown to be HTTP/1.1 compliant.reported. HTTP implementations SHOULD implement persistent connections. 8.1.2 Overall Operation A significant difference between HTTP/1.1servers MUST acceptand earlier versions of HTTP is that persistent connections are the"chunked" transfer coding (section 7.6), thus allowing this mechanism to be used fordefault behavior of any HTTP connection. That is, unless otherwise indicated, the client may assume that the server will maintain arequest when Content-Length is unknown. Ifpersistent connection. Persistent connections provide arequest contains an entity bodymechanism by which a client andContent-Length is not specified, thea serverSHOULD respond with 400 (bad request) if it cannot determinecan signal thelengthclose ofthe request message's content, or with 411a TCP connection. This signaling takes Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 40] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996(length required) if it wishes to insist on receiving a valid Content- Length. Messages MUST NOT include both a Content-Length header field andplace using the"chunked" transfer coding. If both are received,Connection header field. Once a close has been signaled, theContent-Lengthclient MUSTbe ignored. Whennot send any more requests on that connection. 8.1.2.1 Negotiation An HTTP/1.1 server MAY assume that aContent-Length is given inHTTP/1.1 client intends to maintain amessage where an entity body is allowed, its field value MUST exactly matchpersistent connection unless a Connection header including thenumber of OCTETsconnection-token "close" was sent in theentity body. HTTP/1.1 user agents MUST notifyrequest. If theuser when an invalid length is received and detected. 12 Status Code Definitions Each Status-Code is described below,server chooses to close the connection immediately after sending the response, it SHOULD send a Connection header including the connection-token close. An HTTP/1.1 client MAY expect adescription of which method(s)connection to remain open, but would decide to keep itcan follow and any metainformation required inopen based on whether theresponse. 12.1 Informational 1xx This class of status code indicatesresponse from aprovisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. Since HTTP/1.0 did not define any 1xx status codes, servers MUST NOT sendserver contains a1xx response to an HTTP/1.0 client except under experimental conditions. 12.1.1.1 100 Continue The client may continueConnection header withits request. This interim response is used to informthe connection-token close. In case the client does not want to maintain a connection for more than that request, it SHOULD send a Connection header including theinitial part of the request has been received and has not yet been rejected byconnection- token close. If either theserver. TheclientSHOULD continue by sendingor theremainder ofserver sends therequest or, ifclose token in the Connection header, that requesthas already been completed, ignore this response. The server MUST send a final response afterbecomes therequest has been completed. 12.1.1.2 101 Switching Protocols The server understandslast one for the connection. Clients and servers SHOULD NOT assume that a persistent connection iswilling to complymaintained for HTTP versions less than 1.1 unless it is explicitly signaled. See section 19.7.1 for more information on backwards compatibility with HTTP/1.0 clients. In order to remain persistent, all messages on theclient's request, via the Upgrade message header field (section 18.44), forconnection must have achange inself-defined message length (i.e., one not defined by closure of theapplication protocol being used on this connection. Theconnection), as described in section 4.4. 8.1.2.2 Pipelining A client that supports persistent connections MAY "pipeline" its requests (i.e., send multiple requests without waiting for each response). A serverwill switch protocolsMUST send its responses to thosedefined byrequests in theresponse's Upgrade header field immediately aftersame order that theempty linerequests were received. Clients whichterminates the 101 response. The protocol should onlyassume persistent connections and pipeline immediately after connection establishment SHOULD beswitched whenprepared to retry their connection if the first pipelined attempt fails. If a client does such a retry, it MUST NOT pipeline before it knows the connection isadvantageous to do so. For example, switchingpersistent. Clients MUST also be prepared toa newer versionresend their requests if the server closes the connection before sending all ofHTTPthe corresponding responses. 8.1.3 Proxy Servers It isadvantageous over older versions, and switching to a real-time, synchronous protocol may be advantageous when delivering resourcesespecially important thatuse such features. 12.2 Successful 2xx This classproxies correctly implement the properties ofstatus code indicates thattheclient's request was successfully received, understood, and accepted.Connection header field as specified in 14.2.1. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 41] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199612.2.1.1 200 OK The request has succeeded.Theinformation returnedproxy server MUST signal persistent connections separately with its clients and theresponse is dependent on the method used in the request, as follows: GET an entity correspondingorigin servers (or other proxy servers) that it connects to. Each persistent connection applies tothe requested resource is sent in the response; HEAD the response MUSTonlycontain the header information andone transport link. A proxy server MUST NOT establish a persistent connection with an HTTP/1.0 client. 8.1.4 Practical Considerations Servers will usually have some time-out value beyond which they will noEntity- Body; POSTlonger maintain anentity describing or containing the result of the action; TRACE an entity containing the request message as received by the end server; otherwise, an entity describing the result of the action; If the entity corresponds to a resource, the response MAY includeinactive connection. Proxy servers might make this aContent-Location header field giving the actual location ofhigher value since it is likely thatplain resource for later reference. 12.2.1.2 201 Created The request has been fulfilled and resulted in a new resource being created. The newly created resource can be referenced bytheURI(s) returned inclient will be making more connections through theentitysame server. The use of persistent connections places no requirements on theresponse, with the most specific URLlength of this time-out for either theresource given byclient or the server. When aLocation header field. The originclient or server wishes to time-out it SHOULDcreate the resource before returning this status code. If the action cannot be carried out immediately, the server MUST include in the response bodyissue adescription of when the resource will be available; otherwise,graceful close on theservertransport connection. Clients and servers SHOULDrespond with 202 (Accepted). 12.2.1.3 202 Accepted The request has been acceptedboth constantly watch forprocessing, buttheprocessing has not been completed. The request MAY or MAY NOT eventually be acted upon, as it MAY be disallowed when processing actually takes place. There is no facility for re-sending a status code from an asynchronous operation such as this. The 202 response is intentionally non-committal. Its purpose is to allow a server to accept a request for someotherprocess (perhaps a batch- oriented process that is only run once per day) without requiring that the user agent's connection to the server persist until the process is completed. The entity returned with this response SHOULD include an indicationside of therequest's current statustransport close, andeither a pointerrespond to it as appropriate. If astatus monitorclient orsome estimate of when the user can expect the request to be fulfilled. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 42] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 12.2.1.4 203 Non-Authoritative Information The returned metainformation in the Entity-Header isserver does not detect thedefinitive set as available fromother side's close promptly it could cause unnecessary resource drain on theoriginnetwork. A client, server,but is gathered from a localora third-party copy. The set presentedproxy MAYbe a subset or superset ofclose theoriginal version.transport connection at any time. For example,including local annotation information about the resourcea client MAYresult inhave started to send asuperset of the metainformation known bynew request at theorigin server. Use of this response code is not required and is only appropriate whensame time that theresponse would otherwise be 200 (OK). 12.2.1.5 204 No Content Theserver hasfulfilled the request but there is no new informationdecided tosend back. Ifclose theclient"idle" connection. From the server's point of view, the connection isa user agent,being closed while itSHOULD NOT change its document viewwas idle, but fromthat which causedthe client's point of view, a requestto be generated. This responseisprimarily intendedin progress. This means that clients, servers, and proxies MUST be able toallow input for actions to take place without causing a change to the user agent's active document view. The response MAY include new metainformation in the form of entity headers, whichrecover from asynchronous close events. Client software SHOULDapply to the document currently inreopen theuser agent's active view. The 204 response MUST NOT include an entity body,transport connection andthus is always terminated by the first empty line after the header fields. 12.2.1.6 205 Reset Content The server has fulfilledretransmit the aborted requestand thewithout useragent SHOULD reset the document view which causedinteraction so long as the requestto be generated. This responsemethod isprimarily intended to allow input for actions to take place viaidempotent (see section 9.1.2); other methods MUST NOT be automatically retried, although userinput, followed byagents MAY offer aclearing of the form in which the input is given so thathuman operator theuser can easily initiate another input action. The response MUST include a Content-Length with a valuechoice ofzero (0) and no entity body. 12.2.1.7 206 Partial Content The server has fulfilled the partial GET request for the resource. The request MUST have included a Range header field (section 18.38) indicating the desired range. The response MUST include a Content-Range header field (section 18.18) indicatingretrying therange included withrequest. However, thisresponse. All entity header fields in the response MUST describeautomatic retry SHOULD NOT be repeated if thepartial entity transmitted rather than what would have been transmitted insecond request fails. Servers SHOULD always respond to at least one request per connection, if at all possible. Servers SHOULD NOT close afull response. In particular, the Content-Length header fieldconnection in theresponse MUST match the actual numbermiddle ofOCTETs transmitted in the entity body.transmitting a response, unless a network or client failure is suspected. It isassumedsuggested that clients which use persistent connections SHOULD limit theclient already has the complete entity's header field data. 12.3 Redirection 3xx This classnumber ofstatus code indicatessimultaneous connections thatfurther action needs to be taken by the user agent in orderthey maintain tofulfill the request. The action required MAY be carried out by the user agent without interactiona given server. A single-user client SHOULD maintain AT MOST 2 connections withthe user if and only if the method used in the second request is GETany server orHEAD.proxy. Auser agentproxy SHOULDNOT automatically redirect a request more than 5 times, since such redirections usually indicate an infinite loop.use up to 2*N connections to another server or proxy, where N is the number of simultaneously active Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page43]42] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199612.3.1.1 300 Multiple Choices This status code is reserved for future use by a planned content negotiation mechanism. HTTP/1.1 user agents receiving a 300 response which includes a Location header field can treat this response as they would treat a 303 (See Other) response. If no Location header field is included, the appropriate action isusers. These guidelines are intended todisplay the entity enclosed in theimprove HTTP responseto the user. 12.3.1.2 301 Moved Permanently The requested resource has been assigned a new permanent URItimes andany future references to this resource SHOULD be done using oneavoid congestion of thereturned URIs. Clients with link editing capabilitiesInternet or other networks. 8.2 Message Transmission Requirements General requirements: . HTTP/1.1 servers SHOULDautomatically re-link references to the Request-URImaintain persistent connections and use TCP's flow control mechanisms toone or more of the new references returned byresolve temporary overloads, rather than terminating connections with theserver, where possible. This response is cachable unless indicated otherwise. Ifexpectation that clients will retry. The latter technique can exacerbate network congestion. . An HTTP/1.1 (or later) client doing a PUT-like method SHOULD monitor thenew URInetwork connection for an error status while it isa location, its URL MUST be given bytransmitting theLocation field inrequest. If theresponse. Unlessclient sees an error status, itwas a HEAD request,SHOULD immediately cease transmitting theEntity-Body ofbody. If theresponse SHOULD containbody is being sent using ashort hypertext note with"chunked" encoding, ahyperlinkzero length chunk is used to mark thenew URI(s).end of the message. If the301 status code is received in response tobody was preceded by arequest other than GET or HEAD,Content-Length header, theuser agentclient MUSTNOT automatically redirectclose therequest unless it canconnection. . An HTTP/1.1 (or later) client MUST beconfirmedprepared to accept a 100 (Continue) status followed bythe user, since this might change the conditions under which the request was issued. Note: When automatically redirectingaPOSTregular response. . An HTTP/1.1 (or later) server that receives a requestafter receivingfrom a301 status code, some existingHTTP/1.0user agents will erroneously change(or earlier) client MUST NOT transmit the 100 (continue) response; itinto a GET request. 12.3.1.3 302 Moved Temporarily The requested resource resides temporarily under a different URI. SinceSHOULD either wait for theredirection mayrequest to bealtered on occasion,completed normally (thus avoiding an interrupted request) or close theclient SHOULDconnection prematurely. Upon receiving a method subject to these requirements from an HTTP/1.1 (or later) client, an HTTP/1.1 (or later) server MUST either respond with 100 (Continue) status and continue touseread from theRequest-URI for future requests. This response is only cachable if indicated by a Cache-Controlinput stream, orExpires header field.respond with an error status. If it responds with an error status, it MAY close thenew URI is a location, its URL MUST be given bytransport (TCP) connection or it MAY continue to read and discard theLocation field inrest of theresponse. Unlessrequest. It MUST NOT perform the requested method if itwas a HEAD request,returns an error status. Clients SHOULD remember theEntity-Bodyversion number of at least the most recently used server; if an HTTP/1.1 client has seen an HTTP/1.1 or later responseSHOULD contain a short hypertext note with a hyperlink tofrom thenew URI(s). Ifserver, and it sees the302connection close before receiving any statuscode is received in response to a request other than GET or HEAD,from the server, the client SHOULD retry the request without useragent MUST NOT automatically redirectinteraction so long as the requestunless it canmethod is idempotent (see section 9.1.2); other methods MUST NOT beconfirmed byautomatically retried, although user agents MAY offer a human operator theuser, since this might changechoice of retrying theconditions under whichrequest.. If the client does retry the request, the client . MUST first send the requestwas issued. Note: When automatically redirecting a POST request after receivingheader fields, and then . MUST wait for the server to respond with either a302 status code, some existing100 (Continue) response, in which case the client should continue, or with an error status. If an HTTP/1.1 client has not seen an HTTP/1.1 or later response from the server, it should assume that the server implements HTTP/1.0user agentsor older and willerroneously change it into a GET request.not use the 100 (Continue) response. If in this case the Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page44]43] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199612.3.1.4 303 See Other The response to the request can be found under a different URI and SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirectclient sees theuser agent to a selected resource. The new resource is not a update reference forconnection close before receiving any status from theoriginal Request-URI. The 303 response is not cachable, butserver, theresponse toclient SHOULD retry thesecond request MAY be cachable.request. If thenew URI is a location, its URL MUST be given by the Location field inclient does retry theresponse. Unless it was a HEADrequest, it should use theEntity-Bodyfollowing "binary exponential backoff" algorithm to be assured ofthe response SHOULD containobtaining ashort hypertext note withreliable response: 1. Initiate ahyperlinknew connection to thenew URI(s). 12.3.1.5 304 Not Modified Ifserver 2. Transmit theclient has performedrequest-headers 3. Initialize aconditional GET request and access is allowed, butvariable R to thedocument has not been modified sinceestimated round-trip time to the server (e.g., based on thedate andtimespecified init took to establish theIf-Modified-Since field,connection), or to a constant value of 5 seconds if theserver MUST respond with this status code andround-trip time is notsend an Entity-Body toavailable. 4. Compute T = R * (2**N), where N is theclient. Header fields contained innumber of previous retries of this request. 5. Wait either for an error response from the server, or for T seconds (whichever comes first) 6. If no error responseSHOULD only include information whichisrelevant to cache managers or which MAY have changed independently ofreceived, after T seconds transmit theentity's Last-Modified date. Examplesbody ofrelevant header fields include: Date, Server, Content-Length, Content-MD5, Content-Version, Cache-Control and Expires. A cache SHOULD update its cached entity to reflect any new field values given inthe304 response.request. 7. Ifthe new field values indicateclient sees that thecached entity differsconnection is closed prematurely, repeat from step 1 until thecurrent resource entity (as would be indicated by a change in Content-Length, Content-MD5,request is accepted, an error response is received, orContent- Version), then the cache MUST disregardthe304 responseuser becomes impatient andrepeatterminates therequest withoutretry process. No matter what the server version, if anIf-Modified-Since field. The 304 responseerror status is received, the client . MUST NOTinclude an entity body,continue andthus is always terminated by the first empty line after the header fields. 12.3.1.6 305 Use Proxy The requested resource. MUSTbe accessed through the proxy given by the Location field in the response. In other words, this is a proxy redirect. 12.4 Client Error 4xx The 4xx class of status code is intended for cases in which the client seems to have erred. Ifclose theclientconnection if it has not already completed sending the full requestwhen a 4xx code is received, it SHOULD immediately cease sending databody including any encoding mechanism used to transmit theserver. Except when responding to a HEAD request,body. An HTTP/1.1 (or later) client that sees theserverconnection close after receiving a 100 (Continue) but before receiving any other status SHOULDinclude an entity containing an explanation ofretry theerror situation,request, andwhether it is a temporary or permanent condition. These status codes are applicable to any request method. Note: Ifneed not wait for 100 (Continue) response (but MAY do so if this simplifies theclientimplementation). 9 Method Definitions The set of common methods for HTTP/1.1 issending data, server implementations using TCP SHOULDdefined below. Although this set can becarefulexpanded, additional methods cannot be assumed toensureshare the same semantics for separately extended clients and servers. The Host request-header field (section 14.23) MUST accompany all HTTP/1.1 requests. 9.1.1 Safe Methods Implementers should be aware that theclient acknowledges receipt ofsoftware represents thepacket(s) containinguser in their interactions over theresponse priorInternet, and should be careful toclosingallow the user to be aware of any actions they may take which may have an unexpected significance to themselves or others. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page45]44] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996 In particular, theinput connection. If the client continues sending data to the server after the close, the server's controller will send a reset packet to the client, which may eraseconvention has been established that theclient's unacknowledged input buffers before they can be readGET andinterpreted byHEAD methods should never have theHTTP application. 12.4.1.1 400 Bad Request The request could notsignificance of taking an action other than retrieval. These methods should beunderstood by the server dueconsidered "safe." This allows user agents tomalformed syntax. The client SHOULD NOT repeatrepresent other methods, such as POST, PUT and DELETE, in a special way, so that therequest without modifications. 12.4.1.2 401 Unauthorized The request requiresuserauthentication. The response MUST include a WWW-Authenticate header field (section 18.46) containingis made aware of the fact that achallenge applicablepossibly unsafe action is being requested. Naturally, it is not possible to ensure that therequested resource.server does not generate side-effects as a result of performing a GET request; in fact, some dynamic resources consider that a feature. Theclient MAY repeatimportant distinction here is that the user did not requestwith a suitable Authorization header field (section 18.8). Iftherequest already included Authorization credentials, thenside-effects, so therefore cannot be held accountable for them. 9.1.2 Idempotent Methods Methods may also have the401 response indicatesproperty of "idempotence" in thatauthorization has been refused for those credentials. If(aside from error or expiration issues) the401 response containsresults from N>0 identical requests is the samechallengeasthe prior response,for a single request. The methods GET, HEAD, PUT andthe user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 14. 12.4.1.3 402 Payment Required This code is reserved for future use. 12.4.1.4 403 ForbiddenDELETE share this property. 9.2 OPTIONS Theserver understoodOPTIONS method represents a request for information about therequest, but is refusing to fulfill it. Authorization will not help andcommunication options available on therequest SHOULD not be repeated. Ifrequest/response chain identified by therequestRequest-URI. This methodwas not HEAD andallows theserver wishesclient tomake public why the request has not been fulfilled, it SHOULD describedetermine thereason foroptions and/or requirements associated with a resource, or therefusal incapabilities of a server, without implying a resource action or initiating a resource retrieval. Unless theentity body. This status codeserver's response iscommonly used when the server does not wish to reveal exactly whyan error, therequest has been refused, or when no otherresponse MUST NOT include entity information other than what can be considered as communication options (e.g., Allow isapplicable. 12.4.1.5 404 Not Found The server hasappropriate, but Content-Type is not). Responses to this method are notfound anything matchingcachable. If theRequest-URI. No indicationRequest-URI isgiven of whetheran asterisk ("*"), theconditionOPTIONS request istemporary or permanent. Ifintended to apply to the serverdoesas a whole. A 200 response SHOULD include any header fields which indicate optional features implemented by the server (e.g., Public), including any extensions notwish to makedefined by thisinformation availablespecification, in addition tothe client, the status code 403 (Forbidden)any applicable general or response-header fields. As described in section 5.1.2, an "OPTIONS *" request can beused instead. The 410 (Gone) status code SHOULD be used ifapplied through a proxy by specifying the destination serverknows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. 12.4.1.6 405 Method Not Allowed The method specifiedin theRequest-LineRequest-URI without any path information. If the Request-URI is notallowed foran asterisk, theresource identified byOPTIONS request applies only to theRequest-URI. Theoptions that are available when communicating with that resource. A 200 responseMUSTSHOULD includean Allowany headercontaining a list of valid methods forfields which indicate optional features implemented by therequested resource.server and applicable to that resource (e.g., Allow), including any extensions not defined by this specification, in addition to any applicable general or response-header Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page46]45] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199612.4.1.7 406 Not Acceptable The resource identified byfields. If the OPTIONS requestis only capable of generating response entities which have content characteristics not acceptable according topasses through a proxy, theaccept headers sent inproxy MUST edit therequest. HTTP/1.1 servers are allowedresponse toreturn responses which are not acceptable accordingexclude those options known tothe accept headers sent in the request. In some cases, this may evenbepreferable to sending a 406 response. User agents are encouraged to inspectunavailable through that proxy. 9.3 GET The GET method means retrieve whatever information (in theheadersform of anincoming response to determine if itentity) isacceptable.identified by the Request-URI. If theresponseRequest-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and notacceptable, user agents SHOULD interruptthereceiptsource text of theresponse if doing so would save network resources. If it is unknown whether an incoming response wouldprocess, unless that text happens to beacceptable, a user agent SHOULD temporarily stop receiptthe output ofmore data and querytheuser for a decision on furtheractions. 12.4.1.8 407 Proxy Authentication Required This code is similarprocess. The semantics of the GET method change to401 (Unauthorized), but indicatesa "conditional GET" if the request message includes an If-Modified-Since , If-Unmodified-Since, If- Match, If-None-Match, or If-Range header field. A conditional GET method requests that theclient MUST first authenticate itself withentity be transferred only under theproxy. The proxy MUST return a Proxy-Authenticatecircumstances described by the conditional headerfield (section 18.35) containing a challenge applicablefield(s). The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already held by theproxy for the requested resource.client. Theclient MAY repeatsemantics of the GET method change to a "partial GET" if the requestwithmessage includes asuitable Proxy-AuthorizationRange headerfield (section 18.36). HTTP access authentication is explainedfield. A partial GET requests that only part of the entity be transferred, as described in section14. 12.4.1.9 408 Request Timeout14.36. Theclient did not produce a request within the time that the server was preparedpartial GET method is intended to reduce unnecessary network usage by allowing partially-retrieved entities towait. The client MAY repeat the request without modifications at any later time. 12.4.1.10 409 Conflict The request could notbe completedduewithout transferring data already held by the client. The response to aconflict with the current state of the resource. This codeGET request is cachable if and onlyallowed in situations whereif itis expected that the user MAY be able to resolve the conflict and resubmitmeets therequest. The response body SHOULD include enough informationrequirements forthe userHTTP caching described in section 13. 9.4 HEAD The HEAD method is identical torecognizeGET except that thesource ofserver MUST NOT return a message-body in theconflict. Ideally,response. The metainformation contained in the HTTP headers in responseentity would include enough information for the user or user-agenttofix the problem; however, that MAY nota HEAD request SHOULD bepossible and is not required. Conflicts are most likelyidentical tooccurthe information sent in response to aPUTGET request.If versioning is beingThis method can be usedandfor obtaining metainformation about the entitybeing PUT includes changes to a resource which conflict with those madeimplied byan earlier (third-party) request,theserver MAY userequest without transferring the409entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification. The response toindicatea HEAD request may be cachable in the sense thatit can't completetherequest. In this case,information contained in the responseentity SHOULD containmay be used to update alist ofpreviously cached entity from that resource. If thedifferences betweennew field values indicate that thetwo versions in a format defined bycached entity differs from theresponse Content-Type. 12.4.1.11 410 Gone The requested resource is no longer available at the server and no forwarding address is known. This condition SHOULDcurrent entity (as would beconsidered permanent. Clients with link editing capabilities SHOULD deleteindicated by a change in Content-Length, Content-MD5, ETag or Last-Modified), then the cache MUST treat the cache entry as stale. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page47]46] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996references9.5 POST The POST method is used to request that theRequest-URI after user approval. If thedestination serverdoes not know, or has no facility to determine, whether or not the condition is permanent,accept thestatus code 404 (Not Found) SHOULD be used instead. This response is cachable unless indicated otherwise. The 410 response is primarily intended to assistentity enclosed in thetaskrequest as a new subordinate ofweb maintenance by notifying the recipient thatthe resourceis intentionally unavailable and thatidentified by theserver owners desire that remote links to that resource be removed. Such an event is common for limited- time, promotional services and for resources belonging to individuals no longer working atRequest-URI in theserver's site. ItRequest-Line. POST isnot necessary to mark all permanently unavailable resources as "gone" ordesigned tokeep the mark for any length of time -- that is leftallow a uniform method to cover thediscretionfollowing functions: . Annotation ofthe server owner. 12.4.1.12 411 Length Required The server refusesexisting resources; . Posting a message toaccept the request withoutadefined Content- Length. The client MAY repeat the request if it addsbulletin board, newsgroup, mailing list, or similar group of articles; . Providing avalid Content- Length header field containing the lengthblock of data, such as theentity body in the request message. 12.4.1.13 412 Precondition Failed The precondition given in one or moreresult ofthe request header fields evaluatedsubmitting a form, tofalse when it was tested ona data-handling process; . Extending a database through an append operation. The actual function performed by theserver. This response code allowsPOST method is determined by theclient to place preconditionsserver and is usually dependent on thecurrent resource metainformation (header field data) and thus preventRequest-URI. The posted entity is subordinate to that URI in therequested method from being appliedsame way that a file is subordinate to aresource other than the one intended. 12.4.1.14 413 Request Entity Too Large The serverdirectory containing it, a news article isrefusingsubordinate toprocessarequest because it considers the request entitynewsgroup tobe larger thanwhich it iswillingposted, orablea record is subordinate toprocess.a database. Theserver SHOULD closeaction performed by theconnection ifPOST method might not result in a resource that can be identified by a URI. In this case, either 200 (OK) or 204 (No Content) isnecessary to preventtheclient from continuingappropriate response status, depending on whether or not therequest.response includes an entity that describes the result. If a resource has been created on theclient manages to readorigin server, the413 response, it MUST honor it andresponse SHOULDreflect it tobe 201 (Created) and contain an entity which describes theuser. If this restriction is considered temporary,status of theserver MAY includerequest and refers to the new resource , and aRetry-AfterLocation headerfield to indicate that it is temporary and after what time the client MAY try again. 12.4.1.15 414 Request-URI Too Long The server is refusing(see section 14.30). Responses toservice the request becausethis method are not cachable, unless theRequest-URI is longer thanresponse includes appropriate Cache-Control or Expires header fields. However, theserver is willing303 (See Other) response can be used tointerpret. This rare condition is only likelydirect the user agent tooccur when a client has improperly convertedretrieve a cachable resource. POSTrequest to a GET request with long query information, whenrequests must obey theclient has descended into a URL "black hole" of redirection (e.g., a redirected URL prefixmessage transmission requirements set out in section 8.2. 9.6 PUT The PUT method requests thatpointsthe enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as asuffixmodified version ofitself), or whentheserverone residing on the origin server. If the Request-URI does not point to an existing resource, and that URI isunder attackcapable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If aclient attempting to exploit security holes present in some servers using fixed-length buffers for reading or manipulatingnew resource is created, theRequest-URI.Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page48]47] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199612.4.1.16 415 Unsupported Media Type Theorigin serveris refusing to service the request because the entity body ofMUST inform therequest is in a format not supported byuser agent via therequested201 (Created) response. If an existing resourceforis modified, either therequested method. 12.5 Server Error 5xx Response status200 (OK) or 204 (No Content) response codesbeginning with the digit "5"SHOULD be sent to indicatecases in which the server is aware that it has erred or is incapablesuccessful completion ofperformingthe request. If theclient hasresource could notcompletedbe created or modified with therequest when a 5xx code is received, itRequest-URI, an appropriate error response SHOULDimmediately cease sending data tobe given that reflects theserver. Except when responding to a HEAD request,nature of theserver SHOULD include an entity containing an explanationproblem. The recipient of theerror situation, and whetherentity MUST NOT ignore any Content-* (e.g. Content-Range) headers that itis a temporarydoes not understand orpermanent condition. Theseimplement and MUST return a 501 (Not Implemented) responsecodes are applicable to anyin such cases. If the requestmethodpasses through a cache andthere are no required header fields. 12.5.1.1 500 Internal Server Error The server encountered an unexpected condition which prevented it from fulfilling the request. 12.5.1.2 501 Not Implemented The server does not supportthefunctionality requiredRequest-URI identifies one or more currently cached entities, those entries should be treated as stale. Responses tofulfill the request. This is the appropriate response when the server doesthis method are notrecognizecachable. The fundamental difference between therequest methodPOST and PUT requests isnot capablereflected in the different meaning ofsupporting it for any resource. 12.5.1.3 502 Bad Gatewaythe Request-URI. Theserver, while acting asURI in agateway or proxy, received an invalid response fromPOST request identifies theupstream server it accessed in attemptingresource that will handle the enclosed entity. That resource may be a data-accepting process, a gateway tofulfillsome other protocol, or a separate entity that accepts annotations. In contrast, therequest. 12.5.1.4 503 Service Unavailable The serverURI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI iscurrently unableintended and the server MUST NOT attempt tohandleapply the requestduetoa temporary overloading or maintenance ofsome other resource. If theserver. The implication isserver desires thatthis is a temporary condition which willthe request bealleviated after some delay. If known,applied to a different URI, it MUST send a 301 (Moved Permanently) response; thelength ofuser agent MAY then make its own decision regarding whether or not to redirect thedelayrequest. A single resource MAY beindicated inidentified by many different URIs. For example, an article may have aRetry-After header. If no Retry-AfterURI for identifying "the current version" which isgiven, the client SHOULD handleseparate from theresponse as it would forURI identifying each particular version. In this case, a500 response. Note: The existence ofPUT request on a general URI may result in several other URIs being defined by the503 status codeorigin server. HTTP/1.1 does notimply thatdefine how aserverPUT method affects the state of an origin server. PUT requests mustuse it when becoming overloaded. Some serversobey the message transmission requirements set out in section 8.2. 9.7 DELETE The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAYwish to simply refusebe overridden by human intervention (or other means) on theconnection. 12.5.1.5 504 Gateway Timeoutorigin server. Theserver, while acting as a gateway or proxy, did not receive a timely responseclient cannot be guaranteed that the operation has been carried out, even if the status code returned from theupstreamorigin server indicates that the action has been completed successfully. However, the server SHOULD not indicate success unless, at the time the response is given, itaccessed in attemptingintends tocompletedelete therequest.resource or move it to an inaccessible location. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page49]48] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199612.5.1.6 505 HTTP Version Not Supported The serverA successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the response is OK but does notsupport,include an entity. If the request passes through a cache and the Request-URI identifies one orrefusesmore currently cached entities, those entries should be treated as stale. Responses tosupport, the HTTP protocol version that wasthis method are not cachable. 9.8 TRACE The TRACE method is usedinto invoke a remote, application-layer loop-back of the request message. Theserver is indicating that it is unable or unwilling to completefinal recipient of the requestusingSHOULD reflect thesame major version asmessage received back to theclient,client asdescribed in section 7.1, other than with this error message.the entity-body of a 200 (OK) response. Theresponse SHOULD contain an entity describing why that versionfinal recipient isnot supported and what other protocols are supported by that server. 13 Method Definitions The seteither the origin server or the first proxy or gateway to receive a Max-Forwards value ofcommon methods for HTTP/1.1 is defined below. Although this set can be expanded, additional methods cannot be assumedzero (0) in the request (see section 14.31). A TRACE request MUST NOT include an entity. TRACE allows the client tosharesee what is being received at thesame semantics for separately extended clientsother end of the request chain andservers.use that data for testing or diagnostic information. TheHost request-headervalue of the Via header field (section18.24) MUST accompany all HTTP/1.1 requests. 13.1 OPTIONS The OPTIONS method represents14.44) is of particular interest, since it acts as arequest for information about the communication options available ontrace of therequest/response chain identified byrequest chain. Use of theRequest-URI. This methodMax-Forwards header field allows the client todetermine the options and/or requirements associated with a resource, orlimit thecapabilitieslength ofa server, without implying a resource action or initiating a resource retrieval. Unlesstheserver's responserequest chain, which is useful for testing a chain of proxies forwarding messages in anerror,infinite loop. If successful, the responseMUST NOT include entity information other than what can be considered as communication options (e.g., Allow is appropriate, but Content-Type is not) and MUST include a Content-LengthSHOULD contain the entire request message in the entity-body, with avalueContent-Type ofzero (0)."message/http". Responses to this methodare not cachable. If the Request-URI is an asterisk ("*"), the OPTIONS requestMUST NOT be cached. 10 Status Code Definitions Each Status-Code isintended to apply to the server asdescribed below, including awhole. A 200 response SHOULD include any header fieldsdescription of whichindicate optional features implemented by the server (e.g., Public), including any extensions not defined by this specification, in addition to any applicable general or response header fields. As described in section 9.1.2, an "OPTIONS *" requestmethod(s) it canbe applied through a proxy by specifying the destination server in the Request-URI withoutfollow and anypath information. If the Request-URI is not an asterisk,metainformation required in theOPTIONS request appliesresponse. 10.1 Informational 1xx This class of status code indicates a provisional response, consisting onlytoof theoptions that are available when communicating with that resource. A 200 response SHOULD include any header fields which indicateStatus-Line and optionalfeatures implemented by the serverheaders, andapplicable to that resource (e.g., Allow), including any extensions not definedis terminated bythis specification, in addition toan empty line. Since HTTP/1.0 did not define anyapplicable general or response header fields. If the OPTIONS request passes through a proxy, the proxy1xx status codes, servers MUSTedit theNOT send a 1xx response toexclude those options known to be unavailable through that proxy.an HTTP/1.0 client except under experimental conditions. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page50]49] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199613.2 GET10.1.1 100 Continue TheGET method means retrieve whatever information (in the form of an entity)client may continue with its request. This interim response isidentified by the Request-URI. If the Request-URI refersused toa data-producing process, it isinform theproduced data which shall be returned asclient that theentity ininitial part of theresponserequest has been received and has not yet been rejected by thesource text of the process, unless that text happens to be the output of the process.server. Thesemanticsclient SHOULD continue by sending the remainder of theGET method change to a "conditional GET"request or, if the requestmessage includes an If-Modified-Since header field. A conditional GET method requests that the identified resource entity be transferred only if ithasbeen modified since the date given by the If- Modified-Since header, as described in section 18.25. The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring dataalreadyheld by the client.been completed, ignore this response. Thesemantics of the GET method change toserver MUST send a"partial GET" iffinal response after the requestmessage includes a Range header field. A partial GET requests that only part of the identified resource entity be transferred, as described in section 18.38.has been completed. 10.1.2 101 Switching Protocols Thepartial GET methodserver understands and isintended to reduce unnecessary network usage by allowing partially-retrieved entitieswilling tobe completed without transferring data already held bycomply with theclient. The response to a GET request may be cachable if and only if it meetsclient's request, via therequirementsUpgrade message header field (section 14.41), forHTTP caching describeda change insection 16. 13.3 HEADthe application protocol being used on this connection. TheHEAD method is identicalserver will switch protocols toGET except thatthose defined by theserver MUST NOT return any Entity-Body inresponse's Upgrade header field immediately after the empty line which terminates the 101 response. Themetainformation contained in the HTTP headers in response to a HEAD request SHOULDprotocol should only beidenticalswitched when it is advantageous tothe information sent in responsedo so. For example, switching to aGET request. This method can be used for obtaining metainformation about the resource entity identified by the Request-URI without transferring the Entity-Body itself. This methodnewer version of HTTP isoften used for testing hypertext links for validity, accessibility,advantageous over older versions, andrecent modification. The responseswitching to aHEAD requestreal-time, synchronous protocol may becachable in the senseadvantageous when delivering resources that use such features. 10.2 Successful 2xx This class of status code indicates that the client's request was successfully received, understood, and accepted. 10.2.1 200 OK The request has succeeded. The informationcontained inreturned with the responsemay be used to update a previously cached entity from that resource. Ifis dependent on thenew field values indicate thatmethod used in thecachedrequest, for example: GET an entitydiffers fromcorresponding to thecurrentrequested resourceentity (as would be indicated by a changeis sent inContent-Length, Content-MD5, or Content- Version), thenthecache MUST markresponse; HEAD thecache entry stale. There is no "conditional HEAD" or "partial HEAD" request analogousentity-header fields corresponding tothose associated withtheGET method. If an If-Modified-Since and/or Range header field is included with a HEAD request, they SHOULD be ignored. 13.4 POST Therequested resource are sent in the response without any message-body; POSTmethod is used to request thatan entity describing or containing thedestination server acceptresult of the action; TRACE an entityenclosed incontaining the request message asa new subordinate ofreceived by theresourceend server. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page51]50] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996identified by the Request-URI10.2.2 201 Created The request has been fulfilled and resulted inthe Request-Line. POST is designed to allowauniform method to covernew resource being created. The newly created resource can be referenced by thefollowing functions: . Annotation of existing resources; . Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; . Providing a block of data, such asURI(s) returned in theresultentity ofsubmitting a form , to a data-handling process; . Extendingthe response, with the most specific URL for the resource given by adatabase through an append operation.Location header field. Theactual function performed byorigin server MUST create thePOST method is determined byresource before returning the 201 status code. If the action cannot be carried out immediately, the serverand is usually dependent onshould respond with 202 (Accepted) response instead. 10.2.3 202 Accepted The request has been accepted for processing, but theRequest-URI.processing has not been completed. Theposted entityrequest MAY or MAY NOT eventually be acted upon, as it MAY be disallowed when processing actually takes place. There issubordinate to that URI in the same way thatno facility for re-sending afilestatus code from an asynchronous operation such as this. The 202 response issubordinate to a directory containing it, a news articleintentionally non-committal. Its purpose issubordinateto allow anewsgroupserver towhich it is posted, oraccept arecordrequest for some other process (perhaps a batch- oriented process that issubordinateonly run once per day) without requiring that the user agent's connection toa database. For compatibility with HTTP/1.0 applications, all POST requests MUST include a valid Content-Length header field unlessthe server persist until the process isknown to be HTTP/1.1 compliant. When sending a POST request tocompleted. The entity returned with this response SHOULD include anHTTP/1.1 server,indication of the request's current status and either aclient MUST usepointer to avalid Content-Lengthstatus monitor orthe "chunked" Transfer-Encoding. The server SHOULD respond with a 400 (bad request) message if it cannot determine the lengthsome estimate of when the user can expect the requestmessage's content, or with 411 (length required) if it wishestoinsist on receiving a valid Content-Length. A successful POST doesbe fulfilled. 10.2.4 203 Non-Authoritative Information The returned metainformation in the entity-header is notrequire thattheentity be createddefinitive set asa resource onavailable from the originserverserver, but is gathered from a local ormade accessible for future reference. That is,a third-party copy. The set presented MAY be a subset or superset of theaction performed byoriginal version. For example, including local annotation information about thePOST method might notresource MAY result in aresource that can be identifiedsuperset of the metainformation known bya URI. In this case, either 200 (OK) or 204 (no content) istheappropriateorigin server. Use of this responsestatus, depending on whether orcode is not required and is only appropriate when the responseincludes an entity that describes the result. If a resourcewould otherwise be 200 (OK). 10.2.5 204 No Content The server hasbeen created onfulfilled theorigin server,request but there is no new information to send back. If theresponseclient is a user agent, it SHOULDbe 201 (Created) and contain an entity (preferably of type "text/html")NOT change its document view from that whichdescribes the status ofcaused the requestand refers to the new resource. Responsestothis method are not cachable. However, the 303 (See Other) response canbeusedsent. This response is primarily intended todirect the user agentallow input for actions toretrievetake place without causing acachable resource. POST requests must obeychange to theentity transmission requirements set out in section 13.4.1. 13.4.1 SLUSHY: Entity Transmission Requirements Editor's Note:user agent's active document view. Theissues here around reliable transmissionresponse MAY include new metainformation in the form oflarge entities to servers, particularly HTTP/1.0 servers, are complicated and subtle, particularly since we'd like optimistic transmissionentity-headers, which SHOULD apply tobethe document currently in the user agent's active view. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page52]51] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996normal situation. We would like it if we can redraft this section to be simpler in the next draft General requirements: . HTTP/1.1 servers should maintain persistent connections and use TCP's flow control mechanisms to resolve temporary overloads, rather than terminating connections with the expectation that clients will retry.Thelatter technique can exacerbate network congestion. . An HTTP/1.1 (or later) client doing a PUT-like method SHOULD monitor the network connection for204 response MUST NOT include anerror status while itmessage-body, and thus istransmitting the request. If the client sees an error status, it should immediately cease transmitting the body. Ifalways terminated by thebody is being sent using a "Chunked" encoding, a zero length chunk is used to markfirst empty line after theend ofheader fields. 10.2.6 205 Reset Content The server has fulfilled themessage. Ifrequest and thebody was preceded by a Content-length header,user agent SHOULD reset theclient MUST closedocument view which caused theconnection. . An HTTP/1.1 (or later) client MUSTrequest to bepreparedsent. This response is primarily intended toaccept a "100 Continue" statusallow input for actions to take place via user input, followed by aregular response. . An HTTP/1.1 (or later) serverclearing of the form in which the input is given so thatreceives a request from a HTTP/1.0 (or earlier) clientthe user can easily initiate another input action. The response MUST NOTtransmitinclude an entity. 10.2.7 206 Partial Content The server has fulfilled the100 (continue) response; it SHOULD either waitpartial GET request for the resource. The requestto be completed normally (thus avoiding an interrupted request) or close the connection prematurely. Upon receivingmust have included amethod subject to these requirements from an HTTP/1.1 (or later) client, an HTTP/1.1 (or later) serverRange header field (section 14.36) indicating the desired range. The response MUSTeither immediately respondwith 100 (continue) and continue to read frominclude a Content-Range header field (section 14.17) indicating theinput stream, or respond with an error status. If it respondsrange included withan error status, it MAY closethis response. The Content-Length header field in thetransport (TCP) connection or it MAY continue to read and discardresponse MUST match therestactual number of OCTETs transmitted in therequest. Itmessage-body. A cache that does not support the Range and Content-Range headers MUST NOTperformcache 206 (Partial) responses. 10.3 Redirection 3xx This class of status code indicates that further action needs to be taken by therequested method if it returns an error status. If an HTTP/1.1 client has seen an HTTP/1.1 or later response from the server (clients SHOULD remember the version number of at least the most recently used server), and it sees the connection close before receiving any status from the server, the client SHOULD retryuser agent in order to fulfill the request.If the client does retryThe action required MAY be carried out by therequest, . it MUST first senduser agent without interaction with therequest headers, .user if andthen MUST wait foronly if theserver to respond with either a 100 (continue) response,method used inwhich casetheclient should continue,second request is GET orwith an error status. If an HTTP/1.1 client has not seenHEAD. A user agent SHOULD NOT automatically redirect a request more than 5 times, since such redirections usually indicate anHTTP/1.1infinite loop. 10.3.1 300 Multiple Choices The requested resource is available in one orlater response frommore variants, each with their own specific location, and agent-driven negotiation information (section 12) is being provided so that theserver,user (or user agent) can select a preferred representation. Unless itshould assume thatwas a HEAD request, theserver implements HTTP/1.0 or olderresponse SHOULD include an entity containing a list of resource characteristics andwill not use the 100 (Continue) response. If in this case the client sees the connection close before receiving any statuslocation(s) from which theserver,user or user agent can choose theclient SHOULD retryone most appropriate. The entity format is specified by therequest. Ifmedia type given in theclient does retryContent-Type header field. Depending upon therequest, it should useformat and thefollowing "binary exponential backoff" algorithm to be assuredcapabilities ofobtaining a reliable response: 1. Initiate a new connection to the server 2. Transmit the request headers 3. Initialize a variable R to the estimated round-trip time to the server (e.g., based onthetime it took to establishuser agent, selection of the most appropriate choice may be performed automatically. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page53]52] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996connection), or to a constant value of 5 seconds if the round-trip time isHowever, this specification does notavailable. 4. Compute T = R * (2**N), where N isdefine any standard for such automatic selection. If thenumber of previous retriesserver has a preferred choice ofthis request. 5. Wait eitherrepresentation, it SHOULD include the specific URL foran error response fromthat representation in theserver, orLocation field; user agents MAY use the Location field value forT seconds (whichever comes first) 6. If no errorautomatic redirection. This response isreceived, after T seconds transmitcachable unless indicated otherwise. 10.3.2 301 Moved Permanently The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD be done using one of thebodyreturned URIs. Clients with link editing capabilities SHOULD automatically re-link references to the Request-URI to one or more of therequest. 7.new references returned by the server, where possible. This response is cachable unless indicated otherwise. Ifclient sees thattheconnectionnew URI isclosed prematurely, repeat from step 1 untila location, its URL SHOULD be given by the Location field in the response. Unless the requestis accepted, an errormethod was HEAD, the entity of the responseis received, orSHOULD contain a short hypertext note with a hyperlink to theuser becomes impatient. No matter whatnew URI(s). If theserver version, if an error301 status code isreceived, .received in response to a request other than GET or HEAD, theclientuser agent MUST NOTcontinue and . MUST closeautomatically redirect theconnection ifrequest unless ithas not already completed sendingcan be confirmed by thefull request body including any encoding mechanism used to transmituser, since this might change thebody. An HTTP/1.1 (or later) client that seesconditions under which theconnection closerequest was issued. Note: When automatically redirecting a POST request after receiving a100 (continue) but before receiving any other301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request. 10.3.3 302 Moved Temporarily The requested resource resides temporarily under a different URI. Since the redirection may be altered on occasion, the client SHOULDretrycontinue to use therequest, and need not waitRequest-URI for100 (continue)future requests. This response(but MAY do sois only cachable ifthis simplifies the implementation). 13.5 PUT The PUT method requests thatindicated by a Cache-Control or Expires header field. If theenclosed entitynew URI is a location, its URL SHOULD bestored undergiven by thesupplied Request-URI. IfLocation field in theRequest-URI refers to an already existing resource,response. Unless the request method was HEAD, theenclosedentitySHOULD be considered as a modified versionof theone residing onresponse SHOULD contain a short hypertext note with a hyperlink to theorigin server.new URI(s). If theRequest-URI does not point to an existing resource, and that URI302 status code iscapable of being defined asreceived in response to anew resource byrequest other than GET or HEAD, therequestinguseragent,agent MUST NOT automatically redirect theorigin serverrequest unless it cancreate the resource with that URI. If a new resource is created,be confirmed by theorigin server MUST informuser, since this might change theuser agent viaconditions under which the201 (created) response. If anrequest was issued. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 53] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 Note: When automatically redirecting a POST request after receiving a 302 status code, some existingresource is modified, either the 200 (OK) or 204 (No Content)HTTP/1.0 user agents will erroneously change it into a GET request. 10.3.4 303 See Other The responsecodesto the request can be found under a different URI and SHOULD besentretrieved using a GET method on that resource. This method exists primarily toindicate successful completionallow the output of a POST-activated script to redirect therequest. Ifuser agent to a selected resource. The new URI is not a substitute reference for theresource couldoriginally requested resource. The 303 response is notbe created or modified withcachable, but theRequest-URI, an appropriate errorresponse to the second (redirected) request MAY be cachable. If the new URI is a location, its URL SHOULD be giventhat reflectsby thenature ofLocation field in theproblem. Ifresponse. Unless the requestpasses through a cache andmethod was HEAD, theRequest-URI identifies a currently cached entity, thatentityMUST be removed fromof thecache. Responsesresponse SHOULD contain a short hypertext note with a hyperlink tothis method are not cachable. The fundamental difference betweenthePOSTnew URI(s). 10.3.5 304 Not Modified If the client has performed a conditional GET request andPUT requestsaccess isreflected inallowed, but thedifferent meaning ofdocument has not been modified, theRequest-URI.server SHOULD respond with this status code. TheURI inresponse MUST NOT contain aPOST request identifies the resource that will handlemessage- body. Header fields contained in theenclosed entity asresponse MUST include any values that, if anappendage. That resource mayunconditional request had been made, might bea data-accepting process, a gateway to some other protocol, or a separatedifferent from values sent with any prior response for the entity The response MUST also include any values thataccepts annotations. In contrast, the URI incaches use for matching requests and responses with cache entries. The response SHOULD NOT include header fields whose values cannot possibly have changed, such as Content-Type. Examples of relevant header fields include: Date, Server, Content- Length, Content-MD5, Content-Version, Cache-Control, ETag, Vary and Expires. If aPUT request identifies the304 response indicates an entityenclosed withnot currently cached, then therequest --cache MUST disregard theuser agent knows what URI is intendedresponse andthe server MUST NOT attempt to applyrepeat the requestto some other resource. If the server desires thatwithout therequest be appliedconditional. If a cache uses a received 304 response to update adifferent URI, itcache entry, the cache MUSTsend a 301 (Moved Permanently) response;update theuser agent MAY then make its own decision regarding whether or notentry toredirectreflect any new field values given in therequest.response. The 304 response MUST NOT include an message-body, and thus is always terminated by the first empty line after the header fields. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 54] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996A single10.3.6 305 Use Proxy The requested resourceMAYMUST beidentified by many different URIs. For example, an article may have a URI for identifying "the current version" which is separate fromaccessed through theURI identifying each particular version. In this case, a PUT request on a general URI may result in several other URIs being definedproxy given by theorigin server. For compatibility with HTTP/1.0 applications, all PUT requests MUST include a valid Content-Length headerLocation field. The Location fieldunlessgives theserverURL of the proxy. The recipient isknownexpected tobe HTTP/1.1 compliant. When sending a PUTrepeat the requestto an HTTP/1.1 server, avia the proxy. 10.4 Client Error 4xx The 4xx class of status code is intended for cases in which the clientMUST useseems to have erred. Except when responding to avalid Content-Length orHEAD request, the"chunked" Transfer-Encoding. Theserver SHOULDrespond with a 400 (bad request) message if it cannot determine the lengthinclude an entity containing an explanation of therequest message's content, or with 411 (length required) iferror situation, and whether itwishes to insist on receivingis avalid Content-Length. The actual method for determining how the resourcetemporary or permanent condition. These status codes are applicable to any request method. User agents SHOULD display any included entityis placed, and what happenstoits predecessor, is defined entirely bytheorigin server. PUT requests must obey the entity transmission requirements set out in section 13.4.1. 13.6 DELETE The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) onuser. Note: If theorigin server. Theclientcannotis sending data, a server implementation using TCP should beguaranteedcareful to ensure that theoperation has been carried out, even if the status code returned fromclient acknowledges receipt of theorigin server indicates thatpacket(s) containing theaction has been completed successfully. However,response, before the serverSHOULD not indicate success unless, at the timecloses theresponse is given, it intends to deleteinput connection. If theresource or move itclient continues sending data toan inaccessible location. A successful response SHOULD be 200 (OK) iftheresponse includes an entity describingserver after thestatus, 202 (Accepted) ifclose, theaction has not yet been enacted, or 204 (No Content) ifserver's TCP stack will send a reset packet to theresponse is OK but does not include an entity. Ifclient, which may erase therequest passes through a cacheclient's unacknowledged input buffers before they can be read and interpreted by theRequest-URI identifies a currently cached entity, that entity MUSTHTTP application. 10.4.1 400 Bad Request The request could not beremoved fromunderstood by thecache. Responsesserver due tothis method are not cachable. 13.7 TRACEmalformed syntax. TheTRACE method is used to invoke a remote, application-layer loop-back ofclient SHOULD NOT repeat the requestmessage.without modifications. 10.4.2 401 Unauthorized Thefinal recipient of therequestSHOULD reflect the message received backrequires user authentication. The response MUST include a WWW-Authenticate header field (section 14.43) containing a challenge applicable to the requested resource. The clientasMAY repeat theentity body ofrequest with a200 (OK) response. The final recipient is eithersuitable Authorization header field (section 14.8). If theorigin server orrequest already included Authorization credentials, then thefirst proxy or gateway to receive a Max-Forwards value of zero (0) in401 response indicates that authorization has been refused for those credentials. If therequest (see section 18.32). A TRACE request MUST NOT include an entity. TRACE allows401 response contains theclient to see what is being receivedsame challenge as the prior response, and the user agent has already attempted authentication at least once, then theother end ofuser SHOULD be presented therequest chain and useentity thatdata for testing orwas given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 11. 10.4.3 402 Payment Required This code is reserved for future use. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 55] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996information.10.4.4 403 Forbidden Thevalue ofserver understood theVia header field (section 18.47)request, but isof particular interest, since it acts as a trace ofrefusing to fulfill it. Authorization will not help and the requestchain. Use ofSHOULD NOT be repeated. If theMax-Forwards header field allowsrequest method was not HEAD and theclientserver wishes tolimit the length ofmake public why the requestchain, which is useful for testing a chain of proxies forwarding messages in an infinite loop. If successful, the responsehas not been fulfilled, it SHOULDcontaindescribe theentire request messagereason for the refusal in theentity body, with a Content-Type of "message/http", "application/http", or "text/plain". Responses to this method MUST NOT be cached. 14 Access Authentication HTTP provides a simple challenge-response authentication mechanism which MAY beentity. This status code is commonly usedby awhen the server does not wish tochallenge a clientreveal exactly why the requestand by a clienthas been refused, or when no other response is applicable. 10.4.5 404 Not Found The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. If the server does not wish toprovide authentication information. It uses an extensible, case- insensitive tokenmake this information available toidentifytheauthentication scheme, followed by a comma-separated list of attribute-value pairs which carryclient, theparameters necessary for achieving authentication viastatus code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, thatscheme. auth-scheme = token auth-param = token "=" quoted-stringan old resource is permanently unavailable and has no forwarding address. 10.4.6 405 Method Not Allowed The401 (Unauthorized) response messagemethod specified in the Request-Line isusednot allowed for the resource identified byan origin server to challengetheauthorization of a user agent. ThisRequest-URI. The response MUST includea WWW-Authenticatean Allow headerfieldcontainingat least one challenge applicable toa list of valid methods for the requested resource.challenge = auth-scheme 1*SP realm *( "," auth-param ) realm = "realm" "=" realm-value realm-value = quoted-string The realm attribute (case-insensitive) is required for all authentication schemes which issue a challenge.10.4.7 406 Not Acceptable Therealm value (case- sensitive), in combination withresource identified by thecanonical root URLrequest is only capable of generating response entities which have content characteristics not acceptable according to theserver being accessed, defines the protection space. These realms allowaccept headers sent in theprotected resources onrequest. Unless it was aserver to be partitioned intoHEAD request, the response SHOULD include an entity containing asetlist ofprotection spaces, each with its own authentication scheme and/or authorization database. The realm value is a string, generally assigned by the origin server,available entity characteristics and location(s) from whichmay have additional semantics specific totheauthentication scheme. Auseragent that wishes to authenticate itself with a server--usually, but not necessarily, after receiving a 401or411 response--MAY do souser agent can choose the one most appropriate. The entity format is specified byincluding an Authorizationthe media type given in the Content- Type headerfield withfield. Depending upon therequest. The Authorization field value consists of credentials containingformat and theauthentication informationcapabilities of the useragent for the realmagent, selection of theresource being requested. credentials = basic-credentials | auth-scheme 0#auth-param Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 56] INTERNET-DRAFTmost appropriate choice may be performed automatically. However, this specification does not define any standard for such automatic selection. Note: HTTP/1.1Friday, May 03, 1996 The domain overservers are allowed to return responses whichcredentials can be automatically applied by a user agent is determined byare not acceptable according to theprotection space. If a prior request has been authorized,accept headers sent in thesame credentials MAYrequest. In some cases, this may even bereused for all other requests within that protection space for a period of time determined by the authentication scheme, parameters, and/or user preference. Unless otherwise defined by the authentication scheme,preferable to sending asingle protection space cannot extend outside406 response. User agents are encouraged to inspect thescopeheaders ofits server. If the server does not wishan incoming response toacceptdetermine if it is acceptable. If thecredentials sent withresponse could be unacceptable, arequest, ituser agent SHOULDreturntemporarily stop receipt of more data and query the user for a decision on further actions. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 56] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 10.4.8 407 Proxy Authentication Required This code is similar to 401(Unauthorized) response.(Unauthorized), but indicates that the client MUST first authenticate itself with the proxy. Theresponseproxy MUSTincludereturn aWWW-AuthenticateProxy-Authenticate header field (section 14.33) containingthe (possibly new)a challenge applicable to therequested resource and an entity explainingproxy for therefusal.requested resource. TheHTTP protocol does not restrict applications to this simple challenge-response mechanism for access authentication. Additional mechanismsclient MAYbe used, such as encryption atrepeat thetransport level or via message encapsulation, andrequest withadditionala suitable Proxy-Authorization headerfields specifyingfield (section 14.34). HTTP access authenticationinformation. However, these additional mechanisms areis explained in section 11. 10.4.9 408 Request Timeout The client did notdefined by this specification. Proxies MUST be completely transparent regarding user agent authentication. That is, they MUST forwardproduce a request within theWWW-Authenticate and Authorization headers untouched, and MUST NOT cachetime that theresponseserver was prepared toa request containing Authorization. HTTP/1.1 allows await. The client MAY repeat the request without modifications at any later time. 10.4.10 409 Conflict The request could not be completed due topass authentication information to and fromaproxy viaconflict with theProxy-Authenticate and Proxy-Authorization headers. 14.1 Basic Authentication Scheme The "basic" authentication scheme is based oncurrent state of themodelresource. This code is only allowed in situations where it is expected that the useragent must authenticate itself with a user-ID and a password for each realm. The realm value should be considered an opaque string which can onlymight becompared for equality with other realms on that server. The server will service the request only if it can validateable to resolve theuser-IDconflict andpasswordresubmit the request. The response body SHOULD include enough information for theprotection space ofuser to recognize theRequest-URI. There are no optional authentication parameters. Upon receiptsource ofan unauthorized requestthe conflict. Ideally, the response entity would include enough information fora URI withintheprotection space,user or user-agent to fix theserver SHOULD respond withproblem; however, that may not be possible and is not required. Conflicts are most likely to occur in response to achallenge like the following: WWW-Authenticate: Basic realm="WallyWorld" where "WallyWorld"PUT request. If versioning is being used and thestring assignedentity being PUT includes changes to a resource which conflict with those made by an earlier (third-party) request, the server MAY use the 409 response toidentifyindicate that it can't complete theprotection spacerequest. In this case, the response entity SHOULD contain a list of theRequest-URI. To receive authorization,differences between theclient sendstwo versions in a format defined by theuser-IDresponse Content-Type. 10.4.11 410 Gone The requested resource is no longer available at the server andpassword, separatedno forwarding address is known. This condition SHOULD be considered permanent. Clients with link editing capabilities SHOULD delete references to the Request-URI after user approval. If the server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) SHOULD be used instead. This response is cachable unless indicated otherwise. The 410 response is primarily intended to assist the task of web maintenance bya single colon (":") character, within a base64 encoded string innotifying thecredentials. basic-credentials = "Basic" SP basic-cookierecipient that the resource is intentionally unavailable and that the server owners desire that remote links to that resource be removed. Such an event is common for limited- Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 57] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996basic-cookie = <base64 [7] encoding of user-pass, except not limited to 76 char/line> user-pass = userid ":" password userid = [ token ] password = *TEXT If the user agent wishes to send the user-ID "Aladdin"time, promotional services andpassword "open sesame", it would usefor resources belonging to individuals no longer working at thefollowing header field: Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== The basic authentication schemeserver's site. It isa non-secure method of filtering unauthorized accessnot necessary to mark all permanently unavailable resourceson an HTTP server. It is based onas "gone" or to keep theassumptionmark for any length of time -- that is left to theconnection betweendiscretion of the server owner. 10.4.12 411 Length Required The server refuses to accept the request without a defined Content- Length. The clientandMAY repeat theserver can be regarded asrequest if it adds atrusted carrier. As this is not generally true on an open network,valid Content- Length header field containing thebasic authentication scheme should be used accordingly. In spitelength ofthis, clients SHOULD implementtheschememessage-body inorder to communicate with servers that use it. 14.2 Digest Authentication Schemethe request message. 10.4.13 412 Precondition Failed The"digest" authentication scheme is [currently describedprecondition given inan expired Internet-Draft, and this description will have to be improved to reference a new draftone orinclude the old one]. 15 Content Negotiation A generic resource has multiple entities associated with it, all of which are representations of the contentmore of theresource. Content negotiation isrequest-header fields evaluated to false when it was tested on theprocess of selectingserver. This response code allows thebest representation when a GET or HEAD request is madeclient to place preconditions on thegeneric resource. HTTP/1.1 has provisions for two kinds of content negotiation: opaque negotiationcurrent resource metainformation (header field data) andtransparent negotiation. With opaque negotiation,thus prevent theselection ofrequested method from being applied to a resource other than thebest representationone intended. 10.4.14 413 Request Entity Too Large The server isdone by an algorithm located at the origin server, and unknownrefusing to process a request because theproxies and user agents involved. Selectionrequest entity isbased on the contents of particular header fields inlarger than therequest message,server is willing oron other information pertainingable to process. The server may close therequest, likeconnection to prevent thenetwork address ofclient from continuing thesending client. A typical example of opaque negotiation would be the selection of a text/html response in a particular language based onrequest. If thecontents ofcondition is temporary, theAccept-Language requestserver SHOULD include a Retry-After headerfield. A disadvantage of opaque negotiation isfield to indicate that it is temporary and after what time therequest headersclient maynot always contain enough informationtry again. 10.4.15 414 Request-URI Too Long The server is refusing toallow for selection. Ifservice theAccept header Accept: text/*: q=0.3, text/html, */*: q=0.5request because the Request-URI issent inlonger than the server is willing to interpret. This rare condition is only likely to occur when a client has improperly converted a POST requestonto ageneric resource whichGET request with long query information, when the client has descended into avideo/mpeg andURL "black hole" of redirection (e.g., avideo/quicktime representation, the selection algorithm in the origin server will either haveredirected URL prefix that points tomakeadefault choice,suffix of itself), orreturn an error response which allowswhen theuserserver is under attack by a client attempting todecide on further actions.exploit security holes present in some servers using fixed-length buffers for reading or manipulating the Request-URI. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 58] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996With transparent negotiation,10.4.16 415 Unsupported Media Type The server is refusing to service theselectionrequest because the entity of thebest representationrequest isdone by a distributed algorithm which can perform computation stepsin a format not supported by theorigin server,requested resource for the requested method. 10.5 Server Error 5xx Response status codes beginning with the digit "5" indicate cases inproxies,which the server is aware that it has erred orinis incapable of performing theuser agent. Transparent negotiation guarantees that, ifrequest. Except when responding to a HEAD request, theuser agent supportsserver SHOULD include an entity containing an explanation of thetransparent negotiation algorithmerror situation, and whether it iscorrectly configured,a temporary or permanent condition. User agents SHOULD display any included entity to the user. These response codes are applicable to any requestwill always correctly yield either the video/mpeg representation, the video/quicktime representation, ormethod. 10.5.1 500 Internal Server Error The server encountered anerror message indicating thatunexpected condition which prevented it from fulfilling theresource cannot be displayed byrequest. 10.5.2 501 Not Implemented The server does not support theuser agent. 15.1 Negotiation Facilities Defined in this Specificationfunctionality required to fulfill the request. Thisspecification defines all protocol facilities for opaque negotiation, butis the appropriate response when the server does notdefinerecognize thedistributed algorithmrequest method and is not capable of supporting it fortransparent negotiation. This specification only definesany resource. 10.5.3 502 Bad Gateway The server, while acting as a gateway or proxy, received an invalid response from thebasic facilities (Vary, Alternates, Accept)upstream server it accessed in attempting to fulfill thecore protocol allowing requests on transparently negotiated resourcesrequest. 10.5.4 503 Service Unavailable The server is currently unable tobe correctly handled by HTTP/1.1 caches. All other information about transparent content negotiationhandle the request due to a temporary overloading or maintenance of the server. The implication is that this isfound inaseparate document[29].temporary condition which will be alleviated after some delay. If known, the length of the delay may be indicated in ageneric resourceRetry-After header. If no Retry-After isopaquely negotiated, successful responses to requests ongiven, theresource will always include a Vary header. If a generic resource is transparently negotiated, successful responses to requests onclient SHOULD handle theresource will always include an Alternates header. If a successfulresponsecontains an Alternates header,as itwill also always contain a Content-Location header. A future specification may allow a combination of opaque and transparent negotiation thatwouldlead to the inclusion of both a Vary header and an Alternates header infor a 500 response.16 Caching in HTTPNote: TheWorld Wide Web is a distributed system, and so its performance can be improved by the useexistence ofcaches. These caches are typically placed at proxies and intheclients themselves. The HTTP/1.1 protocol includes503 status code does not imply that anumber of elements intended to make caching work as well as possible. Because these elements are inextricable from other aspects of the protocol, and because they interact with each other,server must use itis useful to describe the basic caching design of HTTP separately from the detailed descriptions of methods, headers, response codes, etc. 16.1 Semantic Transparency Requirements for performance, availability, and disconnected operation require us to be able to relax the goal of semantic transparency. The HTTP/1.1 protocol allows origin servers, caches, and clients to explicitly reduce transparencywhennecessary. However, because non- transparent operation may confuse non-expert users, and may be incompatible with certain server applications (such as those for ordering merchandise), the protocol requires that transparencybecoming overloaded. Some servers maynot be relaxed . without an explicit protocol-level request (when relaxed by client or origin server) . without a means for warningwish to simply refuse theend user (when relaxed by cache or client)connection. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 59] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996Therefore, the HTTP/1.1 protocol provides these important elements: 1. Protocol features that provide full semantic transparency when this is desired by all parties. 2. Protocol features that allow an origin server10.5.5 504 Gateway Timeout The server, while acting as a gateway orend-user client to explicitly request and control non-transparent operation. 3. Protocol features that allowproxy, did not receive acachetimely response from the upstream server it accessed in attempting toattach warningscomplete the request. 10.5.6 505 HTTP Version Not Supported The server does not support, or refuses toresponsessupport, the HTTP protocol version thatdo not preserve semantic transparency. A basic principlewas used in the request message. The server is indicating that itmust be possible for the clients to detect any potential breakdown of semantic transparency. Caching would be useless if it did not significantly improve performance. The goal of caching in HTTP/1.1is unable or unwilling toeliminatecomplete theneed to send requests in many cases, and to eliminaterequest using theneed to send full responsessame major version as the client, as described inmanysection 3.1, othercases. The former reduces the number of network round-trips required for many operations; we use an "expiration" mechanism forthan with thispurpose (see section 16.1.2).error message. Thelatter reduces network bandwidth requirements; we useresponse SHOULD contain an entity describing why that version is not supported and what other protocols are supported by that server. 11 Access Authentication HTTP provides a"validation"simple challenge-response authentication mechanismfor this purpose (see section 13.3). The server, cache, or client implementer maywhich MAY befaced with design decisions not explicitly discussed in this specification. Ifused by adecision may affect semantic transparency, the implementer oughtserver toerr on the side of maintaining transparency unlesschallenge acarefulclient request andcomplete analysis shows significant benefits in breaking transparency. 16.1.1 Cache Correctness If the cache can communicate with the origin-server, thenby acorrect cache MUST respondclient toa request with a response that meets all the following conditions: 1. its end-to-end headers (see section 16.4.1) and entity-body value are equivalentprovide authentication information. It uses an extensible, case- insensitive token towhatidentify theserver would have returnedauthentication scheme, followed by a comma-separated list of attribute-value pairs which carry the parameters necessary for achieving authentication via thatrequest if the resource had not been modified since thescheme. auth-scheme = token auth-param = token "=" quoted-string The 401 (Unauthorized) responsewas cached. This may be accomplishedmessage is used byrevalidatingan origin server to challenge the authorization of a user agent. This responsewithMUST include a WWW-Authenticate header field containing at least one challenge applicable to theorigin server, if is not fresh. 2. itrequested resource. challenge = auth-scheme 1*SP realm *( "," auth-param ) realm = "realm" "=" realm-value realm-value = quoted-string The realm attribute (case-insensitive) is"fresh enough" (see section 16.1.2). In the default case, this means it meets the least restrictive freshness requirement ofrequired for all authentication schemes which issue a challenge. The realm value (case- sensitive), in combination with theclient, server, and cachecanonical root URL (see section18.10); if5.1.2) of theorigin-serverso specifies, it isbeing accessed, defines thefreshness requirement ofprotection space. These realms allow theorigin-protected resources on a serveralone. 3. it includesto be partitioned into awarning if the freshness demandset ofthe client or the origin-server is violated (see section 16.1.5 and 18.48). 4. it is the most up-to-date response appropriate to the request the cache has seen (see section 16.2.6, 16.2.8, and 16.13). If the cache can not communicateprotection spaces, each with its own authentication scheme and/or authorization database. The realm value is a string, generally assigned by the origin server,then a correct cache SHOULD respond as above if the response can be correctly served fromwhich may have additional semantics specific to thecache; if not it MUST return an error or warning indicating that there was a communication.authentication scheme. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 60] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199616.1.2 Cache-control Mechanisms The basic cache mechanisms in HTTP/1.1 (server-specified expiration times and validators) are implicit directivesA user agent that wishes tocaches. In some cases,authenticate itself with aserverserver--usually, but not necessarily, after receiving a 401 orclient may need to provide explicit directives to411 response--MAY do so by including an Authorization header field with theHTTP caches. We userequest. The Authorization field value consists of credentials containing theCache-Control headerauthentication information of the user agent forthis purpose.the realm of the resource being requested. credentials = basic-credentials | auth-scheme #auth-param TheCache-Control header allowsdomain over which credentials can be automatically applied by aclient or server to transmituser agent is determined by the protection space. If avariety of directives in eitherprior request has been authorized, the same credentials MAY be reused for all other requestsor responses. These directives typically overridewithin that protection space for a period of time determined by thedefault caching algorithms. Asauthentication scheme, parameters, and/or user preference. Unless otherwise defined by the authentication scheme, ageneral rule, if there is any apparent conflict between header values,single protection space cannot extend outside themost restrictive interpretation should be applied (that is,scope of its server. If theone that is most likelyserver does not wish topreserve semantic transparency). However, in some cases, Cache-Control directives are explicitly specified as weakening semantic transparency (for example, "max-stale" or "public"). The Cache-Control directives are described in detail in section 18.10. 16.1.3 Warnings Wheneveraccept the credentials sent with acache returnsrequest, it SHOULD return a 401 (Unauthorized) response. The responsethat is not semantically transparent, it must attachMUST include awarningWWW-Authenticate header field containing the (possibly new) challenge applicable tothat effect, using a Warning response header. This warning allows clientsthe requested resource anduser agentsan entity explaining the refusal. The HTTP protocol does not restrict applications totake appropriate action. Warnings may be usedthis simple challenge-response mechanism forother purposes, both cache-relatedaccess authentication. Additional mechanisms MAY be used, such as encryption at the transport level or via message encapsulation, andotherwise. The use of a warning, rather than an error status code, distinguishwith additional header fields specifying authentication information. However, theseresponses from true failures. Warningsadditional mechanisms arealways cachable, becausenot defined by this specification. Proxies MUST be completely transparent regarding user agent authentication. That is, theynever weakenMUST forward thetransparency ofWWW-Authenticate and Authorization headers untouched, and follow the rules found in section 14.8. HTTP/1.1 allows aresponse. This means that warnings can be passedclient toHTTP/1.0 caches without danger; such caches will simplypassthe warning along asauthentication information to and from aentity header inproxy via theresponse. Warnings are assigned numbers between 0Proxy-Authenticate and99. This specification definesProxy-Authorization headers. 11.1 Basic Authentication Scheme The "basic" authentication scheme is based on thecode numbers and meanings of each warning, allowingmodel that the user agent must authenticate itself with aclient or cache to take automated action in some (but not all) cases. Warnings also carryuser-ID and awarning message text in any appropriate natural language (perhaps basedpassword for each realm. The realm value should be considered an opaque string which can only be compared for equality with other realms on that server. The server will service theclient's Accept headers),request only if it can validate the user-ID andan optional indicationpassword for the protection space ofwhat language and character setthe Request-URI. There areused. Multiple warning messages may be attached tono optional authentication parameters. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 61] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 Upon receipt of an unauthorized request for aresponse (either byURI within theorigin server or by a cache), including multiple warnings withprotection space, thesame code number. For example, aservermay provide the same warningMAY respond withtexts in both English and Basque. When multiple warnings are attached toaresponse, it may not be practical or reasonablechallenge like the following: WWW-Authenticate: Basic realm="WallyWorld" where "WallyWorld" is the string assigned by the server todisplay allidentify the protection space ofthem totheuser. This versionRequest-URI. To receive authorization, the client sends the userid and password, separated by a single colon (":") character, within a base64 encoded string in the credentials. basic-credentials = "Basic" SP basic-cookie basic-cookie = <base64 [7] encoding ofHTTP doesuser-pass, except notspecify strict priority ruleslimited to 76 char/line> user-pass = userid ":" password userid = *<TEXT excluding ":"> password = *TEXT Userids might be case sensitive. If the user agent wishes to send the userid "Aladdin" and password "open sesame", it would use the following header field: Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== See section 15 fordecidingsecurity considerations associated with Basic authentication. 11.2 Digest Authentication Scheme Note for the RFC editor: This section is reserved for including the Digest Authentication specification, or if the RFC editor chooses to issue a single RFC rather than two RFC's, this section should be deleted. 12 Content Negotiation Most HTTP responses include an entity whichwarningscontains information for interpretation by a human user. Naturally, it is desirable todisplaysupply the user with the "best available" entity corresponding to the request. Unfortunately for servers andincaches, not all users have the same preferences for whatorder, but does suggest some heuristics. The Warning headeris "best," andthe currently defined warningsnot all user agents aredescribed in section 18.48.equally capable of rendering all entity types. For that reason, HTTP has provisions for several mechanisms for "content negotiation" -- the Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page61]62] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199616.1.4 Explicit User Agent Warnings Many user agents make it possible for users to overrideprocess of selecting thebasic caching mechanisms. For example,best representation for a given response when there are multiple representations available. Note: This is not called "format negotiation" because theuser agentalternate representations mayallowbe of theuser to specifysame media type, but use different capabilities of thatcached entities (even explicitly stale ones) are never validated. Or the user agent might habitually add "Cache-Control: max- stale=3600" or "Cache-Control: reload"type, be in different languages, etc. Any response containing an entity-body MAY be subject toevery request. We recognize that therenegotiation, including error responses. There are two kinds of content negotiation which are possible in HTTP: server-driven and agent-driven negotiation. These two kinds of negotiation are orthogonal and thus may besituations which require such overrides, although user agents SHOULD NOT default to any behavior contrary to the HTTP/1.1 specification. That is, the user should have to explicitly request either non-transparent behavior,used separately orbehavior that resultsinabnormally ineffective caching. If the user has overridden the basic caching mechanisms, the user agent should explicitly indicatecombination. One method of combination, referred to as transparent negotiation, occurs when a cache uses theuser whenever this resultsagent-driven negotiation information provided by the origin server in order to provide server- driven negotiation for subsequent requests. 12.1 Server-driven Negotiation If thedisplayselection ofinformation that might not meettheserver's transparency requirements (in particular, ifbest representation for a response is made by an algorithm located at thedisplayed entityserver, it isknown to be stale). Sincecalled server-driven negotiation. Selection is based on theprotocol normally allowsavailable representations of theuser agent to determine if responses are stale or not, this indication need only be displayed when this actually happens. The indication need not be a dialog box;response (the dimensions over which itcould be an icon (for example, a picturecan vary; e.g. language, content-coding, etc.) and the contents ofa rotting fish)particular header fields in the request message orsomeon othervisual indicator. If the user has overriddeninformation pertaining to thecaching mechanisms in a way that would abnormally reducerequest (such as theeffectivenessnetwork address ofcaches,theuser agent should continually display an indication (for example, a picture of currency in flames) so thatclient). Server-driven negotiation is advantageous when theuser does not inadvertently consume excess resources or sufferalgorithm for selecting fromexcessive latency. 16.1.5 Exceptions to the Rules and Warnings In some cases,among theoperator of a cache may chooseavailable representations is difficult toconfigure itdescribe toreturn stale responses even when not requested by clients. This decision not be made lightly, but may be necessary for reasons of availabilitythe user agent, orperformance, especiallywhen thecache is poorly connectedserver desires to send its "best guess" tothe origin server. Whenever a cache returns a stale response, it MUST mark it as such (using a Warning header). This allowsthe clientsoftwarealong with the first response (hoping toalertavoid theuser that there may beround-trip delay of apotential problem. It also allowssubsequent request if theuser to take steps"best guess" is good enough for the user). In order toobtain a firsthand or fresh response, ifimprove theuser so desires. For this reason, a cache MUST NOT return a stale response ifserver's guess, theclient explicitly requestsuser agent MAY include request header fields (Accept, Accept-Language, Accept-Encoding, etc.) which describe its preferences for such afirst-hand or fresh one, unless itresponse. Server-driven negotiation has disadvantages: 1. It is impossibleto comply. 16.1.6 Client-controlled Behavior Whilefor theoriginserver(and to a lesser extent, intermediate caches, by their contributiontothe ageaccurately determine what might be "best" for any given user, since that would require complete knowledge ofa response) areboth theprimary sourcecapabilities ofexpiration information, in some casestheclient may need to control a cache's decision about whether to return a cached response without validating it. Clients do this using several directives ofuser agent and theCache- Control header. A client's request may specifyintended use for themaximum age it is willingresponse (e.g., does the user want toaccept for an unvalidated response; specifyingview it on screen or print it on paper?). 2. Having the user agent describe its capabilities in every request can be both very inefficient (given that only avaluesmall percentage of responses have multiple representations) and a potential violation ofzero forcesthe user's privacy. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page62]63] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996cache(s) to revalidate all responses. A client may also specify the minimum time remaining before a response expires. Both of these options increase constraints on3. It complicates thebehaviorimplementation ofcaches,an origin server andso cannot decrease semantic transparency. A clientthe algorithms for generating responses to a request. 4. It mayalso specify that it will accept stale responses, uplimit a public cache's ability tosome maximum amount of staleness. This loosensuse theconstraints onsame response for multiple user's requests. HTTP/1.1 includes thecaches, and so may violate semantic transparency, but may be necessary to support disconnected operation, or high availability in the face of poor connectivity. 16.2 Expiration Model 16.2.1 Server-Specified Expiration HTTP caching works best when caches can entirely avoid making requests to the origin server. The primary mechanism for avoiding requests isfollowing request-header fields for enabling server-driven negotiation through description of user agent capabilities and user preferences: Accept (section 14.1), Accept-Charset (section 14.2), Accept-Encoding (section 14.3), Accept-Language (section 14.4), and User-Agent (section 14.42). However, an origin server is not limited toprovide an explicit expiration time inthese dimensions and MAY vary thefuture, indicating that a response may be used to satisfy subsequent requests. In other words, a cache can return a freshresponsewithout first contactingbased on any aspect of theserver. Our expectation is thatrequest, including information outside the request-header fields or within extension header fields not defined by this specification. HTTP/1.1 origin serverswill assign future explicit expiration times to responsesMUST include an appropriate Vary header field (section 14.43) in any response based on server-driven negotiation. The Vary header field describes thebelief thatdimensions over which theentity is not likely to change, in a semantically significant way, beforeresponse might vary (i.e. theexpiration time is reached. This normally preserves semantic transparency, as long asdimensions over which theserver's expiration times are carefully chosen. If anorigin serverwishes to force a semantically transparent cache to validate every request,picks its "best guess" response from multiple representations). HTTP/1.1 public caches MUST recognize the Vary header field when itmay assign an explicit expiration timeis included inthe past. This means that thea responseis always stale,andsoobey thecache SHOULD validate it before using it for subsequent requests. (Seerequirements described in section18.10.4 for a more restrictive way to force revalidation). Note13.5 thata firsthand response MUST always be returned todescribes therequesting client, independentinteractions between caching and content negotiation. 12.2 Agent-driven Negotiation With agent-driven negotiation, selection ofits expiration time, unless the connection totheclientbest representation for a response islost. Ifperformed by the user agent after receiving an initial response from the originserver wishes to force any HTTP/1.1 cache, no matter how itserver. Selection isconfigured, to validate every request, it should usebased on a list of the"must- revalidate" Cache-Control directive. See section 18.10. Servers specify explicit expiration times using eitheravailable representations of theExpires header, orresponse included within themax-age directiveheader fields (this specification reserves the keyword Alternates, to be defined in a separate specification [27]) or entity-body of theCache-Control header. 16.2.2 Limitations oninitial response, with each representation identified by its own URI. Selection from among theEffect of Expiration Times An expiration time cannotrepresentations may beused to force aperformed automatically (if the user agentto refresh its displayis capable of doing so) orreload a resource entity; its semantics apply only to caching mechanisms, and such mechanisms need only check a resource's expiration status whenmanually by the user selecting from anew request for that resourcegenerated (possibly hypertext) menu. Agent-driven negotiation isinitiated. User agents often have history mechanisms, suchadvantageous when the response would vary over commonly-used dimensions (such as"Back" buttonstype, language, or encoding), when the origin server is unable to determine a user agent's capabilities from examining the request, andhistory lists, which can begenerally when public caches are used toredisplay an entity retrieved Fielding, Frystyk, Berners-Lee, Gettys,distribute server load andMogul [Page 63] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 earlier in a session. By default, an expiration time does not apply to history mechanisms. Ifreduce network usage. Agent-driven negotiation suffers from theentity is still in storage,disadvantage of needing ahistory mechanism should display it even if the entity has expired, unless the user has specifically configured the agentsecond request torefresh expired history documents. 16.2.3 Heuristic Expiration Since origin servers do not always provide explicit expiration times, HTTP caches typically assign heuristic expiration times, employing algorithms that use other header values (such asobtain theLast-Modified time) to estimate a plausible expiration time. The HTTP/1.1best alternate representation. This second request is only efficient when caching is used. In addition, this specification does notprovide specific algorithms, butdefine any mechanism for supporting automatic Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 64] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 selection, though it also doesimpose worst-case constraints on their results. Since heuristic expiration times may compromise semantic transparency, they should benot prevent any such mechanism from being developed as an extension and usedcautiously,within HTTP/1.1. HTTP/1.1 defines the 300 (Multiple Choices) andwe encourage origin servers406 (Not Acceptable) status codes for enabling agent-driven negotiation when the server is unwilling or unable to provideexplicit expiration times as much as possible. 16.2.4 Age Calculations In order to know ifacached entryvarying response using server-driven negotiation. 12.3 Transparent Negotiation Transparent negotiation isfresh, a cache needs to know if its age exceeds its freshness lifetime. We discuss how to calculate the latter in section 0; this section describes how to calculate the age ofaresponse or cache entry. In this discussion, we use the term "now" to mean "the current valuecombination ofthe clock at the host performing the calculation." All HTTP implementations, but especially origin serversboth server-driven andcaches, should use NTP [RFC1305] or some similar protocol to synchronize their clocks to a globally accurate time standard. Also note that HTTP/1.1 requires origin servers to sendagent-driven negotiation. When aDate headercache is supplied withevery response, giving the time at which the response was generated. We use the term "date_value" to denote a representation of the value of the Date header, ina formappropriate for arithmetic operations. HTTP/1.1 uses the "Age" response header to help convey age information between caches. The Age header value is the sender's estimateof theamountlist of available representations oftime sincethe responsewas generated at the origin server. In(as in agent-driven negotiation) and thecasedimensions ofa cached response that has been revalidated with the origin server,variance are completely understood by theAge value is based oncache, then thetimecache becomes capable ofrevalidation, notperforming server-driven negotiation on behalf of theoriginal response. In essence, the Age value isorigin server for subsequent requests on that resource. Transparent negotiation has thesumadvantage of distributing thetimenegotiation work thatthe response has been resident in eachwould otherwise be required of thecaches along the path from theoriginserver, plusserver and also removing theamountsecond request delay oftime it has been in transit along network paths. We useagent-driven negotiation when theterm "age_value"cache is able todenote a representation of the value ofcorrectly guess theAge header, in a form appropriateright response. This specification does not define any mechanism forarithmetic operations. An response's age can be calculated in two entirely independent ways: Fielding, Frystyk, Berners-Lee, Gettys,transparent negotiation, though it also does not prevent any such mechanism from being developed as an extension andMogul [Page 64] INTERNET-DRAFTused within HTTP/1.1. An HTTP/1.1Friday, May 03, 1996 1. now - date_value, ifcache performing transparent negotiation MUST include a Vary header field in thelocal clock is reasonably well synchronizedresponse (defining the dimensions of its variance) to ensure correct interoperation with all HTTP/1.1 clients. The agent- driven negotiation information supplied by the originserver's clock. Ifserver SHOULD be included with theresult is negative, thistransparently negotiated response. 13 Caching in HTTP HTTP isreplacedtypically used for distributed information systems, where performance can be improved byzero. 2. age_value, if all of the caches along the response path implement HTTP/1.1. Given that we have two independent ways to computetheageuse ofaresponsewhen it is received, we can combine these as corrected_received_age = max(now - date_value, age_value) and as long as we have either nearly synchronized clocks or all-HTTP/1.1 paths, one gets a reliable (conservative) result. Note that this correction is applied at eachcaches. The HTTP/1.1cache along the path, so that if there is an HTTP/1.0 cache in the path, the correct received age is computedprotocol includes a number of elements intended to make caching work aslongwell as possible. Because these elements are inextricable from other aspects of thereceiving cache's clock is nearly in sync. We don't need end-to-end clock synchronization (althoughprotocol, and because they interact with each other, it isgooduseful tohave), and there is no explicit clock synchronization step. Becausedescribe the basic caching design ofnetwork-imposed delays, some significant interval may passHTTP separately from thetime that a server generates a response, and the timedetailed descriptions of methods, headers, response codes, etc. Caching would be useless if it did not significantly improve performance. The goal of caching in HTTP/1.1 isreceived atto eliminate thenext outbound cache or client. If uncorrected, this delay could resultneed to send requests inimproperly low ages. Becausemany cases, and to eliminate therequest that resultedneed to send full responses in many other cases. The former reduces thereturned Age value must have been initiated prior to that Age value's generation,number of network round-trips required for many operations; wecan correctuse an "expiration" mechanism fordelays imposed by thethis purpose (see section 13.2). The latter reduces Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 65] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 networkby recordingbandwidth requirements; we use a "validation" mechanism for this purpose (see section 13.3). Requirements for performance, availability, and disconnected operation require us to be able to relax thetime at whichgoal of semantic transparency. The HTTP/1.1 protocol allows origin servers, caches, and clients to explicitly reduce transparency when necessary. However, because non- transparent operation may confuse non-expert users, and may be incompatible with certain server applications (such as those for ordering merchandise), the protocol requires that transparency may be relaxed . only by an explicit protocol-level requestwas initiated. Then,when relaxed by client or origin server . only with anAge value is received, it MUST be interpreted relativeexplicit warning to thetimeend user when relaxed by cache or client Therefore, the HTTP/1.1 protocol provides these important elements: 1. Protocol features that provide full semantic transparency when this is required by all parties. 2. Protocol features that allow an origin server or end-user client to explicitly requestwas initiated,and control non-transparent operation. 3. Protocol features that allow a cache to attach warnings to responses that do not preserve thetimerequested approximation of semantic transparency. A basic principle is that it must be possible for theresponse was received. This algorithm resultsclients to detect any potential relaxation of semantic transparency. Note: The server, cache, or client implementer may be faced with design decisions not explicitly discussed inconservative behavior no matter how much delay is experienced. So, we compute: corrected_initial_age = corrected_received_age + (now - request_time) where "request_time" isthis specification. If a decision may affect semantic transparency, thetime (accordingimplementer ought to err on thelocal clock) when the request that elicited this response was sent. Summaryside ofage calculation algorithm, when a cache receivesmaintaining transparency unless aresponse: /* * age_value * iscareful and complete analysis shows significant benefits in breaking transparency. 13.1.1 Cache Correctness If thevalue of Age: header received bycache can communicate with the origin-server, then a correct cache MUST respond to a request with* this response. * date_value * isa response that meets one of the following conditions: 1. Its end-to-end headers (see section 13.4.1) and entity-body valueofare equivalent to what theorigin server's Date: header * request_time * isserver would have returned for that request if the(local) time whenresource had not been modified since thecache maderesponse was cached, by revalidating therequest * that resulted in this cachedresponse* response_time *with the origin server, if is not fresh. 2. It is "fresh enough" (see section 13.2). In the(local) time whendefault case, this means it meets the least restrictive freshness requirement of the client, server, and cachereceived(see section 14.9); if the* response * noworigin-server Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page65]66] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996* is the current (local) time */ apparent_age = max(0, now - date_value); corrected_received_age = max(apparent_age, age_value); response_delay = now - request_time; corrected_initial_age = corrected_received_age + response_delay; resident_time = now - response_time; current_age = corrected_initial_age + resident_time; When a cache sends a response,so specifies, itmust add to the corrected_initial_ageis theamountfreshness requirement oftime thattheresponse was resident locally.origin-server alone. 3. Itmust then transmit this total age, usingincludes a warning if theAge header, tofreshness demand of thenext recipient cache. Note that aclientcan usually tell if a responseor the origin-server is violated (see section 13.1.5 and 14.45). and it isfirsthand by comparingtheDatemost up-to-date response appropriate toits local request-time,the request the cache has (see section 13.2.5, 13.2.6, andhoping that13.10). If theclocks arecache can notbadly skewed. 16.2.5 Expiration Calculations In order to decide whethercommunicate with the origin server, then aresponse is fresh or stale, we need to compare its freshness lifetime to its age. The age is calculatedcorrect cache SHOULD respond asdescribed in section 16.2.4; this section describes how to calculate the freshness lifetime, and to determineabove ifathe responsehas expired. We usecan be correctly served from theterm "expires_value" to denotecache; if not it MUST return an error or warning indicating that there was arepresentation ofcommunication failure. 13.1.2 Warnings Whenever a cache returns a response that is neither first-hand nor "fresh enough" (in thevaluesense ofthe Expires header,condition 2 in 13.1.1), it must attach aformwarning to that effect, using a Warning response-header. This warning allows clients to take appropriate action. Warnings may be used forarithmetic operations. Weother purposes, both cache-related and otherwise. The usethe term "max_age_value" to denote an appropriate representationof a warning, rather than an error status code, distinguish these responses from true failures. Warnings are always cachable, because they never weaken thenumber of seconds carried by the max-age directivetransparency ofthe Cache- Control header in a response (see section 18.11). The max-age directive takes priority over Expires, so if max-age is present inaresponse, the calculation is simply: freshness_lifetime = max_age_value Otherwise, if Expires is present in the response, the calculation is: freshness_lifetime = expires_value - date_value Noteresponse. This means thatneither of these calculations is vulnerablewarnings can be passed toclock skew, since all of the information comes fromHTTP/1.0 caches without danger; such caches will simply pass theorigin server. If neither Expires nor Cache-Control max-age appearswarning along as a entity-header in theresponse,response. Warnings are assigned numbers between 0 and 99. This specification defines theresponse doescode numbers and meanings of each currently assigned warnings, allowing a client or cache to take automated action in some (but notinclude other restrictionsall) cases. Warnings also carry a warning text. The text may be in any appropriate natural language (perhaps based oncaching,thecache MAY compute a freshness lifetime using a heuristic. This heuristicclient's Accept headers), and include an optional indication of what character set issubject to certain limitations; the minimum valueused. Multiple warnings may bezero, andattached to a response (either by themaximum value MUST be no more than 24 hours. Also, iforigin server or by a cache), including multiple warnings with theresponse does havesame code number. For example, aLast-Modified time,server may provide theheuristic expiration value SHOULDsame warning with texts in both English and Basque. When multiple warnings are attached to a response, it may not beno more than some fractionpractical or reasonable to display all of them to theinterval since that time. A typical settinguser. This version ofthis fraction might be 10%.HTTP does not specify strict priority rules for deciding which warnings to display and in what order, but does suggest some heuristics. The Warning header and the currently defined warnings are described in section 14.45. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page66]67] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996 13.1.3 Cache-control Mechanisms Thecalculation to determine if a response has expired is quite simple: response_is_fresh = (freshness_lifetime > current_age) 16.2.6 Scope of Expiration HTTP/1.1'sbasic cache mechanisms in HTTP/1.1 (server-specified expirationmodel is that as soon as any variant of a URI becomes stale, all variants becomes stale as well. Thus, "freshness" applies to all the variants of URI, rather than any particular variant. Datestimes andexpires etc. applyvalidators) are implicit directives toany cached variant that a proxy might have withcaches. In some cases, aURI and not just the one particular entity. Editor's note: This restrictionserver or client maybe dropped inneed to provide explicit directives to thenext draft; there are still discussions about whether this restriction is needed. 16.2.7 Disambiguating Expiration Values Because expiration values are assigned optimistically, it is possible that two caches may contain fresh values forHTTP caches. We use thesame resource that are different. If a client performing a retrieval receives a non-firsthand responseCache-Control header fora resource entity that was already fresh in its own cache, and the Datethis purpose. The Cache-Control headerin its existing cache entry is newer than the Date on the new response, then the client MAY ignore the response. If so, it MAY retry the request withallows a"Cache-Control: max-age=0" directive (see section 18.10),client or server toforcetransmit acheck withvariety of directives in either requests or responses. These directives typically override theorigin server. Ifdefault caching algorithms. As acache thatgeneral rule, if there ispooling cached responses from other caches sees two fresh responses forany apparent conflict between header values, thesame resource entity with different validators, it SHOULD usemost restrictive interpretation should be applied (that is, the onewith the newer Date header. 16.2.8 Disambiguating Multiple Responses Because a client may be receiving responses via multiple paths, sothat is most likely to preserve semantic transparency). However, in someresponses flow through one set of caches and other responses flow through a different setcases, Cache-Control directives are explicitly specified as weakening the approximation ofcaches, a client may receive responsessemantic transparency (for example, "max-stale" or "public"). The Cache-Control directives are described inan order different from thatdetail inwhich the origin server generated them. We would like the clientsection 14.9. 13.1.4 Explicit User Agent Warnings Many user agents make it possible for users touseoverride themost recently generated response, even if older responses are still apparently fresh. Neitherbasic caching mechanisms. For example, theentity tag noruser agent may allow theexpiration value can impose an ordering on responses, since it is possibleuser to specify thata later response intentionally carries an earlier expiration time. However, the HTTP/1.1 specification requirescached entities (even explicitly stale ones) are never validated. Or thetransmission of Date headers onuser agent might habitually add "Cache-Control: max- stale=3600" or "Cache-Control: reload" to everyresponse, and the Date values are orderedrequest. The user should have toa granularity of one second. If a client performs aexplicitly requestfor a resource entityeither non-transparent behavior, or behavior thatit already hasresults inits cache, and the response it receives contains a Date header that appears to be older thanabnormally ineffective caching. If theone it alreadyuser hasin its cache, then the client SHOULD repeatoverridden therequest unconditionally, and include Cache-Control: max-age=0 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 67] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 to force any intermediate caches to validate their copies directly withbasic caching mechanisms, theorigin server, or Cache-Control: no-cache to force any intermediate cachesuser agent should explicitly indicate toobtain a new copy fromtheorigin server. This prevents certain paradoxes arising fromuser whenever this results in theusedisplay ofmultiple caches. Ifinformation that might not meet theDate values are equal, then the client may use either response (or may, if it is being extremely prudent, request a new response). Servers MUST NOT depend on clients being able to choose deterministically between responses generated during the same second,server's transparency requirements (in particular, iftheir expiration times overlap. 16.3 Validation Model When a cache has a stale entry that it would like to use as a response to a client's request, it first has to check withtheorigin server (or possibly an intermediate cache with a fresh response) to see if its cached entrydisplayed entity isstill usable. We call this "validating" the cache entry. Since we do not want to haveknown topay the overhead of retransmittingbe stale). Since thefull response ifprotocol normally allows thecached entry is good, and we do not wantuser agent topay the overhead of an extra round tripdetermine ifthe cached entry is invalid, the HTTP/1.1 protocol supports the use of conditional methods. The key protocol features for supporting conditional methodsresponses arethose concerned with "cache validators." When an origin server generatesstale or not, this indication need only be displayed when this actually happens. The indication need not be afull response,dialog box; itattaches some sortcould be an icon (for example, a picture ofvalidator to it, which is kept with the cache entry. Whenaclient (end-userrotting fish) orcache) makes a conditional request for a resource for which itsome other visual indicator. If the user hasa cache entry, it includesoverridden theassociated validatorcaching mechanisms inthe request. The server then checksa way thatvalidator againstwould abnormally reduce thecurrent validator foreffectiveness of caches, theresource entity, and, if they match, it responds with a special status code (usually, "304 Not Modified") and no entity body. Otherwise, it returnsuser agent should continually display an indication (for example, afull response (including entity body). Thus, we avoid transmitting the full response ifpicture of currency in flames) so that thevalidator matches, and we avoid an extra round trip if ituser does notmatch. Note: the comparison functions usedinadvertently consume excess resources or suffer from excessive latency. 13.1.5 Exceptions todecide if validators match are defined in section 16.3.3. In HTTP/1.1, a conditional request looks exactly the same as a normal request for the same resource, except that it carries a special header (which includes the validator) that implicitly turnsthemethod (usually, GET) into a conditional. The protocol includes both positiveRules andnegative sensesWarnings In some cases, the operator ofcache- validating conditions. That is,a cache may choose to configure itis possibletorequest either that a method be performed if and only if the validators match, or if and only if the validators doreturn stale responses even when notmatch.requested by clients. This decision Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 68] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996Note: a response that lacks a cache validatorshould not be made lightly, but maystillbecached, and served fromnecessary for reasons of availability or performance, especially when the cacheuntil it expires, unless thisisexplicitly prohibited by a Cache-Control directive. However,poorly connected to the origin server. Whenever a cachecannot doreturns aconditional retrieval ifstale response, itdoes not haveMUST mark it as such (using acache validator forWarning header). This allows theentity, which means it will notclient software to alert the user that there may berefreshable after it expires. 16.3.1 Last-modified Dates In HTTP/1.0,a potential problem. It also allows theonlyuser to take steps to obtain a first-hand or fresh response. For this reason, a cachevalidatorSHOULD NOT return a stale response if the client explicitly requests a first-hand or fresh one, unless it is impossible to comply for technical or policy reasons. 13.1.6 Client-controlled Behavior While theLast-Modified time carriedorigin server (and to a lesser extent, intermediate caches, by their contribution to the age of aresponse.response) are the primary source of expiration information, in some cases the client may need to control a cache's decision about whether to return a cached response without validating it. Clientsvalidate entitiesdo this using several directives of theIf-Modified-SinceCache- Control header.In simple terms, a cache entryA client's request may specify the maximum age it isconsideredwilling tobe valid ifaccept of an unvalidated response; specifying a value of zero forces theactual resource entity has not been modified sincecache(s) to revalidate all responses. A client may also specify theoriginalminimum time remaining before a responsewas generated. 16.3.2 Entity Tags HTTP/1.1 introducesexpires. Both of these options increase constraints on thepossibilitybehavior ofusing an "opaque" validator, called an "entity tag," for situations wherecaches, and so cannot further relax theLast-Modified date is not appropriate. Thiscache's approximation of semantic transparency. A client mayinclude server implementations wherealso specify that itis not convenientwill accept stale responses, up tostore modification dates,some maximum amount of staleness. This loosens the constraints on the caches, and so may violate the origin server's specified constraints on semantic transparency, but may be necessary to support disconnected operation, orwherehigh availability in theone-second resolutionface of poor connectivity. 13.2 Expiration Model 13.2.1 Server-Specified Expiration HTTPdate values is insufficient, or wherecaching works best when caches can entirely avoid making requests to the origin server. The primary mechanism for avoiding requests is for an origin serverwishestoavoid certain paradoxes that may arise fromprovide an explicit expiration time in theuse of modification dates. An entity tag is simplyfuture, indicating that astring of octets whose internal structure is not knownresponse may be used toclients or caches. Caches store entity tags and return them when making conditionalsatisfy subsequent requests.Also, whenIn other words, a cachereceives a conditional request for a resource for which it hascan return a freshcache entry, it may compare entity tags using strict octet-equality. Otherwise, entity tags have no semantic value to clients or caches. To preserve compatibility with HTTP/1.0 clients and caches, and becauseresponse without first contacting theLast-Modified date may be useful for purposes other than cache validation, HTTP/1.1server. Our expectation is that serversSHOULD send Last-Modified whenever feasible. The headers usedwill assign future explicit expiration times toconvey entity tags are describedresponses insections Error! Reference source not found., Error! Reference sourcethe belief that the entity is notfound., 18.26, and 18.46. 16.3.3 Weak and Strong Validators Since both origin servers and caches will compare two validator valueslikely todecide if they represent the same or different resource entities, one normally would expect that if the resource entity (the entity body or any entity headers) changeschange, inany way, then the associated validator would change as well. If this is true, then we call this validatora"strong validator." However, there may be cases when a server prefers to change the validator only onsemantically significantchanges, and not whenway, before the expiration time is Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 69] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996insignificant aspects of the resource entity change. A validator that does not always change when the resource changes is a "weak validator." One can think of a strong validatorreached. This normally preserves semantic transparency, as long asone that changes wheneverthebits of an entity changes, whileserver's expiration times are carefully chosen. The expiration mechanism applies only to responses taken from aweak value changes whenevercache and not to first-hand responses forwarded immediately to themeaning of an entity changes. Alternatively, one can think of a strong validator as part of an identifier for a specific entity, while a weak validator is part ofrequesting client. If anidentifier fororigin server wishes to force aset ofsemanticallyequivalent entities. Note: One example of a strong validator is an integer that is incremented in stable storagetransparent cache to validate everytime an entity is changed. An entity's modification time, if represented with one-second resolution, could be a weak validator, sincerequest, itis possiblemay assign an explicit expiration time in the past. This means that theresource entity may be modified twice during a single second. Entity tags are normally "strong validators," butresponse is always stale, and so theprotocol providescache SHOULD validate it before using it for subsequent requests. See section 14.9.4 for amechanismmore restrictive way totagforce revalidation. If anentity tag as "weak." A "use" of a validatororigin server wishes to force any HTTP/1.1 cache, no matter how it is configured, to validate every request, it should use the "must- revalidate" Cache-Control directive (see section 14.9). Servers specify explicit expiration times using eitherwhenthe Expires header, or the max-age directive of the Cache-Control header. An expiration time cannot be used to force aclient generatesuser agent to refresh its display or reload arequestresource; its semantics apply only to caching mechanisms, andincludes the validator insuch mechanisms need only check avalidating header field, orresource's expiration status when aserver compares two validators. Strong validators are usable in any context. Weak validators are only usable in contextsnew request for thatdo not depend on exact equality of an entity. For example, either kindresource isusableinitiated. See section 13.11 fora conditional GETexplanation ofa full entity. However, only a strong validator is usable for a sub-range retrieval, since otherwisetheclient may end up with an internally inconsistent entity body. The only functiondifference between caches and history mechanisms. 13.2.2 Heuristic Expiration Since origin servers do not always provide explicit expiration times, HTTP caches typically assign heuristic expiration times, employing algorithms thatthe HTTP/1.1 protocol defines on validators is comparison. There are two validator comparison functions, depending on whether the comparison context allows theuseof weak validators or not: . The strong comparison function: in orderother header values (such as the Last-Modified time) tobe considered equal, both validators must be identical in every way, and neither may be weak. .estimate a plausible expiration time. Theweak comparison function: in order to be considered equal, both validators must be identical in every way,HTTP/1.1 specification does not provide specific algorithms, buteither or both of themdoes impose worst-case constraints on their results. Since heuristic expiration times maybe tagged as "weak" without affecting the result. The weak comparison function SHOULD be used for simple (non-subrange) GET requests. The strong comparison function MUSTcompromise semantic transparency, they should be usedin all other cases. An entity tag is strong unless it is explicitly taggedcautiously, and we encourage origin servers to provide explicit expiration times asweak. Section 16.3 gives the syntax for entity tags. A Last-Modified time, when usedmuch asa validator in a request, is implicitly weak unless it is possiblepossible. 13.2.3 Age Calculations In order todeduce that itknow if a cached entry isstrong, usingfresh, a cache needs to know if its age exceeds its freshness lifetime. We discuss how to calculate thefollowing rules: . The validator is being compared by an origin serverlatter in section 13.2.4; this section describes how to calculate theactualage of a response or cache entry. In this discussion, we use the term "now" to mean "the currentvalidator forvalue of theentity and,clock at the host performing the calculation." All HTTP implementations, but especially origin servers and caches, should use Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 70] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996. That origin server reliably knowsNTP [28] or some similar protocol to synchronize their clocks to a globally accurate time standard. Also note that HTTP/1.1 requires origin servers to send a Date header with every response, giving theassociated entity did not change twice duringtime at which thesecond covered byresponse was generated. We use thepresented validator. or . The validator is aboutterm "date_value" tobe used by a client in an If-Modified- Since or If-Unmodified-Since header, becausedenote theclient hasvalue of the Date header, in acache entryform appropriate for arithmetic operations. HTTP/1.1 uses theassociated entity, and . That cache entry includes a Date value, which givesAge response-header to help convey age information between caches. The Age header value is the sender's estimate of the amount of timewhensince theorigin serverresponse was generated at theoriginal response, and . The presented Last-Modified timeorigin server. In the case of a cached response that has been revalidated with the origin server, the Age value isat least 60 seconds beforebased on theDate value. or . The validatortime of revalidation, not of the original response. In essence, the Age value isbeing compared by an intermediate cache tothevalidator storedsum of the time that the response has been resident inits cache entry foreach of theentity, and . That cache entry includes a Date value, which givescaches along thetime whenpath from the originserver generatedserver, plus theoriginal response, and . The presented Last-Modifiedamount of timeis at least 60 seconds beforeit has been in transit along network paths. We use theDate value. This method relies onterm "age_value" to denote thefact that ifvalue of the Age header, in a form appropriate for arithmetic operations. A response's age can be calculated in twodifferent responses were generated byentirely independent ways: 1. now minus date_value, if the local clock is reasonably well synchronized to the originserver duringserver's clock. If thesame second, but both hadresult is negative, thesame Last-Modified time, then at least oneresult is replaced by zero. 2. age_value, if all ofthose responses wouldthe caches along the response path implement HTTP/1.1. Given that we havea Date value equaltwo independent ways toits Last-Modified time. The arbitrary 60-second limit guards againstcompute the age of a response when it is received, we can combine these as corrected_received_age = max(now - date_value, age_value) and as long as we have either nearly synchronized clocks or all-HTTP/1.1 paths, one gets a reliable (conservative) result. Note that this correction is applied at each HTTP/1.1 cache along thepossibilitypath, so that if there is an HTTP/1.0 cache in theDate and Last-Modified values are generated from different clocks, or at somewhat different times duringpath, thepreparation ofcorrect received age is computed as long as theresponse. An implementation may use a value larger than 60 seconds, if itreceiving cache's clock isbelieved that 60 secondsnearly in sync. We don't need end-to-end clock synchronization (although it istoo short. If a client wishesgood toperform a sub-range retrieval on a value for which it has only a Last-Modified timehave), and there is noopaque validator, itexplicit clock synchronization step. Because of network-imposed delays, some significant interval maydo this only ifpass from theLast-Modifiedtimeis strong in the sense described here. A cache or origin server receiving a cache-conditional request, other than a full-body GET request, must use the strong comparison function to evaluate the condition. These rules allow HTTP/1.1 caches and clients to safely perform sub- range retrievals on valuesthathave been obtained from HTTP/1.0 servers. 16.3.4 Rules for When to Use Entity Tags and Last-modified Dates We adoptaset of rules and recommendations for origin servers, clients, and caches regarding when various validator types should be used,server generates a response andfor what purposes. HTTP/1.1 origin servers: . SHOULD send an entity tag validator unless performance considerations supporttheuse of weak entity tags, or unlesstime it isunfeasible to send a strong entity tag. . MAY send a weak entity tag instead of a strong one.received at the next outbound cache or client. If uncorrected, this delay could result in improperly low ages. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 71] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996. MAY send no entity tag if it is not feasible to generate one. . SHOULD send a Last-Modified value if it is feasible to send one, unlessBecause therisk of a breakdown in semantic transparencyrequest thatcould result from using this dateresulted inan If-Modified-Since header would lead to serious problems. In other words,thepreferred behavior for an HTTP/1.1 origin server is to send both a strong entity tag and a Last-Modified value. In orderreturned Age value must have been initiated prior tobe legal, a strong entity tag MUST change wheneverthat Age value's generation, we can correct for delays imposed by theassociated entity value changes in any way. A weak entity tag SHOULD change whenevernetwork by recording theassociated entity changes in a semantically significant way. Note: in order to provide semantically transparent caching,time at which the request was initiated. Then, when anorigin server should avoid reusing a specific strong entity tag value for two different resource entities, or reusing a specific weak entity tagAge valuefor two semantically different instances of a resource entity. Cache entries may persist for arbitrarily long periods, regardless of expiration times, sois received, itmayMUST beinappropriateinterpreted relative to the time the request was initiated, not the time that the response was received. This algorithm results in conservative behavior no matter how much delay is experienced. So, we compute: corrected_initial_age = corrected_received_age + (now - request_time) where "request_time" is the time (according toexpectthe local clock) when the request that elicited this response was sent. Summary of age calculation algorithm, when a cachewill never again attempt to validate an entry usingreceives avalidator that it obtained at some point in the past. HTTP/1.1 clients: . If an entity tag has been provided byresponse: /* * age_value * is theorigin server, MUST use that entity tag in any cache-conditional request (using If-Match or If-NoneMatch). . If only a Last-Modifiedvaluehas been providedof Age: header received by theorigin server, SHOULD use that value in non-subrange cache-conditional requests (using If-Modified-Since). . If only a Last-Modified value has been provided by an HTTP/1.0 origin server, MAY use thatcache with * this response. * date_value * is the valuein subrange cache-conditional requests (using If-Unmodified-Since:). The user agent should provide a way to disable this, in caseofdifficulty. . If both an entity tag and a Last-Modified value have been provided bythe originserver, SHOULD use both validators in cache- conditional requests. This allows both HTTP/1.0 and HTTP/1.1 caches to respond appropriately. An HTTP/1.1 cache, upon receiving a request, MUST useserver's Date: header * request_time * is themost restrictive validator(local) time whendeciding whethertheclient'scacheentry matchesmade thecache's own cache entry. Thisrequest * that resulted in this cached response * response_time * isonly an issuethe (local) time when therequest contains both an entity tag and a last-modified-date validator (If-Modified-Since or If-Unmodified-Since). A note on rationale: The general principle behind these rulescache received the * response * now * is the current (local) time */ apparent_age = max(0, response_time - date_value); corrected_received_age = max(apparent_age, age_value); response_delay = response_time - request_time; corrected_initial_age = corrected_received_age + response_delay; resident_time = now - response_time; current_age = corrected_initial_age + resident_time; When a cache sends a response, it must add to the corrected_initial_age the amount of time thatHTTP/1.1 servers and clients shouldthe response was resident locally. It must then transmitas much non- redundant information asthis total age, using the Age header, to the next recipient cache. Note that a client cannot reliably tell that a response isavailablefirst- hand, but the presence of an Age header indicates that a response is definitely not first-hand. Also, if the Date intheir responses and requests. HTTP/1.1 systems receiving this information will makea response is earlier than themost conservative assumptions aboutclient's local request time, thevalidators they receive. HTTP/1.0 clients and caches will ignore entity tags. Generally, last-modified values received or used by these systems will support transparent and efficient caching, and so HTTP/1.1 origin servers should provide Last-Modified values. In those rare cases whereresponse is probably not first-hand (in the absence of serious clock skew). Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 72] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996use of a Last-Modified value as a validator by an HTTP/1.0 system could result in13.2.4 Expiration Calculations In order to decide whether aserious problem, then HTTP/1.1 origin servers should not provide one. 16.3.5 Non-validating Conditionalsresponse is fresh or stale, we need to compare its freshness lifetime to its age. Theprinciple behind entity tagsage isthat onlycalculated as described in section 13.2.3; this section describes how to calculate the freshness lifetime, and to determine if a response has expired. In theservice author knowsdiscussion below, thesemanticsvalues can be represented in any form appropriate for arithmetic operations. We use the term "expires_value" to denote the value ofa resource well enoughthe Expires header. We use the term "max_age_value" toselectdenote an appropriatecache validation mechanism, and the specification of any validator comparison function more complex than byte-equality would open up a canvalue ofworms. Thus, comparisonsthe number ofany other headers (except Last-Modified, for compatibility with HTTP/1.0) are never used for purposesseconds carried by the max-age directive ofvalidatingthe Cache- Control header in acache entry. 16.4 Constructing Responses From Cachesresponse (see section 14.10. Thepurpose of an HTTP cachemax-age directive takes priority over Expires, so if max-age isto store information received in response to requests, for usepresent inresponding to future requests. In many cases,acache simply returnsresponse, theappropriate partscalculation is simply: freshness_lifetime = max_age_value Otherwise, if Expires is present in the response, the calculation is: freshness_lifetime = expires_value - date_value Note that neither ofa responsethese calculations is vulnerable to clock skew, since all of therequester. However, ifinformation comes from the origin server. If neither Expires nor Cache-Control: max-age appears in the response, and the response does not include other restrictions on caching, the cacheholdsMAY compute acache entry based onfreshness lifetime using aprevious response, it may haveheuristic. If the value is greater than 24 hours, the cache must attach Warning 13 tocombine parts of a newany responsewith whatwhose age isheld inmore than 24 hours if such warning has not already been added. Also, if thecache entry. 16.4.1 End-to-end and Hop-by-hop Headers Forresponse does have a Last-Modified time, thepurposeheuristic expiration value SHOULD be no more than some fraction ofdefiningthebehaviorinterval since that time. A typical setting ofcaches and non-caching proxies, we divide HTTP headers into two categories: . End-to-end headers, which mustthis fraction might betransmitted10%. The calculation tothe ultimate recipient of a request or response. End-to-end headers in responses must be stored as part ofdetermine if acache entry and transmitted in anyresponseformed from a cache entry. . Hop-by-hop headers, whichhas expired is quite simple: response_is_fresh = (freshness_lifetime > current_age) 13.2.5 Disambiguating Expiration Values Because expiration values aremeaningful onlyassigned optimistically, it is possible fora single transport-level connection, and are not stored bytwo cachesor forwarded by proxies. The following HTTP/1.1 headers are hop-by-hop headers: . Connection . Keep-Alive . Upgrade . Public . Proxy-Authenticate . Transfer-Encoding All other headers defined by HTTP/1.1to contain fresh values for the same resource that areend-to-end headers. Hop-by-hop headers introduced in future versions of HTTP MUST be listed indifferent. If aConnection header, as describedclient performing a retrieval receives a non-first-hand response for a request that was already fresh insection 18.11. 16.4.2 Non-modifiable Headers Some features of the HTTP/1.1 protocol, such as Digest Authentication, depend on the value of certain end-to-end headers. A cache or non- caching proxy SHOULD NOT modify an end-to-end header unlessits own cache, and thedefinition of thatDate headerrequires or specifically allows that.in its existing cache entry is newer than the Date on the new Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 73] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996Aresponse, then the client MAY ignore the response. If so, it MAY retry the request with a "Cache-Control: max-age=0" directive (see section 14.9), to force a check with the origin server. If a cacheor non-caching proxyhas two fresh responses for the same representation with different validators, it MUSTNOT modify any ofuse thefollowing fields inone with the more recent Date header. This situation may arise because the cache is pooling responses from other caches, or because arequestclient has asked for a reload orresponse, nora revalidation of an apparently fresh cache entry. 13.2.6 Disambiguating Multiple Responses Because a client mayit add anybe receiving responses via multiple paths, so that some responses flow through one set ofthese fields if not already present: . Content-Type . Content-Encoding . Content-Length . Expires . Last-Modified . Content-Range . Content-Location Warning: unnecessary modificationcaches and other responses flow through a different set ofend-to-end headerscaches, a client maycause authentication failuresreceive responses in an order different from that in which the origin server sent them. We would like the client to use the most recently generated response, even ifstronger authentication mechanismsolder responses areintroduced instill apparently fresh. Neither the entity tag nor the expiration value can impose an ordering on responses, since it is possible that a laterversionsresponse intentionally carries an earlier expiration time. However, the HTTP/1.1 specification requires the transmission ofHTTP. Such authentication mechanisms may relyDate headers on every response, and the Date values are ordered to a granularity ofheader fields not listed here. 16.4.3 Combining Headersone second. When acache makes a validating requestclient tries to revalidate aserver,cache entry, and theserver provides a 304 Not Modified response, the cache must construct aresponse it receives contains a Date header that appears tosend tobe older than therequesting client. The cache usesone for theentity- body stored inexisting entry, then thecache entry asclient SHOULD repeat theentity-body of this outgoing response. It usesrequest unconditionally, and include Cache-Control: max-age=0 to force any intermediate caches to validate their copies directly with theend-to-end headersorigin server, or Cache-Control: no-cache to force any intermediate caches to obtain a new copy from theincoming response, not fromorigin server. If thecache entry. UnlessDate values are equal, then the client may use either response (or may, if itdecidesis being extremely prudent, request a new response). Servers MUST NOT depend on clients being able toremovechoose deterministically between responses generated during the same second, if their expiration times overlap. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 74] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 13.3 Validation Model When a cacheentry,has a stale entry that itmust also replace the end-to-end headers storedwould like to use as a response to a client's request, it first has to check with the origin server (or possibly an intermediate cacheentrywiththose received ina fresh response) to see if its cached entry is still usable. We call this "validating" theincoming response. In other words,cache entry. Since we do not want to have to pay thecomplete setoverhead ofend-to-end headers received inretransmitting theincomingfull responseoverrides all end-to-end headers stored withif thecache entry. The cache may add Warning headers (see section 18.48)cached entry is good, and we do not want tothis set. A cache MUST preservepay theorderoverhead ofall headers as received in an incoming response. These rule allowsanorigin server to completely controlextra round trip if theresponse seen bycached entry is invalid, theclientHTTP/1.1 protocol supports the use of conditional methods. The key protocol features for supporting conditional methods are those concerned with "cache validators." When an origin server generates acache whenfull response, it attaches some sort of validator to it, which is kept with the cacherevalidates an entry, and may be necessary for preserving semantic transparency or for certain kinds of security mechanismsentry. When a client (end-user orfuture extensions. 16.4.4 Combining Byte Ranges A response may transfer onlycache) makes asubrange of the bytes of an entity, either because theconditional requestincluded one or more Range specifications, or becausefor aconnection was broken prematurely. After several such transfers,resource for which it has a cachemay have received several ranges ofentry, it includes thesame entity. If a cache has a stored non-empty set of subranges for an entity, and an incoming response transfers another subrange,associated validator in thecache MAY combinerequest. The server then checks that validator against thenew subrange withcurrent validator for theexisting setentity, and, ifboth the following conditions are met: Fielding, Frystyk, Berners-Lee, Gettys,they match, it responds with a special status code (usually, 304 (Not Modified)) andMogul [Page 74] INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996 . Bothno entity-body. Otherwise, it returns a full response (including entity-body). Thus, we avoid transmitting theincomingfull response if the validator matches, and we avoid an extra round trip if it does not match. Note: thecache entry must have a cache validator. . The two cachecomparison functions used to decide if validatorsmustmatchusing the strong comparison function (seeare defined in section16.3.3). If either requirement is not meant,13.3.3. In HTTP/1.1, a conditional request looks exactly thecache must use onlysame as a normal request for themost recent partial response (based onsame resource, except that it carries a special header (which includes theDate values transmitted with every response, and usingvalidator) that implicitly turns theincoming responsemethod (usually, GET) into a conditional. The protocol includes both positive and negative senses of cache- validating conditions. That is, it is possible to request either that a method be performed ifthese values are equal or missing),andmust discard the other partial information. 16.5 Cachingonly if a validator matches or if andGeneric Resources Generic resources interacts with caching in several ways: . A generic resource (one subject to content negotiation)only if no validators match. Note: a response that lacks a validator may still bebound to more than one entity. Each of these entitiescached, and served from cache until it expires, unless this iscalledexplicitly prohibited by a Cache-Control directive. However, a"variant" of the resource. . The request-URI may be only one part of thecachekey. 16.5.1 Vary Header Use Origin servers may respond to requests for generic resources use the Vary header (see section 18.46 forcannot do afull description) to informconditional retrieval if it does not have a validator for thecacheentity, whichheader fields of the request weremeans it will not be refreshable after it expires. 13.3.1 Last-modified Dates The Last-Modified entity-header field value is often usedto select the variant returned in the response. Aas a cachecan use that response to reply tovalidator. In simple terms, asubsequent request onlycache entry is considered to be valid if thetwo requestsentity has notonly specify the same URI, but also have the same value for all headers specified inbeen modified since theVary response-header.Last-Modified value. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 75] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 13.3.2 Entity Tag Cache Validators TheVary header may also inform theETag entity-header field value, an entity tag, provides for an "opaque" cachethatvalidator. This may allow more reliable validation in situations where it is inconvenient to store modification dates, where thevariant was selected using criteriaone-second resolution of HTTP date values is notlimitedsufficient, or where the origin server wishes to avoid certain paradoxes that may arise from therequest headers;use of modification dates. Entity Tags are described inthis case, the response MUST NOT besection 3.11. The headers used with entity tags are described ina replysections 14.20, 14.25, 14.26 and 14.43. 13.3.3 Weak and Strong Validators Since both origin servers and caches will compare two validators toa subsequent request exceptdecide if they represent thecache relays the new request tosame or different entities, one normally would expect that if theorigin serverentity (the entity-body or any entity-headers) changes ina conditional request, andany way, then theoriginassociated validator would change as well. If this is true, then we call this validator a "strong validator." However, there may be cases when a serverresponds with 304 (Not Modified)prefers to change the validator only on semantically significant changes, andincludesnot when insignificant aspects of thesame variant-ID (see 13.8.3). 16.5.2 Alternates Header Use The Alternates headerentity change. A validator that does not always change when the resource changes ispresent ina "weak validator." Entity tags are normally "strong validators," but theHTTP/1.1protocol provides a mechanism toenable cachingtag an entity tag as "weak." One can think ofentities from the planned content negotiation facilities. Ifacache receivesstrong validator as one that changes whenever the bits of anAlternates header inentity changes, while aresponse fromweak value changes whenever theorigin server (and implement these planned facilities), it should actmeaning of an entity changes. Alternatively, one can think of a strong validator as part of an identifier for a specific entity, while a weak validator is part of an identifier for a set of semantically equivalent entities. Note: One example of a strong validator is an integer that is incremented in stable storage every time an entity is changed. An entity's modification time, if represented with one-second resolution, could be a weak validator, since it is possible that theresponse carriedresource may be modified twice during a"Vary:{accept-headers}" header. This meanssingle second. Support for weak validators is optional; however, weak validators allow for more efficient caching of equivalent objects; for example, a hit counter on a site is probably good enough if it is updated every few days or weeks, and any value during thatthe response may be returned in replyperiod is likely "good enough" to be equivalent. A "use" of asubsequent request with Accept-* headers identical to those in the current request. 16.5.3 Variant-ID Use If an origin server chooses to use the variant-ID mechanism, it assignsvalidator is either when avariant-ID (see section 7.12) to each distinct resource entity (variant). This assignment can only be made by the origin server. It then returns the appropriate variant-ID with each response that applies toclient generates aspecific resource entity (variant), usingrequest and includes theETagvalidator in a validating header(see Error! Reference source not found.).field, or when a server compares two validators. Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page75]76] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 1996When sending an entity derived from a particular variantStrong validators are usable ina response, an origin server SHOULD include a variant-ID identifying the variantany context. Weak validators are only usable inthe ETag header (see section Error! Reference sourcecontexts that do notfound.). This variant-ID can be used for cache replacement and in conditional requestsdepend onthe generic resource. Whenexact equality of an entity. For example, either kind is usable for acache receivesconditional GET of asuccessful response withfull entity. However, only avariant-ID, it SHOULD use this information to replace any existing cache entriesstrong validator is usable forthe same variant of the corresponding URI. That is, it formsacache key using the URI ofsub-range retrieval, since otherwise therequest andclient may end up with an internally inconsistent entity. The only function that thevariant-ID ofHTTP/1.1 protocol defines on validators is comparison. There are two validator comparison functions, depending on whether theresponse. If this key matchescomparison context allows thekeyuse ofan existing cache entry, it SHOULD replace the existing entry with the new response (subjectweak validators or not: . The strong comparison function: in order toallbe considered equal, both validators must be identical in every way, and neither may be weak. . The weak comparison function: in order to be considered equal, both validators must be identical in every way, but either or both of them may be tagged as "weak" without affecting the result. The weak comparison function MAY be used for simple (non-subrange) GET requests. The strong comparison function MUST be used in all otherrules on caching). See section Error! Reference source not found.cases. An entity tag is strong unless it is explicitly tagged as weak. Section 14.20 gives the syntax formore details on update. When a cache performsentity tags. A Last-Modified time, when used as aconditional request onvalidator in ageneric resource, andrequest, is implicitly weak unless ithas one or more cache entries for the resourceis possible to deduce thatinclude variant- IDs,it is strong, using thecache MUST transmitfollowing rules: . The validator is being compared by an origin server to the(cache-validator, variant-ID) tuples inactual current validator for theconditional request, usingentity and, . That origin server reliably knows that thevariant-set mechanism (see section 7.13). This tellsassociated entity did not change twice during theserver which variants are currently insecond covered by therequester's cache.presented validator. or . Theclient MAY choose to transmit only a subset of the (cache- validator, variant-ID) tuples correspondingvalidator is about toits cache entries for this resource. Whenbe used by aserver receivesclient in an If-Modified- Since or If-Unmodified-Since header, because the client has aconditional request thatcache entry for the associated entity, and . That cache entry includes avariant- set, andDate value, which gives the time when the origin server sent the original response, and . The presented Last-Modified time isable to reply with an appropriate variant (either because it isat least 60 seconds before theorigin server,Date value. orbecause it. The validator is being compared by an intermediate cachethat can properly implementto thevariant selection algorithm), once it has selectedvalidator stored in its cache entry for thevariant it should examineentity, and . That cache entry includes a Date value, which gives theelements oftime when thesupplied variant-set. If one of these matchesorigin server sent thevariant-ID oforiginal response, and . The presented Last-Modified time is at least 60 seconds before theselected variant,Date value. Fielding, Frystyk, Berners-Lee, Gettys, andifMogul [Page 77] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 This method relies on thecache validators match,fact that if two different responses were sent by the origin serverSHOULD reply with a 304 (Not Modified) response, includingduring the same second, but both had thevariant-IDsame Last- Modified time, then at least one of those responses would have a Date value equal to its Last-Modified time. The arbitrary 60-second limit guards against theselected variant. Otherwise,possibility that theserver should reply as ifDate and Last-Modified values are generated from different clocks, or at somewhat different times during therequest were unconditional. The serverpreparation of the response. An implementation mayoptionallyusethe variant-set information in its selection algorithm. For example,a value larger than 60 seconds, ifthe selection algorithm yields several variants with equal preference,it is believed that 60 seconds is too short. If a client wishes to perform a sub-range retrieval on a value for which it has only a Last-Modified time andone of theseno opaque validator, it may do this only if the Last-Modified time isalreadystrong in therequester's cache, thesense described here. A cache or origin servercould select that variant and avoid an extra data transfer. This isreceiving aperformance optimization; otherwise,cache-conditional request, other than a full-body GET request, MUST use thevariant-selection mechanism is orthogonalstrong comparison function to evaluate thevariant-ID mechanism. 16.6 Sharedcondition. These rules allow HTTP/1.1 caches andNon-Shared Caches For reasonsclients to safely perform sub- range retrievals on values that have been obtained from HTTP/1.0 servers. 13.3.4 Rules for When to Use Entity Tags and Last-modified Dates We adopt a set ofsecurityrules andprivacy,recommendations for origin servers, clients, and caches regarding when various validator types should be used, and for what purposes. HTTP/1.1 origin servers: . SHOULD send a entity tag validator unless it isnecessarynot feasible tomakegenerate one. . MAY send adistinction between "shared" and "non-shared" caches. A non-shared cacheweak entity tag instead of a strong entity tag, if performance considerations support the use of weak entity tags, or if it isoneunfeasible to send a strong entity tag . . SHOULD send a Last-Modified value if it is feasible to send one, unless the risk of a breakdown in semantic transparency that could result from using this date in an If-Modified-Since header would lead to serious problems. In other words, the preferred behavior for an HTTP/1.1 origin server isaccessible onlyto send both asingle user. Accessibility in this case SHOULD be enforced by appropriate security mechanisms. All other caches are consideredstrong entity tag and a Last-Modified value. In order to be"shared." Other sections of this specification place certain constraints onlegal, a strong entity tag MUST change whenever theoperation of shared cachesassociated entity value changes in any way. A weak entity tag SHOULD change whenever the associated entity changes in a semantically significant way. Note: in order toprevent loss of privacyprovide semantically transparent caching, an origin server must avoid reusing a specific strong entity tag value for two different entities, orfailure of access controlsreusing a specific weak entity tag Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page76]78] INTERNET-DRAFT HTTP/1.1Friday, MayMonday, June 03, 199616.7 Selecting a Cached Response Whenvalue for two semantically different entities. Cache entries may persist for arbitrarily long periods, regardless of expiration times, so it may be inappropriate to expect that a cachereceives a request it trieswill never again attempt tosee if it hasvalidate an entry using acached response appropriate forvalidator thatrequest, usingit obtained at some point in thematching rulespast. HTTP/1.1 clients: . If an entity tag has been provided by the origin server, MUST use that entity tag inthis section.any cache-conditional request (using If-Match or If-None-Match). . Ifsuchonly aresponse exists, thenLast-Modified value has been provided by thecache can decide if it is fresh enoughorigin server, SHOULD use that value in non-subrange cache-conditional requests (usingthe expiration modelIf-Modified-Since). . If only a Last-Modified value has been provided by an HTTP/1.0 origin server, MAY use that value insection 16.1.2 and the freshness requirements of client and origin-server expressedsubrange cache-conditional requests (using If-Unmodified-Since:). The user agent should provide a way to disable this, inthe Cache-Control headerscase ofthe requestdifficulty. . If both an entity tag andcached response) to returna Last-Modified value have been provided by the origin server, SHOULD use both validators inreplycache- conditional requests. This allows both HTTP/1.0 and HTTP/1.1 caches tothe request. If onrespond appropriately. An HTTP/1.1 cache, upon receiving acache lookup there are two or more fresh entries that appear to match therequest,then the one with the most recent Date valueMUSTbe used. 16.7.1 Plain Resources If the cached response was for a plain resource (that is, the response includes no Vary or Alternates headers), it matches ifuse theRequest-URI ofmost restrictive validator when deciding whether therequestclient's cache entry matches theRequest-URI of the ofcache's own cache entry. This is only an issue when the request contains both an entity tag and a last-modified-date validator (If-Modified-Since or If-Unmodified-Since). A note on rationale: The general principle behind these rules is thatcaused the cached response to be stored. Request-URIs match ifHTTP/1.1 servers and clients should transmit as much non- redundant information as is available in theircanonical forms (see section 7.2.3) are equal. 16.7.2 Generic Resources Ifresponses and requests. HTTP/1.1 systems receiving this information will make thecached response was for a generic resource (that is,most conservative assumptions about theresponse includes Vary,validators they receive. HTTP/1.0 clients and caches will ignore entity tags. Generally, last-modified values received orAlternates headers), it matches ifused by these systems will support transparent and efficient caching, and so HTTP/1.1 origin servers should provide Last-Modified values. In those rare cases where theRequest-URIuse of a Last-Modified value as a validator by an HTTP/1.0 system could result in a serious problem, then HTTP/1.1 origin servers should not provide one. 13.3.5 Non-validating Conditionals The principle behind entity tags is that only therequest matchesservice author knows theRequest-URIsemantics ofthe request that caused the cached responsea resource well enough tobe stored,select an appropriate cache validation mechanism, and theselecting request header field valuesspecification ofthe request match thoseany validator comparison function more complex than byte-equality would open up a can ofthe request that caused the cached response to be stored. (See section 18.46 on Vary, which defines the canonical form for selecting requestworms. Thus, comparisons of any other headersand the matching rules for them.) If the response contains "Vary: {other}", then the selecting request header field values(except Last-Modified, forits requestFielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 79] INTERNET-DRAFT HTTP/1.1 Monday, June 03, 1996 compatibility with HTTP/1.0) aredefined asnevermatching a setused for purposes ofrequest headers. 16.8 Errors or Incomplete Response Cache Behavior Avalidating a cachethat receivesentry. 13.4 Constructing Responses From Caches The purpose of anincompleteHTTP cache is to store information received in response(for example, with fewer bytes of data than specifiedto requests, for use in responding to future requests. In many cases, aContent-length: header) may store the response. However, thecacheMUST treat this as a partial response. Partial responses may be combined as described in section 16.4.4;simply returns theresult might be a full response or might still be partial. A cache MUST NOT returnappropriate parts of apartialresponse toa client without explicitly marking it as such, usingthe206 (Partial Content) status code. Arequester. However, if the cacheMUST NOT returnholds apartial response usingcache entry based on astatus codeprevious response, it may have to combine parts of200 (OK). A cache that receivesa new response witha zero-length Entity-bodywhat is held in the cache entry. 13.4.1