idnits 2.17.1 draft-ietf-httpbis-p2-semantics-24.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The draft header indicates that this document obsoletes RFC2616, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document updates RFC2817, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year (Using the creation date from RFC2817, updated by this document, for RFC5378 checks: 1998-11-18) -- The document seems to contain a disclaimer for pre-RFC5378 work, and may have content which was first submitted before 10 November 2008. The disclaimer is necessary when there are original authors that you have been unable to contact, or if some do not wish to grant the BCP78 rights to the IETF Trust. If you are able to get all authors (current and original) to grant those rights, you can and should remove the disclaimer; otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (September 25, 2013) is 3866 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p1-messaging-24 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p4-conditional-24 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p5-range-24 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p6-cache-24 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p7-auth-24 ** Downref: Normative reference to an Informational RFC: RFC 1950 ** Downref: Normative reference to an Informational RFC: RFC 1951 ** Downref: Normative reference to an Informational RFC: RFC 1952 -- Possible downref: Non-RFC (?) normative reference: ref. 'Welch' -- Obsolete informational reference (is this intentional?): RFC 1305 (Obsoleted by RFC 5905) -- Obsolete informational reference (is this intentional?): RFC 2068 (Obsoleted by RFC 2616) -- Obsolete informational reference (is this intentional?): RFC 2388 (Obsoleted by RFC 7578) -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) -- Obsolete informational reference (is this intentional?): RFC 5987 (Obsoleted by RFC 8187) -- Obsolete informational reference (is this intentional?): RFC 5988 (Obsoleted by RFC 8288) Summary: 3 errors (**), 0 flaws (~~), 6 warnings (==), 13 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTPbis Working Group R. Fielding, Ed. 3 Internet-Draft Adobe 4 Obsoletes: 2616 (if approved) J. Reschke, Ed. 5 Updates: 2817 (if approved) greenbytes 6 Intended status: Standards Track September 25, 2013 7 Expires: March 29, 2014 9 Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content 10 draft-ietf-httpbis-p2-semantics-24 12 Abstract 14 The Hypertext Transfer Protocol (HTTP) is an application-level 15 protocol for distributed, collaborative, hypertext information 16 systems. This document defines the semantics of HTTP/1.1 messages, 17 as expressed by request methods, request header fields, response 18 status codes, and response header fields, along with the payload of 19 messages (metadata and body content) and mechanisms for content 20 negotiation. 22 Editorial Note (To be removed by RFC Editor) 24 Discussion of this draft takes place on the HTTPBIS working group 25 mailing list (ietf-http-wg@w3.org), which is archived at 26 . 28 The current issues list is at 29 and related 30 documents (including fancy diffs) can be found at 31 . 33 The changes in this draft are summarized in Appendix E.4. 35 Status of This Memo 37 This Internet-Draft is submitted in full conformance with the 38 provisions of BCP 78 and BCP 79. 40 Internet-Drafts are working documents of the Internet Engineering 41 Task Force (IETF). Note that other groups may also distribute 42 working documents as Internet-Drafts. The list of current Internet- 43 Drafts is at http://datatracker.ietf.org/drafts/current/. 45 Internet-Drafts are draft documents valid for a maximum of six months 46 and may be updated, replaced, or obsoleted by other documents at any 47 time. It is inappropriate to use Internet-Drafts as reference 48 material or to cite them other than as "work in progress." 49 This Internet-Draft will expire on March 29, 2014. 51 Copyright Notice 53 Copyright (c) 2013 IETF Trust and the persons identified as the 54 document authors. All rights reserved. 56 This document is subject to BCP 78 and the IETF Trust's Legal 57 Provisions Relating to IETF Documents 58 (http://trustee.ietf.org/license-info) in effect on the date of 59 publication of this document. Please review these documents 60 carefully, as they describe your rights and restrictions with respect 61 to this document. Code Components extracted from this document must 62 include Simplified BSD License text as described in Section 4.e of 63 the Trust Legal Provisions and are provided without warranty as 64 described in the Simplified BSD License. 66 This document may contain material from IETF Documents or IETF 67 Contributions published or made publicly available before November 68 10, 2008. The person(s) controlling the copyright in some of this 69 material may not have granted the IETF Trust the right to allow 70 modifications of such material outside the IETF Standards Process. 71 Without obtaining an adequate license from the person(s) controlling 72 the copyright in such materials, this document may not be modified 73 outside the IETF Standards Process, and derivative works of it may 74 not be created outside the IETF Standards Process, except to format 75 it for publication as an RFC or to translate it into languages other 76 than English. 78 Table of Contents 80 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 6 81 1.1. Conformance and Error Handling . . . . . . . . . . . . . . 6 82 1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 6 83 2. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 7 84 3. Representations . . . . . . . . . . . . . . . . . . . . . . . 7 85 3.1. Representation Metadata . . . . . . . . . . . . . . . . . 8 86 3.1.1. Processing Representation Data . . . . . . . . . . . . 8 87 3.1.2. Encoding for Compression or Integrity . . . . . . . . 11 88 3.1.3. Audience Language . . . . . . . . . . . . . . . . . . 13 89 3.1.4. Identification . . . . . . . . . . . . . . . . . . . . 14 90 3.2. Representation Data . . . . . . . . . . . . . . . . . . . 17 91 3.3. Payload Semantics . . . . . . . . . . . . . . . . . . . . 17 92 3.4. Content Negotiation . . . . . . . . . . . . . . . . . . . 18 93 3.4.1. Proactive Negotiation . . . . . . . . . . . . . . . . 19 94 3.4.2. Reactive Negotiation . . . . . . . . . . . . . . . . . 20 95 4. Request Methods . . . . . . . . . . . . . . . . . . . . . . . 21 96 4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . 21 97 4.2. Common Method Properties . . . . . . . . . . . . . . . . . 22 98 4.2.1. Safe Methods . . . . . . . . . . . . . . . . . . . . . 22 99 4.2.2. Idempotent Methods . . . . . . . . . . . . . . . . . . 23 100 4.2.3. Cacheable Methods . . . . . . . . . . . . . . . . . . 24 101 4.3. Method Definitions . . . . . . . . . . . . . . . . . . . . 24 102 4.3.1. GET . . . . . . . . . . . . . . . . . . . . . . . . . 24 103 4.3.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . . 25 104 4.3.3. POST . . . . . . . . . . . . . . . . . . . . . . . . . 25 105 4.3.4. PUT . . . . . . . . . . . . . . . . . . . . . . . . . 26 106 4.3.5. DELETE . . . . . . . . . . . . . . . . . . . . . . . . 29 107 4.3.6. CONNECT . . . . . . . . . . . . . . . . . . . . . . . 30 108 4.3.7. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . 31 109 4.3.8. TRACE . . . . . . . . . . . . . . . . . . . . . . . . 32 110 5. Request Header Fields . . . . . . . . . . . . . . . . . . . . 33 111 5.1. Controls . . . . . . . . . . . . . . . . . . . . . . . . . 33 112 5.1.1. Expect . . . . . . . . . . . . . . . . . . . . . . . . 34 113 5.1.2. Max-Forwards . . . . . . . . . . . . . . . . . . . . . 36 114 5.2. Conditionals . . . . . . . . . . . . . . . . . . . . . . . 36 115 5.3. Content Negotiation . . . . . . . . . . . . . . . . . . . 37 116 5.3.1. Quality Values . . . . . . . . . . . . . . . . . . . . 37 117 5.3.2. Accept . . . . . . . . . . . . . . . . . . . . . . . . 38 118 5.3.3. Accept-Charset . . . . . . . . . . . . . . . . . . . . 40 119 5.3.4. Accept-Encoding . . . . . . . . . . . . . . . . . . . 41 120 5.3.5. Accept-Language . . . . . . . . . . . . . . . . . . . 42 121 5.4. Authentication Credentials . . . . . . . . . . . . . . . . 43 122 5.5. Request Context . . . . . . . . . . . . . . . . . . . . . 44 123 5.5.1. From . . . . . . . . . . . . . . . . . . . . . . . . . 44 124 5.5.2. Referer . . . . . . . . . . . . . . . . . . . . . . . 45 125 5.5.3. User-Agent . . . . . . . . . . . . . . . . . . . . . . 46 126 6. Response Status Codes . . . . . . . . . . . . . . . . . . . . 47 127 6.1. Overview of Status Codes . . . . . . . . . . . . . . . . . 47 128 6.2. Informational 1xx . . . . . . . . . . . . . . . . . . . . 50 129 6.2.1. 100 Continue . . . . . . . . . . . . . . . . . . . . . 50 130 6.2.2. 101 Switching Protocols . . . . . . . . . . . . . . . 50 131 6.3. Successful 2xx . . . . . . . . . . . . . . . . . . . . . . 51 132 6.3.1. 200 OK . . . . . . . . . . . . . . . . . . . . . . . . 51 133 6.3.2. 201 Created . . . . . . . . . . . . . . . . . . . . . 52 134 6.3.3. 202 Accepted . . . . . . . . . . . . . . . . . . . . . 52 135 6.3.4. 203 Non-Authoritative Information . . . . . . . . . . 52 136 6.3.5. 204 No Content . . . . . . . . . . . . . . . . . . . . 53 137 6.3.6. 205 Reset Content . . . . . . . . . . . . . . . . . . 53 138 6.4. Redirection 3xx . . . . . . . . . . . . . . . . . . . . . 54 139 6.4.1. 300 Multiple Choices . . . . . . . . . . . . . . . . . 55 140 6.4.2. 301 Moved Permanently . . . . . . . . . . . . . . . . 56 141 6.4.3. 302 Found . . . . . . . . . . . . . . . . . . . . . . 56 142 6.4.4. 303 See Other . . . . . . . . . . . . . . . . . . . . 57 143 6.4.5. 305 Use Proxy . . . . . . . . . . . . . . . . . . . . 57 144 6.4.6. 306 (Unused) . . . . . . . . . . . . . . . . . . . . . 57 145 6.4.7. 307 Temporary Redirect . . . . . . . . . . . . . . . . 58 146 6.5. Client Error 4xx . . . . . . . . . . . . . . . . . . . . . 58 147 6.5.1. 400 Bad Request . . . . . . . . . . . . . . . . . . . 58 148 6.5.2. 402 Payment Required . . . . . . . . . . . . . . . . . 58 149 6.5.3. 403 Forbidden . . . . . . . . . . . . . . . . . . . . 58 150 6.5.4. 404 Not Found . . . . . . . . . . . . . . . . . . . . 59 151 6.5.5. 405 Method Not Allowed . . . . . . . . . . . . . . . . 59 152 6.5.6. 406 Not Acceptable . . . . . . . . . . . . . . . . . . 59 153 6.5.7. 408 Request Timeout . . . . . . . . . . . . . . . . . 60 154 6.5.8. 409 Conflict . . . . . . . . . . . . . . . . . . . . . 60 155 6.5.9. 410 Gone . . . . . . . . . . . . . . . . . . . . . . . 60 156 6.5.10. 411 Length Required . . . . . . . . . . . . . . . . . 61 157 6.5.11. 413 Payload Too Large . . . . . . . . . . . . . . . . 61 158 6.5.12. 414 URI Too Long . . . . . . . . . . . . . . . . . . . 61 159 6.5.13. 415 Unsupported Media Type . . . . . . . . . . . . . . 61 160 6.5.14. 417 Expectation Failed . . . . . . . . . . . . . . . . 62 161 6.5.15. 426 Upgrade Required . . . . . . . . . . . . . . . . . 62 162 6.6. Server Error 5xx . . . . . . . . . . . . . . . . . . . . . 62 163 6.6.1. 500 Internal Server Error . . . . . . . . . . . . . . 62 164 6.6.2. 501 Not Implemented . . . . . . . . . . . . . . . . . 62 165 6.6.3. 502 Bad Gateway . . . . . . . . . . . . . . . . . . . 63 166 6.6.4. 503 Service Unavailable . . . . . . . . . . . . . . . 63 167 6.6.5. 504 Gateway Timeout . . . . . . . . . . . . . . . . . 63 168 6.6.6. 505 HTTP Version Not Supported . . . . . . . . . . . . 63 169 7. Response Header Fields . . . . . . . . . . . . . . . . . . . . 63 170 7.1. Control Data . . . . . . . . . . . . . . . . . . . . . . . 64 171 7.1.1. Origination Date . . . . . . . . . . . . . . . . . . . 64 172 7.1.2. Location . . . . . . . . . . . . . . . . . . . . . . . 68 173 7.1.3. Retry-After . . . . . . . . . . . . . . . . . . . . . 69 174 7.1.4. Vary . . . . . . . . . . . . . . . . . . . . . . . . . 70 175 7.2. Validator Header Fields . . . . . . . . . . . . . . . . . 71 176 7.3. Authentication Challenges . . . . . . . . . . . . . . . . 72 177 7.4. Response Context . . . . . . . . . . . . . . . . . . . . . 72 178 7.4.1. Allow . . . . . . . . . . . . . . . . . . . . . . . . 72 179 7.4.2. Server . . . . . . . . . . . . . . . . . . . . . . . . 73 180 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 73 181 8.1. Method Registry . . . . . . . . . . . . . . . . . . . . . 74 182 8.1.1. Procedure . . . . . . . . . . . . . . . . . . . . . . 74 183 8.1.2. Considerations for New Methods . . . . . . . . . . . . 74 184 8.1.3. Registrations . . . . . . . . . . . . . . . . . . . . 75 185 8.2. Status Code Registry . . . . . . . . . . . . . . . . . . . 75 186 8.2.1. Procedure . . . . . . . . . . . . . . . . . . . . . . 75 187 8.2.2. Considerations for New Status Codes . . . . . . . . . 76 188 8.2.3. Registrations . . . . . . . . . . . . . . . . . . . . 76 189 8.3. Header Field Registry . . . . . . . . . . . . . . . . . . 77 190 8.3.1. Considerations for New Header Fields . . . . . . . . . 78 191 8.3.2. Registrations . . . . . . . . . . . . . . . . . . . . 80 192 8.4. Content Coding Registry . . . . . . . . . . . . . . . . . 80 193 8.4.1. Procedure . . . . . . . . . . . . . . . . . . . . . . 80 194 8.4.2. Registrations . . . . . . . . . . . . . . . . . . . . 81 195 9. Security Considerations . . . . . . . . . . . . . . . . . . . 81 196 9.1. Attacks Based On File and Path Names . . . . . . . . . . . 81 197 9.2. Personal Information . . . . . . . . . . . . . . . . . . . 82 198 9.3. Sensitive Information in URIs . . . . . . . . . . . . . . 82 199 9.4. Product Information . . . . . . . . . . . . . . . . . . . 83 200 9.5. Fragment after Redirects . . . . . . . . . . . . . . . . . 83 201 9.6. Browser Fingerprinting . . . . . . . . . . . . . . . . . . 83 202 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 84 203 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 84 204 11.1. Normative References . . . . . . . . . . . . . . . . . . . 84 205 11.2. Informative References . . . . . . . . . . . . . . . . . . 86 206 Appendix A. Differences between HTTP and MIME . . . . . . . . . . 88 207 A.1. MIME-Version . . . . . . . . . . . . . . . . . . . . . . . 88 208 A.2. Conversion to Canonical Form . . . . . . . . . . . . . . . 88 209 A.3. Conversion of Date Formats . . . . . . . . . . . . . . . . 89 210 A.4. Conversion of Content-Encoding . . . . . . . . . . . . . . 89 211 A.5. Conversion of Content-Transfer-Encoding . . . . . . . . . 89 212 A.6. MHTML and Line Length Limitations . . . . . . . . . . . . 89 213 Appendix B. Changes from RFC 2616 . . . . . . . . . . . . . . . . 90 214 Appendix C. Imported ABNF . . . . . . . . . . . . . . . . . . . . 92 215 Appendix D. Collected ABNF . . . . . . . . . . . . . . . . . . . 93 216 Appendix E. Change Log (to be removed by RFC Editor before 217 publication) . . . . . . . . . . . . . . . . . . . . 96 218 E.1. Since RFC 2616 . . . . . . . . . . . . . . . . . . . . . . 96 219 E.2. Since draft-ietf-httpbis-p2-semantics-21 . . . . . . . . . 96 220 E.3. Since draft-ietf-httpbis-p2-semantics-22 . . . . . . . . . 97 221 E.4. Since draft-ietf-httpbis-p2-semantics-23 . . . . . . . . . 97 222 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 224 1. Introduction 226 Each Hypertext Transfer Protocol (HTTP) message is either a request 227 or a response. A server listens on a connection for a request, 228 parses each message received, interprets the message semantics in 229 relation to the identified request target, and responds to that 230 request with one or more response messages. A client constructs 231 request messages to communicate specific intentions, and examines 232 received responses to see if the intentions were carried out and 233 determine how to interpret the results. This document defines 234 HTTP/1.1 request and response semantics in terms of the architecture 235 defined in [Part1]. 237 HTTP provides a uniform interface for interacting with a resource 238 (Section 2), regardless of its type, nature, or implementation, via 239 the manipulation and transfer of representations (Section 3). 241 HTTP semantics include the intentions defined by each request method 242 (Section 4), extensions to those semantics that might be described in 243 request header fields (Section 5), the meaning of status codes to 244 indicate a machine-readable response (Section 6), and the meaning of 245 other control data and resource metadata that might be given in 246 response header fields (Section 7). 248 This document also defines representation metadata that describe how 249 a payload is intended to be interpreted by a recipient, the request 250 header fields that might influence content selection, and the various 251 selection algorithms that are collectively referred to as "content 252 negotiation" (Section 3.4). 254 1.1. Conformance and Error Handling 256 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 257 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 258 document are to be interpreted as described in [RFC2119]. 260 Conformance criteria and considerations regarding error handling are 261 defined in Section 2.5 of [Part1]. 263 1.2. Syntax Notation 265 This specification uses the Augmented Backus-Naur Form (ABNF) 266 notation of [RFC5234] with the list rule extension defined in Section 267 7 of [Part1]. Appendix C describes rules imported from other 268 documents. Appendix D shows the collected ABNF with the list rule 269 expanded. 271 This specification uses the terms "character", "character encoding 272 scheme", "charset", and "protocol element" as they are defined in 273 [RFC6365]. 275 2. Resources 277 The target of an HTTP request is called a resource. HTTP does not 278 limit the nature of a resource; it merely defines an interface that 279 might be used to interact with resources. Each resource is 280 identified by a Uniform Resource Identifier (URI), as described in 281 Section 2.7 of [Part1]. 283 When a client constructs an HTTP/1.1 request message, it sends the 284 target URI in one of various forms, as defined in (Section 5.3 of 285 [Part1]). When a request is received, the server reconstructs an 286 effective request URI for the target resource (Section 5.5 of 287 [Part1]). 289 One design goal of HTTP is to separate resource identification from 290 request semantics, which is made possible by vesting the request 291 semantics in the request method (Section 4) and a few request- 292 modifying header fields (Section 5). Resource owners SHOULD NOT 293 include request semantics within a URI, such as by specifying an 294 action to invoke within the path or query components of the effective 295 request URI, unless those semantics are disabled when they are 296 inconsistent with the request method. 298 3. Representations 300 If we consider that a resource could be anything, and that the 301 uniform interface provided by HTTP is similar to a window through 302 which one can observe and act upon such a thing only through the 303 communication of messages to some independent actor on the other 304 side, then we need an abstraction to represent ("take the place of") 305 the current or desired state of that thing in our communications. We 306 call that abstraction a representation [REST]. 308 For the purposes of HTTP, a "representation" is information that is 309 intended to reflect a past, current, or desired state of a given 310 resource, in a format that can be readily communicated via the 311 protocol, and that consists of a set of representation metadata and a 312 potentially unbounded stream of representation data. 314 An origin server might be provided with, or capable of generating, 315 multiple representations that are each intended to reflect the 316 current state of a target resource. In such cases, some algorithm is 317 used by the origin server to select one of those representations as 318 most applicable to a given request, usually based on content 319 negotiation. We refer to that one representation as the "selected 320 representation" and use its particular data and metadata for 321 evaluating conditional requests [Part4] and constructing the payload 322 for 200 (OK) and 304 (Not Modified) responses to GET (Section 4.3.1). 324 3.1. Representation Metadata 326 Representation header fields provide metadata about the 327 representation. When a message includes a payload body, the 328 representation header fields describe how to interpret the 329 representation data enclosed in the payload body. In a response to a 330 HEAD request, the representation header fields describe the 331 representation data that would have been enclosed in the payload body 332 if the same request had been a GET. 334 The following header fields convey representation metadata: 336 +-------------------+-----------------+ 337 | Header Field Name | Defined in... | 338 +-------------------+-----------------+ 339 | Content-Type | Section 3.1.1.5 | 340 | Content-Encoding | Section 3.1.2.2 | 341 | Content-Language | Section 3.1.3.2 | 342 | Content-Location | Section 3.1.4.2 | 343 +-------------------+-----------------+ 345 3.1.1. Processing Representation Data 347 3.1.1.1. Media Type 349 HTTP uses Internet Media Types [RFC2046] in the Content-Type 350 (Section 3.1.1.5) and Accept (Section 5.3.2) header fields in order 351 to provide open and extensible data typing and type negotiation. 352 Media types define both a data format and various processing models: 353 how to process that data in accordance with each context in which it 354 is received. 356 media-type = type "/" subtype *( OWS ";" OWS parameter ) 357 type = token 358 subtype = token 360 The type/subtype MAY be followed by parameters in the form of 361 attribute/value pairs. 363 parameter = attribute "=" value 364 attribute = token 365 value = word 367 The type, subtype, and parameter attribute names are case- 368 insensitive. Parameter values might or might not be case-sensitive, 369 depending on the semantics of the parameter name. The presence or 370 absence of a parameter might be significant to the processing of a 371 media-type, depending on its definition within the media type 372 registry. 374 A parameter value that matches the token production can be 375 transmitted as either a token or within a quoted-string. The quoted 376 and unquoted values are equivalent. For example, the following 377 examples are all equivalent, but the first is preferred for 378 consistency: 380 text/html;charset=utf-8 381 text/html;charset=UTF-8 382 Text/HTML;Charset="utf-8" 383 text/html; charset="utf-8" 385 Internet media types ought to be registered with IANA according to 386 the procedures defined in [BCP13]. 388 Note: Unlike some similar constructs in other header fields, media 389 type parameters do not allow whitespace (even "bad" whitespace) 390 around the "=" character. 392 3.1.1.2. Charset 394 HTTP uses charset names to indicate or negotiate the character 395 encoding scheme of a textual representation [RFC6365]. A charset is 396 identified by a case-insensitive token. 398 charset = token 400 Charset names ought to be registered in IANA Character Set registry 401 () according to the 402 procedures defined in [RFC2978]. 404 3.1.1.3. Canonicalization and Text Defaults 406 Internet media types are registered with a canonical form in order to 407 be interoperable among systems with varying native encoding formats. 408 Representations selected or transferred via HTTP ought to be in 409 canonical form, for many of the same reasons described by the 410 Multipurpose Internet Mail Extensions (MIME) [RFC2045]. However, the 411 performance characteristics of email deployments (i.e., store and 412 forward messages to peers) are significantly different from those 413 common to HTTP and the Web (server-based information services). 414 Furthermore, MIME's constraints for the sake of compatibility with 415 older mail transfer protocols do not apply to HTTP (see Appendix A). 417 MIME's canonical form requires that media subtypes of the "text" type 418 use CRLF as the text line break. HTTP allows the transfer of text 419 media with plain CR or LF alone representing a line break, when such 420 line breaks are consistent for an entire representation. An HTTP 421 sender MAY generate, and a recipient MUST be able to parse, line 422 breaks in text media that consist of CRLF, bare CR, or bare LF. In 423 addition, text media in HTTP is not limited to charsets that use 424 octets 13 and 10 for CR and LF, respectively. This flexibility 425 regarding line breaks applies only to text within a representation 426 that has been assigned a "text" media type; it does not apply to 427 "multipart" types or HTTP elements outside the payload body (e.g., 428 header fields). 430 If a representation is encoded with a content-coding, the underlying 431 data ought to be in a form defined above prior to being encoded. 433 3.1.1.4. Multipart Types 435 MIME provides for a number of "multipart" types -- encapsulations of 436 one or more representations within a single message body. All 437 multipart types share a common syntax, as defined in Section 5.1.1 of 438 [RFC2046], and include a boundary parameter as part of the media type 439 value. The message body is itself a protocol element; a sender MUST 440 generate only CRLF to represent line breaks between body parts. 442 HTTP message framing does not use the multipart boundary as an 443 indicator of message body length, though it might be used by 444 implementations that generate or process the payload. For example, 445 the "multipart/form-data" type is often used for carrying form data 446 in a request, as described in [RFC2388], and the "multipart/ 447 byteranges" type is defined by this specification for use in some 206 448 (Partial Content) responses [Part5]. 450 3.1.1.5. Content-Type 452 The "Content-Type" header field indicates the media type of the 453 associated representation: either the representation enclosed in the 454 message payload or the selected representation, as determined by the 455 message semantics. The indicated media type defines both the data 456 format and how that data is intended to be processed by a recipient, 457 within the scope of the received message semantics, after any content 458 codings indicated by Content-Encoding are decoded. 460 Content-Type = media-type 462 Media types are defined in Section 3.1.1.1. An example of the field 463 is 464 Content-Type: text/html; charset=ISO-8859-4 466 A sender that generates a message containing a payload body SHOULD 467 generate a Content-Type header field in that message unless the 468 intended media type of the enclosed representation is unknown to the 469 sender. If a Content-Type header field is not present, the recipient 470 MAY either assume a media type of "application/octet-stream" 471 ([RFC2046], Section 4.5.1) or examine the data to determine its type. 473 In practice, resource owners do not always properly configure their 474 origin server to provide the correct Content-Type for a given 475 representation, with the result that some clients will examine a 476 payload's content and override the specified type. Clients that do 477 so risk drawing incorrect conclusions, which might expose additional 478 security risks (e.g., "privilege escalation"). Furthermore, it is 479 impossible to determine the sender's intent by examining the data 480 format: many data formats match multiple media types that differ only 481 in processing semantics. Implementers are encouraged to provide a 482 means of disabling such "content sniffing" when it is used. 484 3.1.2. Encoding for Compression or Integrity 486 3.1.2.1. Content Codings 488 Content coding values indicate an encoding transformation that has 489 been or can be applied to a representation. Content codings are 490 primarily used to allow a representation to be compressed or 491 otherwise usefully transformed without losing the identity of its 492 underlying media type and without loss of information. Frequently, 493 the representation is stored in coded form, transmitted directly, and 494 only decoded by the final recipient. 496 content-coding = token 498 All content-coding values are case-insensitive and ought to be 499 registered within the HTTP Content Coding registry, as defined in 500 Section 8.4. They are used in the Accept-Encoding (Section 5.3.4) 501 and Content-Encoding (Section 3.1.2.2) header fields. 503 The following content-coding values are defined by this 504 specification: 506 compress (and x-compress): See Section 4.2.1 of [Part1]. 508 deflate: See Section 4.2.2 of [Part1]. 510 gzip (and x-gzip): See Section 4.2.3 of [Part1]. 512 3.1.2.2. Content-Encoding 514 The "Content-Encoding" header field indicates what content codings 515 have been applied to the representation, beyond those inherent in the 516 media type, and thus what decoding mechanisms have to be applied in 517 order to obtain data in the media type referenced by the Content-Type 518 header field. Content-Encoding is primarily used to allow a 519 representation's data to be compressed without losing the identity of 520 its underlying media type. 522 Content-Encoding = 1#content-coding 524 An example of its use is 526 Content-Encoding: gzip 528 If one or more encodings have been applied to a representation, the 529 sender that applied the encodings MUST generate a Content-Encoding 530 header field that lists the content codings in the order in which 531 they were applied. Additional information about the encoding 532 parameters MAY be provided by other header fields not defined by this 533 specification. 535 Unlike Transfer-Encoding (Section 3.3.1 of [Part1]), the codings 536 listed in Content-Encoding are a characteristic of the 537 representation; the representation is defined in terms of the coded 538 form, and all other metadata about the representation is about the 539 coded form unless otherwise noted in the metadata definition. 540 Typically, the representation is only decoded just prior to rendering 541 or analogous usage. 543 If the media type includes an inherent encoding, such as a data 544 format that is always compressed, then that encoding would not be 545 restated in Content-Encoding even if it happens to be the same 546 algorithm as one of the content codings. Such a content coding would 547 only be listed if, for some bizarre reason, it is applied a second 548 time to form the representation. Likewise, an origin server might 549 choose to publish the same data as multiple representations that 550 differ only in whether the coding is defined as part of Content-Type 551 or Content-Encoding, since some user agents will behave differently 552 in their handling of each response (e.g., open a "Save as ..." dialog 553 instead of automatic decompression and rendering of content). 555 An origin server MAY respond with a status code of 415 (Unsupported 556 Media Type) if a representation in the request message has a content 557 coding that is not acceptable. 559 3.1.3. Audience Language 561 3.1.3.1. Language Tags 563 A language tag, as defined in [RFC5646], identifies a natural 564 language spoken, written, or otherwise conveyed by human beings for 565 communication of information to other human beings. Computer 566 languages are explicitly excluded. 568 HTTP uses language tags within the Accept-Language and Content- 569 Language header fields. Accept-Language uses the broader language- 570 range production defined in Section 5.3.5, whereas Content-Language 571 uses the language-tag production defined below. 573 language-tag = 575 A language tag is a sequence of one or more case-insensitive subtags, 576 each separated by a hyphen character ("-", %x2D). In most cases, a 577 language tag consists of a primary language subtag that identifies a 578 broad family of related languages (e.g., "en" = English) which is 579 optionally followed by a series of subtags that refine or narrow that 580 language's range (e.g., "en-CA" = the variety of English as 581 communicated in Canada). Whitespace is not allowed within a language 582 tag. Example tags include: 584 fr, en-US, es-419, az-Arab, x-pig-latin, man-Nkoo-GN 586 See [RFC5646] for further information. 588 3.1.3.2. Content-Language 590 The "Content-Language" header field describes the natural language(s) 591 of the intended audience for the representation. Note that this 592 might not be equivalent to all the languages used within the 593 representation. 595 Content-Language = 1#language-tag 597 Language tags are defined in Section 3.1.3.1. The primary purpose of 598 Content-Language is to allow a user to identify and differentiate 599 representations according to the users' own preferred language. 600 Thus, if the content is intended only for a Danish-literate audience, 601 the appropriate field is 603 Content-Language: da 605 If no Content-Language is specified, the default is that the content 606 is intended for all language audiences. This might mean that the 607 sender does not consider it to be specific to any natural language, 608 or that the sender does not know for which language it is intended. 610 Multiple languages MAY be listed for content that is intended for 611 multiple audiences. For example, a rendition of the "Treaty of 612 Waitangi", presented simultaneously in the original Maori and English 613 versions, would call for 615 Content-Language: mi, en 617 However, just because multiple languages are present within a 618 representation does not mean that it is intended for multiple 619 linguistic audiences. An example would be a beginner's language 620 primer, such as "A First Lesson in Latin", which is clearly intended 621 to be used by an English-literate audience. In this case, the 622 Content-Language would properly only include "en". 624 Content-Language MAY be applied to any media type -- it is not 625 limited to textual documents. 627 3.1.4. Identification 629 3.1.4.1. Identifying a Representation 631 When a complete or partial representation is transferred in a message 632 payload, it is often desirable for the sender to supply, or the 633 recipient to determine, an identifier for a resource corresponding to 634 that representation. 636 For a request message: 638 o If the request has a Content-Location header field, then the 639 sender asserts that the payload is a representation of the 640 resource identified by the Content-Location field-value. However, 641 such an assertion cannot be trusted unless it can be verified by 642 other means (not defined by this specification). The information 643 might still be useful for revision history links. 645 o Otherwise, the payload is unidentified. 647 For a response message, the following rules are applied in order 648 until a match is found: 650 1. If the request is GET or HEAD and the response status code is 200 651 (OK), 204 (No Content), 206 (Partial Content), or 304 (Not 652 Modified), the payload is a representation of the resource 653 identified by the effective request URI (Section 5.5 of [Part1]). 655 2. If the request is GET or HEAD and the response status code is 203 656 (Non-Authoritative Information), the payload is a potentially 657 modified or enhanced representation of the target resource as 658 provided by an intermediary. 660 3. If the response has a Content-Location header field and its 661 field-value is a reference to the same URI as the effective 662 request URI, the payload is a representation of the resource 663 identified by the effective request URI. 665 4. If the response has a Content-Location header field and its 666 field-value is a reference to a URI different from the effective 667 request URI, then the sender asserts that the payload is a 668 representation of the resource identified by the Content-Location 669 field-value. However, such an assertion cannot be trusted unless 670 it can be verified by other means (not defined by this 671 specification). 673 5. Otherwise, the payload is unidentified. 675 3.1.4.2. Content-Location 677 The "Content-Location" header field references a URI that can be used 678 as an identifier for a specific resource corresponding to the 679 representation in this message's payload. In other words, if one 680 were to perform a GET request on this URI at the time of this 681 message's generation, then a 200 (OK) response would contain the same 682 representation that is enclosed as payload in this message. 684 Content-Location = absolute-URI / partial-URI 686 The Content-Location value is not a replacement for the effective 687 Request URI (Section 5.5 of [Part1]). It is representation metadata. 688 It has the same syntax and semantics as the header field of the same 689 name defined for MIME body parts in Section 4 of [RFC2557]. However, 690 its appearance in an HTTP message has some special implications for 691 HTTP recipients. 693 If Content-Location is included in a 2xx (Successful) response 694 message and its value refers (after conversion to absolute form) to a 695 URI that is the same as the effective request URI, then the recipient 696 MAY consider the payload to be a current representation of that 697 resource at the time indicated by the message origination date. For 698 a GET or HEAD request, this is the same as the default semantics when 699 no Content-Location is provided by the server. For a state-changing 700 request like PUT or POST, it implies that the server's response 701 contains the new representation of that resource, thereby 702 distinguishing it from representations that might only report about 703 the action (e.g., "It worked!"). This allows authoring applications 704 to update their local copies without the need for a subsequent GET 705 request. 707 If Content-Location is included in a 2xx (Successful) response 708 message and its field-value refers to a URI that differs from the 709 effective request URI, then the origin server claims that the URI is 710 an identifier for a different resource corresponding to the enclosed 711 representation. Such a claim can only be trusted if both identifiers 712 share the same resource owner, which cannot be programmatically 713 determined via HTTP. 715 o For a response to a GET or HEAD request, this is an indication 716 that the effective request URI refers to a resource that is 717 subject to content negotiation and the Content-Location field- 718 value is a more specific identifier for the selected 719 representation. 721 o For a 201 (Created) response to a state-changing method, a 722 Content-Location field-value that is identical to the Location 723 field-value indicates that this payload is a current 724 representation of the newly created resource. 726 o Otherwise, such a Content-Location indicates that this payload is 727 a representation reporting on the requested action's status and 728 that the same report is available (for future access with GET) at 729 the given URI. For example, a purchase transaction made via a 730 POST request might include a receipt document as the payload of 731 the 200 (OK) response; the Content-Location field-value provides 732 an identifier for retrieving a copy of that same receipt in the 733 future. 735 A user agent that sends Content-Location in a request message is 736 stating that its value refers to where the user agent originally 737 obtained the content of the enclosed representation (prior to any 738 modifications made by that user agent). In other words, the user 739 agent is providing a back link to the source of the original 740 representation. 742 An origin server that receives a Content-Location field in a request 743 message MUST treat the information as transitory request context 744 rather than as metadata to be saved verbatim as part of the 745 representation. An origin server MAY use that context to guide in 746 processing the request or to save it for other uses, such as within 747 source links or versioning metadata. However, an origin server MUST 748 NOT use such context information to alter the request semantics. 750 For example, if a client makes a PUT request on a negotiated resource 751 and the origin server accepts that PUT (without redirection), then 752 the new state of that resource is expected to be consistent with the 753 one representation supplied in that PUT; the Content-Location cannot 754 be used as a form of reverse content selection identifier to update 755 only one of the negotiated representations. If the user agent had 756 wanted the latter semantics, it would have applied the PUT directly 757 to the Content-Location URI. 759 3.2. Representation Data 761 The representation data associated with an HTTP message is either 762 provided as the payload body of the message or referred to by the 763 message semantics and the effective request URI. The representation 764 data is in a format and encoding defined by the representation 765 metadata header fields. 767 The data type of the representation data is determined via the header 768 fields Content-Type and Content-Encoding. These define a two-layer, 769 ordered encoding model: 771 representation-data := Content-Encoding( Content-Type( bits ) ) 773 3.3. Payload Semantics 775 Some HTTP messages transfer a complete or partial representation as 776 the message "payload". In some cases, a payload might contain only 777 the associated representation's header fields (e.g., responses to 778 HEAD) or only some part(s) of the representation data (e.g., the 206 779 (Partial Content) status code). 781 The purpose of a payload in a request is defined by the method 782 semantics. For example, a representation in the payload of a PUT 783 request (Section 4.3.4) represents the desired state of the target 784 resource if the request is successfully applied, whereas a 785 representation in the payload of a POST request (Section 4.3.3) 786 represents an anonymous resource for providing data to be processed, 787 such as the information that a user entered within an HTML form. 789 In a response, the payload's purpose is defined by both the request 790 method and the response status code. For example, the payload of a 791 200 (OK) response to GET (Section 4.3.1) represents the current state 792 of the target resource, as observed at the time of the message 793 origination date (Section 7.1.1.2), whereas the payload of the same 794 status code in a response to POST might represent either the 795 processing result or the new state of the target resource after 796 applying the processing. Response messages with an error status code 797 usually contain a payload that represents the error condition, such 798 that it describes the error state and what next steps are suggested 799 for resolving it. 801 Header fields that specifically describe the payload, rather than the 802 associated representation, are referred to as "payload header 803 fields". Payload header fields are defined in other parts of this 804 specification, due to their impact on message parsing. 806 +-------------------+--------------------------+ 807 | Header Field Name | Defined in... | 808 +-------------------+--------------------------+ 809 | Content-Length | Section 3.3.2 of [Part1] | 810 | Content-Range | Section 4.2 of [Part5] | 811 | Transfer-Encoding | Section 3.3.1 of [Part1] | 812 +-------------------+--------------------------+ 814 3.4. Content Negotiation 816 When responses convey payload information, whether indicating a 817 success or an error, the origin server often has different ways of 818 representing that information; for example, in different formats, 819 languages, or encodings. Likewise, different users or user agents 820 might have differing capabilities, characteristics, or preferences 821 that could influence which representation, among those available, 822 would be best to deliver. For this reason, HTTP provides mechanisms 823 for content negotiation. 825 This specification defines two patterns of content negotiation that 826 can be made visible within the protocol: "proactive", where the 827 server selects the representation based upon the user agent's stated 828 preferences, and "reactive" negotiation, where the server provides a 829 list of representations for the user agent to choose from. Other 830 patterns of content negotiation include "conditional content", where 831 the representation consists of multiple parts that are selectively 832 rendered based on user agent parameters, "active content", where the 833 representation contains a script that makes additional (more 834 specific) requests based on the user agent characteristics, and 835 "Transparent Content Negotiation" ([RFC2295]), where content 836 selection is performed by an intermediary. These patterns are not 837 mutually exclusive, and each has trade-offs in applicability and 838 practicality. 840 Note that, in all cases, HTTP is not aware of the resource semantics. 841 The consistency with which an origin server responds to requests, 842 over time and over the varying dimensions of content negotiation, and 843 thus the "sameness" of a resource's observed representations over 844 time, is determined entirely by whatever entity or algorithm selects 845 or generates those responses. HTTP pays no attention to the man 846 behind the curtain. 848 3.4.1. Proactive Negotiation 850 When content negotiation preferences are sent by the user agent in a 851 request to encourage an algorithm located at the server to select the 852 preferred representation, it is called proactive negotiation (a.k.a., 853 server-driven negotiation). Selection is based on the available 854 representations for a response (the dimensions over which it might 855 vary, such as language, content-coding, etc.) compared to various 856 information supplied in the request, including both the explicit 857 negotiation fields of Section 5.3 and implicit characteristics, such 858 as the client's network address or parts of the User-Agent field. 860 Proactive negotiation is advantageous when the algorithm for 861 selecting from among the available representations is difficult to 862 describe to a user agent, or when the server desires to send its 863 "best guess" to the user agent along with the first response (hoping 864 to avoid the round-trip delay of a subsequent request if the "best 865 guess" is good enough for the user). In order to improve the 866 server's guess, a user agent MAY send request header fields that 867 describe its preferences. 869 Proactive negotiation has serious disadvantages: 871 o It is impossible for the server to accurately determine what might 872 be "best" for any given user, since that would require complete 873 knowledge of both the capabilities of the user agent and the 874 intended use for the response (e.g., does the user want to view it 875 on screen or print it on paper?); 877 o Having the user agent describe its capabilities in every request 878 can be both very inefficient (given that only a small percentage 879 of responses have multiple representations) and a potential risk 880 to the user's privacy; 882 o It complicates the implementation of an origin server and the 883 algorithms for generating responses to a request; and, 885 o It limits the reusability of responses for shared caching. 887 A user agent cannot rely on proactive negotiation preferences being 888 consistently honored, since the origin server might not implement 889 proactive negotiation for the requested resource or might decide that 890 sending a response that doesn't conform to the user agent's 891 preferences is better than sending a 406 (Not Acceptable) response. 893 An origin server MAY generate a Vary header field (Section 7.1.4) in 894 responses that are subject to proactive negotiation to indicate what 895 parameters of request information might be used in its selection 896 algorithm, thereby providing a means for recipients to determine the 897 reusability of that same response for user agents with differing 898 request information. 900 3.4.2. Reactive Negotiation 902 With reactive negotiation (a.k.a., agent-driven negotiation), 903 selection of the best response representation (regardless of the 904 status code) is performed by the user agent after receiving an 905 initial response from the origin server that contains a list of 906 resources for alternative representations. If the user agent is not 907 satisfied by the initial response representation, it can perform a 908 GET request on one or more of the alternative resources, selected 909 based on metadata included in the list, to obtain a different form of 910 representation for that response. Selection of alternatives might be 911 performed automatically by the user agent or manually by the user 912 selecting from a generated (possibly hypertext) menu. 914 Note that the above refers to representations of the response, in 915 general, not representations of the resource. The alternative 916 representations are only considered representations of the target 917 resource if the response in which those alternatives are provided has 918 the semantics of being a representation of the target resource (e.g., 919 a 200 (OK) response to a GET request) or has the semantics of 920 providing links to alternative representations for the target 921 resource (e.g., a 300 (Multiple Choices) response to a GET request). 923 A server might choose not to send an initial representation, other 924 than the list of alternatives, and thereby indicate that reactive 925 negotiation by the user agent is preferred. For example, the 926 alternatives listed in responses with the 300 (Multiple Choices) and 927 406 (Not Acceptable) status codes include information about the 928 available representations so that the user or user agent can react by 929 making a selection. 931 Reactive negotiation is advantageous when the response would vary 932 over commonly-used dimensions (such as type, language, or encoding), 933 when the origin server is unable to determine a user agent's 934 capabilities from examining the request, and generally when public 935 caches are used to distribute server load and reduce network usage. 937 Reactive negotiation suffers from the disadvantages of transmitting a 938 list of alternatives to the user agent, which degrades user-perceived 939 latency if transmitted in the header section, and needing a second 940 request to obtain an alternate representation. Furthermore, this 941 specification does not define a mechanism for supporting automatic 942 selection, though it does not prevent such a mechanism from being 943 developed as an extension. 945 4. Request Methods 947 4.1. Overview 949 The request method token is the primary source of request semantics; 950 it indicates the purpose for which the client has made this request 951 and what is expected by the client as a successful result. 953 The request method's semantics might be further specialized by the 954 semantics of some header fields when present in a request (Section 5) 955 if those additional semantics do not conflict with the method. For 956 example, a client can send conditional request header fields 957 (Section 5.2) to make the requested action conditional on the current 958 state of the target resource ([Part4]). 960 method = token 962 HTTP was originally designed to be usable as an interface to 963 distributed object systems. The request method was envisioned as 964 applying semantics to a target resource in much the same way as 965 invoking a defined method on an identified object would apply 966 semantics. The method token is case-sensitive because it might be 967 used as a gateway to object-based systems with case-sensitive method 968 names. 970 Unlike distributed objects, the standardized request methods in HTTP 971 are not resource-specific, since uniform interfaces provide for 972 better visibility and reuse in network-based systems [REST]. Once 973 defined, a standardized method ought to have the same semantics when 974 applied to any resource, though each resource determines for itself 975 whether those semantics are implemented or allowed. 977 This specification defines a number of standardized methods that are 978 commonly used in HTTP, as outlined by the following table. By 979 convention, standardized methods are defined in all-uppercase ASCII 980 letters. 982 +---------+-------------------------------------------------+-------+ 983 | Method | Description | Sec. | 984 +---------+-------------------------------------------------+-------+ 985 | GET | Transfer a current representation of the target | 4.3.1 | 986 | | resource. | | 987 | HEAD | Same as GET, but only transfer the status line | 4.3.2 | 988 | | and header section. | | 989 | POST | Perform resource-specific processing on the | 4.3.3 | 990 | | request payload. | | 991 | PUT | Replace all current representations of the | 4.3.4 | 992 | | target resource with the request payload. | | 993 | DELETE | Remove all current representations of the | 4.3.5 | 994 | | target resource. | | 995 | CONNECT | Establish a tunnel to the server identified by | 4.3.6 | 996 | | the target resource. | | 997 | OPTIONS | Describe the communication options for the | 4.3.7 | 998 | | target resource. | | 999 | TRACE | Perform a message loop-back test along the path | 4.3.8 | 1000 | | to the target resource. | | 1001 +---------+-------------------------------------------------+-------+ 1003 All general-purpose servers MUST support the methods GET and HEAD. 1004 All other methods are OPTIONAL; when implemented, a server MUST 1005 implement the above methods according to the semantics defined for 1006 them in Section 4.3. 1008 Additional methods, outside the scope of this specification, have 1009 been standardized for use in HTTP. All such methods ought to be 1010 registered within the HTTP Method Registry maintained by IANA, as 1011 defined in Section 8.1. 1013 The set of methods allowed by a target resource can be listed in an 1014 Allow header field (Section 7.4.1). However, the set of allowed 1015 methods can change dynamically. When a request method is received 1016 that is unrecognized or not implemented by an origin server, the 1017 origin server SHOULD respond with the 501 (Not Implemented) status 1018 code. When a request method is received that is known by an origin 1019 server but not allowed for the target resource, the origin server 1020 SHOULD respond with the 405 (Method Not Allowed) status code. 1022 4.2. Common Method Properties 1024 4.2.1. Safe Methods 1026 Request methods are considered "safe" if their defined semantics are 1027 essentially read-only; i.e., the client does not request, and does 1028 not expect, any state change on the origin server as a result of 1029 applying a safe method to a target resource. Likewise, reasonable 1030 use of a safe method is not expected to cause any harm, loss of 1031 property, or unusual burden on the origin server. 1033 This definition of safe methods does not prevent an implementation 1034 from including behavior that is potentially harmful, not entirely 1035 read-only, or which causes side-effects while invoking a safe method. 1036 What is important, however, is that the client did not request that 1037 additional behavior and cannot be held accountable for it. For 1038 example, most servers append request information to access log files 1039 at the completion of every response, regardless of the method, and 1040 that is considered safe even though the log storage might become full 1041 and crash the server. Likewise, a safe request initiated by 1042 selecting an advertisement on the Web will often have the side-effect 1043 of charging an advertising account. 1045 Of the request methods defined by this specification, the GET, HEAD, 1046 OPTIONS, and TRACE methods are defined to be safe. 1048 The purpose of distinguishing between safe and unsafe methods is to 1049 allow automated retrieval processes (spiders) and cache performance 1050 optimization (pre-fetching) to work without fear of causing harm. In 1051 addition, it allows a user agent to apply appropriate constraints on 1052 the automated use of unsafe methods when processing potentially 1053 untrusted content. 1055 A user agent SHOULD distinguish between safe and unsafe methods when 1056 presenting potential actions to a user, such that the user can be 1057 made aware of an unsafe action before it is requested. 1059 When a resource is constructed such that parameters within the 1060 effective request URI have the effect of selecting an action, it is 1061 the resource owner's responsibility to ensure that the action is 1062 consistent with the request method semantics. For example, it is 1063 common for Web-based content editing software to use actions within 1064 query parameters, such as "page?do=delete". If the purpose of such a 1065 resource is to perform an unsafe action, then the resource owner MUST 1066 disable or disallow that action when it is accessed using a safe 1067 request method. Failure to do so will result in unfortunate side- 1068 effects when automated processes perform a GET on every URI reference 1069 for the sake of link maintenance, pre-fetching, building a search 1070 index, etc. 1072 4.2.2. Idempotent Methods 1074 Request methods are considered "idempotent" if the intended effect of 1075 multiple identical requests is the same as for a single request. Of 1076 the request methods defined by this specification, the PUT, DELETE, 1077 and safe request methods are idempotent. 1079 Like the definition of safe, the idempotent property only applies to 1080 what has been requested by the user; a server is free to log each 1081 request separately, retain a revision control history, or implement 1082 other non-idempotent side-effects for each idempotent request. 1084 Idempotent methods are distinguished because the request can be 1085 repeated automatically if a communication failure occurs before the 1086 client is able to read the server's response. For example, if a 1087 client sends a PUT request and the underlying connection is closed 1088 before any response is received, then it can establish a new 1089 connection and retry the idempotent request because it knows that 1090 repeating the request will have the same effect even if the original 1091 request succeeded. Note, however, that repeated failures would 1092 indicate a problem within the server. 1094 4.2.3. Cacheable Methods 1096 Request methods can be defined as "cacheable" to indicate that 1097 responses to them are allowed to be stored for future reuse; for 1098 specific requirements see [Part6]. In general, safe methods that do 1099 not depend on a current or authoritative response are defined as 1100 cacheable; this specification defines GET, HEAD and POST as 1101 cacheable, although the overwhelming majority of cache 1102 implementations only support GET and HEAD. 1104 4.3. Method Definitions 1106 4.3.1. GET 1108 The GET method requests transfer of a current selected representation 1109 for the target resource. GET is the primary mechanism of information 1110 retrieval and the focus of almost all performance optimizations. 1111 Hence, when people speak of retrieving some identifiable information 1112 via HTTP, they are generally referring to making a GET request. 1114 It is tempting to think of resource identifiers as remote filesystem 1115 pathnames, and of representations as being a copy of the contents of 1116 such files. In fact, that is how many resources are implemented (see 1117 Section 9.1 for related security considerations). However, there are 1118 no such limitations in practice. The HTTP interface for a resource 1119 is just as likely to be implemented as a tree of content objects, a 1120 programmatic view on various database records, or a gateway to other 1121 information systems. Even when the URI mapping mechanism is tied to 1122 a filesystem, an origin server might be configured to execute the 1123 files with the request as input and send the output as the 1124 representation, rather than transfer the files directly. Regardless, 1125 only the origin server needs to know how each of its resource 1126 identifiers corresponds to an implementation, and how each 1127 implementation manages to select and send a current representation of 1128 the target resource in a response to GET. 1130 A client can alter the semantics of GET to be a "range request", 1131 requesting transfer of only some part(s) of the selected 1132 representation, by sending a Range header field in the request 1133 ([Part5]). 1135 A payload within a GET request message has no defined semantics; 1136 sending a payload body on a GET request might cause some existing 1137 implementations to reject the request. 1139 The response to a GET request is cacheable; a cache MAY use it to 1140 satisfy subsequent GET and HEAD requests unless otherwise indicated 1141 by the Cache-Control header field (Section 5.2 of [Part6]). 1143 4.3.2. HEAD 1145 The HEAD method is identical to GET except that the server MUST NOT 1146 send a message body in the response (i.e., the response terminates at 1147 the end of the header section). The server SHOULD send the same 1148 header fields in response to a HEAD request as it would have sent if 1149 the request had been a GET, except that the payload header fields 1150 (Section 3.3) MAY be omitted. This method can be used for obtaining 1151 metadata about the selected representation without transferring the 1152 representation data and is often used for testing hypertext links for 1153 validity, accessibility, and recent modification. 1155 A payload within a HEAD request message has no defined semantics; 1156 sending a payload body on a HEAD request might cause some existing 1157 implementations to reject the request. 1159 The response to a HEAD request is cacheable; a cache MAY use it to 1160 satisfy subsequent HEAD requests unless otherwise indicated by the 1161 Cache-Control header field (Section 5.2 of [Part6]). A HEAD response 1162 might also have an effect on previously cached responses to GET; see 1163 Section 4.3.5 of [Part6]. 1165 4.3.3. POST 1167 The POST method requests that the target resource process the 1168 representation enclosed in the request according to the resource's 1169 own specific semantics. For example, POST is used for the following 1170 functions (among others): 1172 o Providing a block of data, such as the fields entered into an HTML 1173 form, to a data-handling process; 1175 o Posting a message to a bulletin board, newsgroup, mailing list, 1176 blog, or similar group of articles; 1178 o Creating a new resource that has yet to be identified by the 1179 origin server; and 1181 o Appending data to a resource's existing representation(s). 1183 An origin server indicates response semantics by choosing an 1184 appropriate status code depending on the result of processing the 1185 POST request; almost all of the status codes defined by this 1186 specification might be received in a response to POST (the exceptions 1187 being 206, 304, and 416). 1189 If one or more resources has been created on the origin server as a 1190 result of successfully processing a POST request, the origin server 1191 SHOULD send a 201 (Created) response containing a Location header 1192 field that provides an identifier for the primary resource created 1193 (Section 7.1.2) and a representation that describes the status of the 1194 request while referring to the new resource(s). 1196 Responses to POST requests are only cacheable when they include 1197 explicit freshness information (see Section 4.2.1 of [Part6]). 1198 However, POST caching is not widely implemented. For cases where an 1199 origin server wishes the client to be able to cache the result of a 1200 POST in a way that can be reused by a later GET, the origin server 1201 MAY send a 200 (OK) response containing the result and a Content- 1202 Location header field that has the same value as the POST's effective 1203 request URI (Section 3.1.4.2). 1205 If the result of processing a POST would be equivalent to a 1206 representation of an existing resource, an origin server MAY redirect 1207 the user agent to that resource by sending a 303 (See Other) response 1208 with the existing resource's identifier in the Location field. This 1209 has the benefits of providing the user agent a resource identifier 1210 and transferring the representation via a method more amenable to 1211 shared caching, though at the cost of an extra request if the user 1212 agent does not already have the representation cached. 1214 4.3.4. PUT 1216 The PUT method requests that the state of the target resource be 1217 created or replaced with the state defined by the representation 1218 enclosed in the request message payload. A successful PUT of a given 1219 representation would suggest that a subsequent GET on that same 1220 target resource will result in an equivalent representation being 1221 sent in a 200 (OK) response. However, there is no guarantee that 1222 such a state change will be observable, since the target resource 1223 might be acted upon by other user agents in parallel, or might be 1224 subject to dynamic processing by the origin server, before any 1225 subsequent GET is received. A successful response only implies that 1226 the user agent's intent was achieved at the time of its processing by 1227 the origin server. 1229 If the target resource does not have a current representation and the 1230 PUT successfully creates one, then the origin server MUST inform the 1231 user agent by sending a 201 (Created) response. If the target 1232 resource does have a current representation and that representation 1233 is successfully modified in accordance with the state of the enclosed 1234 representation, then the origin server MUST send either a 200 (OK) or 1235 a 204 (No Content) response to indicate successful completion of the 1236 request. 1238 An origin server SHOULD ignore unrecognized header fields received in 1239 a PUT request (i.e., do not save them as part of the resource state). 1241 An origin server SHOULD verify that the PUT representation is 1242 consistent with any constraints the server has for the target 1243 resource that cannot or will not be changed by the PUT. This is 1244 particularly important when the origin server uses internal 1245 configuration information related to the URI in order to set the 1246 values for representation metadata on GET responses. When a PUT 1247 representation is inconsistent with the target resource, the origin 1248 server SHOULD either make them consistent, by transforming the 1249 representation or changing the resource configuration, or respond 1250 with an appropriate error message containing sufficient information 1251 to explain why the representation is unsuitable. The 409 (Conflict) 1252 or 415 (Unsupported Media Type) status codes are suggested, with the 1253 latter being specific to constraints on Content-Type values. 1255 For example, if the target resource is configured to always have a 1256 Content-Type of "text/html" and the representation being PUT has a 1257 Content-Type of "image/jpeg", the origin server ought to do one of: 1259 a. reconfigure the target resource to reflect the new media type; 1261 b. transform the PUT representation to a format consistent with that 1262 of the resource before saving it as the new resource state; or, 1264 c. reject the request with a 415 (Unsupported Media Type) response 1265 indicating that the target resource is limited to "text/html", 1266 perhaps including a link to a different resource that would be a 1267 suitable target for the new representation. 1269 HTTP does not define exactly how a PUT method affects the state of an 1270 origin server beyond what can be expressed by the intent of the user 1271 agent request and the semantics of the origin server response. It 1272 does not define what a resource might be, in any sense of that word, 1273 beyond the interface provided via HTTP. It does not define how 1274 resource state is "stored", nor how such storage might change as a 1275 result of a change in resource state, nor how the origin server 1276 translates resource state into representations. Generally speaking, 1277 all implementation details behind the resource interface are 1278 intentionally hidden by the server. 1280 An origin server MUST NOT send a validator header field 1281 (Section 7.2), such as an ETag or Last-Modified field, in a 1282 successful response to PUT unless the request's representation data 1283 was saved without any transformation applied to the body (i.e., the 1284 resource's new representation data is identical to the representation 1285 data received in the PUT request) and the validator field value 1286 reflects the new representation. This requirement allows a user 1287 agent to know when the representation body it has in memory remains 1288 current as a result of the PUT, thus not in need of retrieving again 1289 from the origin server, and that the new validator(s) received in the 1290 response can be used for future conditional requests in order to 1291 prevent accidental overwrites (Section 5.2). 1293 The fundamental difference between the POST and PUT methods is 1294 highlighted by the different intent for the enclosed representation. 1295 The target resource in a POST request is intended to handle the 1296 enclosed representation according to the resource's own semantics, 1297 whereas the enclosed representation in a PUT request is defined as 1298 replacing the state of the target resource. Hence, the intent of PUT 1299 is idempotent and visible to intermediaries, even though the exact 1300 effect is only known by the origin server. 1302 Proper interpretation of a PUT request presumes that the user agent 1303 knows which target resource is desired. A service that selects a 1304 proper URI on behalf of the client, after receiving a state-changing 1305 request, SHOULD be implemented using the POST method rather than PUT. 1306 If the origin server will not make the requested PUT state change to 1307 the target resource and instead wishes to have it applied to a 1308 different resource, such as when the resource has been moved to a 1309 different URI, then the origin server MUST send an appropriate 3xx 1310 (Redirection) response; the user agent MAY then make its own decision 1311 regarding whether or not to redirect the request. 1313 A PUT request applied to the target resource can have side-effects on 1314 other resources. For example, an article might have a URI for 1315 identifying "the current version" (a resource) that is separate from 1316 the URIs identifying each particular version (different resources 1317 that at one point shared the same state as the current version 1318 resource). A successful PUT request on "the current version" URI 1319 might therefore create a new version resource in addition to changing 1320 the state of the target resource, and might also cause links to be 1321 added between the related resources. 1323 An origin server that allows PUT on a given target resource MUST send 1324 a 400 (Bad Request) response to a PUT request that contains a 1325 Content-Range header field (Section 4.2 of [Part5]), since the 1326 payload is likely to be partial content that has been mistakenly PUT 1327 as a full representation. Partial content updates are possible by 1328 targeting a separately identified resource with state that overlaps a 1329 portion of the larger resource, or by using a different method that 1330 has been specifically defined for partial updates (for example, the 1331 PATCH method defined in [RFC5789]). 1333 Responses to the PUT method are not cacheable. If a successful PUT 1334 request passes through a cache that has one or more stored responses 1335 for the effective request URI, those stored responses will be 1336 invalidated (see Section 4.4 of [Part6]). 1338 4.3.5. DELETE 1340 The DELETE method requests that the origin server remove the 1341 association between the target resource and its current 1342 functionality. In effect, this method is similar to the rm command 1343 in UNIX: it expresses a deletion operation on the URI mapping of the 1344 origin server, rather than an expectation that the previously 1345 associated information be deleted. 1347 If the target resource has one or more current representations, they 1348 might or might not be destroyed by the origin server, and the 1349 associated storage might or might not be reclaimed, depending 1350 entirely on the nature of the resource and its implementation by the 1351 origin server (which are beyond the scope of this specification). 1352 Likewise, other implementation aspects of a resource might need to be 1353 deactivated or archived as a result of a DELETE, such as database or 1354 gateway connections. In general, it is assumed that the origin 1355 server will only allow DELETE on resources for which it has a 1356 prescribed mechanism for accomplishing the deletion. 1358 Relatively few resources allow the DELETE method -- its primary use 1359 is for remote authoring environments, where the user has some 1360 direction regarding its effect. For example, a resource that was 1361 previously created using a PUT request, or identified via the 1362 Location header field after a 201 (Created) response to a POST 1363 request, might allow a corresponding DELETE request to undo those 1364 actions. Similarly, custom user agent implementations that implement 1365 an authoring function, such as revision control clients using HTTP 1366 for remote operations, might use DELETE based on an assumption that 1367 the server's URI space has been crafted to correspond to a version 1368 repository. 1370 If a DELETE method is successfully applied, the origin server SHOULD 1371 send a 202 (Accepted) status code if the action will likely succeed 1372 but has not yet been enacted, a 204 (No Content) status code if the 1373 action has been enacted and no further information is to be supplied, 1374 or a 200 (OK) status code if the action has been enacted and the 1375 response message includes a representation describing the status. 1377 A payload within a DELETE request message has no defined semantics; 1378 sending a payload body on a DELETE request might cause some existing 1379 implementations to reject the request. 1381 Responses to the DELETE method are not cacheable. If a DELETE 1382 request passes through a cache that has one or more stored responses 1383 for the effective request URI, those stored responses will be 1384 invalidated (see Section 4.4 of [Part6]). 1386 4.3.6. CONNECT 1388 The CONNECT method requests that the recipient establish a tunnel to 1389 the destination origin server identified by the request-target and, 1390 if successful, thereafter restrict its behavior to blind forwarding 1391 of packets, in both directions, until the tunnel is closed. 1393 CONNECT is intended only for use in requests to a proxy. An origin 1394 server that receives a CONNECT request for itself MAY respond with a 1395 2xx status code to indicate that a connection is established. 1396 However, most origin servers do not implement CONNECT. 1398 A client sending a CONNECT request MUST send the authority form of 1399 request-target (Section 5.3 of [Part1]); i.e., the request-target 1400 consists of only the host name and port number of the tunnel 1401 destination, separated by a colon. For example, 1403 CONNECT server.example.com:80 HTTP/1.1 1404 Host: server.example.com:80 1406 The recipient proxy can establish a tunnel either by directly 1407 connecting to the request-target or, if configured to use another 1408 proxy, by forwarding the CONNECT request to the next inbound proxy. 1409 Any 2xx (Successful) response indicates that the sender (and all 1410 inbound proxies) will switch to tunnel mode immediately after the 1411 blank line that concludes the successful response's header section; 1412 data received after that blank line is from the server identified by 1413 the request-target. Any response other than a successful response 1414 indicates that the tunnel has not yet been formed and that the 1415 connection remains governed by HTTP. 1417 A tunnel is closed when a tunnel intermediary detects that either 1418 side has closed its connection: the intermediary MUST attempt to send 1419 any outstanding data that came from the closed side to the other 1420 side, close both connections, and then discard any remaining data 1421 left undelivered. 1423 Proxy authentication might be used to establish the authority to 1424 create a tunnel. For example, 1426 CONNECT server.example.com:80 HTTP/1.1 1427 Host: server.example.com:80 1428 Proxy-Authorization: basic aGVsbG86d29ybGQ= 1430 There are significant risks in establishing a tunnel to arbitrary 1431 servers, particularly when the destination is a well-known or 1432 reserved TCP port that is not intended for Web traffic. For example, 1433 a CONNECT to a request-target of "example.com:25" would suggest that 1434 the proxy connect to the reserved port for SMTP traffic; if allowed, 1435 that could trick the proxy into relaying spam email. Proxies that 1436 support CONNECT SHOULD restrict its use to a limited set of known 1437 ports or a configurable whitelist of safe request targets. 1439 A server MUST NOT send any Transfer-Encoding or Content-Length header 1440 fields in a 2xx (Successful) response to CONNECT. A client MUST 1441 ignore any Content-Length or Transfer-Encoding header fields received 1442 in a successful response to CONNECT. 1444 A payload within a CONNECT request message has no defined semantics; 1445 sending a payload body on a CONNECT request might cause some existing 1446 implementations to reject the request. 1448 Responses to the CONNECT method are not cacheable. 1450 4.3.7. OPTIONS 1452 The OPTIONS method requests information about the communication 1453 options available for the target resource, either at the origin 1454 server or an intervening intermediary. This method allows a client 1455 to determine the options and/or requirements associated with a 1456 resource, or the capabilities of a server, without implying a 1457 resource action. 1459 An OPTIONS request with an asterisk ("*") as the request-target 1460 (Section 5.3 of [Part1]) applies to the server in general rather than 1461 to a specific resource. Since a server's communication options 1462 typically depend on the resource, the "*" request is only useful as a 1463 "ping" or "no-op" type of method; it does nothing beyond allowing the 1464 client to test the capabilities of the server. For example, this can 1465 be used to test a proxy for HTTP/1.1 conformance (or lack thereof). 1467 If the request-target is not an asterisk, the OPTIONS request applies 1468 to the options that are available when communicating with the target 1469 resource. 1471 A server generating a successful response to OPTIONS SHOULD send any 1472 header fields that might indicate optional features implemented by 1473 the server and applicable to the target resource (e.g., Allow), 1474 including potential extensions not defined by this specification. 1475 The response payload, if any, might also describe the communication 1476 options in a machine or human-readable representation. A standard 1477 format for such a representation is not defined by this 1478 specification, but might be defined by future extensions to HTTP. A 1479 server MUST generate a Content-Length field with a value of "0" if no 1480 payload body is to be sent in the response. 1482 A client MAY send a Max-Forwards header field in an OPTIONS request 1483 to target a specific recipient in the request chain (see 1484 Section 5.1.2). A proxy MUST NOT generate a Max-Forwards header 1485 field while forwarding a request unless that request was received 1486 with a Max-Forwards field. 1488 A client that generates an OPTIONS request containing a payload body 1489 MUST send a valid Content-Type header field describing the 1490 representation media type. Although this specification does not 1491 define any use for such a payload, future extensions to HTTP might 1492 use the OPTIONS body to make more detailed queries about the target 1493 resource. 1495 Responses to the OPTIONS method are not cacheable. 1497 4.3.8. TRACE 1499 The TRACE method requests a remote, application-level loop-back of 1500 the request message. The final recipient of the request SHOULD 1501 reflect the message received, excluding some fields described below, 1502 back to the client as the message body of a 200 (OK) response with a 1503 Content-Type of "message/http" (Section 8.3.1 of [Part1]). The final 1504 recipient is either the origin server or the first server to receive 1505 a Max-Forwards value of zero (0) in the request (Section 5.1.2). 1507 A client MUST NOT generate header fields in a TRACE request 1508 containing sensitive data that might be disclosed by the response. 1510 For example, it would be foolish for a user agent to send stored user 1511 credentials [Part7] or cookies [RFC6265] in a TRACE request. The 1512 final recipient of the request SHOULD exclude any request header 1513 fields that are likely to contain sensitive data when that recipient 1514 generates the response body. 1516 TRACE allows the client to see what is being received at the other 1517 end of the request chain and use that data for testing or diagnostic 1518 information. The value of the Via header field (Section 5.7.1 of 1519 [Part1]) is of particular interest, since it acts as a trace of the 1520 request chain. Use of the Max-Forwards header field allows the 1521 client to limit the length of the request chain, which is useful for 1522 testing a chain of proxies forwarding messages in an infinite loop. 1524 A client MUST NOT send a message body in a TRACE request. 1526 Responses to the TRACE method are not cacheable. 1528 5. Request Header Fields 1530 A client sends request header fields to provide more information 1531 about the request context, make the request conditional based on the 1532 target resource state, suggest preferred formats for the response, 1533 supply authentication credentials, or modify the expected request 1534 processing. These fields act as request modifiers, similar to the 1535 parameters on a programming language method invocation. 1537 5.1. Controls 1539 Controls are request header fields that direct specific handling of 1540 the request. 1542 +-------------------+------------------------+ 1543 | Header Field Name | Defined in... | 1544 +-------------------+------------------------+ 1545 | Cache-Control | Section 5.2 of [Part6] | 1546 | Expect | Section 5.1.1 | 1547 | Host | Section 5.4 of [Part1] | 1548 | Max-Forwards | Section 5.1.2 | 1549 | Pragma | Section 5.4 of [Part6] | 1550 | Range | Section 3.1 of [Part5] | 1551 | TE | Section 4.3 of [Part1] | 1552 +-------------------+------------------------+ 1554 5.1.1. Expect 1556 The "Expect" header field in a request indicates a certain set of 1557 behaviors (expectations) that need to be supported by the server in 1558 order to properly handle this request. The only such expectation 1559 defined by this specification is 100-continue. 1561 Expect = "100-continue" 1563 The Expect field-value is case-insensitive. 1565 A server that receives an Expect field-value other than 100-continue 1566 MAY respond with a 417 (Expectation Failed) status code to indicate 1567 that the unexpected expectation cannot be met. 1569 A 100-continue expectation informs recipients that the client is 1570 about to send a (presumably large) message body in this request and 1571 wishes to receive a 100 (Continue) interim response if the request- 1572 line and header fields are not sufficient to cause an immediate 1573 success, redirect, or error response. This allows the client to wait 1574 for an indication that it is worthwhile to send the message body 1575 before actually doing so, which can improve efficiency when the 1576 message body is huge or when the client anticipates that an error is 1577 likely (e.g., when sending a state-changing method, for the first 1578 time, without previously verified authentication credentials). 1580 For example, a request that begins with 1582 PUT /somewhere/fun HTTP/1.1 1583 Host: origin.example.com 1584 Content-Type: video/h264 1585 Content-Length: 1234567890987 1586 Expect: 100-continue 1588 allows the origin server to immediately respond with an error 1589 message, such as 401 (Unauthorized) or 405 (Method Not Allowed), 1590 before the client starts filling the pipes with an unnecessary data 1591 transfer. 1593 Requirements for clients: 1595 o A client MUST NOT generate a 100-continue expectation in a request 1596 that does not include a message body. 1598 o A client that will wait for a 100 (Continue) response before 1599 sending the request message body MUST send an Expect header field 1600 containing a 100-continue expectation. 1602 o A client that sends a 100-continue expectation is not required to 1603 wait for any specific length of time; such a client MAY proceed to 1604 send the message body even if it has not yet received a response. 1605 Furthermore, since 100 (Continue) responses cannot be sent through 1606 an HTTP/1.0 intermediary, such a client SHOULD NOT wait for an 1607 indefinite period before sending the message body. 1609 o A client that receives a 417 (Expectation Failed) status code in 1610 response to a request containing a 100-continue expectation SHOULD 1611 repeat that request without a 100-continue expectation, since the 1612 417 response merely indicates that the response chain does not 1613 support expectations (e.g., it passes through an HTTP/1.0 server). 1615 Requirements for servers: 1617 o A server that receives a 100-continue expectation in an HTTP/1.0 1618 request MUST ignore that expectation. 1620 o A server MAY omit sending a 100 (Continue) response if it has 1621 already received some or all of the message body for the 1622 corresponding request, or if the framing indicates that there is 1623 no message body. 1625 o A server that sends a 100 (Continue) response MUST ultimately send 1626 a final status code, once the message body is received and 1627 processed, unless the connection is closed prematurely. 1629 o A server that responds with a final status code before reading the 1630 entire message body SHOULD indicate in that response whether it 1631 intends to close the connection or continue reading and discarding 1632 the request message (see Section 6.6 of [Part1]). 1634 An origin server MUST, upon receiving an HTTP/1.1 (or later) request- 1635 line and a complete header section that contains a 100-continue 1636 expectation and indicates a request message body will follow, either 1637 send an immediate response with a final status code, if that status 1638 can be determined by examining just the request-line and header 1639 fields, or send an immediate 100 (Continue) response to encourage the 1640 client to send the request's message body. The origin server MUST 1641 NOT wait for the message body before sending the 100 (Continue) 1642 response. 1644 A proxy MUST, upon receiving an HTTP/1.1 (or later) request-line and 1645 a complete header section that contains a 100-continue expectation 1646 and indicates a request message body will follow, either send an 1647 immediate response with a final status code, if that status can be 1648 determined by examining just the request-line and header fields, or 1649 begin forwarding the request toward the origin server by sending a 1650 corresponding request-line and header section to the next inbound 1651 server. If the proxy believes (from configuration or past 1652 interaction) that the next inbound server only supports HTTP/1.0, the 1653 proxy MAY generate an immediate 100 (Continue) response to encourage 1654 the client to begin sending the message body. 1656 Note: The Expect header field was added after the original 1657 publication of HTTP/1.1 [RFC2068] as both the means to request an 1658 interim 100 response and the general mechanism for indicating 1659 must-understand extensions. However, the extension mechanism has 1660 not been used by clients and the must-understand requirements have 1661 not been implemented by many servers, rendering the extension 1662 mechanism useless. This specification has removed the extension 1663 mechanism in order to simplify the definition and processing of 1664 100-continue. 1666 5.1.2. Max-Forwards 1668 The "Max-Forwards" header field provides a mechanism with the TRACE 1669 (Section 4.3.8) and OPTIONS (Section 4.3.7) request methods to limit 1670 the number of times that the request is forwarded by proxies. This 1671 can be useful when the client is attempting to trace a request that 1672 appears to be failing or looping mid-chain. 1674 Max-Forwards = 1*DIGIT 1676 The Max-Forwards value is a decimal integer indicating the remaining 1677 number of times this request message can be forwarded. 1679 Each intermediary that receives a TRACE or OPTIONS request containing 1680 a Max-Forwards header field MUST check and update its value prior to 1681 forwarding the request. If the received value is zero (0), the 1682 intermediary MUST NOT forward the request; instead, the intermediary 1683 MUST respond as the final recipient. If the received Max-Forwards 1684 value is greater than zero, the intermediary MUST generate an updated 1685 Max-Forwards field in the forwarded message with a field-value that 1686 is the lesser of: a) the received value decremented by one (1), or b) 1687 the recipient's maximum supported value for Max-Forwards. 1689 A recipient MAY ignore a Max-Forwards header field received with any 1690 other request methods. 1692 5.2. Conditionals 1694 The HTTP conditional request header fields [Part4] allow a client to 1695 place a precondition on the state of the target resource, so that the 1696 action corresponding to the method semantics will not be applied if 1697 the precondition evaluates to false. Each precondition defined by 1698 this specification consists of a comparison between a set of 1699 validators obtained from prior representations of the target resource 1700 to the current state of validators for the selected representation 1701 (Section 7.2). Hence, these preconditions evaluate whether the state 1702 of the target resource has changed since a given state known by the 1703 client. The effect of such an evaluation depends on the method 1704 semantics and choice of conditional, as defined in Section 5 of 1705 [Part4]. 1707 +---------------------+------------------------+ 1708 | Header Field Name | Defined in... | 1709 +---------------------+------------------------+ 1710 | If-Match | Section 3.1 of [Part4] | 1711 | If-None-Match | Section 3.2 of [Part4] | 1712 | If-Modified-Since | Section 3.3 of [Part4] | 1713 | If-Unmodified-Since | Section 3.4 of [Part4] | 1714 | If-Range | Section 3.2 of [Part5] | 1715 +---------------------+------------------------+ 1717 5.3. Content Negotiation 1719 The following request header fields are sent by a user agent to 1720 engage in proactive negotiation of the response content, as defined 1721 in Section 3.4.1. The preferences sent in these fields apply to any 1722 content in the response, including representations of the target 1723 resource, representations of error or processing status, and 1724 potentially even the miscellaneous text strings that might appear 1725 within the protocol. 1727 +-------------------+---------------+ 1728 | Header Field Name | Defined in... | 1729 +-------------------+---------------+ 1730 | Accept | Section 5.3.2 | 1731 | Accept-Charset | Section 5.3.3 | 1732 | Accept-Encoding | Section 5.3.4 | 1733 | Accept-Language | Section 5.3.5 | 1734 +-------------------+---------------+ 1736 5.3.1. Quality Values 1738 Many of the request header fields for proactive negotiation use a 1739 common parameter, named "q" (case-insensitive), to assign a relative 1740 "weight" to the preference for that associated kind of content. This 1741 weight is referred to as a "quality value" (or "qvalue") because the 1742 same parameter name is often used within server configurations to 1743 assign a weight to the relative quality of the various 1744 representations that can be selected for a resource. 1746 The weight is normalized to a real number in the range 0 through 1, 1747 where 0.001 is the least preferred and 1 is the most preferred; a 1748 value of 0 means "not acceptable". If no "q" parameter is present, 1749 the default weight is 1. 1751 weight = OWS ";" OWS "q=" qvalue 1752 qvalue = ( "0" [ "." 0*3DIGIT ] ) 1753 / ( "1" [ "." 0*3("0") ] ) 1755 A sender of qvalue MUST NOT generate more than three digits after the 1756 decimal point. User configuration of these values ought to be 1757 limited in the same fashion. 1759 5.3.2. Accept 1761 The "Accept" header field can be used by user agents to specify 1762 response media types that are acceptable. Accept header fields can 1763 be used to indicate that the request is specifically limited to a 1764 small set of desired types, as in the case of a request for an in- 1765 line image. 1767 Accept = #( media-range [ accept-params ] ) 1769 media-range = ( "*/*" 1770 / ( type "/" "*" ) 1771 / ( type "/" subtype ) 1772 ) *( OWS ";" OWS parameter ) 1773 accept-params = weight *( accept-ext ) 1774 accept-ext = OWS ";" OWS token [ "=" word ] 1776 The asterisk "*" character is used to group media types into ranges, 1777 with "*/*" indicating all media types and "type/*" indicating all 1778 subtypes of that type. The media-range can include media type 1779 parameters that are applicable to that range. 1781 Each media-range might be followed by zero or more applicable media 1782 type parameters (e.g., charset), an optional "q" parameter for 1783 indicating a relative weight (Section 5.3.1), and then zero or more 1784 extension parameters. The "q" parameter is necessary if any 1785 extensions (accept-ext) are present, since it acts as a separator 1786 between the two parameter sets. 1788 Note: Use of the "q" parameter name to separate media type 1789 parameters from Accept extension parameters is due to historical 1790 practice. Although this prevents any media type parameter named 1791 "q" from being used with a media range, such an event is believed 1792 to be unlikely given the lack of any "q" parameters in the IANA 1793 media type registry and the rare usage of any media type 1794 parameters in Accept. Future media types are discouraged from 1795 registering any parameter named "q". 1797 The example 1799 Accept: audio/*; q=0.2, audio/basic 1801 is interpreted as "I prefer audio/basic, but send me any audio type 1802 if it is the best available after an 80% mark-down in quality". 1804 A request without any Accept header field implies that the user agent 1805 will accept any media type in response. If the header field is 1806 present in a request and none of the available representations for 1807 the response have a media type that is listed as acceptable, the 1808 origin server can either honor the header field by sending a 406 (Not 1809 Acceptable) response or disregard the header field by treating the 1810 response as if it is not subject to content negotiation. 1812 A more elaborate example is 1814 Accept: text/plain; q=0.5, text/html, 1815 text/x-dvi; q=0.8, text/x-c 1817 Verbally, this would be interpreted as "text/html and text/x-c are 1818 the equally preferred media types, but if they do not exist, then 1819 send the text/x-dvi representation, and if that does not exist, send 1820 the text/plain representation". 1822 Media ranges can be overridden by more specific media ranges or 1823 specific media types. If more than one media range applies to a 1824 given type, the most specific reference has precedence. For example, 1826 Accept: text/*, text/plain, text/plain;format=flowed, */* 1828 have the following precedence: 1830 1. text/plain;format=flowed 1832 2. text/plain 1834 3. text/* 1836 4. */* 1838 The media type quality factor associated with a given type is 1839 determined by finding the media range with the highest precedence 1840 that matches the type. For example, 1841 Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1, 1842 text/html;level=2;q=0.4, */*;q=0.5 1844 would cause the following values to be associated: 1846 +-------------------+---------------+ 1847 | Media Type | Quality Value | 1848 +-------------------+---------------+ 1849 | text/html;level=1 | 1 | 1850 | text/html | 0.7 | 1851 | text/plain | 0.3 | 1852 | image/jpeg | 0.5 | 1853 | text/html;level=2 | 0.4 | 1854 | text/html;level=3 | 0.7 | 1855 +-------------------+---------------+ 1857 Note: A user agent might be provided with a default set of quality 1858 values for certain media ranges. However, unless the user agent is a 1859 closed system that cannot interact with other rendering agents, this 1860 default set ought to be configurable by the user. 1862 5.3.3. Accept-Charset 1864 The "Accept-Charset" header field can be sent by a user agent to 1865 indicate what charsets are acceptable in textual response content. 1866 This field allows user agents capable of understanding more 1867 comprehensive or special-purpose charsets to signal that capability 1868 to an origin server that is capable of representing information in 1869 those charsets. 1871 Accept-Charset = 1#( ( charset / "*" ) [ weight ] ) 1873 Charset names are defined in Section 3.1.1.2. A user agent MAY 1874 associate a quality value with each charset to indicate the user's 1875 relative preference for that charset, as defined in Section 5.3.1. 1876 An example is 1878 Accept-Charset: iso-8859-5, unicode-1-1;q=0.8 1880 The special value "*", if present in the Accept-Charset field, 1881 matches every charset that is not mentioned elsewhere in the Accept- 1882 Charset field. If no "*" is present in an Accept-Charset field, then 1883 any charsets not explicitly mentioned in the field are considered 1884 "not acceptable" to the client. 1886 A request without any Accept-Charset header field implies that the 1887 user agent will accept any charset in response. Most general-purpose 1888 user agents do not send Accept-Charset, unless specifically 1889 configured to do so, because a detailed list of supported charsets 1890 makes it easier for a server to identify an individual by virtue of 1891 the user agent's request characteristics (Section 9.6). 1893 If an Accept-Charset header field is present in a request and none of 1894 the available representations for the response has a charset that is 1895 listed as acceptable, the origin server can either honor the header 1896 field, by sending a 406 (Not Acceptable) response, or disregard the 1897 header field by treating the resource as if it is not subject to 1898 content negotiation. 1900 5.3.4. Accept-Encoding 1902 The "Accept-Encoding" header field can be used by user agents to 1903 indicate what response content-codings (Section 3.1.2.1) are 1904 acceptable in the response. An "identity" token is used as a synonym 1905 for "no encoding" in order to communicate when no encoding is 1906 preferred. 1908 Accept-Encoding = #( codings [ weight ] ) 1909 codings = content-coding / "identity" / "*" 1911 Each codings value MAY be given an associated quality value 1912 representing the preference for that encoding, as defined in 1913 Section 5.3.1. The asterisk "*" symbol in an Accept-Encoding field 1914 matches any available content-coding not explicitly listed in the 1915 header field. 1917 For example, 1919 Accept-Encoding: compress, gzip 1920 Accept-Encoding: 1921 Accept-Encoding: * 1922 Accept-Encoding: compress;q=0.5, gzip;q=1.0 1923 Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0 1925 A request without an Accept-Encoding header field implies that the 1926 user agent has no preferences regarding content-codings. Although 1927 this allows the server to use any content-coding in a response, it 1928 does not imply that the user agent will be able to correctly process 1929 all encodings. 1931 A server tests whether a content-coding for a given representation is 1932 acceptable using these rules: 1934 1. If no Accept-Encoding field is in the request, any content-coding 1935 is considered acceptable by the user agent. 1937 2. If the representation has no content-coding, then it is 1938 acceptable by default unless specifically excluded by the Accept- 1939 Encoding field stating either "identity;q=0" or "*;q=0" without a 1940 more specific entry for "identity". 1942 3. If the representation's content-coding is one of the content- 1943 codings listed in the Accept-Encoding field, then it is 1944 acceptable unless it is accompanied by a qvalue of 0. (As 1945 defined in Section 5.3.1, a qvalue of 0 means "not acceptable".) 1947 4. If multiple content-codings are acceptable, then the acceptable 1948 content-coding with the highest non-zero qvalue is preferred. 1950 An Accept-Encoding header field with a combined field-value that is 1951 empty implies that the user agent does not want any content-coding in 1952 response. If an Accept-Encoding header field is present in a request 1953 and none of the available representations for the response have a 1954 content-coding that is listed as acceptable, the origin server SHOULD 1955 send a response without any content-coding. 1957 Note: Most HTTP/1.0 applications do not recognize or obey qvalues 1958 associated with content-codings. This means that qvalues might 1959 not work and are not permitted with x-gzip or x-compress. 1961 5.3.5. Accept-Language 1963 The "Accept-Language" header field can be used by user agents to 1964 indicate the set of natural languages that are preferred in the 1965 response. Language tags are defined in Section 3.1.3.1. 1967 Accept-Language = 1#( language-range [ weight ] ) 1968 language-range = 1969 1971 Each language-range can be given an associated quality value 1972 representing an estimate of the user's preference for the languages 1973 specified by that range, as defined in Section 5.3.1. For example, 1975 Accept-Language: da, en-gb;q=0.8, en;q=0.7 1977 would mean: "I prefer Danish, but will accept British English and 1978 other types of English". 1980 A request without any Accept-Language header field implies that the 1981 user agent will accept any language in response. If the header field 1982 is present in a request and none of the available representations for 1983 the response have a matching language tag, the origin server can 1984 either disregard the header field by treating the response as if it 1985 is not subject to content negotiation, or honor the header field by 1986 sending a 406 (Not Acceptable) response. However, the latter is not 1987 encouraged, as doing so can prevent users from accessing content that 1988 they might be able to use (with translation software, for example). 1990 Note that some recipients treat the order in which language tags are 1991 listed as an indication of descending priority, particularly for tags 1992 that are assigned equal quality values (no value is the same as q=1). 1993 However, this behavior cannot be relied upon. For consistency and to 1994 maximize interoperability, many user agents assign each language tag 1995 a unique quality value while also listing them in order of decreasing 1996 quality. Additional discussion of language priority lists can be 1997 found in Section 2.3 of [RFC4647]. 1999 For matching, Section 3 of [RFC4647] defines several matching 2000 schemes. Implementations can offer the most appropriate matching 2001 scheme for their requirements. The "Basic Filtering" scheme 2002 ([RFC4647], Section 3.3.1) is identical to the matching scheme that 2003 was previously defined for HTTP in Section 14.4 of [RFC2616]. 2005 It might be contrary to the privacy expectations of the user to send 2006 an Accept-Language header field with the complete linguistic 2007 preferences of the user in every request (Section 9.6). 2009 Since intelligibility is highly dependent on the individual user, 2010 user agents need to allow user control over the linguistic 2011 preference. A user agent that does not provide such control to the 2012 user MUST NOT send an Accept-Language header field. 2014 Note: User agents ought to provide guidance to users when setting 2015 a preference, since users are rarely familiar with the details of 2016 language matching as described above. For example, users might 2017 assume that on selecting "en-gb", they will be served any kind of 2018 English document if British English is not available. A user 2019 agent might suggest, in such a case, to add "en" to the list for 2020 better matching behavior. 2022 5.4. Authentication Credentials 2024 Two header fields are used for carrying authentication credentials, 2025 as defined in [Part7]. Note that various custom mechanisms for user 2026 authentication use the Cookie header field for this purpose, as 2027 defined in [RFC6265]. 2029 +---------------------+------------------------+ 2030 | Header Field Name | Defined in... | 2031 +---------------------+------------------------+ 2032 | Authorization | Section 4.1 of [Part7] | 2033 | Proxy-Authorization | Section 4.3 of [Part7] | 2034 +---------------------+------------------------+ 2036 5.5. Request Context 2038 The following request header fields provide additional information 2039 about the request context, including information about the user, user 2040 agent, and resource behind the request. 2042 +-------------------+---------------+ 2043 | Header Field Name | Defined in... | 2044 +-------------------+---------------+ 2045 | From | Section 5.5.1 | 2046 | Referer | Section 5.5.2 | 2047 | User-Agent | Section 5.5.3 | 2048 +-------------------+---------------+ 2050 5.5.1. From 2052 The "From" header field contains an Internet email address for a 2053 human user who controls the requesting user agent. The address ought 2054 to be machine-usable, as defined by "mailbox" in Section 3.4 of 2055 [RFC5322]: 2057 From = mailbox 2059 mailbox = 2061 An example is: 2063 From: webmaster@example.org 2065 The From header field is rarely sent by non-robotic user agents. A 2066 user agent SHOULD NOT send a From header field without explicit 2067 configuration by the user, since that might conflict with the user's 2068 privacy interests or their site's security policy. 2070 A robotic user agent SHOULD send a valid From header field so that 2071 the person responsible for running the robot can be contacted if 2072 problems occur on servers, such as if the robot is sending excessive, 2073 unwanted, or invalid requests. 2075 A server SHOULD NOT use the From header field for access control or 2076 authentication, since most recipients will assume that the field 2077 value is public information. 2079 5.5.2. Referer 2081 The "Referer" [sic] header field allows the user agent to specify a 2082 URI reference for the resource from which the target URI was obtained 2083 (i.e., the "referrer", though the field name is misspelled). A user 2084 agent MUST NOT include the fragment and userinfo components of the 2085 URI reference [RFC3986], if any, when generating the Referer field 2086 value. 2088 Referer = absolute-URI / partial-URI 2090 Referer allows servers to generate back-links to other resources for 2091 simple analytics, logging, optimized caching, etc. It also allows 2092 obsolete or mistyped links to be found for maintenance. Some servers 2093 use Referer as a means of denying links from other sites (so-called 2094 "deep linking") or restricting cross-site request forgery (CSRF), but 2095 not all requests contain a Referer header field. 2097 Example: 2099 Referer: http://www.example.org/hypertext/Overview.html 2101 If the target URI was obtained from a source that does not have its 2102 own URI (e.g., input from the user keyboard, or an entry within the 2103 user's bookmarks/favorites), the user agent MUST either exclude 2104 Referer or send it with a value of "about:blank". 2106 The Referer field has the potential to reveal information about the 2107 request context or browsing history of the user, which is a privacy 2108 concern if the referring resource's identifier reveals personal 2109 information (such as an account name) or a resource that is supposed 2110 to be confidential (such as behind a firewall or internal to a 2111 secured service). Most general-purpose user agents do not send the 2112 Referer header field when the referring resource is a local "file" or 2113 "data" URI. A user agent MUST NOT send a Referer header field in an 2114 unsecured HTTP request if the referring page was received with a 2115 secure protocol. See Section 9.3 for additional security 2116 considerations. 2118 Some intermediaries have been known to indiscriminately remove 2119 Referer header fields from outgoing requests. This has the 2120 unfortunate side-effect of interfering with protection against CSRF 2121 attacks, which can be far more harmful to their users. 2122 Intermediaries and user agent extensions that wish to limit 2123 information disclosure in Referer ought to restrict their changes to 2124 specific edits, such as replacing internal domain names with 2125 pseudonyms or truncating the query and/or path components. An 2126 intermediary SHOULD NOT modify or delete the Referer header field 2127 when the field value shares the same scheme and host as the request 2128 target. 2130 5.5.3. User-Agent 2132 The "User-Agent" header field contains information about the user 2133 agent originating the request, which is often used by servers to help 2134 identify the scope of reported interoperability problems, to work 2135 around or tailor responses to avoid particular user agent 2136 limitations, and for analytics regarding browser or operating system 2137 use. A user agent SHOULD send a User-Agent field in each request 2138 unless specifically configured not to do so. 2140 User-Agent = product *( RWS ( product / comment ) ) 2142 The User-Agent field-value consists of one or more product 2143 identifiers, each followed by zero or more comments (Section 3.2 of 2144 [Part1]), which together identify the user agent software and its 2145 significant subproducts. By convention, the product identifiers are 2146 listed in decreasing order of their significance for identifying the 2147 user agent software. Each product identifier consists of a name and 2148 optional version. 2150 product = token ["/" product-version] 2151 product-version = token 2153 A sender SHOULD limit generated product identifiers to what is 2154 necessary to identify the product; a sender MUST NOT generate 2155 advertising or other non-essential information within the product 2156 identifier. A sender SHOULD NOT generate information in product- 2157 version that is not a version identifier (i.e., successive versions 2158 of the same product name ought to only differ in the product-version 2159 portion of the product identifier). 2161 Example: 2163 User-Agent: CERN-LineMode/2.15 libwww/2.17b3 2165 A user agent SHOULD NOT generate a User-Agent field containing 2166 needlessly fine-grained detail and SHOULD limit the addition of 2167 subproducts by third parties. Overly long and detailed User-Agent 2168 field values increase request latency and the risk of a user being 2169 identified against their wishes ("fingerprinting"). 2171 Likewise, implementations are encouraged not to use the product 2172 tokens of other implementations in order to declare compatibility 2173 with them, as this circumvents the purpose of the field. If a user 2174 agent masquerades as a different user agent, recipients can assume 2175 that the user intentionally desires to see responses tailored for 2176 that identified user agent, even if they might not work as well for 2177 the actual user agent being used. 2179 6. Response Status Codes 2181 The status-code element is a 3-digit integer code giving the result 2182 of the attempt to understand and satisfy the request. 2184 HTTP status codes are extensible. HTTP clients are not required to 2185 understand the meaning of all registered status codes, though such 2186 understanding is obviously desirable. However, a client MUST 2187 understand the class of any status code, as indicated by the first 2188 digit, and treat an unrecognized status code as being equivalent to 2189 the x00 status code of that class, with the exception that a 2190 recipient MUST NOT cache a response with an unrecognized status code. 2192 For example, if an unrecognized status code of 471 is received by a 2193 client, the client can assume that there was something wrong with its 2194 request and treat the response as if it had received a 400 status 2195 code. The response message will usually contain a representation 2196 that explains the status. 2198 The first digit of the status-code defines the class of response. 2199 The last two digits do not have any categorization role. There are 5 2200 values for the first digit: 2202 o 1xx (Informational): The request was received, continuing process 2204 o 2xx (Successful): The request was successfully received, 2205 understood, and accepted 2207 o 3xx (Redirection): Further action needs to be taken in order to 2208 complete the request 2210 o 4xx (Client Error): The request contains bad syntax or cannot be 2211 fulfilled 2213 o 5xx (Server Error): The server failed to fulfill an apparently 2214 valid request 2216 6.1. Overview of Status Codes 2218 The status codes listed below are defined in this specification, 2219 Section 4 of [Part4], Section 4 of [Part5], and Section 3 of [Part7]. 2220 The reason phrases listed here are only recommendations -- they can 2221 be replaced by local equivalents without affecting the protocol. 2223 Responses with status codes that are defined as cacheable by default 2224 (e.g., 200, 203, 206, 300, 301, and 410 in this specification) can be 2225 reused by a cache with heuristic expiration unless otherwise 2226 indicated by the method definition or explicit cache controls 2227 [Part6]; all other status codes are not cacheable by default. 2229 +------+-------------------------------+------------------------+ 2230 | code | reason-phrase | Defined in... | 2231 +------+-------------------------------+------------------------+ 2232 | 100 | Continue | Section 6.2.1 | 2233 | 101 | Switching Protocols | Section 6.2.2 | 2234 | 200 | OK | Section 6.3.1 | 2235 | 201 | Created | Section 6.3.2 | 2236 | 202 | Accepted | Section 6.3.3 | 2237 | 203 | Non-Authoritative Information | Section 6.3.4 | 2238 | 204 | No Content | Section 6.3.5 | 2239 | 205 | Reset Content | Section 6.3.6 | 2240 | 206 | Partial Content | Section 4.1 of [Part5] | 2241 | 300 | Multiple Choices | Section 6.4.1 | 2242 | 301 | Moved Permanently | Section 6.4.2 | 2243 | 302 | Found | Section 6.4.3 | 2244 | 303 | See Other | Section 6.4.4 | 2245 | 304 | Not Modified | Section 4.1 of [Part4] | 2246 | 305 | Use Proxy | Section 6.4.5 | 2247 | 307 | Temporary Redirect | Section 6.4.7 | 2248 | 400 | Bad Request | Section 6.5.1 | 2249 | 401 | Unauthorized | Section 3.1 of [Part7] | 2250 | 402 | Payment Required | Section 6.5.2 | 2251 | 403 | Forbidden | Section 6.5.3 | 2252 | 404 | Not Found | Section 6.5.4 | 2253 | 405 | Method Not Allowed | Section 6.5.5 | 2254 | 406 | Not Acceptable | Section 6.5.6 | 2255 | 407 | Proxy Authentication Required | Section 3.2 of [Part7] | 2256 | 408 | Request Time-out | Section 6.5.7 | 2257 | 409 | Conflict | Section 6.5.8 | 2258 | 410 | Gone | Section 6.5.9 | 2259 | 411 | Length Required | Section 6.5.10 | 2260 | 412 | Precondition Failed | Section 4.2 of [Part4] | 2261 | 413 | Payload Too Large | Section 6.5.11 | 2262 | 414 | URI Too Long | Section 6.5.12 | 2263 | 415 | Unsupported Media Type | Section 6.5.13 | 2264 | 416 | Range Not Satisfiable | Section 4.4 of [Part5] | 2265 | 417 | Expectation Failed | Section 6.5.14 | 2266 | 426 | Upgrade Required | Section 6.5.15 | 2267 | 500 | Internal Server Error | Section 6.6.1 | 2268 | 501 | Not Implemented | Section 6.6.2 | 2269 | 502 | Bad Gateway | Section 6.6.3 | 2270 | 503 | Service Unavailable | Section 6.6.4 | 2271 | 504 | Gateway Time-out | Section 6.6.5 | 2272 | 505 | HTTP Version Not Supported | Section 6.6.6 | 2273 +------+-------------------------------+------------------------+ 2275 Note that this list is not exhaustive -- it does not include 2276 extension status codes defined in other specifications. The complete 2277 list of status codes is maintained by IANA. See Section 8.2 for 2278 details. 2280 6.2. Informational 1xx 2282 The 1xx (Informational) class of status code indicates an interim 2283 response for communicating connection status or request progress 2284 prior to completing the requested action and sending a final 2285 response. All 1xx responses consist of only the status-line and 2286 optional header fields, and thus are terminated by the empty line at 2287 the end of the header section. Since HTTP/1.0 did not define any 1xx 2288 status codes, a server MUST NOT send a 1xx response to an HTTP/1.0 2289 client. 2291 A client MUST be able to parse one or more 1xx responses received 2292 prior to a final response, even if the client does not expect one. A 2293 user agent MAY ignore unexpected 1xx responses. 2295 A proxy MUST forward 1xx responses unless the proxy itself requested 2296 the generation of the 1xx response. For example, if a proxy adds an 2297 "Expect: 100-continue" field when it forwards a request, then it need 2298 not forward the corresponding 100 (Continue) response(s). 2300 6.2.1. 100 Continue 2302 The 100 (Continue) status code indicates that the initial part of a 2303 request has been received and has not yet been rejected by the 2304 server. The server intends to send a final response after the 2305 request has been fully received and acted upon. 2307 When the request contains an Expect header field that includes a 100- 2308 continue expectation, the 100 response indicates that the server 2309 wishes to receive the request payload body, as described in 2310 Section 5.1.1. The client ought to continue sending the request and 2311 discard the 100 response. 2313 If the request did not contain an Expect header field containing the 2314 100-continue expectation, the client can simply discard this interim 2315 response. 2317 6.2.2. 101 Switching Protocols 2319 The 101 (Switching Protocols) status code indicates that the server 2320 understands and is willing to comply with the client's request, via 2321 the Upgrade header field (Section 6.7 of [Part1]), for a change in 2322 the application protocol being used on this connection. The server 2323 MUST generate an Upgrade header field in the response that indicates 2324 which protocol(s) will be switched to immediately after the empty 2325 line that terminates the 101 response. 2327 It is assumed that the server will only agree to switch protocols 2328 when it is advantageous to do so. For example, switching to a newer 2329 version of HTTP might be advantageous over older versions, and 2330 switching to a real-time, synchronous protocol might be advantageous 2331 when delivering resources that use such features. 2333 6.3. Successful 2xx 2335 The 2xx (Successful) class of status code indicates that the client's 2336 request was successfully received, understood, and accepted. 2338 6.3.1. 200 OK 2340 The 2341 200 (OK) status code indicates that the request has succeeded. The 2342 payload sent in a 200 response depends on the request method. For 2343 the methods defined by this specification, the intended meaning of 2344 the payload can be summarized as: 2346 GET a representation of the target resource; 2348 HEAD the same representation as GET, but without the representation 2349 data; 2351 POST a representation of the status of, or results obtained from, 2352 the action; 2354 PUT, DELETE a representation of the status of the action; 2356 OPTIONS a representation of the communications options; 2358 TRACE a representation of the request message as received by the end 2359 server. 2361 Aside from responses to CONNECT, a 200 response always has a payload, 2362 though an origin server MAY generate a payload body of zero length. 2363 If no payload is desired, an origin server ought to send 204 (No 2364 Content) instead. For CONNECT, no payload is allowed because the 2365 successful result is a tunnel, which begins immediately after the 200 2366 response header section. 2368 A 200 response is cacheable unless otherwise indicated by the method 2369 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2371 6.3.2. 201 Created 2373 The 201 (Created) status code indicates that the request has been 2374 fulfilled and has resulted in one or more new resources being 2375 created. The primary resource created by the request is identified 2376 by either a Location header field in the response or, if no Location 2377 field is received, by the effective request URI. 2379 The 201 response payload typically describes and links to the 2380 resource(s) created. See Section 7.2 for a discussion of the meaning 2381 and purpose of validator header fields, such as ETag and Last- 2382 Modified, in a 201 response. 2384 6.3.3. 202 Accepted 2386 The 202 (Accepted) status code indicates that the request has been 2387 accepted for processing, but the processing has not been completed. 2388 The request might or might not eventually be acted upon, as it might 2389 be disallowed when processing actually takes place. There is no 2390 facility in HTTP for re-sending a status code from an asynchronous 2391 operation. 2393 The 202 response is intentionally non-committal. Its purpose is to 2394 allow a server to accept a request for some other process (perhaps a 2395 batch-oriented process that is only run once per day) without 2396 requiring that the user agent's connection to the server persist 2397 until the process is completed. The representation sent with this 2398 response ought to describe the request's current status and point to 2399 (or embed) a status monitor that can provide the user with an 2400 estimate of when the request will be fulfilled. 2402 6.3.4. 203 Non-Authoritative Information 2404 The 203 (Non-Authoritative Information) status code indicates that 2405 the request was successful but the enclosed payload has been modified 2406 from that of the origin server's 200 (OK) response by a transforming 2407 proxy (Section 5.7.2 of [Part1]). This status code allows the proxy 2408 to notify recipients when a transformation has been applied, since 2409 that knowledge might impact later decisions regarding the content. 2410 For example, future cache validation requests for the content might 2411 only be applicable along the same request path (through the same 2412 proxies). 2414 The 203 response is similar to the Warning code of 214 Transformation 2415 Applied (Section 5.5 of [Part6]), which has the advantage of being 2416 applicable to responses with any status code. 2418 A 203 response is cacheable unless otherwise indicated by the method 2419 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2421 6.3.5. 204 No Content 2423 The 204 (No Content) status code indicates that the server has 2424 successfully fulfilled the request and that there is no additional 2425 content to send in the response payload body. Metadata in the 2426 response header fields refer to the target resource and its selected 2427 representation after the requested action was applied. 2429 For example, if a 204 status code is received in response to a PUT 2430 request and the response contains an ETag header field, then the PUT 2431 was successful and the ETag field-value contains the entity-tag for 2432 the new representation of that target resource. 2434 The 204 response allows a server to indicate that the action has been 2435 successfully applied to the target resource, while implying that the 2436 user agent does not need to traverse away from its current "document 2437 view" (if any). The server assumes that the user agent will provide 2438 some indication of the success to its user, in accord with its own 2439 interface, and apply any new or updated metadata in the response to 2440 its active representation. 2442 For example, a 204 status code is commonly used with document editing 2443 interfaces corresponding to a "save" action, such that the document 2444 being saved remains available to the user for editing. It is also 2445 frequently used with interfaces that expect automated data transfers 2446 to be prevalent, such as within distributed version control systems. 2448 A 204 response is terminated by the first empty line after the header 2449 fields because it cannot contain a message body. 2451 A 204 response is cacheable unless otherwise indicated by the method 2452 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2454 6.3.6. 205 Reset Content 2456 The 205 (Reset Content) status code indicates that the server has 2457 fulfilled the request and desires that the user agent reset the 2458 "document view", which caused the request to be sent, to its original 2459 state as received from the origin server. 2461 This response is intended to support a common data entry use case 2462 where the user receives content that supports data entry (a form, 2463 notepad, canvas, etc.), enters or manipulates data in that space, 2464 causes the entered data to be submitted in a request, and then the 2465 data entry mechanism is reset for the next entry so that the user can 2466 easily initiate another input action. 2468 Since the 205 status code implies that no additional content will be 2469 provided, a server MUST NOT generate a payload in a 205 response. In 2470 other words, a server MUST do one of the following for a 205 2471 response: a) indicate a zero-length body for the response by 2472 including a Content-Length header field with a value of 0; b) 2473 indicate a zero-length payload for the response by including a 2474 Transfer-Encoding header field with a value of chunked and a message 2475 body consisting of a single chunk of zero-length; or, c) close the 2476 connection immediately after sending the blank line terminating the 2477 header section. 2479 6.4. Redirection 3xx 2481 The 3xx (Redirection) class of status code indicates that further 2482 action needs to be taken by the user agent in order to fulfill the 2483 request. If a Location header field (Section 7.1.2) is provided, the 2484 user agent MAY automatically redirect its request to the URI 2485 referenced by the Location field value, even if the specific status 2486 code is not understood. Automatic redirection needs to done with 2487 care for methods not known to be safe, as defined in Section 4.2.1, 2488 since the user might not wish to redirect an unsafe request. 2490 There are several types of redirects: 2492 1. Redirects that indicate the resource might be available at a 2493 different URI, as provided by the Location field, as in the 2494 status codes 301 (Moved Permanently), 302 (Found), and 307 2495 (Temporary Redirect). 2497 2. Redirection that offers a choice of matching resources, each 2498 capable of representing the original request target, as in the 2499 300 (Multiple Choices) status code. 2501 3. Redirection to a different resource, identified by the Location 2502 field, that can represent an indirect response to the request, as 2503 in the 303 (See Other) status code. 2505 4. Redirection to a previously cached result, as in the 304 (Not 2506 Modified) status code. 2508 Note: In HTTP/1.0, the status codes 301 (Moved Permanently) and 2509 302 (Found) were defined for the first type of redirect 2510 ([RFC1945], Section 9.3). Early user agents split on whether the 2511 method applied to the redirect target would be the same as the 2512 original request or would be rewritten as GET. Although HTTP 2513 originally defined the former semantics for 301 and 302 (to match 2514 its original implementation at CERN), and defined 303 (See Other) 2515 to match the latter semantics, prevailing practice gradually 2516 converged on the latter semantics for 301 and 302 as well. The 2517 first revision of HTTP/1.1 added 307 (Temporary Redirect) to 2518 indicate the former semantics without being impacted by divergent 2519 practice. Over 10 years later, most user agents still do method 2520 rewriting for 301 and 302; therefore, this specification makes 2521 that behavior conformant when the original request is POST. 2523 A client SHOULD detect and intervene in cyclical redirections (i.e., 2524 "infinite" redirection loops). 2526 Note: An earlier version of this specification recommended a 2527 maximum of five redirections ([RFC2068], Section 10.3). Content 2528 developers need to be aware that some clients might implement such 2529 a fixed limitation. 2531 6.4.1. 300 Multiple Choices 2533 The 300 (Multiple Choices) status code indicates that the target 2534 resource has more than one representation, each with its own more 2535 specific identifier, and information about the alternatives is being 2536 provided so that the user (or user agent) can select a preferred 2537 representation by redirecting its request to one or more of those 2538 identifiers. In other words, the server desires that the user agent 2539 engage in reactive negotiation to select the most appropriate 2540 representation(s) for its needs (Section 3.4). 2542 If the server has a preferred choice, the server SHOULD generate a 2543 Location header field containing a preferred choice's URI reference. 2544 The user agent MAY use the Location field value for automatic 2545 redirection. 2547 For request methods other than HEAD, the server SHOULD generate a 2548 payload in the 300 response containing a list of representation 2549 metadata and URI reference(s) from which the user or user agent can 2550 choose the one most preferred. The user agent MAY make a selection 2551 from that list automatically, depending upon the list format, but 2552 this specification does not define a standard for such automatic 2553 selection. 2555 A 300 response is cacheable unless otherwise indicated by the method 2556 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2558 Note: The original proposal for 300 defined the URI header field 2559 as providing a list of alternative representations, such that it 2560 would be usable for 200, 300, and 406 responses and be transferred 2561 in responses to the HEAD method. However, lack of deployment and 2562 disagreement over syntax led to both URI and Alternates (a 2563 subsequent proposal) being dropped from this specification. It is 2564 possible to communicate the list using a set of Link header fields 2565 [RFC5988], each with a relationship of "alternate", though 2566 deployment is a chicken-and-egg problem. 2568 6.4.2. 301 Moved Permanently 2570 The 301 (Moved Permanently) status code indicates that the target 2571 resource has been assigned a new permanent URI and any future 2572 references to this resource ought to use one of the enclosed URIs. 2573 Clients with link editing capabilities ought to automatically re-link 2574 references to the effective request URI to one or more of the new 2575 references sent by the server, where possible. 2577 The server SHOULD generate a Location header field in the response 2578 containing a preferred URI reference for the new permanent URI. The 2579 user agent MAY use the Location field value for automatic 2580 redirection. The server's response payload usually contains a short 2581 hypertext note with a hyperlink to the new URI(s). 2583 Note: For historic reasons, a user agent MAY change the request 2584 method from POST to GET for the subsequent request. If this 2585 behavior is undesired, the 307 (Temporary Redirect) status code 2586 can be used instead. 2588 A 301 response is cacheable unless otherwise indicated by the method 2589 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2591 6.4.3. 302 Found 2593 The 302 (Found) status code indicates that the target resource 2594 resides temporarily under a different URI. Since the redirection 2595 might be altered on occasion, the client ought to continue to use the 2596 effective request URI for future requests. 2598 The server SHOULD generate a Location header field in the response 2599 containing a URI reference for the different URI. The user agent MAY 2600 use the Location field value for automatic redirection. The server's 2601 response payload usually contains a short hypertext note with a 2602 hyperlink to the different URI(s). 2604 Note: For historic reasons, a user agent MAY change the request 2605 method from POST to GET for the subsequent request. If this 2606 behavior is undesired, the 307 (Temporary Redirect) status code 2607 can be used instead. 2609 6.4.4. 303 See Other 2611 The 303 (See Other) status code indicates that the server is 2612 redirecting the user agent to a different resource, as indicated by a 2613 URI in the Location header field, that is intended to provide an 2614 indirect response to the original request. In order to satisfy the 2615 original request, a user agent ought to perform a retrieval request 2616 using the Location URI (a GET or HEAD request if using HTTP), which 2617 can itself be redirected further, and present the eventual result as 2618 an answer to the original request. Note that the new URI in the 2619 Location header field is not considered equivalent to the effective 2620 request URI. 2622 This status code is applicable to any HTTP method. It is primarily 2623 used to allow the output of a POST action to redirect the user agent 2624 to a selected resource, since doing so provides the information 2625 corresponding to the POST response in a form that can be separately 2626 identified, bookmarked, and cached independent of the original 2627 request. 2629 A 303 response to a GET request indicates that the origin server does 2630 not have a representation of the target resource that can be 2631 transferred by the server over HTTP. However, the Location field 2632 value refers to a resource that is descriptive of the target 2633 resource, such that making a retrieval request on that other resource 2634 might result in a representation that is useful to recipients without 2635 implying that it represents the original target resource. Note that 2636 answers to the questions of what can be represented, what 2637 representations are adequate, and what might be a useful description 2638 are outside the scope of HTTP. 2640 Except for responses to a HEAD request, the representation of a 303 2641 response ought to contain a short hypertext note with a hyperlink to 2642 the same URI reference provided in the Location header field. 2644 6.4.5. 305 Use Proxy 2646 The 305 (Use Proxy) status code was defined in a previous version of 2647 this specification and is now deprecated (Appendix B). 2649 6.4.6. 306 (Unused) 2651 The 306 status code was defined in a previous version of this 2652 specification, is no longer used, and the code is reserved. 2654 6.4.7. 307 Temporary Redirect 2656 The 307 (Temporary Redirect) status code indicates that the target 2657 resource resides temporarily under a different URI and the user agent 2658 MUST NOT change the request method if it performs an automatic 2659 redirection to that URI. Since the redirection can change over time, 2660 the client ought to continue using the original effective request URI 2661 for future requests. 2663 The server SHOULD generate a Location header field in the response 2664 containing a URI reference for the different URI. The user agent MAY 2665 use the Location field value for automatic redirection. The server's 2666 response payload usually contains a short hypertext note with a 2667 hyperlink to the different URI(s). 2669 Note: This status code is similar to 302 (Found), except that it 2670 does not allow changing the request method from POST to GET. This 2671 specification defines no equivalent counterpart for 301 (Moved 2672 Permanently) ([status-308], however, defines the status code 308 2673 (Permanent Redirect) for this purpose). 2675 6.5. Client Error 4xx 2677 The 4xx (Client Error) class of status code indicates that the client 2678 seems to have erred. Except when responding to a HEAD request, the 2679 server SHOULD send a representation containing an explanation of the 2680 error situation, and whether it is a temporary or permanent 2681 condition. These status codes are applicable to any request method. 2682 User agents SHOULD display any included representation to the user. 2684 6.5.1. 400 Bad Request 2686 The 400 (Bad Request) status code indicates that the server cannot or 2687 will not process the request due to something which is perceived to 2688 be a client error (e.g., malformed request syntax, invalid request 2689 message framing, or deceptive request routing). 2691 6.5.2. 402 Payment Required 2693 The 402 (Payment Required) status code is reserved for future use. 2695 6.5.3. 403 Forbidden 2697 The 403 (Forbidden) status code indicates that the server understood 2698 the request but refuses to authorize it. A server that wishes to 2699 make public why the request has been forbidden can describe that 2700 reason in the response payload (if any). 2702 If authentication credentials were provided in the request, the 2703 server considers them insufficient to grant access. The client 2704 SHOULD NOT automatically repeat the request with the same 2705 credentials. The client MAY repeat the request with new or different 2706 credentials. However, a request might be forbidden for reasons 2707 unrelated to the credentials. 2709 An origin server that wishes to "hide" the current existence of a 2710 forbidden target resource MAY instead respond with a status code of 2711 404 (Not Found). 2713 6.5.4. 404 Not Found 2715 The 404 (Not Found) status code indicates that the origin server did 2716 not find a current representation for the target resource or is not 2717 willing to disclose that one exists. A 404 status code does not 2718 indicate whether this lack of representation is temporary or 2719 permanent; the 410 (Gone) status code is preferred over 404 if the 2720 origin server knows, presumably through some configurable means, that 2721 the condition is likely to be permanent. 2723 A 404 response is cacheable unless otherwise indicated by the method 2724 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2726 6.5.5. 405 Method Not Allowed 2728 The 405 (Method Not Allowed) status code indicates that the method 2729 received in the request-line is known by the origin server but not 2730 supported by the target resource. The origin server MUST generate an 2731 Allow header field in a 405 response containing a list of the target 2732 resource's currently supported methods. 2734 A 405 response is cacheable unless otherwise indicated by the method 2735 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2737 6.5.6. 406 Not Acceptable 2739 The 406 (Not Acceptable) status code indicates that the target 2740 resource does not have a current representation that would be 2741 acceptable to the user agent, according to the proactive negotiation 2742 header fields received in the request (Section 5.3), and the server 2743 is unwilling to supply a default representation. 2745 The server SHOULD generate a payload containing a list of available 2746 representation characteristics and corresponding resource identifiers 2747 from which the user or user agent can choose the one most 2748 appropriate. A user agent MAY automatically select the most 2749 appropriate choice from that list. However, this specification does 2750 not define any standard for such automatic selection, as described in 2751 Section 6.4.1. 2753 6.5.7. 408 Request Timeout 2755 The 408 (Request Timeout) status code indicates that the server did 2756 not receive a complete request message within the time that it was 2757 prepared to wait. A server SHOULD send the close connection option 2758 (Section 6.1 of [Part1]) in the response, since 408 implies that the 2759 server has decided to close the connection rather than continue 2760 waiting. If the client has an outstanding request in transit, the 2761 client MAY repeat that request on a new connection. 2763 6.5.8. 409 Conflict 2765 The 409 (Conflict) status code indicates that the request could not 2766 be completed due to a conflict with the current state of the target 2767 resource. This code is used in situations where the user might be 2768 able to resolve the conflict and resubmit the request. The server 2769 SHOULD generate a payload that includes enough information for a user 2770 to recognize the source of the conflict. 2772 Conflicts are most likely to occur in response to a PUT request. For 2773 example, if versioning were being used and the representation being 2774 PUT included changes to a resource that conflict with those made by 2775 an earlier (third-party) request, the origin server might use a 409 2776 response to indicate that it can't complete the request. In this 2777 case, the response representation would likely contain information 2778 useful for merging the differences based on the revision history. 2780 6.5.9. 410 Gone 2782 The 410 (Gone) status code indicates that access to the target 2783 resource is no longer available at the origin server and that this 2784 condition is likely to be permanent. If the origin server does not 2785 know, or has no facility to determine, whether or not the condition 2786 is permanent, the status code 404 (Not Found) ought to be used 2787 instead. 2789 The 410 response is primarily intended to assist the task of web 2790 maintenance by notifying the recipient that the resource is 2791 intentionally unavailable and that the server owners desire that 2792 remote links to that resource be removed. Such an event is common 2793 for limited-time, promotional services and for resources belonging to 2794 individuals no longer associated with the origin server's site. It 2795 is not necessary to mark all permanently unavailable resources as 2796 "gone" or to keep the mark for any length of time -- that is left to 2797 the discretion of the server owner. 2799 A 410 response is cacheable unless otherwise indicated by the method 2800 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2802 6.5.10. 411 Length Required 2804 The 411 (Length Required) status code indicates that the server 2805 refuses to accept the request without a defined Content-Length 2806 (Section 3.3.2 of [Part1]). The client MAY repeat the request if it 2807 adds a valid Content-Length header field containing the length of the 2808 message body in the request message. 2810 6.5.11. 413 Payload Too Large 2812 The 413 (Payload Too Large) status code indicates that the server is 2813 refusing to process a request because the request payload is larger 2814 than the server is willing or able to process. The server MAY close 2815 the connection to prevent the client from continuing the request. 2817 If the condition is temporary, the server SHOULD generate a Retry- 2818 After header field to indicate that it is temporary and after what 2819 time the client MAY try again. 2821 6.5.12. 414 URI Too Long 2823 The 414 (URI Too Long) status code indicates that the server is 2824 refusing to service the request because the request-target (Section 2825 5.3 of [Part1]) is longer than the server is willing to interpret. 2826 This rare condition is only likely to occur when a client has 2827 improperly converted a POST request to a GET request with long query 2828 information, when the client has descended into a "black hole" of 2829 redirection (e.g., a redirected URI prefix that points to a suffix of 2830 itself), or when the server is under attack by a client attempting to 2831 exploit potential security holes. 2833 A 414 response is cacheable unless otherwise indicated by the method 2834 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2836 6.5.13. 415 Unsupported Media Type 2838 The 415 (Unsupported Media Type) status code indicates that the 2839 origin server is refusing to service the request because the payload 2840 is in a format not supported by this method on the target resource. 2841 The format problem might be due to the request's indicated Content- 2842 Type or Content-Encoding, or as a result of inspecting the data 2843 directly. 2845 6.5.14. 417 Expectation Failed 2847 The 417 (Expectation Failed) status code indicates that the 2848 expectation given in the request's Expect header field 2849 (Section 5.1.1) could not be met by at least one of the inbound 2850 servers. 2852 6.5.15. 426 Upgrade Required 2854 The 426 (Upgrade Required) status code indicates that the server 2855 refuses to perform the request using the current protocol but might 2856 be willing to do so after the client upgrades to a different 2857 protocol. The server MUST send an Upgrade header field in a 426 2858 response to indicate the required protocol(s) (Section 6.7 of 2859 [Part1]). 2861 Example: 2863 HTTP/1.1 426 Upgrade Required 2864 Upgrade: HTTP/3.0 2865 Connection: Upgrade 2866 Content-Length: 53 2867 Content-Type: text/plain 2869 This service requires use of the HTTP/3.0 protocol. 2871 6.6. Server Error 5xx 2873 The 5xx (Server Error) class of status code indicates that the server 2874 is aware that it has erred or is incapable of performing the 2875 requested method. Except when responding to a HEAD request, the 2876 server SHOULD send a representation containing an explanation of the 2877 error situation, and whether it is a temporary or permanent 2878 condition. A user agent SHOULD display any included representation 2879 to the user. These response codes are applicable to any request 2880 method. 2882 6.6.1. 500 Internal Server Error 2884 The 500 (Internal Server Error) status code indicates that the server 2885 encountered an unexpected condition that prevented it from fulfilling 2886 the request. 2888 6.6.2. 501 Not Implemented 2890 The 501 (Not Implemented) status code indicates that the server does 2891 not support the functionality required to fulfill the request. This 2892 is the appropriate response when the server does not recognize the 2893 request method and is not capable of supporting it for any resource. 2895 A 501 response is cacheable unless otherwise indicated by the method 2896 definition or explicit cache controls (see Section 4.2.2 of [Part6]). 2898 6.6.3. 502 Bad Gateway 2900 The 502 (Bad Gateway) status code indicates that the server, while 2901 acting as a gateway or proxy, received an invalid response from an 2902 inbound server it accessed while attempting to fulfill the request. 2904 6.6.4. 503 Service Unavailable 2906 The 503 (Service Unavailable) status code indicates that the server 2907 is currently unable to handle the request due to a temporary overload 2908 or scheduled maintenance, which will likely be alleviated after some 2909 delay. The server MAY send a Retry-After header field 2910 (Section 7.1.3) to suggest an appropriate amount of time for the 2911 client to wait before retrying the request. 2913 Note: The existence of the 503 status code does not imply that a 2914 server has to use it when becoming overloaded. Some servers might 2915 simply refuse the connection. 2917 6.6.5. 504 Gateway Timeout 2919 The 504 (Gateway Timeout) status code indicates that the server, 2920 while acting as a gateway or proxy, did not receive a timely response 2921 from an upstream server it needed to access in order to complete the 2922 request. 2924 6.6.6. 505 HTTP Version Not Supported 2926 The 505 (HTTP Version Not Supported) status code indicates that the 2927 server does not support, or refuses to support, the major version of 2928 HTTP that was used in the request message. The server is indicating 2929 that it is unable or unwilling to complete the request using the same 2930 major version as the client, as described in Section 2.6 of [Part1], 2931 other than with this error message. The server SHOULD generate a 2932 representation for the 505 response that describes why that version 2933 is not supported and what other protocols are supported by that 2934 server. 2936 7. Response Header Fields 2938 The response header fields allow the server to pass additional 2939 information about the response beyond what is placed in the status- 2940 line. These header fields give information about the server, about 2941 further access to the target resource, or about related resources. 2943 Although each response header field has a defined meaning, in 2944 general, the precise semantics might be further refined by the 2945 semantics of the request method and/or response status code. 2947 7.1. Control Data 2949 Response header fields can supply control data that supplements the 2950 status code, directs caching, or instructs the client where to go 2951 next. 2953 +-------------------+------------------------+ 2954 | Header Field Name | Defined in... | 2955 +-------------------+------------------------+ 2956 | Age | Section 5.1 of [Part6] | 2957 | Cache-Control | Section 5.2 of [Part6] | 2958 | Expires | Section 5.3 of [Part6] | 2959 | Date | Section 7.1.1.2 | 2960 | Location | Section 7.1.2 | 2961 | Retry-After | Section 7.1.3 | 2962 | Vary | Section 7.1.4 | 2963 | Warning | Section 5.5 of [Part6] | 2964 +-------------------+------------------------+ 2966 7.1.1. Origination Date 2968 7.1.1.1. Date/Time Formats 2970 Prior to 1995, there were three different formats commonly used by 2971 servers to communicate timestamps. For compatibility with old 2972 implementations, all three are defined here. The preferred format is 2973 a fixed-length and single-zone subset of the date and time 2974 specification used by the Internet Message Format [RFC5322]. 2976 HTTP-date = IMF-fixdate / obs-date 2978 An example of the preferred format is 2980 Sun, 06 Nov 1994 08:49:37 GMT ; IMF-fixdate 2982 Examples of the two obsolete formats are 2984 Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format 2985 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format 2987 A recipient that parses a timestamp value in an HTTP header field 2988 MUST accept all three HTTP-date formats. When a sender generates a 2989 header field that contains one or more timestamps defined as HTTP- 2990 date, the sender MUST generate those timestamps in the IMF-fixdate 2991 format. 2993 An HTTP-date value represents time as an instance of Coordinated 2994 Universal Time (UTC). The first two formats indicate UTC by the 2995 three-letter abbreviation for Greenwich Mean Time, "GMT", a 2996 predecessor of the UTC name; values in the asctime format are assumed 2997 to be in UTC. A sender that generates HTTP-date values from a local 2998 clock ought to use NTP ([RFC1305]) or some similar protocol to 2999 synchronize its clock to UTC. 3001 Preferred format: 3003 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 3004 ; fixed length/zone subset of the format defined in 3005 ; Section 3.3 of [RFC5322] 3007 day-name = %x4D.6F.6E ; "Mon", case-sensitive 3008 / %x54.75.65 ; "Tue", case-sensitive 3009 / %x57.65.64 ; "Wed", case-sensitive 3010 / %x54.68.75 ; "Thu", case-sensitive 3011 / %x46.72.69 ; "Fri", case-sensitive 3012 / %x53.61.74 ; "Sat", case-sensitive 3013 / %x53.75.6E ; "Sun", case-sensitive 3015 date1 = day SP month SP year 3016 ; e.g., 02 Jun 1982 3018 day = 2DIGIT 3019 month = %x4A.61.6E ; "Jan", case-sensitive 3020 / %x46.65.62 ; "Feb", case-sensitive 3021 / %x4D.61.72 ; "Mar", case-sensitive 3022 / %x41.70.72 ; "Apr", case-sensitive 3023 / %x4D.61.79 ; "May", case-sensitive 3024 / %x4A.75.6E ; "Jun", case-sensitive 3025 / %x4A.75.6C ; "Jul", case-sensitive 3026 / %x41.75.67 ; "Aug", case-sensitive 3027 / %x53.65.70 ; "Sep", case-sensitive 3028 / %x4F.63.74 ; "Oct", case-sensitive 3029 / %x4E.6F.76 ; "Nov", case-sensitive 3030 / %x44.65.63 ; "Dec", case-sensitive 3031 year = 4DIGIT 3033 GMT = %x47.4D.54 ; "GMT", case-sensitive 3035 time-of-day = hour ":" minute ":" second 3036 ; 00:00:00 - 23:59:60 (leap second) 3038 hour = 2DIGIT 3039 minute = 2DIGIT 3040 second = 2DIGIT 3042 Obsolete formats: 3044 obs-date = rfc850-date / asctime-date 3045 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 3046 date2 = day "-" month "-" 2DIGIT 3047 ; e.g., 02-Jun-82 3049 day-name-l = %x4D.6F.6E.64.61.79 ; "Monday", case-sensitive 3050 / %x54.75.65.73.64.61.79 ; "Tuesday", case-sensitive 3051 / %x57.65.64.6E.65.73.64.61.79 ; "Wednesday", case-sensitive 3052 / %x54.68.75.72.73.64.61.79 ; "Thursday", case-sensitive 3053 / %x46.72.69.64.61.79 ; "Friday", case-sensitive 3054 / %x53.61.74.75.72.64.61.79 ; "Saturday", case-sensitive 3055 / %x53.75.6E.64.61.79 ; "Sunday", case-sensitive 3057 asctime-date = day-name SP date3 SP time-of-day SP year 3058 date3 = month SP ( 2DIGIT / ( SP 1DIGIT )) 3059 ; e.g., Jun 2 3061 HTTP-date is case sensitive. A sender MUST NOT generate additional 3062 whitespace in an HTTP-date beyond that specifically included as SP in 3063 the grammar. The semantics of day-name, day, month, year, and time- 3064 of-day are the same as those defined for the Internet Message Format 3065 constructs with the corresponding name ([RFC5322], Section 3.3). 3067 Recipients of a timestamp value in rfc850-date format, which uses a 3068 two-digit year, MUST interpret a timestamp that appears to be more 3069 than 50 years in the future as representing the most recent year in 3070 the past that had the same last two digits. 3072 Recipients of timestamp values are encouraged to be robust in parsing 3073 timestamps unless otherwise restricted by the field definition. For 3074 example, messages are occasionally forwarded over HTTP from a non- 3075 HTTP source that might generate any of the date and time 3076 specifications defined by the Internet Message Format. 3078 Note: HTTP requirements for the date/time stamp format apply only 3079 to their usage within the protocol stream. Implementations are 3080 not required to use these formats for user presentation, request 3081 logging, etc. 3083 7.1.1.2. Date 3085 The "Date" header field represents the date and time at which the 3086 message was originated, having the same semantics as the Origination 3087 Date Field (orig-date) defined in Section 3.6.1 of [RFC5322]. The 3088 field value is an HTTP-date, as defined in Section 7.1.1.1. 3090 Date = HTTP-date 3092 An example is 3094 Date: Tue, 15 Nov 1994 08:12:31 GMT 3096 When a Date header field is generated, the sender SHOULD generate its 3097 field value as the best available approximation of the date and time 3098 of message generation. In theory, the date ought to represent the 3099 moment just before the payload is generated. In practice, the date 3100 can be generated at any time during message origination. 3102 An origin server MUST NOT send a Date header field if it does not 3103 have a clock capable of providing a reasonable approximation of the 3104 current instance in Coordinated Universal Time. An origin server MAY 3105 send a Date header field if the response is in the 1xx 3106 (Informational) or 5xx (Server Error) class of status codes. An 3107 origin server MUST send a Date header field in all other cases. 3109 A recipient with a clock that receives a response message without a 3110 Date header field MUST record the time it was received and append a 3111 corresponding Date header field to the message's header section if it 3112 is cached or forwarded downstream. 3114 A user agent MAY send a Date header field in a request, though 3115 generally will not do so unless it is believed to convey useful 3116 information to the server. For example, custom applications of HTTP 3117 might convey a Date if the server is expected to adjust its 3118 interpretation of the user's request based on differences between the 3119 user agent and server clocks. 3121 7.1.2. Location 3123 The "Location" header field is used in some responses to refer to a 3124 specific resource in relation to the response. The type of 3125 relationship is defined by the combination of request method and 3126 status code semantics. 3128 Location = URI-reference 3130 The field value consists of a single URI-reference. When it has the 3131 form of a relative reference ([RFC3986], Section 4.2), the final 3132 value is computed by resolving it against the effective request URI 3133 ([RFC3986], Section 5). 3135 For 201 (Created) responses, the Location value refers to the primary 3136 resource created by the request. For 3xx (Redirection) responses, 3137 the Location value refers to the preferred target resource for 3138 automatically redirecting the request. 3140 If the Location value provided in a 3xx (Redirection) does not have a 3141 fragment component, a user agent MUST process the redirection as if 3142 the value inherits the fragment component of the URI reference used 3143 to generate the request target (i.e., the redirection inherits the 3144 original reference's fragment, if any). 3146 For example, a GET request generated for the URI reference 3147 "http://www.example.org/~tim" might result in a 303 (See Other) 3148 response containing the header field: 3150 Location: /People.html#tim 3152 which suggests that the user agent redirect to 3153 "http://www.example.org/People.html#tim" 3155 Likewise, a GET request generated for the URI reference 3156 "http://www.example.org/index.html#larry" might result in a 301 3157 (Moved Permanently) response containing the header field: 3159 Location: http://www.example.net/index.html 3161 which suggests that the user agent redirect to 3162 "http://www.example.net/index.html#larry", preserving the original 3163 fragment identifier. 3165 There are circumstances in which a fragment identifier in a Location 3166 value would not be appropriate. For example, the Location header 3167 field in a 201 (Created) response is supposed to provide a URI that 3168 is specific to the created resource. 3170 Note: Some recipients attempt to recover from Location fields that 3171 are not valid URI references. This specification does not mandate 3172 or define such processing, but does allow it for the sake of 3173 robustness. 3175 Note: The Content-Location header field (Section 3.1.4.2) differs 3176 from Location in that the Content-Location refers to the most 3177 specific resource corresponding to the enclosed representation. 3178 It is therefore possible for a response to contain both the 3179 Location and Content-Location header fields. 3181 7.1.3. Retry-After 3183 Servers send the "Retry-After" header field to indicate how long the 3184 user agent ought to wait before making a follow-up request. When 3185 sent with a 503 (Service Unavailable) response, Retry-After indicates 3186 how long the service is expected to be unavailable to the client. 3187 When sent with any 3xx (Redirection) response, Retry-After indicates 3188 the minimum time that the user agent is asked to wait before issuing 3189 the redirected request. 3191 The value of this field can be either an HTTP-date or an integer 3192 number of seconds (in decimal) after the time of the response. 3194 Retry-After = HTTP-date / delta-seconds 3196 Time spans are non-negative decimal integers, representing time in 3197 seconds. 3199 delta-seconds = 1*DIGIT 3201 Two examples of its use are 3203 Retry-After: Fri, 31 Dec 1999 23:59:59 GMT 3204 Retry-After: 120 3206 In the latter example, the delay is 2 minutes. 3208 7.1.4. Vary 3210 The "Vary" header field in a response describes what parts of a 3211 request message, aside from the method, Host header field, and 3212 request target, might influence the origin server's process for 3213 selecting and representing this response. The value consists of 3214 either a single asterisk ("*") or a list of header field names (case- 3215 insensitive). 3217 Vary = "*" / 1#field-name 3219 A Vary field value of "*" signals that anything about the request 3220 might play a role in selecting the response representation, possibly 3221 including elements outside the message syntax (e.g., the client's 3222 network address), and thus a recipient will not be able to determine 3223 whether this response is appropriate for a later request without 3224 forwarding the request to the origin server. A proxy MUST NOT 3225 generate a Vary field with a "*" value. 3227 A Vary field value consisting of a comma-separated list of names 3228 indicates that the named request header fields, known as the 3229 selecting header fields, might have a role in selecting the 3230 representation. The potential selecting header fields are not 3231 limited to those defined by this specification. 3233 For example, a response that contains 3235 Vary: accept-encoding, accept-language 3237 indicates that the origin server might have used the request's 3238 Accept-Encoding and Accept-Language fields (or lack thereof) as 3239 determining factors while choosing the content for this response. 3241 An origin server might send Vary with a list of fields for two 3242 purposes: 3244 1. To inform cache recipients that they MUST NOT use this response 3245 to satisfy a later request unless the later request has the same 3246 values for the listed fields as the original request (Section 4.1 3247 of [Part6]). In other words, Vary expands the cache key required 3248 to match a new request to the stored cache entry. 3250 2. To inform user agent recipients that this response is subject to 3251 content negotiation (Section 5.3) and that a different 3252 representation might be sent in a subsequent request if 3253 additional parameters are provided in the listed header fields 3254 (proactive negotiation). 3256 An origin server SHOULD send a Vary header field when its algorithm 3257 for selecting a representation varies based on aspects of the request 3258 message other than the method and request target, unless the variance 3259 cannot be crossed or the origin server has been deliberately 3260 configured to prevent cache transparency. For example, there is no 3261 need to send the Authorization field name in Vary because reuse 3262 across users is constrained by the field definition (Section 4.1 of 3263 [Part7]). Likewise, an origin server might use Cache-Control 3264 directives (Section 5.2 of [Part6]) to supplant Vary if it considers 3265 the variance less significant than the performance cost of Vary's 3266 impact on caching. 3268 7.2. Validator Header Fields 3270 Validator header fields convey metadata about the selected 3271 representation (Section 3). In responses to safe requests, validator 3272 fields describe the selected representation chosen by the origin 3273 server while handling the response. Note that, depending on the 3274 status code semantics, the selected representation for a given 3275 response is not necessarily the same as the representation enclosed 3276 as response payload. 3278 In a successful response to a state-changing request, validator 3279 fields describe the new representation that has replaced the prior 3280 selected representation as a result of processing the request. 3282 For example, an ETag header field in a 201 response communicates the 3283 entity-tag of the newly created resource's representation, so that it 3284 can be used in later conditional requests to prevent the "lost 3285 update" problem [Part4]. 3287 +-------------------+------------------------+ 3288 | Header Field Name | Defined in... | 3289 +-------------------+------------------------+ 3290 | ETag | Section 2.3 of [Part4] | 3291 | Last-Modified | Section 2.2 of [Part4] | 3292 +-------------------+------------------------+ 3294 7.3. Authentication Challenges 3296 Authentication challenges indicate what mechanisms are available for 3297 the client to provide authentication credentials in future requests. 3299 +--------------------+------------------------+ 3300 | Header Field Name | Defined in... | 3301 +--------------------+------------------------+ 3302 | WWW-Authenticate | Section 4.4 of [Part7] | 3303 | Proxy-Authenticate | Section 4.2 of [Part7] | 3304 +--------------------+------------------------+ 3306 7.4. Response Context 3308 The remaining response header fields provide more information about 3309 the target resource for potential use in later requests. 3311 +-------------------+------------------------+ 3312 | Header Field Name | Defined in... | 3313 +-------------------+------------------------+ 3314 | Accept-Ranges | Section 2.3 of [Part5] | 3315 | Allow | Section 7.4.1 | 3316 | Server | Section 7.4.2 | 3317 +-------------------+------------------------+ 3319 7.4.1. Allow 3321 The "Allow" header field lists the set of methods advertised as 3322 supported by the target resource. The purpose of this field is 3323 strictly to inform the recipient of valid request methods associated 3324 with the resource. 3326 Allow = #method 3328 Example of use: 3330 Allow: GET, HEAD, PUT 3332 The actual set of allowed methods is defined by the origin server at 3333 the time of each request. An origin server MUST generate an Allow 3334 field in a 405 (Method Not Allowed) response and MAY do so in any 3335 other response. An empty Allow field value indicates that the 3336 resource allows no methods, which might occur in a 405 response if 3337 the resource has been temporarily disabled by configuration. 3339 A proxy MUST NOT modify the Allow header field -- it does not need to 3340 understand all of the indicated methods in order to handle them 3341 according to the generic message handling rules. 3343 7.4.2. Server 3345 The "Server" header field contains information about the software 3346 used by the origin server to handle the request, which is often used 3347 by clients to help identify the scope of reported interoperability 3348 problems, to work around or tailor requests to avoid particular 3349 server limitations, and for analytics regarding server or operating 3350 system use. An origin server MAY generate a Server field in its 3351 responses. 3353 Server = product *( RWS ( product / comment ) ) 3355 The Server field-value consists of one or more product identifiers, 3356 each followed by zero or more comments (Section 3.2 of [Part1]), 3357 which together identify the origin server software and its 3358 significant subproducts. By convention, the product identifiers are 3359 listed in decreasing order of their significance for identifying the 3360 origin server software. Each product identifier consists of a name 3361 and optional version, as defined in Section 5.5.3. 3363 Example: 3365 Server: CERN/3.0 libwww/2.17 3367 An origin server SHOULD NOT generate a Server field containing 3368 needlessly fine-grained detail and SHOULD limit the addition of 3369 subproducts by third parties. Overly long and detailed Server field 3370 values increase response latency and potentially reveal internal 3371 implementation details that might make it (slightly) easier for 3372 attackers to find and exploit known security holes. 3374 8. IANA Considerations 3375 8.1. Method Registry 3377 The HTTP Method Registry defines the name space for the request 3378 method token (Section 4). The method registry will be created and 3379 maintained at . 3381 8.1.1. Procedure 3383 HTTP method registrations MUST include the following fields: 3385 o Method Name (see Section 4) 3387 o Safe ("yes" or "no", see Section 4.2.1) 3389 o Idempotent ("yes" or "no", see Section 4.2.2) 3391 o Pointer to specification text 3393 Values to be added to this name space require IETF Review (see 3394 [RFC5226], Section 4.1). 3396 8.1.2. Considerations for New Methods 3398 Standardized methods are generic; that is, they are potentially 3399 applicable to any resource, not just one particular media type, kind 3400 of resource, or application. As such, it is preferred that new 3401 methods be registered in a document that isn't specific to a single 3402 application or data format, since orthogonal technologies deserve 3403 orthogonal specification. 3405 Since message parsing (Section 3.3 of [Part1]) needs to be 3406 independent of method semantics (aside from responses to HEAD), 3407 definitions of new methods cannot change the parsing algorithm or 3408 prohibit the presence of a message body on either the request or the 3409 response message. Definitions of new methods can specify that only a 3410 zero-length message body is allowed by requiring a Content-Length 3411 header field with a value of "0". 3413 A new method definition needs to indicate whether it is safe 3414 (Section 4.2.1), idempotent (Section 4.2.2), cacheable 3415 (Section 4.2.3), what semantics are to be associated with the payload 3416 body if any is present in the request, and what refinements the 3417 method makes to header field or status code semantics. If the new 3418 method is cacheable, its definition ought to describe how, and under 3419 what conditions, a cache can store a response and use it to satisfy a 3420 subsequent request. The new method ought to describe whether it can 3421 be made conditional (Section 5.2) and, if so, how a server responds 3422 when the condition is false. Likewise, if the new method might have 3423 some use for partial response semantics ([Part5]), it ought to 3424 document this too. 3426 Note: Avoid defining a method name that starts with "M-", since 3427 that prefix might be misinterpreted as having the semantics 3428 assigned to it by [RFC2774]. 3430 8.1.3. Registrations 3432 The HTTP Method Registry shall be populated with the registrations 3433 below: 3435 +---------+------+------------+---------------+ 3436 | Method | Safe | Idempotent | Reference | 3437 +---------+------+------------+---------------+ 3438 | CONNECT | no | no | Section 4.3.6 | 3439 | DELETE | no | yes | Section 4.3.5 | 3440 | GET | yes | yes | Section 4.3.1 | 3441 | HEAD | yes | yes | Section 4.3.2 | 3442 | OPTIONS | yes | yes | Section 4.3.7 | 3443 | POST | no | no | Section 4.3.3 | 3444 | PUT | no | yes | Section 4.3.4 | 3445 | TRACE | yes | yes | Section 4.3.8 | 3446 +---------+------+------------+---------------+ 3448 8.2. Status Code Registry 3450 The HTTP Status Code Registry defines the name space for the response 3451 status-code token (Section 6). The status code registry is 3452 maintained at . 3454 This Section replaces the registration procedure for HTTP Status 3455 Codes previously defined in Section 7.1 of [RFC2817]. 3457 8.2.1. Procedure 3459 A registration MUST include the following fields: 3461 o Status Code (3 digits) 3463 o Short Description 3465 o Pointer to specification text 3467 Values to be added to the HTTP status code name space require IETF 3468 Review (see [RFC5226], Section 4.1). 3470 8.2.2. Considerations for New Status Codes 3472 When it is necessary to express semantics for a response that are not 3473 defined by current status codes, a new status code can be registered. 3474 Status codes are generic; they are potentially applicable to any 3475 resource, not just one particular media type, kind of resource, or 3476 application of HTTP. As such, it is preferred that new status codes 3477 be registered in a document that isn't specific to a single 3478 application. 3480 New status codes are required to fall under one of the categories 3481 defined in Section 6. To allow existing parsers to process the 3482 response message, new status codes cannot disallow a payload, 3483 although they can mandate a zero-length payload body. 3485 Proposals for new status codes that are not yet widely deployed ought 3486 to avoid allocating a specific number for the code until there is 3487 clear consensus that it will be registered; instead, early drafts can 3488 use a notation such as "4NN", or "3N0" .. "3N9", to indicate the 3489 class of the proposed status code(s) without consuming a number 3490 prematurely. 3492 The definition of a new status code ought to explain the request 3493 conditions that would cause a response containing that status code 3494 (e.g., combinations of request header fields and/or method(s)) along 3495 with any dependencies on response header fields (e.g., what fields 3496 are required, what fields can modify the semantics, and what header 3497 field semantics are further refined when used with the new status 3498 code). 3500 The definition of a new status code ought to specify whether or not 3501 it is cacheable. Note that all status codes can be cached if the 3502 response they occur in has explicit freshness information; however, 3503 status codes that are defined as being cacheable are allowed to be 3504 cached without explicit freshness information. Likewise, the 3505 definition of a status code can place constraints upon cache 3506 behavior. See [Part6] for more information. 3508 Finally, the definition of a new status code ought to indicate 3509 whether the payload has any implied association with an identified 3510 resource (Section 3.1.4.1). 3512 8.2.3. Registrations 3514 The HTTP Status Code Registry shall be updated with the registrations 3515 below: 3517 +-------+-------------------------------+----------------+ 3518 | Value | Description | Reference | 3519 +-------+-------------------------------+----------------+ 3520 | 100 | Continue | Section 6.2.1 | 3521 | 101 | Switching Protocols | Section 6.2.2 | 3522 | 200 | OK | Section 6.3.1 | 3523 | 201 | Created | Section 6.3.2 | 3524 | 202 | Accepted | Section 6.3.3 | 3525 | 203 | Non-Authoritative Information | Section 6.3.4 | 3526 | 204 | No Content | Section 6.3.5 | 3527 | 205 | Reset Content | Section 6.3.6 | 3528 | 300 | Multiple Choices | Section 6.4.1 | 3529 | 301 | Moved Permanently | Section 6.4.2 | 3530 | 302 | Found | Section 6.4.3 | 3531 | 303 | See Other | Section 6.4.4 | 3532 | 305 | Use Proxy | Section 6.4.5 | 3533 | 306 | (Unused) | Section 6.4.6 | 3534 | 307 | Temporary Redirect | Section 6.4.7 | 3535 | 400 | Bad Request | Section 6.5.1 | 3536 | 402 | Payment Required | Section 6.5.2 | 3537 | 403 | Forbidden | Section 6.5.3 | 3538 | 404 | Not Found | Section 6.5.4 | 3539 | 405 | Method Not Allowed | Section 6.5.5 | 3540 | 406 | Not Acceptable | Section 6.5.6 | 3541 | 408 | Request Timeout | Section 6.5.7 | 3542 | 409 | Conflict | Section 6.5.8 | 3543 | 410 | Gone | Section 6.5.9 | 3544 | 411 | Length Required | Section 6.5.10 | 3545 | 413 | Payload Too Large | Section 6.5.11 | 3546 | 414 | URI Too Long | Section 6.5.12 | 3547 | 415 | Unsupported Media Type | Section 6.5.13 | 3548 | 417 | Expectation Failed | Section 6.5.14 | 3549 | 426 | Upgrade Required | Section 6.5.15 | 3550 | 500 | Internal Server Error | Section 6.6.1 | 3551 | 501 | Not Implemented | Section 6.6.2 | 3552 | 502 | Bad Gateway | Section 6.6.3 | 3553 | 503 | Service Unavailable | Section 6.6.4 | 3554 | 504 | Gateway Timeout | Section 6.6.5 | 3555 | 505 | HTTP Version Not Supported | Section 6.6.6 | 3556 +-------+-------------------------------+----------------+ 3558 8.3. Header Field Registry 3560 HTTP header fields are registered within the Message Header Field 3561 Registry located at , as defined by [BCP90]. 3564 8.3.1. Considerations for New Header Fields 3566 Header fields are key:value pairs that can be used to communicate 3567 data about the message, its payload, the target resource, or the 3568 connection (i.e., control data). See Section 3.2 of [Part1] for a 3569 general definition of header field syntax in HTTP messages. 3571 The requirements for header field names are defined in [BCP90]. 3572 Authors of specifications defining new fields are advised to keep the 3573 name as short as practical and to not prefix the name with "X-" 3574 unless the header field will never be used on the Internet. (The 3575 "x-" prefix idiom has been extensively misused in practice; it was 3576 intended to only be used as a mechanism for avoiding name collisions 3577 inside proprietary software or intranet processing, since the prefix 3578 would ensure that private names never collide with a newly registered 3579 Internet name.) 3581 New header field values typically have their syntax defined using 3582 ABNF ([RFC5234]), using the extension defined in Section 7 of [Part1] 3583 as necessary, and are usually constrained to the range of ASCII 3584 characters. Header fields needing a greater range of characters can 3585 use an encoding such as the one defined in [RFC5987]. 3587 Leading and trailing whitespace in raw field values is removed upon 3588 field parsing (Section 3.2.4 of [Part1]). Field definitions where 3589 leading or trailing whitespace in values is significant will have to 3590 use a container syntax such as quoted-string. 3592 Because commas (",") are used as a generic delimiter between field- 3593 values, they need to be treated with care if they are allowed in the 3594 field-value. Typically, components that might contain a comma are 3595 protected with double-quotes using the quoted-string ABNF production 3596 (Section 3.2.6 of [Part1]). 3598 For example, a textual date and a URI (either of which might contain 3599 a comma) could be safely carried in field-values like these: 3601 Example-URI-Field: "http://example.com/a.html,foo", 3602 "http://without-a-comma.example.com/" 3603 Example-Date-Field: "Sat, 04 May 1996", "Wed, 14 Sep 2005" 3605 Note that double-quote delimiters almost always are used with the 3606 quoted-string production; using a different syntax inside double- 3607 quotes will likely cause unnecessary confusion. 3609 Many header fields use a format including (case-insensitively) named 3610 parameters (for instance, Content-Type, defined in Section 3.1.1.5). 3611 Allowing both unquoted (token) and quoted (quoted-string) syntax for 3612 the parameter value enables recipients to use existing parser 3613 components. When allowing both forms, the meaning of a parameter 3614 value ought to be independent of the syntax used for it (for an 3615 example, see the notes on parameter handling for media types in 3616 Section 3.1.1.1). 3618 Authors of specifications defining new header fields are advised to 3619 consider documenting: 3621 o Whether the field is a single value, or whether it can be a list 3622 (delimited by commas; see Section 3.2 of [Part1]). 3624 If it does not use the list syntax, document how to treat messages 3625 where the field occurs multiple times (a sensible default would be 3626 to ignore the field, but this might not always be the right 3627 choice). 3629 Note that intermediaries and software libraries might combine 3630 multiple header field instances into a single one, despite the 3631 field's definition not allowing the list syntax. A robust format 3632 enables recipients to discover these situations (good example: 3633 "Content-Type", as the comma can only appear inside quoted 3634 strings; bad example: "Location", as a comma can occur inside a 3635 URI). 3637 o Under what conditions the header field can be used; e.g., only in 3638 responses or requests, in all messages, only on responses to a 3639 particular request method, etc. 3641 o Whether the field should be stored by origin servers that 3642 understand it upon a PUT request. 3644 o Whether the field semantics are further refined by the context, 3645 such as by existing request methods or status codes. 3647 o Whether it is appropriate to list the field-name in the Connection 3648 header field (i.e., if the header field is to be hop-by-hop; see 3649 Section 6.1 of [Part1]). 3651 o Under what conditions intermediaries are allowed to insert, 3652 delete, or modify the field's value. 3654 o Whether it is appropriate to list the field-name in a Vary 3655 response header field (e.g., when the request header field is used 3656 by an origin server's content selection algorithm; see 3657 Section 7.1.4). 3659 o Whether the header field is useful or allowable in trailers (see 3660 Section 4.1 of [Part1]). 3662 o Whether the header field ought to be preserved across redirects. 3664 8.3.2. Registrations 3666 The Message Header Field Registry shall be updated with the following 3667 permanent registrations: 3669 +-------------------+----------+----------+-----------------+ 3670 | Header Field Name | Protocol | Status | Reference | 3671 +-------------------+----------+----------+-----------------+ 3672 | Accept | http | standard | Section 5.3.2 | 3673 | Accept-Charset | http | standard | Section 5.3.3 | 3674 | Accept-Encoding | http | standard | Section 5.3.4 | 3675 | Accept-Language | http | standard | Section 5.3.5 | 3676 | Allow | http | standard | Section 7.4.1 | 3677 | Content-Encoding | http | standard | Section 3.1.2.2 | 3678 | Content-Language | http | standard | Section 3.1.3.2 | 3679 | Content-Location | http | standard | Section 3.1.4.2 | 3680 | Content-Type | http | standard | Section 3.1.1.5 | 3681 | Date | http | standard | Section 7.1.1.2 | 3682 | Expect | http | standard | Section 5.1.1 | 3683 | From | http | standard | Section 5.5.1 | 3684 | Location | http | standard | Section 7.1.2 | 3685 | MIME-Version | http | standard | Appendix A.1 | 3686 | Max-Forwards | http | standard | Section 5.1.2 | 3687 | Referer | http | standard | Section 5.5.2 | 3688 | Retry-After | http | standard | Section 7.1.3 | 3689 | Server | http | standard | Section 7.4.2 | 3690 | User-Agent | http | standard | Section 5.5.3 | 3691 | Vary | http | standard | Section 7.1.4 | 3692 +-------------------+----------+----------+-----------------+ 3694 The change controller for the above registrations is: "IETF 3695 (iesg@ietf.org) - Internet Engineering Task Force". 3697 8.4. Content Coding Registry 3699 The HTTP Content Coding Registry defines the name space for content 3700 coding names (Section 4.2 of [Part1]). The content coding registry 3701 is maintained at . 3703 8.4.1. Procedure 3705 Content Coding registrations MUST include the following fields: 3707 o Name 3709 o Description 3711 o Pointer to specification text 3713 Names of content codings MUST NOT overlap with names of transfer 3714 codings (Section 4 of [Part1]), unless the encoding transformation is 3715 identical (as is the case for the compression codings defined in 3716 Section 4.2 of [Part1]). 3718 Values to be added to this name space require IETF Review (see 3719 Section 4.1 of [RFC5226]), and MUST conform to the purpose of content 3720 coding defined in this section. 3722 8.4.2. Registrations 3724 The HTTP Content Codings Registry shall be updated with the 3725 registrations below: 3727 +------------+--------------------------------------+---------------+ 3728 | Name | Description | Reference | 3729 +------------+--------------------------------------+---------------+ 3730 | compress | UNIX "compress" data format [Welch] | Section 4.2.1 | 3731 | | | of [Part1] | 3732 | deflate | "deflate" compressed data | Section 4.2.2 | 3733 | | ([RFC1951]) inside the "zlib" data | of [Part1] | 3734 | | format ([RFC1950]) | | 3735 | gzip | GZIP file format [RFC1952] | Section 4.2.3 | 3736 | | | of [Part1] | 3737 | identity | Reserved (synonym for "no encoding" | Section 5.3.4 | 3738 | | in Accept-Encoding) | | 3739 | x-compress | Deprecated (alias for compress) | Section 4.2.1 | 3740 | | | of [Part1] | 3741 | x-gzip | Deprecated (alias for gzip) | Section 4.2.3 | 3742 | | | of [Part1] | 3743 +------------+--------------------------------------+---------------+ 3745 9. Security Considerations 3747 This section is meant to inform developers, information providers, 3748 and users of known security concerns relevant to HTTP/1.1 semantics 3749 and its use for transferring information over the Internet. 3751 9.1. Attacks Based On File and Path Names 3753 Origin servers frequently make use of their local file system to 3754 manage the mapping from effective request URI to resource 3755 representations. Implementers need to be aware that most file 3756 systems are not designed to protect against malicious file or path 3757 names, and thus depend on the origin server to avoid mapping to file 3758 names, folders, or directories that have special significance to the 3759 system. 3761 For example, UNIX, Microsoft Windows, and other operating systems use 3762 ".." as a path component to indicate a directory level above the 3763 current one, and use specially named paths or file names to send data 3764 to system devices. Similar naming conventions might exist within 3765 other types of storage systems. Likewise, local storage systems have 3766 an annoying tendency to prefer user-friendliness over security when 3767 handling invalid or unexpected characters, recomposition of 3768 decomposed characters, and case-normalization of case-insensitive 3769 names. 3771 Attacks based on such special names tend to focus on either denial of 3772 service (e.g., telling the server to read from a COM port) or 3773 disclosure of configuration and source files that are not meant to be 3774 served. 3776 9.2. Personal Information 3778 Clients are often privy to large amounts of personal information, 3779 including both information provided by the user to interact with 3780 resources (e.g., the user's name, location, mail address, passwords, 3781 encryption keys, etc.) and information about the user's browsing 3782 activity over time (e.g., history, bookmarks, etc.). Implementations 3783 need to prevent unintentional leakage of personal information. 3785 9.3. Sensitive Information in URIs 3787 URIs are intended to be shared, not secured, even when they identify 3788 secure resources. URIs are often shown on displays, added to 3789 templates when a page is printed, and stored in a variety of 3790 unprotected bookmark lists. It is therefore unwise to include 3791 information within a URI that is sensitive, personally identifiable, 3792 or a risk to disclose. 3794 Authors of services ought to avoid GET-based forms for the submission 3795 of sensitive data because that data will be placed in the request- 3796 target. Many existing servers, proxies, and user agents log or 3797 display the request-target in places where it might be visible to 3798 third parties. Such services ought to use POST-based form submission 3799 instead. 3801 Since the Referer header field tells a target site about the context 3802 that resulted in a request, it has the potential to reveal 3803 information about the user's immediate browsing history and any 3804 personal information that might be found in the referring resource's 3805 URI. Limitations on Referer are described in Section 5.5.2 to 3806 address some of its security considerations. 3808 9.4. Product Information 3810 The User-Agent (Section 5.5.3), Via (Section 5.7.1 of [Part1]), and 3811 Server (Section 7.4.2) header fields often reveal information about 3812 the respective sender's software systems. In theory, this can make 3813 it easier for an attacker to exploit known security holes; in 3814 practice, attackers tend to try all potential holes regardless of the 3815 apparent software versions being used. 3817 Proxies that serve as a portal through a network firewall ought to 3818 take special precautions regarding the transfer of header information 3819 that might identify hosts behind the firewall. The Via header field 3820 allows intermediaries to replace sensitive machine names with 3821 pseudonyms. 3823 9.5. Fragment after Redirects 3825 Although fragment identifiers used within URI references are not sent 3826 in requests, implementers ought to be aware that they will be visible 3827 to the user agent and any extensions or scripts running as a result 3828 of the response. In particular, when a redirect occurs and the 3829 original request's fragment identifier is inherited by the new 3830 reference in Location (Section 7.1.2), this might have the effect of 3831 leaking one site's fragment to another site. If the first site uses 3832 personal information in fragments, it ought to ensure that redirects 3833 to other sites include a (possibly empty) fragment component in order 3834 to block that inheritance. 3836 9.6. Browser Fingerprinting 3838 Browser fingerprinting is a set of techniques for identifying a 3839 specific user agent over time through its unique set of 3840 characteristics. These characteristics might include information 3841 related to its TCP behavior, feature capabilities, and scripting 3842 environment, though of particular interest here is the set of unique 3843 characteristics that might be communicated via HTTP. Fingerprinting 3844 is considered a privacy concern because it enables tracking of a user 3845 agent's behavior over time without the corresponding controls that 3846 the user might have over other forms of data collection (e.g., 3847 cookies). Many general-purpose user agents (i.e., Web browsers) have 3848 taken steps to reduce their fingerprints. 3850 There are a number of request header fields that might reveal 3851 information to servers that is sufficiently unique to enable 3852 fingerprinting. The From header field is the most obvious, though it 3853 is expected that From will only be sent when self-identification is 3854 desired by the user. Likewise, Cookie header fields are deliberately 3855 designed to enable re-identification, so we can assume that 3856 fingerprinting concerns only apply to situations where cookies are 3857 disabled or restricted by the user agent's configuration. 3859 The User-Agent header field might contain enough information to 3860 uniquely identify a specific device, usually when combined with other 3861 characteristics, particularly if the user agent sends excessive 3862 details about the user's system or extensions. However, the source 3863 of unique information that is least expected by users is proactive 3864 negotiation (Section 5.3), including the Accept, Accept-Charset, 3865 Accept-Encoding, and Accept-Language header fields. 3867 In addition to the fingerprinting concern, detailed use of the 3868 Accept-Language header field can reveal information the user might 3869 consider to be of a private nature, because the understanding of 3870 particular languages is often strongly correlated to membership in a 3871 particular ethnic group. An approach that limits such loss of 3872 privacy would be for a user agent to omit the sending of Accept- 3873 Language except for sites that have been whitelisted, perhaps via 3874 interaction after detecting a Vary header field that would indicate 3875 language negotiation might be useful. 3877 In environments where proxies are used to enhance privacy, user 3878 agents ought to be conservative in sending proactive negotiation 3879 header fields. General-purpose user agents that provide a high 3880 degree of header field configurability ought to inform users about 3881 the loss of privacy that might result if too much detail is provided. 3882 As an extreme privacy measure, proxies could filter the proactive 3883 negotiation header fields in relayed requests. 3885 10. Acknowledgments 3887 See Section 10 of [Part1]. 3889 11. References 3891 11.1. Normative References 3893 [Part1] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext 3894 Transfer Protocol (HTTP/1.1): Message Syntax and 3895 Routing", draft-ietf-httpbis-p1-messaging-24 (work in 3896 progress), September 2013. 3898 [Part4] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext 3899 Transfer Protocol (HTTP/1.1): Conditional Requests", 3900 draft-ietf-httpbis-p4-conditional-24 (work in 3901 progress), September 2013. 3903 [Part5] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., 3904 "Hypertext Transfer Protocol (HTTP/1.1): Range 3905 Requests", draft-ietf-httpbis-p5-range-24 (work in 3906 progress), September 2013. 3908 [Part6] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 3909 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 3910 draft-ietf-httpbis-p6-cache-24 (work in progress), 3911 September 2013. 3913 [Part7] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext 3914 Transfer Protocol (HTTP/1.1): Authentication", 3915 draft-ietf-httpbis-p7-auth-24 (work in progress), 3916 September 2013. 3918 [RFC1950] Deutsch, L. and J-L. Gailly, "ZLIB Compressed Data 3919 Format Specification version 3.3", RFC 1950, May 1996. 3921 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format 3922 Specification version 1.3", RFC 1951, May 1996. 3924 [RFC1952] Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and 3925 G. Randers-Pehrson, "GZIP file format specification 3926 version 4.3", RFC 1952, May 1996. 3928 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet 3929 Mail Extensions (MIME) Part One: Format of Internet 3930 Message Bodies", RFC 2045, November 1996. 3932 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet 3933 Mail Extensions (MIME) Part Two: Media Types", 3934 RFC 2046, November 1996. 3936 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3937 Requirement Levels", BCP 14, RFC 2119, March 1997. 3939 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, 3940 "Uniform Resource Identifier (URI): Generic Syntax", 3941 STD 66, RFC 3986, January 2005. 3943 [RFC4647] Phillips, A., Ed. and M. Davis, Ed., "Matching of 3944 Language Tags", BCP 47, RFC 4647, September 2006. 3946 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for 3947 Syntax Specifications: ABNF", STD 68, RFC 5234, 3948 January 2008. 3950 [RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for 3951 Identifying Languages", BCP 47, RFC 5646, 3952 September 2009. 3954 [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in 3955 Internationalization in the IETF", BCP 166, RFC 6365, 3956 September 2011. 3958 [Welch] Welch, T., "A Technique for High Performance Data 3959 Compression", IEEE Computer 17(6), June 1984. 3961 11.2. Informative References 3963 [BCP13] Freed, N., Klensin, J., and T. Hansen, "Media Type 3964 Specifications and Registration Procedures", BCP 13, 3965 RFC 6838, January 2013. 3967 [BCP90] Klyne, G., Nottingham, M., and J. Mogul, "Registration 3968 Procedures for Message Header Fields", BCP 90, 3969 RFC 3864, September 2004. 3971 [REST] Fielding, R., "Architectural Styles and the Design of 3972 Network-based Software Architectures", Doctoral 3973 Dissertation, University of California, Irvine , 3974 September 2000, 3975 . 3977 [RFC1305] Mills, D., "Network Time Protocol (Version 3) 3978 Specification, Implementation", RFC 1305, March 1992. 3980 [RFC1945] Berners-Lee, T., Fielding, R., and H. Nielsen, 3981 "Hypertext Transfer Protocol -- HTTP/1.0", RFC 1945, 3982 May 1996. 3984 [RFC2049] Freed, N. and N. Borenstein, "Multipurpose Internet 3985 Mail Extensions (MIME) Part Five: Conformance Criteria 3986 and Examples", RFC 2049, November 1996. 3988 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and 3989 T. Berners-Lee, "Hypertext Transfer Protocol -- 3990 HTTP/1.1", RFC 2068, January 1997. 3992 [RFC2295] Holtman, K. and A. Mutz, "Transparent Content 3993 Negotiation in HTTP", RFC 2295, March 1998. 3995 [RFC2388] Masinter, L., "Returning Values from Forms: multipart/ 3996 form-data", RFC 2388, August 1998. 3998 [RFC2557] Palme, F., Hopmann, A., Shelness, N., and E. Stefferud, 3999 "MIME Encapsulation of Aggregate Documents, such as 4000 HTML (MHTML)", RFC 2557, March 1999. 4002 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 4003 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 4004 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 4006 [RFC2774] Frystyk, H., Leach, P., and S. Lawrence, "An HTTP 4007 Extension Framework", RFC 2774, February 2000. 4009 [RFC2817] Khare, R. and S. Lawrence, "Upgrading to TLS Within 4010 HTTP/1.1", RFC 2817, May 2000. 4012 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 4013 Procedures", BCP 19, RFC 2978, October 2000. 4015 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing 4016 an IANA Considerations Section in RFCs", BCP 26, 4017 RFC 5226, May 2008. 4019 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 4020 October 2008. 4022 [RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP", 4023 RFC 5789, March 2010. 4025 [RFC5987] Reschke, J., "Character Set and Language Encoding for 4026 Hypertext Transfer Protocol (HTTP) Header Field 4027 Parameters", RFC 5987, August 2010. 4029 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 4031 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 4032 April 2011. 4034 [RFC6266] Reschke, J., "Use of the Content-Disposition Header 4035 Field in the Hypertext Transfer Protocol (HTTP)", 4036 RFC 6266, June 2011. 4038 [status-308] Reschke, J., "The Hypertext Transfer Protocol (HTTP) 4039 Status Code 308 (Permanent Redirect)", 4040 draft-reschke-http-status-308-07 (work in progress), 4041 March 2012. 4043 Appendix A. Differences between HTTP and MIME 4045 HTTP/1.1 uses many of the constructs defined for the Internet Message 4046 Format [RFC5322] and the Multipurpose Internet Mail Extensions (MIME) 4047 [RFC2045] to allow a message body to be transmitted in an open 4048 variety of representations and with extensible header fields. 4049 However, RFC 2045 is focused only on email; applications of HTTP have 4050 many characteristics that differ from email, and hence HTTP has 4051 features that differ from MIME. These differences were carefully 4052 chosen to optimize performance over binary connections, to allow 4053 greater freedom in the use of new media types, to make date 4054 comparisons easier, and to acknowledge the practice of some early 4055 HTTP servers and clients. 4057 This appendix describes specific areas where HTTP differs from MIME. 4058 Proxies and gateways to and from strict MIME environments need to be 4059 aware of these differences and provide the appropriate conversions 4060 where necessary. 4062 A.1. MIME-Version 4064 HTTP is not a MIME-compliant protocol. However, messages can include 4065 a single MIME-Version header field to indicate what version of the 4066 MIME protocol was used to construct the message. Use of the MIME- 4067 Version header field indicates that the message is in full 4068 conformance with the MIME protocol (as defined in [RFC2045]). 4069 Senders are responsible for ensuring full conformance (where 4070 possible) when exporting HTTP messages to strict MIME environments. 4072 A.2. Conversion to Canonical Form 4074 MIME requires that an Internet mail body part be converted to 4075 canonical form prior to being transferred, as described in Section 4 4076 of [RFC2049]. Section 3.1.1.3 of this document describes the forms 4077 allowed for subtypes of the "text" media type when transmitted over 4078 HTTP. [RFC2046] requires that content with a type of "text" 4079 represent line breaks as CRLF and forbids the use of CR or LF outside 4080 of line break sequences. HTTP allows CRLF, bare CR, and bare LF to 4081 indicate a line break within text content. 4083 A proxy or gateway from HTTP to a strict MIME environment ought to 4084 translate all line breaks within the text media types described in 4085 Section 3.1.1.3 of this document to the RFC 2049 canonical form of 4086 CRLF. Note, however, this might be complicated by the presence of a 4087 Content-Encoding and by the fact that HTTP allows the use of some 4088 charsets that do not use octets 13 and 10 to represent CR and LF, 4089 respectively. 4091 Conversion will break any cryptographic checksums applied to the 4092 original content unless the original content is already in canonical 4093 form. Therefore, the canonical form is recommended for any content 4094 that uses such checksums in HTTP. 4096 A.3. Conversion of Date Formats 4098 HTTP/1.1 uses a restricted set of date formats (Section 7.1.1.1) to 4099 simplify the process of date comparison. Proxies and gateways from 4100 other protocols ought to ensure that any Date header field present in 4101 a message conforms to one of the HTTP/1.1 formats and rewrite the 4102 date if necessary. 4104 A.4. Conversion of Content-Encoding 4106 MIME does not include any concept equivalent to HTTP/1.1's Content- 4107 Encoding header field. Since this acts as a modifier on the media 4108 type, proxies and gateways from HTTP to MIME-compliant protocols 4109 ought to either change the value of the Content-Type header field or 4110 decode the representation before forwarding the message. (Some 4111 experimental applications of Content-Type for Internet mail have used 4112 a media-type parameter of ";conversions=" to perform 4113 a function equivalent to Content-Encoding. However, this parameter 4114 is not part of the MIME standards). 4116 A.5. Conversion of Content-Transfer-Encoding 4118 HTTP does not use the Content-Transfer-Encoding field of MIME. 4119 Proxies and gateways from MIME-compliant protocols to HTTP need to 4120 remove any Content-Transfer-Encoding prior to delivering the response 4121 message to an HTTP client. 4123 Proxies and gateways from HTTP to MIME-compliant protocols are 4124 responsible for ensuring that the message is in the correct format 4125 and encoding for safe transport on that protocol, where "safe 4126 transport" is defined by the limitations of the protocol being used. 4127 Such a proxy or gateway ought to transform and label the data with an 4128 appropriate Content-Transfer-Encoding if doing so will improve the 4129 likelihood of safe transport over the destination protocol. 4131 A.6. MHTML and Line Length Limitations 4133 HTTP implementations that share code with MHTML [RFC2557] 4134 implementations need to be aware of MIME line length limitations. 4135 Since HTTP does not have this limitation, HTTP does not fold long 4136 lines. MHTML messages being transported by HTTP follow all 4137 conventions of MHTML, including line length limitations and folding, 4138 canonicalization, etc., since HTTP transfers message-bodies as 4139 payload and, aside from the "multipart/byteranges" type (Appendix A 4140 of [Part5]), does not interpret the content or any MIME header lines 4141 that might be contained therein. 4143 Appendix B. Changes from RFC 2616 4145 The primary changes in this revision have been editorial in nature: 4146 extracting the messaging syntax and partitioning HTTP semantics into 4147 separate documents for the core features, conditional requests, 4148 partial requests, caching, and authentication. The conformance 4149 language has been revised to clearly target requirements and the 4150 terminology has been improved to distinguish payload from 4151 representations and representations from resources. 4153 A new requirement has been added that semantics embedded in a URI 4154 should be disabled when those semantics are inconsistent with the 4155 request method, since this is a common cause of interoperability 4156 failure. (Section 2) 4158 An algorithm has been added for determining if a payload is 4159 associated with a specific identifier. (Section 3.1.4.1) 4161 The default charset of ISO-8859-1 for text media types has been 4162 removed; the default is now whatever the media type definition says. 4163 Likewise, special treatment of ISO-8859-1 has been removed from the 4164 Accept-Charset header field. (Section 3.1.1.3 and Section 5.3.3) 4166 The definition of Content-Location has been changed to no longer 4167 affect the base URI for resolving relative URI references, due to 4168 poor implementation support and the undesirable effect of potentially 4169 breaking relative links in content-negotiated resources. 4170 (Section 3.1.4.2) 4172 To be consistent with the method-neutral parsing algorithm of 4173 [Part1], the definition of GET has been relaxed so that requests can 4174 have a body, even though a body has no meaning for GET. 4175 (Section 4.3.1) 4177 Servers are no longer required to handle all Content-* header fields 4178 and use of Content-Range has been explicitly banned in PUT requests. 4179 (Section 4.3.4) 4181 Definition of the CONNECT method has been moved from [RFC2817] to 4182 this specification. (Section 4.3.6) 4184 The OPTIONS and TRACE request methods have been defined as being 4185 safe. (Section 4.3.7 and Section 4.3.8) 4186 The Expect header field's extension mechanism has been removed due to 4187 widely-deployed broken implementations. (Section 5.1.1) 4189 The Max-Forwards header field has been restricted to the OPTIONS and 4190 TRACE methods; previously, extension methods could have used it as 4191 well. (Section 5.1.2) 4193 The "about:blank" URI has been suggested as a value for the Referer 4194 header field when no referring URI is applicable, which distinguishes 4195 that case from others where the Referer field is not sent or has been 4196 removed. (Section 5.5.2) 4198 The following status codes are now cacheable (that is, they can be 4199 stored and reused by a cache without explicit freshness information 4200 present): 204, 404, 405, 414, 501. (Section 6) 4202 The 201 (Created) status description has been changed to allow for 4203 the possibility that more than one resource has been created. 4204 (Section 6.3.2) 4206 The definition of 203 (Non-Authoritative Information) has been 4207 broadened to include cases of payload transformations as well. 4208 (Section 6.3.4) 4210 The set of request methods that are safe to automatically redirect is 4211 no longer closed; user agents are able to make that determination 4212 based upon the request method semantics. The redirect status codes 4213 301, 302, and 307 no longer have normative requirements on response 4214 payloads and user interaction. (Section 6.4) 4216 The status codes 301 and 302 have been changed to allow user agents 4217 to rewrite the method from POST to GET. (Sections 6.4.2 and 6.4.3) 4219 The description of 303 (See Other) status code has been changed to 4220 allow it to be cached if explicit freshness information is given, and 4221 a specific definition has been added for a 303 response to GET. 4222 (Section 6.4.4) 4224 The 305 (Use Proxy) status code has been deprecated due to security 4225 concerns regarding in-band configuration of a proxy. (Section 6.4.5) 4227 The 400 (Bad Request) status code has been relaxed so that it isn't 4228 limited to syntax errors. (Section 6.5.1) 4230 The 426 (Upgrade Required) status code has been incorporated from 4231 [RFC2817]. (Section 6.5.15) 4233 The target of requirements on HTTP-date and the Date header field 4234 have been reduced to those systems generating the date, rather than 4235 all systems sending a date. (Section 7.1.1) 4237 The syntax of the Location header field has been changed to allow all 4238 URI references, including relative references and fragments, along 4239 with some clarifications as to when use of fragments would not be 4240 appropriate. (Section 7.1.2) 4242 Allow has been reclassified as a response header field, removing the 4243 option to specify it in a PUT request. Requirements relating to the 4244 content of Allow have been relaxed; correspondingly, clients are not 4245 required to always trust its value. (Section 7.4.1) 4247 A Method Registry has been defined. (Section 8.1) 4249 The Status Code Registry has been redefined by this specification; 4250 previously, it was defined in Section 7.1 of [RFC2817]. 4251 (Section 8.2) 4253 Registration of Content Codings has been changed to require IETF 4254 Review. (Section 8.4) 4256 The Content-Disposition header field has been removed since it is now 4257 defined by [RFC6266]. 4259 The Content-MD5 header field has been removed because it was 4260 inconsistently implemented with respect to partial responses. 4262 Appendix C. Imported ABNF 4264 The following core rules are included by reference, as defined in 4265 Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return), 4266 CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double 4267 quote), HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF 4268 (line feed), OCTET (any 8-bit sequence of data), SP (space), and 4269 VCHAR (any visible US-ASCII character). 4271 The rules below are defined in [Part1]: 4273 BWS = 4274 OWS = 4275 RWS = 4276 URI-reference = 4277 absolute-URI = 4278 comment = 4279 field-name = 4280 partial-URI = 4281 quoted-string = 4282 token = 4283 word = 4285 Appendix D. Collected ABNF 4287 In the collected ABNF below, list rules are expanded as per Section 4288 1.2 of [Part1]. 4290 Accept = [ ( "," / ( media-range [ accept-params ] ) ) *( OWS "," [ 4291 OWS ( media-range [ accept-params ] ) ] ) ] 4292 Accept-Charset = *( "," OWS ) ( ( charset / "*" ) [ weight ] ) *( OWS 4293 "," [ OWS ( ( charset / "*" ) [ weight ] ) ] ) 4294 Accept-Encoding = [ ( "," / ( codings [ weight ] ) ) *( OWS "," [ OWS 4295 ( codings [ weight ] ) ] ) ] 4296 Accept-Language = *( "," OWS ) ( language-range [ weight ] ) *( OWS 4297 "," [ OWS ( language-range [ weight ] ) ] ) 4298 Allow = [ ( "," / method ) *( OWS "," [ OWS method ] ) ] 4300 BWS = 4302 Content-Encoding = *( "," OWS ) content-coding *( OWS "," [ OWS 4303 content-coding ] ) 4304 Content-Language = *( "," OWS ) language-tag *( OWS "," [ OWS 4305 language-tag ] ) 4306 Content-Location = absolute-URI / partial-URI 4307 Content-Type = media-type 4309 Date = HTTP-date 4311 Expect = "100-continue" 4313 From = mailbox 4315 GMT = %x47.4D.54 ; GMT 4317 HTTP-date = IMF-fixdate / obs-date 4319 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 4320 Location = URI-reference 4322 Max-Forwards = 1*DIGIT 4324 OWS = 4326 RWS = 4327 Referer = absolute-URI / partial-URI 4328 Retry-After = HTTP-date / delta-seconds 4330 Server = product *( RWS ( product / comment ) ) 4332 URI-reference = 4333 User-Agent = product *( RWS ( product / comment ) ) 4335 Vary = "*" / ( *( "," OWS ) field-name *( OWS "," [ OWS field-name ] 4336 ) ) 4338 absolute-URI = 4339 accept-ext = OWS ";" OWS token [ "=" word ] 4340 accept-params = weight *accept-ext 4341 asctime-date = day-name SP date3 SP time-of-day SP year 4342 attribute = token 4344 charset = token 4345 codings = content-coding / "identity" / "*" 4346 comment = 4347 content-coding = token 4349 date1 = day SP month SP year 4350 date2 = day "-" month "-" 2DIGIT 4351 date3 = month SP ( 2DIGIT / ( SP DIGIT ) ) 4352 day = 2DIGIT 4353 day-name = %x4D.6F.6E ; Mon 4354 / %x54.75.65 ; Tue 4355 / %x57.65.64 ; Wed 4356 / %x54.68.75 ; Thu 4357 / %x46.72.69 ; Fri 4358 / %x53.61.74 ; Sat 4359 / %x53.75.6E ; Sun 4360 day-name-l = %x4D.6F.6E.64.61.79 ; Monday 4361 / %x54.75.65.73.64.61.79 ; Tuesday 4362 / %x57.65.64.6E.65.73.64.61.79 ; Wednesday 4363 / %x54.68.75.72.73.64.61.79 ; Thursday 4364 / %x46.72.69.64.61.79 ; Friday 4365 / %x53.61.74.75.72.64.61.79 ; Saturday 4366 / %x53.75.6E.64.61.79 ; Sunday 4367 delta-seconds = 1*DIGIT 4368 field-name = 4370 hour = 2DIGIT 4372 language-range = 4373 language-tag = 4375 mailbox = 4376 media-range = ( "*/*" / ( type "/*" ) / ( type "/" subtype ) ) *( OWS 4377 ";" OWS parameter ) 4378 media-type = type "/" subtype *( OWS ";" OWS parameter ) 4379 method = token 4380 minute = 2DIGIT 4381 month = %x4A.61.6E ; Jan 4382 / %x46.65.62 ; Feb 4383 / %x4D.61.72 ; Mar 4384 / %x41.70.72 ; Apr 4385 / %x4D.61.79 ; May 4386 / %x4A.75.6E ; Jun 4387 / %x4A.75.6C ; Jul 4388 / %x41.75.67 ; Aug 4389 / %x53.65.70 ; Sep 4390 / %x4F.63.74 ; Oct 4391 / %x4E.6F.76 ; Nov 4392 / %x44.65.63 ; Dec 4394 obs-date = rfc850-date / asctime-date 4396 parameter = attribute "=" value 4397 partial-URI = 4398 product = token [ "/" product-version ] 4399 product-version = token 4401 quoted-string = 4402 qvalue = ( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] ) 4404 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 4406 second = 2DIGIT 4407 subtype = token 4409 time-of-day = hour ":" minute ":" second 4410 token = 4411 type = token 4413 value = word 4415 weight = OWS ";" OWS "q=" qvalue 4416 word = 4418 year = 4DIGIT 4420 Appendix E. Change Log (to be removed by RFC Editor before publication) 4422 E.1. Since RFC 2616 4424 Changes up to the first Working Group Last Call draft are summarized 4425 in . 4428 E.2. Since draft-ietf-httpbis-p2-semantics-21 4430 Closed issues: 4432 o : "ETag (and 4433 other metadata) in status messages" 4435 o : "Conditional 4436 GET text" 4438 o : "Clarify 4439 description of 405 (Not Allowed)" 4441 o : "Allowing 4442 heuristic caching for new status codes" 4444 o : "method 4445 semantics: retrieval/representation" 4447 o : "User 4448 confirmation for unsafe methods" 4450 o : "Tentative 4451 Status Codes" 4453 o : "No-Transform" 4455 o : "p2 editorial 4456 feedback" 4458 o : "Absence of 4459 Accept-Encoding" 4461 o : "Accept- 4462 Language ordering for identical qvalues" 4464 o : "Identify 4465 additional status codes as cacheable by default" 4467 o : "mention in 4468 header field considerations that leading/trailing WS is lossy" 4470 E.3. Since draft-ietf-httpbis-p2-semantics-22 4472 Closed issues: 4474 o : "explain list 4475 expansion in ABNF appendices" 4477 o : "Fallback for 4478 Accept-Language" 4480 o : "Receiving a 4481 higher minor HTTP version number" 4483 o : "Language-tag 4484 vs. language-range" 4486 o : "Registering 4487 x-gzip and x-deflate" 4489 o : "RFC2774 and 4490 method registrations" 4492 o : "Selection 4493 based upon request target" 4495 E.4. Since draft-ietf-httpbis-p2-semantics-23 4497 Closed issues: 4499 o : "400 response 4500 isn't generic" 4502 o : "p2 Editorial 4503 feedback" 4505 o : "Content- 4506 Length in HEAD responses" 4508 o : "Requirements 4509 upon proxies for Expect" 4511 o : "Expectation 4512 Extensions" 4514 o : "What is 4515 'Cacheable'?" 4517 o : "MUSTs and 4518 other feedback" 4520 o : "Resubmission 4521 of 403" 4523 o : "does 205 4524 allow chunked encoding?" 4526 Index 4528 1 4529 1xx Informational (status code class) 50 4531 2 4532 2xx Successful (status code class) 51 4534 3 4535 3xx Redirection (status code class) 54 4537 4 4538 4xx Client Error (status code class) 58 4540 5 4541 5xx Server Error (status code class) 62 4543 1 4544 100 Continue (status code) 50 4545 100-continue (expect value) 34 4546 101 Switching Protocols (status code) 50 4548 2 4549 200 OK (status code) 51 4550 201 Created (status code) 52 4551 202 Accepted (status code) 52 4552 203 Non-Authoritative Information (status code) 52 4553 204 No Content (status code) 53 4554 205 Reset Content (status code) 53 4556 3 4557 300 Multiple Choices (status code) 55 4558 301 Moved Permanently (status code) 56 4559 302 Found (status code) 56 4560 303 See Other (status code) 57 4561 305 Use Proxy (status code) 57 4562 306 (Unused) (status code) 57 4563 307 Temporary Redirect (status code) 58 4565 4 4566 400 Bad Request (status code) 58 4567 402 Payment Required (status code) 58 4568 403 Forbidden (status code) 58 4569 404 Not Found (status code) 59 4570 405 Method Not Allowed (status code) 59 4571 406 Not Acceptable (status code) 59 4572 408 Request Timeout (status code) 60 4573 409 Conflict (status code) 60 4574 410 Gone (status code) 60 4575 411 Length Required (status code) 61 4576 413 Payload Too Large (status code) 61 4577 414 URI Too Long (status code) 61 4578 415 Unsupported Media Type (status code) 61 4579 417 Expectation Failed (status code) 62 4580 426 Upgrade Required (status code) 62 4582 5 4583 500 Internal Server Error (status code) 62 4584 501 Not Implemented (status code) 62 4585 502 Bad Gateway (status code) 63 4586 503 Service Unavailable (status code) 63 4587 504 Gateway Timeout (status code) 63 4588 505 HTTP Version Not Supported (status code) 63 4590 A 4591 Accept header field 38 4592 Accept-Charset header field 40 4593 Accept-Encoding header field 41 4594 Accept-Language header field 42 4595 Allow header field 72 4597 C 4598 cacheable 24 4599 compress (content coding) 11 4600 conditional request 36 4601 CONNECT method 30 4602 content coding 11 4603 content negotiation 6 4604 Content-Encoding header field 12 4605 Content-Language header field 13 4606 Content-Location header field 15 4607 Content-Transfer-Encoding header field 89 4608 Content-Type header field 10 4610 D 4611 Date header field 67 4612 deflate (content coding) 11 4613 DELETE method 29 4615 E 4616 Expect header field 34 4618 F 4619 From header field 44 4621 G 4622 GET method 24 4623 Grammar 4624 Accept 38 4625 Accept-Charset 40 4626 Accept-Encoding 41 4627 accept-ext 38 4628 Accept-Language 42 4629 accept-params 38 4630 Allow 72 4631 asctime-date 67 4632 attribute 8 4633 charset 9 4634 codings 41 4635 content-coding 11 4636 Content-Encoding 12 4637 Content-Language 13 4638 Content-Location 15 4639 Content-Type 10 4640 Date 67 4641 date1 66 4642 day 66 4643 day-name 66 4644 day-name-l 66 4645 delta-seconds 70 4646 Expect 34 4647 From 44 4648 GMT 66 4649 hour 66 4650 HTTP-date 64 4651 IMF-fixdate 66 4652 language-range 42 4653 language-tag 13 4654 Location 68 4655 Max-Forwards 36 4656 media-range 38 4657 media-type 8 4658 method 21 4659 minute 66 4660 month 66 4661 obs-date 66 4662 parameter 8 4663 product 46 4664 product-version 46 4665 qvalue 38 4666 Referer 45 4667 Retry-After 70 4668 rfc850-date 67 4669 second 66 4670 Server 73 4671 subtype 8 4672 time-of-day 66 4673 type 8 4674 User-Agent 46 4675 value 8 4676 Vary 70 4677 weight 38 4678 year 66 4679 gzip (content coding) 11 4681 H 4682 HEAD method 25 4684 I 4685 idempotent 23 4687 L 4688 Location header field 68 4690 M 4691 Max-Forwards header field 36 4692 MIME-Version header field 88 4694 O 4695 OPTIONS method 31 4697 P 4698 payload 17 4699 POST method 25 4700 PUT method 26 4702 R 4703 Referer header field 45 4704 representation 7 4705 Retry-After header field 69 4707 S 4708 safe 22 4709 selected representation 7, 71 4710 Server header field 73 4711 Status Codes Classes 4712 1xx Informational 50 4713 2xx Successful 51 4714 3xx Redirection 54 4715 4xx Client Error 58 4716 5xx Server Error 62 4718 T 4719 TRACE method 32 4721 U 4722 User-Agent header field 46 4724 V 4725 Vary header field 70 4727 X 4728 x-compress (content coding) 11 4729 x-gzip (content coding) 11 4731 Authors' Addresses 4733 Roy T. Fielding (editor) 4734 Adobe Systems Incorporated 4735 345 Park Ave 4736 San Jose, CA 95110 4737 USA 4739 EMail: fielding@gbiv.com 4740 URI: http://roy.gbiv.com/ 4741 Julian F. Reschke (editor) 4742 greenbytes GmbH 4743 Hafenweg 16 4744 Muenster, NW 48155 4745 Germany 4747 EMail: julian.reschke@greenbytes.de 4748 URI: http://greenbytes.de/tech/webdav/