HTTP/1.1 200 OK Date: Tue, 09 Apr 2002 02:41:29 GMT Server: Apache/1.3.20 (Unix) Last-Modified: Thu, 23 Nov 1995 23:00:00 GMT ETag: "2edab5-3762c-30b4fcf0" Accept-Ranges: bytes Content-Length: 226860 Connection: close Content-Type: text/plain HTTP Working Group R. Fielding, UC Irvine INTERNET-DRAFT H. Frystyk, MIT/LCS T. Berners-Lee, MIT/LCS Expires May 22, 1996 November 22, 1995 Hypertext Transfer Protocol -- HTTP/1.1 Status 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 obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress". 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 . Discussions of the working group are archived at . General discussions about HTTP and the applications which use HTTP should take place on the mailing list. Abstract 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 request methods (commands). A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred. HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as "HTTP/1.1". Table of Contents 1. Introduction 1.1 Purpose 1.2 Requirements 1.3 Terminology 1.4 Overall Operation 2. Notational Conventions and Generic Grammar 2.1 Augmented BNF 2.2 Basic Rules 3. Protocol Parameters 3.1 HTTP Version 3.2 Uniform Resource Identifiers 3.2.1 General Syntax 3.2.2 http URL 3.3 Date/Time Formats 3.3.1 Full Date 3.3.2 Delta Seconds 3.4 Character Sets 3.5 Content Codings 3.6 Transfer Codings 3.7 Media Types 3.7.1 Canonicalization and Text Defaults 3.7.2 Multipart Types 3.8 Product Tokens 3.9 Quality Values 3.10 Language Tags 3.11 Logic Bags 4. HTTP Message 4.1 Message Types 4.2 Message Headers 4.3 General Header Fields 5. Request 5.1 Request-Line 5.1.1 Method 5.1.2 Request-URI 5.2 Request Header Fields 6. Response 6.1 Status-Line 6.1.1 Status Code and Reason Phrase 6.2 Response Header Fields 7. Entity 7.1 Entity Header Fields 7.2 Entity Body 7.2.1 Type 7.2.2 Length 8. Method Definitions 8.1 OPTIONS 8.2 GET 8.3 HEAD 8.4 POST 8.5 PUT 8.6 PATCH 8.7 COPY 8.8 MOVE 8.9 DELETE 8.10 LINK 8.11 UNLINK 8.12 TRACE 8.13 WRAPPED 9. Status Code Definitions 9.1 Informational 1xx 9.2 Successful 2xx 9.3 Redirection 3xx 9.4 Client Error 4xx 9.5 Server Error 5xx 10. Header Field Definitions 10.1 Accept 10.2 Accept-Charset 10.3 Accept-Encoding 10.4 Accept-Language 10.5 Allow 10.6 Authorization 10.7 Base 10.8 Cache-Control 10.9 Connection 10.9.1 Persistent Connections 10.10 Content-Encoding 10.11 Content-Language 10.12 Content-Length 10.13 Content-MD5 10.14 Content-Range 10.15 Content-Type 10.16 Content-Version 10.17 Date 10.18 Derived-From 10.19 Expires 10.20 Forwarded 10.21 From 10.22 Host 10.23 If-Modified-Since 10.24 Keep-Alive 10.25 Last-Modified 10.26 Link 10.27 Location 10.28 MIME-Version 10.29 Pragma 10.30 Proxy-Authenticate 10.31 Proxy-Authorization 10.32 Public 10.33 Range 10.34 Referer 10.35 Refresh 10.36 Retry-After 10.37 Server 10.38 Title 10.39 Transfer Encoding 10.40 Unless 10.41 Upgrade 10.42 URI 10.43 User-Agent 10.44 WWW-Authenticate 11. Access Authentication 11.1 Basic Authentication Scheme 11.2 Digest Authentication Scheme 12. Content Negotiation 12.1 Preemptive Negotiation 13. Caching 14. Security Considerations 14.1 Authentication of Clients 14.2 Safe Methods 14.3 Abuse of Server Log Information 14.4 Transfer of Sensitive Information 15. Acknowledgments 16. References 17. Authors' Addresses Appendix A. Internet Media Type message/http Appendix B. Tolerant Applications Appendix C. Relationship to MIME C.1 Conversion to Canonical Form C.1.1 Representation of Line Breaks C.1.2 Default Character Set C.2 Conversion of Date Formats C.3 Introduction of Content-Encoding C.4 No Content-Transfer-Encoding C.5 Introduction of Transfer-Encoding Appendix D. Changes from HTTP/1.0 1. Introduction 1.1 Purpose The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. HTTP has been in use by the World-Wide Web global information initiative since 1990. The first version of HTTP, referred to as HTTP/0.9, was a simple protocol for raw data transfer across the Internet. HTTP/1.0, as defined by RFC xxxx [6], improved the protocol by allowing messages to be in the format of MIME-like entities, containing metainformation about the data transferred and modifiers on the request/response semantics. However, HTTP/1.0 does not sufficiently take into consideration the effect of hierarchical proxies and caching, the desire for persistent connections and virtual hosts, and a number of other details that slipped through the cracks of existing implementations. In addition, the proliferation of incompletely- implemented applications calling themselves "HTTP/1.0" has necessitated a protocol version change in order for two communicating applications to determine each other's true capabilities. This specification defines the protocol referred to as "HTTP/1.1". This protocol is backwards-compatible with HTTP/1.0, but includes more stringent requirements 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 to be used to indicate the purpose of a request. It builds on the discipline of reference provided by the Uniform Resource Identifier (URI) [3], as a location (URL) [4] or name (URN) [20], for indicating the resource on which a method is to be applied. Messages are passed in a format similar to that used by Internet Mail [9] and the Multipurpose Internet Mail Extensions (MIME) [7]. HTTP is also used as a generic protocol for communication between user agents and proxies/gateways to other Internet protocols, such as SMTP [16], NNTP [13], FTP [18], Gopher [2], and WAIS [10], allowing basic hypermedia access to resources available from diverse applications and simplifying the implementation of user agents. 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. 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. may 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 "conditionally compliant". 1.3 Terminology This specification uses a number of terms to refer to the roles played by participants in, and objects of, the HTTP communication. connection A transport layer virtual circuit established between two application programs for the purpose of communication. message The basic unit of HTTP communication, consisting of a structured sequence of octets matching the syntax defined in Section 4 and transmitted via the connection. request An HTTP request message (as defined in Section 5). response An HTTP response message (as defined in Section 6). resource A network data object or service which can be identified by a URI (Section 3.2). entity A particular representation or rendition of a data resource, or reply from a service resource, that may be enclosed within a request or response message. An entity consists of metainformation in the form of entity headers and content in the form of an entity body. client An application program that establishes connections for the purpose of sending requests. user agent The client which initiates a request. These are often browsers, editors, spiders (web-traversing robots), or other end user tools. server An application program that accepts connections in order to service requests by sending back responses. origin server The server on which a given resource resides or is to be created. proxy An intermediary program which acts as both a server and a client for the purpose of making requests on behalf of other clients. Requests are serviced internally or by passing them, with possible translation, on to other servers. A proxy must 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 by the user agent. 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 A tunnel is an intermediary program which is acting as a blind relay between two connections. Once active, a tunnel is not considered a party to the HTTP communication, though the tunnel may have been initiated by an HTTP request. The tunnel ceases to exist when both ends of the relayed connections are closed. 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 server may include a cache, though a cache cannot be used by a server while it is acting as a tunnel. Any given program may be capable of being both a client and a server; our use of these terms refers only to the role being performed by the program for a particular connection, rather than to the program's capabilities in general. Likewise, any server may act as an origin server, proxy, gateway, or tunnel, switching behavior based on the nature of each request. 1.4 Overall Operation The HTTP protocol is based on a request/response paradigm. A client establishes a connection with a server and 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. The server responds with a status line, including the message's protocol version and a success or error code, followed by a MIME-like message containing server information, entity metainformation, and possible body content. Most HTTP communication is initiated by a user agent and consists of a request to be applied to a resource on some origin server. In the simplest case, this may be accomplished via a single connection (v) between the user agent (UA) and the origin server (O). request chain ------------------------> UA -------------------v------------------- O <----------------------- response chain A more complicated situation occurs when one or more intermediaries are present in the request/response chain. There are three common forms of intermediary: proxy, gateway, and tunnel. A proxy is a forwarding agent, receiving requests for a URI in its absolute form, rewriting all or parts of the message, and forwarding the reformatted request toward the server identified by the URI. A gateway is a receiving agent, acting as a layer above some other server(s) and, if necessary, translating the requests to the underlying server's protocol. A tunnel acts as a relay point between two connections without changing the messages; tunnels are used when the communication needs to pass through an intermediary (such as a firewall) even when the intermediary cannot understand the contents of the messages. request chain --------------------------------------> UA -----v----- A -----v----- B -----v----- C -----v----- O <------------------------------------- response chain The figure above shows three intermediaries (A, B, and C) between the user agent and origin server. A request or response message that travels the whole chain must 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 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 Section 13. On the Internet, HTTP communication generally takes place over TCP/IP connections. The default port is TCP 80 [19], 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, and the mapping of the HTTP/1.1 request and response structures onto the transport data units of the protocol in question is outside the scope of this specification. For most implementations, each connection is established by the client prior to the request and closed by the server after sending the response. However, this is not a feature of the protocol and is not required by this specification. Both clients and servers must be capable of handling cases where either party closes the connection prematurely, due to user action, automated time-out, or program failure. In any case, the closing of the connection by either or both parties always terminates the current request, regardless of its status. 2. Notational Conventions and Generic Grammar 2.1 Augmented BNF All of the mechanisms specified in this document are described in both prose and an augmented Backus-Naur Form (BNF) similar to that used by RFC 822 [9]. Implementors will need to be familiar with the notation in order to understand this specification. The augmented BNF includes the following constructs: name = definition The name of a rule is simply the name itself (without any enclosing "<" and ">") and is separated from its definition by the equal character "=". 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 "*element" indicating at least and at most occurrences of element. Default values are 0 and infinity so that "*(element)" allows any number, including zero; "1*element" requires at least one; and "1*2element" allows one or two. [rule] Square brackets enclose optional elements; "[foo bar]" is equivalent to "*1(foo bar)". N rule Specific repetition: "(element)" is equivalent to "*(element)"; that is, exactly 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 "#element" indicating at least and at most 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 element must be present. Default values are 0 and infinity so that "#(element)" allows any number, including zero; "1#element" requires at least one; and "1#2element" allows one or two. ; comment A semi-colon, set off some distance to the right of rule text, starts a comment that continues to the end of line. This is a simple way of including useful notes in parallel with the specifications. implied *LWS The grammar described by this specification is word-based. Except where noted otherwise, linear 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) must 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. 2.2 Basic Rules The following rules are used throughout this specification to describe basic parsing constructs. The US-ASCII coded character set is defined by [21]. OCTET = CHAR = UPALPHA = LOALPHA = ALPHA = UPALPHA | LOALPHA DIGIT = CTL = CR = LF = SP = HT = <"> = HTTP/1.1 defines the octet sequence CR LF as the end-of-line marker for all protocol elements except the Entity-Body (see Appendix B for tolerant applications). The end-of-line marker within an Entity-Body is defined by its associated media type, as described in Section 3.7. CRLF = CR LF HTTP/1.1 headers can be folded onto multiple lines if the continuation line begins with a space or horizontal tab. All linear whitespace, 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 *TEXT may contain octets from character sets other than US-ASCII only when encoded according to the rules of RFC 1522 [14]. TEXT = 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-string token = 1* tspecials = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT 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 = A string of text is parsed as a single word if it is quoted using double-quote marks. quoted-string = ( <"> *(qdtext) <"> ) qdtext = 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 = "\" CHAR Braces are used to delimit an attribute-value bag, which may consist of a set, list, or recursively defined tokens and quoted strings. The bag semantics are defined by its context and the bag name, which may be a Uniform Resource Identifier (Section 3.2) in some fields. bag = "{" bagname 1*LWS *bagitem "}" bagname = token | URI bagitem = bag | token | quoted-string 3. Protocol Parameters 3.1 HTTP Version HTTP uses a "." 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 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 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 [6]. HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT Note that the major and minor numbers should be treated as separate integers and that each may 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 zeros should be ignored by recipients and never generated by senders. Applications sending Full-Request or Full-Response messages, as defined by this specification, must include an HTTP-Version of "HTTP/1.1". Use of this version number indicates that the sending application is at least conditionally compliant with this specification. HTTP/1.1 servers must: o recognize the format of the Request-Line for HTTP/0.9, 1.0, and 1.1 requests; o understand any valid request in the format of HTTP/0.9, 1.0, or 1.1; o respond appropriately with a message in the same major version used by the client. HTTP/1.1 clients must: o recognize the format of the Status-Line for HTTP/1.0 and 1.1 responses; o understand any valid response in the format of HTTP/0.9, 1.0, or 1.1. Proxy and gateway applications must be careful in forwarding requests that are received in a format different than that of the application's native HTTP version. 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 its native 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 the application's native format may be upgraded before being forwarded; the proxy/gateway's response to that request must follow the server requirements listed above. 3.2 Uniform Resource Identifiers URIs have been known by many names: WWW addresses, Universal Document Identifiers, Universal Resource Identifiers [3], and finally the combination of Uniform Resource Locators (URL) [4] and Names (URN) [20]. As far as HTTP is concerned, Uniform Resource Identifiers are simply formatted strings which identify--via name, location, or any other characteristic--a network resource. 3.2.1 General Syntax URIs in HTTP can be represented in absolute form or relative to some known base URI [11], 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 ] path = fsegment *( "/" segment ) fsegment = 1*pchar segment = *pchar params = param *( ";" param ) param = *( pchar | "/" ) scheme = 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 = 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. 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 ] host = port = *DIGIT If 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. If the abs_path is not present in the URL, it must be given as "/" when used as a Request-URI for a resource (Section 5.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 "/". 3.3 Date/Time Formats 3.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 [8] (an update to RFC 822 [9]). The second format is in common use, but is based on the obsolete RFC 850 [12] date format and lacks a four-digit year. HTTP/1.1 clients and servers that parse the date value must accept all three formats, though they must only generate the RFC 1123 format for representing date/time stamps in HTTP message fields. Note: Recipients of date values are encouraged to be robust in accepting date values that may have been generated 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 in Universal Time (UT), also known as Greenwich 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, and should 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. 3.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*DIGIT 3.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. HTTP character sets are identified by case-insensitive tokens. The complete set of tokens are defined by the IANA Character Set registry [19]. 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 [7] -- the US-ASCII [21] and ISO-8859 [22] character sets -- and other names specifically recommended for use within MIME charset parameters. 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 [19] must represent the character set defined by that registry. Applications should limit their use of character sets to those defined by the IANA registry. 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. 3.5 Content Codings Content coding values are used to indicate an encoding transformation that has been or can be applied to a resource. Content codings are primarily used to allow a document to be compressed or encrypted without losing the identity of its underlying media type. Typically, the resource is stored in this encoding and only decoded before rendering or analogous usage. content-coding = "gzip" | "compress" | token Note: 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 (Section 10.3) and Content-Encoding (Section 10.10) 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 that a single program may be capable of decoding multiple content-coding formats. Two values are defined by this specification: gzip An encoding format produced by the file compression program "gzip" (GNU zip) developed by Jean-loup Gailly. This format is typically a Lempel-Ziv coding (LZ77) with a 32 bit CRC. Gzip is available from the GNU project at . compress The encoding format produced by the file compression program "compress". This format is an adaptive Lempel-Ziv-Welch coding (LZW). Note: 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. 3.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 an Entity-Body in order to ensure safe transport through the network. This differs from a content coding in that the transfer coding is a property of the message, not of the original resource. transfer-coding = "chunked" | token All transfer-coding values are case-insensitive. HTTP/1.1 uses transfer coding values in the Transfer-Encoding header field (Section 10.39). Transfer codings are analogous to the Content-Transfer-Encoding values of MIME [7], which were designed to enable safe transport of binary data over a 7-bit transport service. However, "safe transport" has a different focus for an 8bit-clean transfer protocol. In HTTP, the only unsafe characteristic of message bodies is the difficulty in determining the exact body length (Section 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. 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. Chunked-Body = *chunk "0" CRLF footer CRLF chunk = chunk-size CRLF chunk-data CRLF chunk-size = hex-no-zero *HEX chunk-data = chunk-size(OCTET) footer = * hex-no-zero = Note that the chunks are ended by a zero-sized chunk, followed by the footer and terminated by an empty line. An example process for decoding a Chunked-Body is presented in Appendix C.5. 3.7 Media Types HTTP uses Internet Media Types [17] in the Content-Type (Section 10.15) and Accept (Section 10.1) header fields in order to provide open and extensible data typing and type negotiation. For mail applications, where there is no type negotiation between sender and recipient, it is reasonable to put strict limits on the set of allowed media types. With HTTP, where the sender and recipient can communicate directly, applications are allowed more freedom in the use of non-registered types. The following grammar for media types is a superset of that for MIME because it does not restrict itself to the official IANA and x-token types. 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. LWS should not be generated between the type and subtype, nor between an attribute and its value. If a given media-type value has been registered by the IANA, any use of that value must be indicative of the registered data format. Although HTTP allows the use of non-registered media types, such usage must not conflict with the IANA registry. Data providers are strongly encouraged to register their media types with IANA via the procedures outlined in RFC 1590 [17]. All media-type's registered by IANA must be preferred over extension tokens. However, HTTP does not limit applications to the use of officially registered media types, nor does it encourage the use of an "x-" prefix for unofficial types outside of explicitly short experimental use between consenting applications. 3.7.1 Canonicalization and Text Defaults Media types are registered in a canonical form. In general, entity bodies transferred via HTTP must be represented in the appropriate canonical form prior to transmission. If the body has been encoded via a Content-Encoding and/or Transfer-Encoding, the data must be in canonical form prior to that encoding. However, HTTP modifies the canonical form requirements for media of primary type "text" and for "application" types consisting of text-like records. HTTP redefines the canonical form of text media to allow multiple octet sequences to indicate a text line break. In addition to the preferred form of CRLF, HTTP applications must accept a bare CR or LF alone as representing a single line break in text media. Furthermore, if the text media is represented in a character set which 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 sequence(s) is defined by that character set to represent the equivalent of CRLF, bare CR, and bare LF. It is assumed that any recipient capable of using such a character set will know the appropriate octet sequence for representing line breaks within that character set. Note: This interpretation of line breaks applies only to the contents of an Entity-Body and only after any Transfer-Encoding and/or Content-Encoding has been removed. All other HTTP constructs use CRLF exclusively to indicate a line break. Content and transfer codings define their own line break requirements. A recipient of an HTTP text entity should translate the received entity line breaks to the local line break conventions before saving the entity external to the application and its cache; whether this translation takes place immediately upon receipt of the entity, or only when prompted by the user, is entirely up to the individual application. HTTP also redefines the default character set for text media in an entity body. If a textual media type defines a charset parameter with a registered default value of "US-ASCII", HTTP changes the default to be "ISO-8859-1". Since the ISO-8859-1 [22] character set is a superset of US-ASCII [21], this does not affect the interpretation of entity bodies which only contain octets within the US-ASCII character set (0 - 127). The presence of a charset parameter value in a Content-Type header field overrides the default. It is recommended that the character set of an entity body be labelled as the lowest common denominator of the character codes used within a document, with the exception that no label is preferred over the labels US-ASCII or ISO-8859-1. 3.7.2 Multipart Types MIME provides for a number of "multipart" types -- encapsulations of one or more entities within a single message's Entity-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 MIME, the epilogue of any multipart message must be empty; HTTP applications must not transmit the epilogue even if the original resource contains an epilogue. In HTTP, multipart body-parts may contain header fields which are significant to the meaning of that part. A URI entity-header field (Section 10.42) should be included in the body-part for each enclosed entity that can be identified by a URI. 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. The following subtypes have been defined: multipart/mixed The mixed subtype is used when there are no additional semantics implied beyond the fact that one or more entities are encaspsulated. HTTP servers should not use this type to send groups of entities if it is possible for those entities to be individually retrieved and cached. multipart/alternative The alternative subtype implies that each of the parts is an alternative format for the same information; the user agent should present only the part most preferred by the user. HTTP servers should use some form of content negotiation (Section 12) instead of this type. multipart/digest The digest subtype implies that each of the parts is a message (normally of type "message/rfc822") and thus the whole entity is a collected sequence of message traffic. This type does not have any special significance for HTTP. multipart/form-data The form-data subtype is defined by RFC 1867 [15] for use in submitting the data that comes about from filling-in a form. multipart/parallel The parallel subtype implies that the parts should be presented simultaneously by the user agent. This media type would be appropriate for situations where simultaneous presentation is an important aspect of the information, such as for audio-annotated slides. Note: This document does not define what is meant by "simultaneous presentation". That is, HTTP does not provide any means of synchronization between the parts in messages of type "multipart/parallel". Other multipart subtypes may be registered by IANA [19] according to the procedures defined in RFC 1590 [17]. If an application receives an unrecognized multipart subtype, the application must treat it as being equivalent to "multipart/mixed". 3.8 Product Tokens Product tokens are used to allow communicating applications to identify themselves via a simple product token, with an optional slash and version designator. Most fields using product tokens also allow subproducts 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 advertizing 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). 3.9 Quality Values HTTP content negotiation (Section 12) uses short "floating point" numbers to indicate the relative importance ("weight") of various negotiable parameters. The weights are 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 ] ) | ( "." 0*3DIGIT ) | ( "1" [ "." 0*3("0") ] ) "Quality values" is a slight misnomer, since these values actually measure relative degradation in perceived quality. Thus, a value of "0.8" represents a 20% degradation from the optimum rather than a statement of 80% quality. 3.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 the Accept-Language, Content-Language, and URI-header fields. 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 namespace 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. In the context of the Accept-Language header (Section 10.4), a language tag is not to be interpreted as a single token, as per RFC 1766, but as a hierarchy. A server should consider that it has a match when a language tag received in an Accept-Language header matches the initial portion of the language tag of a document. An exact match should be preferred. This interpretation allows a browser to send, for example: Accept-Language: en-US, en; ql=0.95 when the intent is to access, in order of preference, documents in US-English ("en-US"), 'plain' or 'international' English ("en"), and any other variant of English (initial "en-"). Note: Using the language tag as a hierarchy does not imply that all languages with a common prefix will be understood by those fluent in one or more of those languages; it simply allows the user to request this commonality when it is true for that user. 3.11 Logic Bags A logic bag is a binary logic expression tree represented in prefix notation using the generic bag syntax. Logic bags are used by HTTP in the Unless (Section 10.40) header field as expressions to be tested against the requested resource's header field metainformation. logic-bag = "{" expression "}" expression = ( log-op 1*logic-bag ) | ( rel-op 1*field-tuple ) | ( "def" 1*field-name ) log-op = "and" | "or" | "xor" | "not" rel-op = "eq" | "ne" | "lt" | "le" | "ge" | "gt" | "in" field-tuple = "{" field-name ( bag | token | quoted-string ) "}" The recursive structure of a logic bag allows a complex expression tree to be formed by joining together subexpressions with logical operators. Expressions with relational operators are used to compare the requested resource's corresponding metainformation (header field values) to those inside the expression field-tuples. For example, {or {ne {Content-MD5 "Q2hlY2sgSW50ZWdyaXR5IQ=="}} {ne {Content-Length 10036}} {ne {Content-Version "12.4.8"}} {gt {Last-Modified "Mon, 04 Dec 1995 01:23:45 GMT"}}} The expression is evaluated recursively by depth-first traversal and bottom-up evaluation of the subexpressions until a true or false value can be determined. Multiple operands to an operator imply a conjunctive ("and") expression; e.g., {eq {A "a"} {B "b"} {C "c"}} is equivalent to {and {eq {A "a"}} {eq {B "b"}} {eq {C "c"}}} Each expression is evaluated as defined by the operator: and True if all of the operands evaluate true. or True if any of the operands evaluate true. xor True if one and only one operand evaluates true. not True if all of the operands evaluate false. eq True if all field-tuple values exactly match the resource's corresponding field values. ne True if all field-tuple values do not match the resource's corresponding field values. lt True if, for each field-tuple, the resource's corresponding field value is less than the one given in the expression. le True if, for each field-tuple, the resource's corresponding field value is less than or equal to the one given in the expression. ge True if, for each field-tuple, the resource's corresponding field value is greater than or equal to the one given in the expression. gt True if, for each field-tuple, the resource's corresponding field value is greater than the one given in the expression. in True if, for each field-tuple, the resource's corresponding field value contains the component value given in the expression. def True if, for each field-name operand, the resource defines a value for that field. A field-tuple consists of a field-name (assumed to be an HTTP header field name, though not constrained to those defined by this specification) and the field-value component which is to be compared against the resource's field value. The actual method of comparison (e.g., byte equivalence, substring matching, numeric order, substructure containment, etc.) is defined by the logical definition of the operator and the type of field-value allowed for that field-name. Server implementors must use an appropriate comparison function for each type of field-value given in this specification. The default functions for unrecognized fields are numeric comparison (for values consisting of 1*DIGIT) and lexical comparison (for all others). Except for "ne", any comparison to a field not defined by the resource evaluates to false. 4. HTTP Message 4.1 Message Types HTTP messages consist of requests from client to server and responses from server to client. HTTP-message = Simple-Request ; HTTP/0.9 messages | Simple-Response | Full-Request ; HTTP/1.1 messages | Full-Response Full-Request and Full-Response use the generic message format of RFC 822 [9] 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., a line with nothing preceding the CRLF). Full-Request = Request-Line ; Section 5.1 *( General-Header ; Section 4.3 | Request-Header ; Section 5.2 | Entity-Header ) ; Section 7.1 CRLF [ Entity-Body ] ; Section 7.2 Full-Response = Status-Line ; Section 6.1 *( General-Header ; Section 4.3 | Response-Header ; Section 6.2 | Entity-Header ) ; Section 7.1 CRLF [ Entity-Body ] ; Section 7.2 Simple-Request and Simple-Response do not allow the use of any header information and are limited to a single request method (GET). Simple-Request = "GET" SP Request-URI CRLF Simple-Response = [ Entity-Body ] Use of the Simple-Request format is discouraged because it prevents the client from using content negotiation and the server from identifying the media type of the returned entity. 4.2 Message Headers HTTP header fields, which include General-Header (Section 4.3), Request-Header (Section 5.2), 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. HTTP-header = field-name ":" [ field-value ] CRLF field-name = token field-value = *( field-content | LWS ) field-content = The order in which header fields are received is not significant. However, it is "good practice" to send General-Header fields first, followed by Request-Header or Response-Header fields prior to the Entity-Header fields. Multiple HTTP-header fields with the same field-name may be present in a message 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 the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. 4.3 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. These headers apply only to the message being transmitted. General-Header = Cache-Control ; Section 10.8 | Connection ; Section 10.9 | Date ; Section 10.17 | Forwarded ; Section 10.20 | Keep-Alive ; Section 10.24 | MIME-Version ; Section 10.28 | Pragma ; Section 10.29 | Upgrade ; Section 10.41 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 be general header fields. Unrecognized header fields are treated as Entity-Header fields. 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 = Simple-Request | Full-Request Simple-Request = "GET" SP Request-URI CRLF Full-Request = Request-Line ; Section 5.1 *( General-Header ; Section 4.3 | Request-Header ; Section 5.2 | Entity-Header ) ; Section 7.1 CRLF [ Entity-Body ] ; Section 7.2 If an HTTP/1.1 server receives a Simple-Request, it must respond with an HTTP/0.9 Simple-Response. An HTTP/1.1 client must never generate a Simple-Request. 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 = Method SP Request-URI SP HTTP-Version CRLF Note that the difference between a Simple-Request and the Request-Line of a Full-Request is the presence of the HTTP-Version field and the availability of methods other than GET. 5.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" ; Section 8.1 | "GET" ; Section 8.2 | "HEAD" ; Section 8.3 | "POST" ; Section 8.4 | "PUT" ; Section 8.5 | "PATCH" ; Section 8.6 | "COPY" ; Section 8.7 | "MOVE" ; Section 8.8 | "DELETE" ; Section 8.9 | "LINK" ; Section 8.10 | "UNLINK" ; Section 8.11 | "TRACE" ; Section 8.12 | "WRAPPED" ; Section 8.13 | extension-method extension-method = token The list of methods acceptable by a specific resource can be specified in an Allow header field (Section 10.5). However, the client is always notified through the return code of the response whether a method is currently allowed on a specific resource, as this can change dynamically. Servers should return the status code 405 (method not allowed) if the method is known by the server but not allowed for the requested resource, and 501 (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 Public response header field (Section 10.32). 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 Section 8. 5.1.2 Request-URI The Request-URI is a Uniform Resource Identifier (Section 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 the Method used does not necessarily apply to a resource. One example would be OPTIONS * HTTP/1.1 The absoluteURI form is only allowed when the request is being made to a proxy. The proxy is requested to forward the request and return the response. If the request is GET or HEAD and a prior response is cached, the proxy may use the cached message if it passes any restrictions in the Cache-Control and Expires header fields. 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 The most common form of Request-URI is that used to identify a resource on an origin server or gateway. In this case, only the absolute path of the URI is transmitted (see Section 3.2.1, abs_path). 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 line: GET /pub/WWW/TheProject.html HTTP/1.1 followed by the remainder of the Full-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). If a proxy receives a request without any path in the Request-URI and the method used 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 as OPTIONS * HTTP/1.1 after connecting to port 8001 of host "www.ics.uci.edu". The Request-URI is transmitted as an encoded string, where some characters may be escaped using the "% hex hex" encoding defined by RFC 1738 [4]. The origin server must decode the Request-URI in order to properly interpret the request. 5.2 Request Header Fields The request 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 equivalent to the parameters on a programming language method (procedure) invocation. Request-Header = Accept ; Section 10.1 | Accept-Charset ; Section 10.2 | Accept-Encoding ; Section 10.3 | Accept-Language ; Section 10.4 | Authorization ; Section 10.6 | From ; Section 10.21 | Host ; Section 10.22 | If-Modified-Since ; Section 10.23 | Proxy-Authorization ; Section 10.31 | Range ; Section 10.33 | Referer ; Section 10.34 | Unless ; Section 10.40 | User-Agent ; Section 10.43 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 of request header fields if all parties in the communication recognize them to be request header fields. Unrecognized header fields are treated as Entity-Header fields. 6. Response After receiving and interpreting a request message, a server responds in the form of an HTTP response message. Response = Simple-Response | Full-Response Simple-Response = [ Entity-Body ] Full-Response = Status-Line ; Section 6.1 *( General-Header ; Section 4.3 | Response-Header ; Section 6.2 | Entity-Header ) ; Section 7.1 CRLF [ Entity-Body ] ; Section 7.2 A Simple-Response should only be sent in response to an HTTP/0.9 Simple-Request or if the server only supports the more limited HTTP/0.9 protocol. If a client sends an HTTP/1.1 Full-Request and receives a response that does not begin with a Status-Line, it should assume that the response is a Simple-Response and parse it accordingly. Note that the Simple-Response consists only of the entity body and is terminated by the server closing the connection. 6.1 Status-Line The first line of a Full-Response 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 CRLF Since a status line always begins with the protocol version and status code "HTTP/" 1*DIGIT "." 1*DIGIT SP 3DIGIT SP (e.g., "HTTP/1.1 200 "), the presence of that expression is sufficient to differentiate a Full-Response from a Simple-Response. Although the Simple-Response format may allow such an expression to occur at the beginning of an entity body, and thus cause a misinterpretation of the message if it was given in response to a Full-Request, most HTTP/0.9 servers are limited to responses of type "text/html" and therefore would never generate such a response. 6.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. 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 the human user. The client is not required to examine or display the 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: o 1xx: Informational - Request received, continuing process o 2xx: Success - The action was successfully received, understood, and accepted o 3xx: Redirection - Further action must be taken in order to complete the request o 4xx: Client Error - The request contains bad syntax or cannot be fulfilled o 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 9. 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" ; None Acceptable | "407" ; Proxy Authentication Required | "408" ; Request Timeout | "409" ; Conflict | "410" ; Gone | "411" ; Length Required | "412" ; Unless True | "500" ; Internal Server Error | "501" ; Not Implemented | "502" ; Bad Gateway | "503" ; Service Unavailable | "504" ; Gateway Timeout | extension-code extension-code = 3DIGIT Reason-Phrase = * 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 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. 6.2 Response Header Fields The response header fields allow the server to pass additional information about the response which cannot be placed in the Status-Line. These header fields are not intended to give information about an Entity-Body returned in the response, but about access to the resource or the server itself. Response-Header= Location ; Section 10.27 | Proxy-Authenticate ; Section 10.30 | Public ; Section 10.32 | Retry-After ; Section 10.36 | Server ; Section 10.37 | WWW-Authenticate ; Section 10.44 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 of response header fields if all parties in the communication recognize them to be response header fields. Unrecognized header fields are treated as Entity-Header fields. 7. Entity Full-Request and Full-Response messages may transfer an entity within some requests and responses. An entity consists of Entity-Header fields and (usually) an Entity-Body. In this section, both sender and recipient refer to either the client or the server, depending on who sends and who receives the entity. 7.1 Entity Header Fields Entity-Header fields define optional metainformation about the Entity-Body or, if no body is present, about the resource identified by the request. Entity-Header = Allow ; Section 10.5 | Content-Encoding ; Section 10.10 | Content-Language ; Section 10.11 | Content-Length ; Section 10.12 | Content-MD5 ; Section 10.13 | Content-Range ; Section 10.14 | Content-Type ; Section 10.15 | Content-Version ; Section 10.16 | Derived-From ; Section 10.18 | Expires ; Section 10.19 | Last-Modified ; Section 10.25 | Link ; Section 10.26 | Title ; Section 10.38 | Transfer-Encoding ; Section 10.39 | URI-header ; Section 10.42 | extension-header extension-header=HTTP-header The extension-header mechanism allows additional Entity-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. 7.2 Entity Body The entity body (if any) sent with an HTTP request or response is in a format and encoding defined by the Entity-Header fields. Entity-Body = *OCTET An entity body is included with a request message only when the request method calls for one. The presence of an entity body in a request is signaled by the inclusion of a Content-Length and/or Content-Type header field in the request message headers. For response messages, whether or not an entity body is included with a message is dependent on both the request method and the response code. All responses to the HEAD request method must not include a body, even though the presence of entity header fields may lead one to believe they do. All 1xx (informational), 204 (no content), and 304 (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 value of zero (0). 7.2.1 Type When an entity body is included with a message, the data type of that body is determined via the header fields Content-Type, Content-Encoding, and Transfer-Encoding. These define a three-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 the type, usually for the purpose of data compression, that are a property of the resource 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-Encoding is a property of the message, not of the resource. Any HTTP/1.1 message containing an entity 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-Type header, as is the case for Simple-Response messages, the recipient may 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". 7.2.2 Length When an entity body is included with a message, the length of that body may be determined in one of several ways. If a Content-Length header field is present, its value in bytes represents the length of the entity body. Otherwise, the body length is determined by the Transfer-Encoding (if the "chunked" transfer coding has been applied), by the Content-Type (for multipart types with an explicit end-of-body delimiter), or by the server closing the connection. Note: Any response message which must not include an entity body (such as the 1xx, 204, and 304 responses and any response to a HEAD request) is always terminated by the first empty line after the header fields, regardless of the entity header fields present in the message. Closing the connection cannot be used to indicate the end of a request body, since it leaves no possibility for the server to send back a response. For compatibility with HTTP/1.0 applications, HTTP/1.1 requests containing an entity body must include a valid Content-Length header field unless the server is known to be HTTP/1.1 compliant. HTTP/1.1 servers must accept the "chunked" transfer coding (Section 3.6) and multipart media types (Section 3.7.2), thus allowing either mechanism to be used for a request when Content-Length is unknown. If a request contains an entity body and Content-Length is not specified, the server should respond with 400 (bad request) if it cannot determine the length of the request message's content, or with 411 (length required) if it wishes to insist on receiving a valid Content-Length. Messages must not include both a Content-Length header field and the "chunked" transfer coding. If both are received, the Content-Length must be ignored. When a Content-Length is given in a message where an entity body is allowed, its field value must exactly match the number of OCTETs in the entity body. HTTP/1.1 user agents must notify the user when an invalid length is received and detected. 8. Method Definitions The set of common methods for HTTP/1.1 is defined below. Although this set can be expanded, additional methods cannot be assumed to share the same semantics for separately extended clients and servers. The semantics of all methods may be affected by the presence of an Unless request header field, as described in Section 10.40. 8.1 OPTIONS The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. Unless the server's response is an error, the response must 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-Length with a value of zero (0). Responses to this method are not cachable. If the Request-URI is an asterisk ("*"), the OPTIONS request is intended to apply to the server as a whole. A 200 response should include any header fields which indicate 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 5.1.2, an "OPTIONS *" request can be applied through a proxy by specifying the destination server in the Request-URI without any path information. If the Request-URI is not an asterisk, the OPTIONS request applies only to the options that are available when communicating with that resource. A 200 response should include any header fields which indicate optional features implemented by the 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 fields. If the OPTIONS request passes through a proxy, the proxy must edit the response to exclude those options known to be unavailable through that proxy. 8.2 GET The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process. The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since header field. A conditional GET method requests that the identified resource be transferred only if it has been modified since the date given by the If-Modified-Since header, as described in Section 10.23. 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 the client. The semantics of the GET method change to a "partial GET" if the request message includes a Range header field. A partial GET requests that only part of the identified resource be transferred, as described in Section 10.33. The partial GET method is intended to reduce unnecessary network usage by allowing partially-retrieved entities to be completed without transferring data already held by the client. The response to a GET request may be cachable if and only if it meets the requirements for HTTP caching described in Section 13. 8.3 HEAD The HEAD method is identical to GET except that the server must not return any Entity-Body in the response. The metainformation contained in the HTTP headers in response to a HEAD request should be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the resource identified by the Request-URI without transferring the Entity-Body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification. The response to a HEAD request may be cachable in the sense that the information contained in the response may be used to update a previously cached entity from that resource. If the new field values indicate that the cached entity differs from the current resource (as would be indicated by a change in Content-Length, Content-MD5, or Content-Version), then the cache must discard the cached entity. There is no "conditional HEAD" or "partial HEAD" request analogous to those associated with the GET method. If an If-Modified-Since and/or Range header field is included with a HEAD request, they should be ignored. 8.4 POST The POST method is used to request that the destination server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions: o Annotation of existing resources; o Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; o Providing a block of data, such as the result of submitting a form [5], to a data-handling process; o Extending a database through an append operation. The actual function performed by the POST method is determined by the server and is usually dependent on the Request-URI. The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it, a news article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a database. HTTP/1.1 allows for a two-phase process to occur in accepting and processing a POST request. If the media type of the posted entity is not "application/x-www-form-urlencoded" [5], an HTTP/1.1 client must pause between sending the message header fields (including the empty line signifying the end of the headers) and sending the message body; the duration of the pause is five (5) seconds or until a response is received from the server, whichever is shorter. If no response is received during the pause period, or if the initial response is 100 (continue), the client may continue sending the POST request. If the response indicates an error, the client must discontinue the request and close the connection with the server after reading the response. Upon receipt of a POST request, the server must examine the header fields and determine whether or not the client should continue its request. If any of the header fields indicate the request is insufficient or unacceptable to the server (i.e., will result in a 4xx or 5xx response), or if the server can determine the response without reading the entity body (e.g., a 301 or 302 response due to an old Request-URI), the server must send that response immediately upon its determination. If, on the other hand, the request appears (at least initially) to be acceptable and the client has indicated HTTP/1.1 compliance, the server must transmit an interim 100 response message after receiving the empty line terminating the request headers and continue processing the request. After processing has finished, a final response message must be sent to indicate the actual result of the request. A 100 response should not be sent in response to an HTTP/1.0 request except under experimental conditions, since an HTTP/1.0 client may mistake the 100 response for the final response. For compatibility with HTTP/1.0 applications, all POST requests must include a valid Content-Length header field unless the server is known to be HTTP/1.1 compliant. When sending a POST request to an HTTP/1.1 server, a client must use at least one of: a valid Content-Length, a multipart Content-Type, or the "chunked" Transfer-Encoding. The server should respond with a 400 (bad request) message if it cannot determine the length of the request message's content, or with 411 (length required) if it wishes to insist on receiving a valid Content-Length. The client can suggest one or more URIs for the new resource by including a URI header field in the request. However, the server should treat those URIs as advisory and may store the entity under a different URI, additional URIs, or without any URI. The client may apply relationships between the new resource and other existing resources by including Link header fields, as described in Section 10.26. The server may use the Link information to perform other operations as a result of the new resource being added. For example, lists and indexes might be updated. However, no mandatory operation is imposed on the origin server. The origin server may also generate its own or additional links to other resources. A successful POST does not require that the entity be created as a resource on the origin server or made accessible for future reference. That is, the action performed by the POST method might not result in a resource that can be identified by a URI. In this case, either 200 (ok) or 204 (no content) is the appropriate response status, depending on whether or not the response includes an entity that describes the result. If a resource has been created on the origin server, the response should be 201 (created) and contain an entity (preferably of type "text/html") which describes the status of the request and refers to the new resource. Responses to this method are not cachable. However, the 303 (see other) response can be used to direct the user agent to retrieve a cachable resource. 8.5 PUT The PUT method requests that the 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 a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If a new resource is created, the origin server must inform the user agent via the 201 (created) response. If an existing resource is modified, either the 200 (ok) or 204 (no content) response codes should be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response should be given that reflects the nature of the problem. If the request passes through a cache and the Request-URI identifies a currently cached entity, that entity must be removed from the cache. Responses to this method are not cachable. The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity as an appendage. That resource may be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server must not attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI, it must send a 301 (moved permanently) response; the user agent may then make its own decision regarding whether or not to redirect the request. A single resource may be identified by many different URIs. For example, an article may have a URI for identifying "the current version" which is separate from the URI identifying each particular version. In this case, a PUT request on a general URI may result in several other URIs being defined by the origin server. The user agent should be informed of these URIs via one or more URI header fields in the response. HTTP/1.1 allows for a two-phase process to occur in accepting and processing a PUT request. An HTTP/1.1 client must pause between sending the message header fields (including the empty line signifying the end of the headers) and sending the message body; the duration of the pause is five (5) seconds or until a response is received from the server, whichever is shorter. If no response is received during the pause period, or if the initial response is 100 (continue), the client may continue sending the PUT request. If the response indicates an error, the client must discontinue the request and close the connection with the server after reading the response. Upon receipt of a PUT request, the server must examine the header fields and determine whether or not the client should continue its request. If any of the header fields indicate the request is insufficient or unacceptable to the server (i.e., will result in a 4xx or 5xx response), or if the server can determine the response without reading the entity body (e.g., a 301 or 302 response due to an old Request-URI), the server must send that response immediately upon its determination. If, on the other hand, the request appears (at least initially) to be acceptable and the client has indicated HTTP/1.1 compliance, the server must transmit an interim 100 response message after receiving the empty line terminating the request headers and continue processing the request. After processing has finished, a final response message must be sent to indicate the actual result of the request. A 100 response should not be sent in response to an HTTP/1.0 request except under experimental conditions, since an HTTP/1.0 client may mistake the 100 response for the final response. For compatibility with HTTP/1.0 applications, all PUT requests must include a valid Content-Length header field unless the server is known to be HTTP/1.1 compliant. When sending a PUT request to an HTTP/1.1 server, a client must use at least one of: a valid Content-Length, a multipart Content-Type, or the "chunked" Transfer-Encoding. The server should respond with a 400 (bad request) message if it cannot determine the length of the request message's content, or with 411 (length required) if it wishes to insist on receiving a valid Content-Length. The client can create or modify relationships between the enclosed entity and other existing resources by including Link header fields, as described in Section 10.26. As with POST, the server may use the Link information to perform other operations as a result of the request. However, no mandatory operation is imposed on the origin server. The origin server may generate its own or additional links to other resources. The actual method for determining how the resource is placed, and what happens to its predecessor, is defined entirely by the origin server. If version control is implemented by the origin server, then Link relationships should be defined by the server to help identify and control revisions to a resource. If the entity being PUT was derived from an existing resource which included a Content-Version header field, the new entity must include a Derived-From header field corresponding to the value of the original Content-Version header field. Multiple Derived-From values may be included if the entity was derived from multiple resources with Content-Version information. Applications are encouraged to use these fields for constructing versioning relationships and resolving version conflicts. 8.6 PATCH The PATCH method is similar to PUT except that the entity contains a list of differences between the original version of the resource identified by the Request-URI and the desired content of the resource after the PATCH action has been applied. The list of differences is in a format defined by the media type of the entity (e.g., "application/diff") and must include sufficient information to allow the server to recreate the changes necessary to convert the original version of the resource to the desired version. If the request passes through a cache and the Request-URI identifies a currently cached entity, that entity must be removed from the cache. Responses to this method are not cachable. HTTP/1.1 allows for a two-phase process to occur in accepting and processing a PATCH request. An HTTP/1.1 client must pause between sending the message header fields (including the empty line signifying the end of the headers) and sending the message body; the duration of the pause is five (5) seconds or until a response is received from the server, whichever is shorter. If no response is received during the pause period, or if the initial response is 100 (continue), the client may continue sending the PATCH request. If the response indicates an error, the client must discontinue the request and close the connection with the server after reading the response. Upon receipt of a PATCH request, the server must examine the header fields and determine whether or not the client should continue its request. If any of the header fields indicate the request is insufficient or unacceptable to the server (i.e., will result in a 4xx or 5xx response), or if the server can determine the response without reading the entity body (e.g., a 301 or 302 response due to an old Request-URI), the server must send that response immediately upon its determination. If, on the other hand, the request appears (at least initially) to be acceptable and the client has indicated HTTP/1.1 compliance, the server must transmit an interim 100 response message after receiving the empty line terminating the request headers and continue processing the request. After processing has finished, a final response message must be sent to indicate the actual result of the request. A 100 response should not be sent in response to an HTTP/1.0 request except under experimental conditions, since an HTTP/1.0 client may mistake the 100 response for the final response. For compatibility with HTTP/1.0 applications, all PATCH requests must include a valid Content-Length header field unless the server is known to be HTTP/1.1 compliant. When sending a PATCH request to an HTTP/1.1 server, a client must use at least one of: a valid Content-Length, a multipart Content-Type, or the "chunked" Transfer-Encoding. The server should respond with a 400 (bad request) message if it cannot determine the length of the request message's content, or with 411 (length required) if it wishes to insist on receiving a valid Content-Length. The client can create or modify relationships between the new resource and other existing resources by including Link header fields, as described in Section 10.26. As with POST, the server may use the Link information to perform other operations as a result of the request. However, no mandatory operation is imposed on the origin server. The origin server may generate its own or additional links to other resources. The actual method for determining how the patched resource is placed, and what happens to its predecessor, is defined entirely by the origin server. If version control is implemented by the origin server, then Link relationships should be defined by the server to help identify and control revisions to a resource. If the original version of the resource being patched included a Content-Version header field, the request entity must include a Derived-From header field corresponding to the value of the original Content-Version header field. Applications are encouraged to use these fields for constructing versioning relationships and resolving version conflicts. 8.7 COPY The COPY method requests that the resource identified by the Request-URI be copied to the location(s) given in the URI header field of the request. Responses to this method are not cachable. 8.8 MOVE The MOVE method requests that the resource identified by the Request-URI be moved to the location(s) given in the URI header field of the request. This method is equivalent to a COPY immediately followed by a DELETE, but enables both to occur within a single transaction. If the request passes through a cache and the Request-URI identifies a currently cached entity, that entity must be removed from the cache. Responses to this method are not cachable. 8.9 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) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server should not indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location. A 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 not include an entity. If the request passes through a cache and the Request-URI identifies a currently cached entity, that entity must be removed from the cache. Responses to this method are not cachable. 8.10 LINK The LINK method establishes one or more Link relationships between the existing resource identified by the Request-URI and other existing resources. The difference between LINK and other methods allowing links to be established between resources is that the LINK method does not allow any Entity-Body to be sent in the request and does not directly result in the creation of new resources. If the request passes through a cache and the Request-URI identifies a currently cached entity, that entity must be removed from the cache. Responses to this method are not cachable. 8.11 UNLINK The UNLINK method removes one or more Link relationships from the existing resource identified by the Request-URI. These relationships may have been established using the LINK method or by any other method supporting the Link header. The removal of a link to a resource does not imply that the resource ceases to exist or becomes inaccessible for future references. If the request passes through a cache and the Request-URI identifies a currently cached entity, that entity must be removed from the cache. Responses to this method are not cachable. 8.12 TRACE The TRACE method requests that the server identified by the Request-URI reflect whatever is received back to the client as the entity body of the response. In this way, the client can see what is being received at the other end of the request chain, and may use this data for testing or diagnostic information. If successful, the response should contain the entire, unedited request message in the entity body, with a Content-Type of "message/http", "application/http", or "text/plain". Responses to this method are not cachable. 8.13 WRAPPED The WRAPPED method allows a client to send one or more encapsulated requests to the server identified by the Request-URI. This method is intended to allow the request(s) to be wrapped together, possibly encrypted in order to improve the security and/or privacy of the request, and delivered for unwrapping by the destination server. Upon receipt of the WRAPPED request, the destination server must unwrap the message and feed it to the appropriate protocol handler as if it were an incoming request stream. Responses to this method are not cachable. Applications should not use this method for making requests that would normally be public and cachable. The request entity must include at least one encapsulated message, with the media type identifying the protocol of that message. For example, if the wrapped request is another HTTP request message, then the media type must be either "message/http" (for a single message) or "application/http" (for a request stream containing one or more requests), with any codings identied by the Content-Encoding and Transfer-Encoding header fields. HTTP/1.1 allows for a two-phase process to occur in accepting and processing a WRAPPED request. An HTTP/1.1 client must pause between sending the message header fields (including the empty line signifying the end of the headers) and sending the message body; the duration of the pause is five (5) seconds or until a response is received from the server, whichever is shorter. If no response is received during the pause period, or if the initial response is 100 (continue), the client may continue sending the WRAPPED request. If the response indicates an error, the client must discontinue the request and close the connection with the server after reading the response. Upon receipt of a WRAPPED request, the server must examine the header fields and determine whether or not the client should continue its request. If any of the header fields indicate the request is insufficient or unacceptable to the server (i.e., will result in a 4xx or 5xx response), or if the server can determine the response without reading the entity body (e.g., a 301 or 302 response due to an old Request-URI), the server must send that response immediately upon its determination. If, on the other hand, the request appears (at least initially) to be acceptable and the client has indicated HTTP/1.1 compliance, the server must transmit an interim 100 response message after receiving the empty line terminating the request headers and continue processing the request. After processing has finished, a final response message must be sent to indicate the actual result of the request. A 100 response should not be sent in response to an HTTP/1.0 request except under experimental conditions, since an HTTP/1.0 client may mistake the 100 response for the final response. For compatibility with HTTP/1.0 applications, all WRAPPED requests must include a valid Content-Length header field unless the server is known to be HTTP/1.1 compliant. When sending a WRAPPED request to an HTTP/1.1 server, a client must use at least one of: a valid Content-Length, a multipart Content-Type, or the "chunked" Transfer-Encoding. The server should respond with a 400 (bad request) message if it cannot determine the length of the request message's content, or with 411 (length required) if it wishes to insist on receiving a valid Content-Length. 9. Status Code Definitions Each Status-Code is described below, including a description of which method(s) it can follow and any metainformation required in the response. 9.1 Informational 1xx This class of status code indicates a provisional 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 should not send a 1xx response to an HTTP/1.0 client except under experimental conditions. 100 Continue The client may continue with its request. This interim response is used to inform the client that the initial part of the request has been received and has not yet been rejected by the server. The client should continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server must send a final response after the request has been completed. 101 Switching Protocols The server understands and is willing to comply with the client's request, via the Upgrade message header field (Section 10.41), for a change in the application protocol being used on this connection. The server will switch protocols to those defined by the response's Upgrade header field immediately after the empty line which terminates the 101 response. The protocol should only be switched when it is advantageous to do so. For example, switching to a newer version of HTTP is advantageous over older versions, and switching to a real-time, synchronous protocol may be advantageous when delivering resources that use such features. 9.2 Successful 2xx This class of status code indicates that the client's request was successfully received, understood, and accepted. 200 OK The request has succeeded. The information returned with the response is dependent on the method used in the request, as follows: GET an entity corresponding to the requested resource is sent in the response; HEAD the response must only contain the header information and no Entity-Body; POST an entity 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 include a Location header field giving the actual location of that specific resource for later reference. 201 Created The request has been fulfilled and resulted in a new resource being created. The newly created resource can be referenced by the URI(s) returned in the URI-header field and/or the entity of the response, with the most specific URL for the resource given by a Location header field. The origin server should create the resource before using this Status-Code. If the action cannot be carried out immediately, the server must include in the response body a description of when the resource will be available; otherwise, the server should respond with 202 (accepted). 202 Accepted The request has been accepted for processing, but the processing 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 some other process (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 indication of the request's current status and either a pointer to a status monitor or some estimate of when the user can expect the request to be fulfilled. 203 Non-Authoritative Information The returned metainformation in the Entity-Header is not the definitive set as available from the origin server, but is gathered from a local or a third-party copy. The set presented may be a subset or superset of the original version. For example, including local annotation information about the resource may result in a superset of the metainformation known by the origin server. Use of this response code is not required and is only appropriate when the response would otherwise be 200 (ok). 204 No Content The server has fulfilled the request but there is no new information to send back. If the client is a user agent, it should not change its document view from that which caused the request to be generated. This response is primarily intended to allow 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, which should apply to the document currently in the user agent's active view. The 204 response must not include an entity body, and thus is always ternminated by the first empty line after the header fields. 205 Reset Content The server has fulfilled the request and the user agent should reset the document view which caused the request to be generated. This response is primarily intended to allow input for actions to take place via user input, followed by a clearing of the form in which the input is given so that the user can easily initiate another input action. The response must include a Content-Length with a value of zero (0) and no entity body. 206 Partial Content The server has fulfilled the partial GET request for the resource. The request must have included a Range header field (Section 10.33) indicating the desired range. The response must include a Content-Range header field (Section 10.14) indicating the range included with this response. All entity header fields in the response must describe the actual entity transmitted rather than what would have been transmitted in a full response. In particular, the Content-Length header field in the response must match the actual number of OCTETs transmitted in the entity body. It is assumed that the client already has the complete entity's header field data. 9.3 Redirection 3xx This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. The action required may be carried out by the user agent without interaction with the user if and only if the method used in the second request is GET or HEAD. A user agent should never automatically redirect a request more than 5 times, since such redirections usually indicate an infinite loop. 300 Multiple Choices The requested resource is available at one or more locations and a preferred location could not be determined via preemptive content negotiation (Section 12). Unless it was a HEAD request, the response should include an entity containing a list of resource characteristics and locations from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice may be performed automatically. If the server has a preferred choice, it should include the URL in a Location field; user agents not capable of complex selection may use this field value for automatic redirection. This response is cachable unless indicated otherwise. 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 the returned URIs. Clients with link editing capabilities should automatically relink references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cachable unless indicated otherwise. If the new URI is a single location, its URL must be given by the Location field in the response. If more than one URI exists for the resource, the primary URL should be given in the Location field and the other URIs given in one or more URI-header fields. Unless it was a HEAD request, the Entity-Body of the response should contain a short hypertext note with a hyperlink to the new URI(s). If the 301 status code is received in response to a request other than GET or HEAD, the user agent must not automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued. 302 Moved Temporarily The requested resource resides temporarily under a different URI. Since the redirection may be altered on occasion, the client should continue to use the Request-URI for future requests. This response is only cachable if indicated by a Cache-Control or Expires header field. If the new URI is a single location, its URL must be given by the Location field in the response. If more than one URI exists for the resource, the primary URL should be given in the Location field and the other URIs given in one or more URI-header fields. Unless it was a HEAD request, the Entity-Body of the response should contain a short hypertext note with a hyperlink to the new URI(s). If the 302 status code is received in response to a request other than GET or HEAD, the user agent must not automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued. 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 redirect the user agent to a selected resource. The new resource is not a replacement reference for the original Request-URI. The 303 response is not cachable, but the response to the second request may be cachable. If the new URI is a single location, its URL must be given by the Location field in the response. If more than one URI exists for the resource, the primary URL should be given in the Location field and the other URIs given in one or more URI-header fields. Unless it was a HEAD request, the Entity-Body of the response should contain a short hypertext note with a hyperlink to the new URI(s). 304 Not Modified If the client has performed a conditional GET request and access is allowed, but the document has not been modified since the date and time specified in the If-Modified-Since field, the server must respond with this status code and not send an Entity-Body to the client. Header fields contained in the response should only include information which is relevant to cache managers or which may have changed independently of the entity's Last-Modified date. Examples of relevant 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 in the 304 response. If the new field values indicate that the cached entity differs from the current resource (as would be indicated by a change in Content-Length, Content-MD5, or Content-Version), then the cache must disregard the 304 response and repeat the request without an If-Modified-Since field. The 304 response must not include an entity body, and thus is always ternminated by the first empty line after the header fields. 305 Use Proxy The requested resource must be accessed through the proxy given by the Location field in the response. In other words, this is a proxy redirect. 9.4 Client Error 4xx The 4xx class of status code is intended for cases in which the client seems to have erred. If the client has not completed the request when a 4xx code is received, it should immediately cease sending data to the server. Except when responding to a HEAD request, the server should include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable to any request method. Note: If the client is sending data, server implementations on TCP should be careful to ensure that the client acknowledges receipt of the packet(s) containing the response prior to closing the input 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 erase the client's unacknowledged input buffers before they can be read and interpreted by the HTTP application. 400 Bad Request The request could not be understood by the server due to malformed syntax. The client should not repeat the request without modifications. 401 Unauthorized The request requires user authentication. The response must include a WWW-Authenticate header field (Section 10.44) containing a challenge applicable to the requested resource. The client may repeat the request with a suitable Authorization header field (Section 10.6). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the 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 11. 402 Payment Required This code is reserved for future use. 403 Forbidden The server understood the request, but is refusing to fulfill it. Authorization will not help and the request should not be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it should describe the reason for the refusal in the entity body. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable. 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 to make this information available to the client, the status code 403 (forbidden) can be used instead. The 410 (gone) status code should be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. 405 Method Not Allowed The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response must include an Allow header containing a list of valid methods for the requested resource. 406 None Acceptable The server has found a resource matching the Request-URI, but not one that satisfies the conditions identified by the Accept and Accept-Encoding request headers. Unless it was a HEAD request, the response should include an entity containing a list of resource characteristics and locations from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice may be performed automatically. 407 Proxy Authentication Required This code is similar to 401 (unauthorized), but indicates that the client must first authenticate itself with the proxy. The proxy must return a Proxy-Authenticate header field (Section 10.30) containing a challenge applicable to the proxy for the requested resource. The client may repeat the request with a suitable Proxy-Authorization header field (Section 10.31). HTTP access authentication is explained in Section 11. 408 Request Timeout The client did not produce a request within the time that the server was prepared to wait. The client may repeat the request without modifications at any later time. 409 Conflict The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user may be able to resolve the conflict and resubmit the request. The response body should include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user-agent to fix the problem; however, that may not be possible and is not required. Conflicts are most likely to occur in response to a PUT or PATCH