idnits 2.17.1 draft-ietf-httpbis-p2-semantics-25.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 (November 17, 2013) is 3812 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-25 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p4-conditional-25 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p5-range-25 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p6-cache-25 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p7-auth-25 -- 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: 0 errors (**), 0 flaws (~~), 6 warnings (==), 11 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 November 17, 2013 7 Expires: May 21, 2014 9 Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content 10 draft-ietf-httpbis-p2-semantics-25 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.2. 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 May 21, 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 . . . . . . . . . . . . . . . . . 48 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) . . . . . . . . . . . . . . . . . . . . . 58 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 . . . . . . . . . . . . . . . . . . . . 59 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 . . . . . . . . . . . . . . 62 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 . . . . . . . . . . . . . . 63 164 6.6.2. 501 Not Implemented . . . . . . . . . . . . . . . . . 63 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 . . . . . . . . . . . . . . . . . . . . 64 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 . . . . . . . . . . . . . . . . . . . 82 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 . . . . . . . . . . . . . . . . . . 85 206 Appendix A. Differences between HTTP and MIME . . . . . . . . . . 87 207 A.1. MIME-Version . . . . . . . . . . . . . . . . . . . . . . . 88 208 A.2. Conversion to Canonical Form . . . . . . . . . . . . . . . 88 209 A.3. Conversion of Date Formats . . . . . . . . . . . . . . . . 88 210 A.4. Conversion of Content-Encoding . . . . . . . . . . . . . . 88 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 . . . . . . . . . . . . . . . . 89 214 Appendix C. Imported ABNF . . . . . . . . . . . . . . . . . . . . 92 215 Appendix D. Collected ABNF . . . . . . . . . . . . . . . . . . . 92 216 Appendix E. Change Log (to be removed by RFC Editor before 217 publication) . . . . . . . . . . . . . . . . . . . . 95 218 E.1. Since RFC 2616 . . . . . . . . . . . . . . . . . . . . . . 95 219 E.2. Since draft-ietf-httpbis-p2-semantics-24 . . . . . . . . . 95 220 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 222 1. Introduction 224 Each Hypertext Transfer Protocol (HTTP) message is either a request 225 or a response. A server listens on a connection for a request, 226 parses each message received, interprets the message semantics in 227 relation to the identified request target, and responds to that 228 request with one or more response messages. A client constructs 229 request messages to communicate specific intentions, and examines 230 received responses to see if the intentions were carried out and 231 determine how to interpret the results. This document defines 232 HTTP/1.1 request and response semantics in terms of the architecture 233 defined in [Part1]. 235 HTTP provides a uniform interface for interacting with a resource 236 (Section 2), regardless of its type, nature, or implementation, via 237 the manipulation and transfer of representations (Section 3). 239 HTTP semantics include the intentions defined by each request method 240 (Section 4), extensions to those semantics that might be described in 241 request header fields (Section 5), the meaning of status codes to 242 indicate a machine-readable response (Section 6), and the meaning of 243 other control data and resource metadata that might be given in 244 response header fields (Section 7). 246 This document also defines representation metadata that describe how 247 a payload is intended to be interpreted by a recipient, the request 248 header fields that might influence content selection, and the various 249 selection algorithms that are collectively referred to as "content 250 negotiation" (Section 3.4). 252 1.1. Conformance and Error Handling 254 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 255 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 256 document are to be interpreted as described in [RFC2119]. 258 Conformance criteria and considerations regarding error handling are 259 defined in Section 2.5 of [Part1]. 261 1.2. Syntax Notation 263 This specification uses the Augmented Backus-Naur Form (ABNF) 264 notation of [RFC5234] with the list rule extension defined in Section 265 7 of [Part1]. Appendix C describes rules imported from other 266 documents. Appendix D shows the collected ABNF with the list rule 267 expanded. 269 This specification uses the terms "character", "character encoding 270 scheme", "charset", and "protocol element" as they are defined in 271 [RFC6365]. 273 2. Resources 275 The target of an HTTP request is called a resource. HTTP does not 276 limit the nature of a resource; it merely defines an interface that 277 might be used to interact with resources. Each resource is 278 identified by a Uniform Resource Identifier (URI), as described in 279 Section 2.7 of [Part1]. 281 When a client constructs an HTTP/1.1 request message, it sends the 282 target URI in one of various forms, as defined in (Section 5.3 of 283 [Part1]). When a request is received, the server reconstructs an 284 effective request URI for the target resource (Section 5.5 of 285 [Part1]). 287 One design goal of HTTP is to separate resource identification from 288 request semantics, which is made possible by vesting the request 289 semantics in the request method (Section 4) and a few request- 290 modifying header fields (Section 5). Resource owners SHOULD NOT 291 include request semantics within a URI, such as by specifying an 292 action to invoke within the path or query components of the effective 293 request URI, unless those semantics are disabled when they are 294 inconsistent with the request method. 296 3. Representations 298 If we consider that a resource could be anything, and that the 299 uniform interface provided by HTTP is similar to a window through 300 which one can observe and act upon such a thing only through the 301 communication of messages to some independent actor on the other 302 side, then we need an abstraction to represent ("take the place of") 303 the current or desired state of that thing in our communications. We 304 call that abstraction a representation [REST]. 306 For the purposes of HTTP, a "representation" is information that is 307 intended to reflect a past, current, or desired state of a given 308 resource, in a format that can be readily communicated via the 309 protocol, and that consists of a set of representation metadata and a 310 potentially unbounded stream of representation data. 312 An origin server might be provided with, or capable of generating, 313 multiple representations that are each intended to reflect the 314 current state of a target resource. In such cases, some algorithm is 315 used by the origin server to select one of those representations as 316 most applicable to a given request, usually based on content 317 negotiation. We refer to that one representation as the "selected 318 representation" and use its particular data and metadata for 319 evaluating conditional requests [Part4] and constructing the payload 320 for 200 (OK) and 304 (Not Modified) responses to GET (Section 4.3.1). 322 3.1. Representation Metadata 324 Representation header fields provide metadata about the 325 representation. When a message includes a payload body, the 326 representation header fields describe how to interpret the 327 representation data enclosed in the payload body. In a response to a 328 HEAD request, the representation header fields describe the 329 representation data that would have been enclosed in the payload body 330 if the same request had been a GET. 332 The following header fields convey representation metadata: 334 +-------------------+-----------------+ 335 | Header Field Name | Defined in... | 336 +-------------------+-----------------+ 337 | Content-Type | Section 3.1.1.5 | 338 | Content-Encoding | Section 3.1.2.2 | 339 | Content-Language | Section 3.1.3.2 | 340 | Content-Location | Section 3.1.4.2 | 341 +-------------------+-----------------+ 343 3.1.1. Processing Representation Data 345 3.1.1.1. Media Type 347 HTTP uses Internet Media Types [RFC2046] in the Content-Type 348 (Section 3.1.1.5) and Accept (Section 5.3.2) header fields in order 349 to provide open and extensible data typing and type negotiation. 350 Media types define both a data format and various processing models: 351 how to process that data in accordance with each context in which it 352 is received. 354 media-type = type "/" subtype *( OWS ";" OWS parameter ) 355 type = token 356 subtype = token 358 The type/subtype MAY be followed by parameters in the form of 359 attribute/value pairs. 361 parameter = attribute "=" value 362 attribute = token 363 value = word 365 The type, subtype, and parameter attribute names are case- 366 insensitive. Parameter values might or might not be case-sensitive, 367 depending on the semantics of the parameter name. The presence or 368 absence of a parameter might be significant to the processing of a 369 media-type, depending on its definition within the media type 370 registry. 372 A parameter value that matches the token production can be 373 transmitted as either a token or within a quoted-string. The quoted 374 and unquoted values are equivalent. For example, the following 375 examples are all equivalent, but the first is preferred for 376 consistency: 378 text/html;charset=utf-8 379 text/html;charset=UTF-8 380 Text/HTML;Charset="utf-8" 381 text/html; charset="utf-8" 383 Internet media types ought to be registered with IANA according to 384 the procedures defined in [BCP13]. 386 Note: Unlike some similar constructs in other header fields, media 387 type parameters do not allow whitespace (even "bad" whitespace) 388 around the "=" character. 390 3.1.1.2. Charset 392 HTTP uses charset names to indicate or negotiate the character 393 encoding scheme of a textual representation [RFC6365]. A charset is 394 identified by a case-insensitive token. 396 charset = token 398 Charset names ought to be registered in IANA Character Set registry 399 () according to the 400 procedures defined in [RFC2978]. 402 3.1.1.3. Canonicalization and Text Defaults 404 Internet media types are registered with a canonical form in order to 405 be interoperable among systems with varying native encoding formats. 406 Representations selected or transferred via HTTP ought to be in 407 canonical form, for many of the same reasons described by the 408 Multipurpose Internet Mail Extensions (MIME) [RFC2045]. However, the 409 performance characteristics of email deployments (i.e., store and 410 forward messages to peers) are significantly different from those 411 common to HTTP and the Web (server-based information services). 412 Furthermore, MIME's constraints for the sake of compatibility with 413 older mail transfer protocols do not apply to HTTP (see Appendix A). 415 MIME's canonical form requires that media subtypes of the "text" type 416 use CRLF as the text line break. HTTP allows the transfer of text 417 media with plain CR or LF alone representing a line break, when such 418 line breaks are consistent for an entire representation. An HTTP 419 sender MAY generate, and a recipient MUST be able to parse, line 420 breaks in text media that consist of CRLF, bare CR, or bare LF. In 421 addition, text media in HTTP is not limited to charsets that use 422 octets 13 and 10 for CR and LF, respectively. This flexibility 423 regarding line breaks applies only to text within a representation 424 that has been assigned a "text" media type; it does not apply to 425 "multipart" types or HTTP elements outside the payload body (e.g., 426 header fields). 428 If a representation is encoded with a content-coding, the underlying 429 data ought to be in a form defined above prior to being encoded. 431 3.1.1.4. Multipart Types 433 MIME provides for a number of "multipart" types -- encapsulations of 434 one or more representations within a single message body. All 435 multipart types share a common syntax, as defined in Section 5.1.1 of 436 [RFC2046], and include a boundary parameter as part of the media type 437 value. The message body is itself a protocol element; a sender MUST 438 generate only CRLF to represent line breaks between body parts. 440 HTTP message framing does not use the multipart boundary as an 441 indicator of message body length, though it might be used by 442 implementations that generate or process the payload. For example, 443 the "multipart/form-data" type is often used for carrying form data 444 in a request, as described in [RFC2388], and the "multipart/ 445 byteranges" type is defined by this specification for use in some 206 446 (Partial Content) responses [Part5]. 448 3.1.1.5. Content-Type 450 The "Content-Type" header field indicates the media type of the 451 associated representation: either the representation enclosed in the 452 message payload or the selected representation, as determined by the 453 message semantics. The indicated media type defines both the data 454 format and how that data is intended to be processed by a recipient, 455 within the scope of the received message semantics, after any content 456 codings indicated by Content-Encoding are decoded. 458 Content-Type = media-type 460 Media types are defined in Section 3.1.1.1. An example of the field 461 is 462 Content-Type: text/html; charset=ISO-8859-4 464 A sender that generates a message containing a payload body SHOULD 465 generate a Content-Type header field in that message unless the 466 intended media type of the enclosed representation is unknown to the 467 sender. If a Content-Type header field is not present, the recipient 468 MAY either assume a media type of "application/octet-stream" 469 ([RFC2046], Section 4.5.1) or examine the data to determine its type. 471 In practice, resource owners do not always properly configure their 472 origin server to provide the correct Content-Type for a given 473 representation, with the result that some clients will examine a 474 payload's content and override the specified type. Clients that do 475 so risk drawing incorrect conclusions, which might expose additional 476 security risks (e.g., "privilege escalation"). Furthermore, it is 477 impossible to determine the sender's intent by examining the data 478 format: many data formats match multiple media types that differ only 479 in processing semantics. Implementers are encouraged to provide a 480 means of disabling such "content sniffing" when it is used. 482 3.1.2. Encoding for Compression or Integrity 484 3.1.2.1. Content Codings 486 Content coding values indicate an encoding transformation that has 487 been or can be applied to a representation. Content codings are 488 primarily used to allow a representation to be compressed or 489 otherwise usefully transformed without losing the identity of its 490 underlying media type and without loss of information. Frequently, 491 the representation is stored in coded form, transmitted directly, and 492 only decoded by the final recipient. 494 content-coding = token 496 All content-coding values are case-insensitive and ought to be 497 registered within the HTTP Content Coding registry, as defined in 498 Section 8.4. They are used in the Accept-Encoding (Section 5.3.4) 499 and Content-Encoding (Section 3.1.2.2) header fields. 501 The following content-coding values are defined by this 502 specification: 504 compress (and x-compress): See Section 4.2.1 of [Part1]. 506 deflate: See Section 4.2.2 of [Part1]. 508 gzip (and x-gzip): See Section 4.2.3 of [Part1]. 510 3.1.2.2. Content-Encoding 512 The "Content-Encoding" header field indicates what content codings 513 have been applied to the representation, beyond those inherent in the 514 media type, and thus what decoding mechanisms have to be applied in 515 order to obtain data in the media type referenced by the Content-Type 516 header field. Content-Encoding is primarily used to allow a 517 representation's data to be compressed without losing the identity of 518 its underlying media type. 520 Content-Encoding = 1#content-coding 522 An example of its use is 524 Content-Encoding: gzip 526 If one or more encodings have been applied to a representation, the 527 sender that applied the encodings MUST generate a Content-Encoding 528 header field that lists the content codings in the order in which 529 they were applied. Additional information about the encoding 530 parameters MAY be provided by other header fields not defined by this 531 specification. 533 Unlike Transfer-Encoding (Section 3.3.1 of [Part1]), the codings 534 listed in Content-Encoding are a characteristic of the 535 representation; the representation is defined in terms of the coded 536 form, and all other metadata about the representation is about the 537 coded form unless otherwise noted in the metadata definition. 538 Typically, the representation is only decoded just prior to rendering 539 or analogous usage. 541 If the media type includes an inherent encoding, such as a data 542 format that is always compressed, then that encoding would not be 543 restated in Content-Encoding even if it happens to be the same 544 algorithm as one of the content codings. Such a content coding would 545 only be listed if, for some bizarre reason, it is applied a second 546 time to form the representation. Likewise, an origin server might 547 choose to publish the same data as multiple representations that 548 differ only in whether the coding is defined as part of Content-Type 549 or Content-Encoding, since some user agents will behave differently 550 in their handling of each response (e.g., open a "Save as ..." dialog 551 instead of automatic decompression and rendering of content). 553 An origin server MAY respond with a status code of 415 (Unsupported 554 Media Type) if a representation in the request message has a content 555 coding that is not acceptable. 557 3.1.3. Audience Language 559 3.1.3.1. Language Tags 561 A language tag, as defined in [RFC5646], identifies a natural 562 language spoken, written, or otherwise conveyed by human beings for 563 communication of information to other human beings. Computer 564 languages are explicitly excluded. 566 HTTP uses language tags within the Accept-Language and Content- 567 Language header fields. Accept-Language uses the broader language- 568 range production defined in Section 5.3.5, whereas Content-Language 569 uses the language-tag production defined below. 571 language-tag = 573 A language tag is a sequence of one or more case-insensitive subtags, 574 each separated by a hyphen character ("-", %x2D). In most cases, a 575 language tag consists of a primary language subtag that identifies a 576 broad family of related languages (e.g., "en" = English) which is 577 optionally followed by a series of subtags that refine or narrow that 578 language's range (e.g., "en-CA" = the variety of English as 579 communicated in Canada). Whitespace is not allowed within a language 580 tag. Example tags include: 582 fr, en-US, es-419, az-Arab, x-pig-latin, man-Nkoo-GN 584 See [RFC5646] for further information. 586 3.1.3.2. Content-Language 588 The "Content-Language" header field describes the natural language(s) 589 of the intended audience for the representation. Note that this 590 might not be equivalent to all the languages used within the 591 representation. 593 Content-Language = 1#language-tag 595 Language tags are defined in Section 3.1.3.1. The primary purpose of 596 Content-Language is to allow a user to identify and differentiate 597 representations according to the users' own preferred language. 598 Thus, if the content is intended only for a Danish-literate audience, 599 the appropriate field is 601 Content-Language: da 603 If no Content-Language is specified, the default is that the content 604 is intended for all language audiences. This might mean that the 605 sender does not consider it to be specific to any natural language, 606 or that the sender does not know for which language it is intended. 608 Multiple languages MAY be listed for content that is intended for 609 multiple audiences. For example, a rendition of the "Treaty of 610 Waitangi", presented simultaneously in the original Maori and English 611 versions, would call for 613 Content-Language: mi, en 615 However, just because multiple languages are present within a 616 representation does not mean that it is intended for multiple 617 linguistic audiences. An example would be a beginner's language 618 primer, such as "A First Lesson in Latin", which is clearly intended 619 to be used by an English-literate audience. In this case, the 620 Content-Language would properly only include "en". 622 Content-Language MAY be applied to any media type -- it is not 623 limited to textual documents. 625 3.1.4. Identification 627 3.1.4.1. Identifying a Representation 629 When a complete or partial representation is transferred in a message 630 payload, it is often desirable for the sender to supply, or the 631 recipient to determine, an identifier for a resource corresponding to 632 that representation. 634 For a request message: 636 o If the request has a Content-Location header field, then the 637 sender asserts that the payload is a representation of the 638 resource identified by the Content-Location field-value. However, 639 such an assertion cannot be trusted unless it can be verified by 640 other means (not defined by this specification). The information 641 might still be useful for revision history links. 643 o Otherwise, the payload is unidentified. 645 For a response message, the following rules are applied in order 646 until a match is found: 648 1. If the request is GET or HEAD and the response status code is 200 649 (OK), 204 (No Content), 206 (Partial Content), or 304 (Not 650 Modified), the payload is a representation of the resource 651 identified by the effective request URI (Section 5.5 of [Part1]). 653 2. If the request is GET or HEAD and the response status code is 203 654 (Non-Authoritative Information), the payload is a potentially 655 modified or enhanced representation of the target resource as 656 provided by an intermediary. 658 3. If the response has a Content-Location header field and its 659 field-value is a reference to the same URI as the effective 660 request URI, the payload is a representation of the resource 661 identified by the effective request URI. 663 4. If the response has a Content-Location header field and its 664 field-value is a reference to a URI different from the effective 665 request URI, then the sender asserts that the payload is a 666 representation of the resource identified by the Content-Location 667 field-value. However, such an assertion cannot be trusted unless 668 it can be verified by other means (not defined by this 669 specification). 671 5. Otherwise, the payload is unidentified. 673 3.1.4.2. Content-Location 675 The "Content-Location" header field references a URI that can be used 676 as an identifier for a specific resource corresponding to the 677 representation in this message's payload. In other words, if one 678 were to perform a GET request on this URI at the time of this 679 message's generation, then a 200 (OK) response would contain the same 680 representation that is enclosed as payload in this message. 682 Content-Location = absolute-URI / partial-URI 684 The Content-Location value is not a replacement for the effective 685 Request URI (Section 5.5 of [Part1]). It is representation metadata. 686 It has the same syntax and semantics as the header field of the same 687 name defined for MIME body parts in Section 4 of [RFC2557]. However, 688 its appearance in an HTTP message has some special implications for 689 HTTP recipients. 691 If Content-Location is included in a 2xx (Successful) response 692 message and its value refers (after conversion to absolute form) to a 693 URI that is the same as the effective request URI, then the recipient 694 MAY consider the payload to be a current representation of that 695 resource at the time indicated by the message origination date. For 696 a GET or HEAD request, this is the same as the default semantics when 697 no Content-Location is provided by the server. For a state-changing 698 request like PUT or POST, it implies that the server's response 699 contains the new representation of that resource, thereby 700 distinguishing it from representations that might only report about 701 the action (e.g., "It worked!"). This allows authoring applications 702 to update their local copies without the need for a subsequent GET 703 request. 705 If Content-Location is included in a 2xx (Successful) response 706 message and its field-value refers to a URI that differs from the 707 effective request URI, then the origin server claims that the URI is 708 an identifier for a different resource corresponding to the enclosed 709 representation. Such a claim can only be trusted if both identifiers 710 share the same resource owner, which cannot be programmatically 711 determined via HTTP. 713 o For a response to a GET or HEAD request, this is an indication 714 that the effective request URI refers to a resource that is 715 subject to content negotiation and the Content-Location field- 716 value is a more specific identifier for the selected 717 representation. 719 o For a 201 (Created) response to a state-changing method, a 720 Content-Location field-value that is identical to the Location 721 field-value indicates that this payload is a current 722 representation of the newly created resource. 724 o Otherwise, such a Content-Location indicates that this payload is 725 a representation reporting on the requested action's status and 726 that the same report is available (for future access with GET) at 727 the given URI. For example, a purchase transaction made via a 728 POST request might include a receipt document as the payload of 729 the 200 (OK) response; the Content-Location field-value provides 730 an identifier for retrieving a copy of that same receipt in the 731 future. 733 A user agent that sends Content-Location in a request message is 734 stating that its value refers to where the user agent originally 735 obtained the content of the enclosed representation (prior to any 736 modifications made by that user agent). In other words, the user 737 agent is providing a back link to the source of the original 738 representation. 740 An origin server that receives a Content-Location field in a request 741 message MUST treat the information as transitory request context 742 rather than as metadata to be saved verbatim as part of the 743 representation. An origin server MAY use that context to guide in 744 processing the request or to save it for other uses, such as within 745 source links or versioning metadata. However, an origin server MUST 746 NOT use such context information to alter the request semantics. 748 For example, if a client makes a PUT request on a negotiated resource 749 and the origin server accepts that PUT (without redirection), then 750 the new state of that resource is expected to be consistent with the 751 one representation supplied in that PUT; the Content-Location cannot 752 be used as a form of reverse content selection identifier to update 753 only one of the negotiated representations. If the user agent had 754 wanted the latter semantics, it would have applied the PUT directly 755 to the Content-Location URI. 757 3.2. Representation Data 759 The representation data associated with an HTTP message is either 760 provided as the payload body of the message or referred to by the 761 message semantics and the effective request URI. The representation 762 data is in a format and encoding defined by the representation 763 metadata header fields. 765 The data type of the representation data is determined via the header 766 fields Content-Type and Content-Encoding. These define a two-layer, 767 ordered encoding model: 769 representation-data := Content-Encoding( Content-Type( bits ) ) 771 3.3. Payload Semantics 773 Some HTTP messages transfer a complete or partial representation as 774 the message "payload". In some cases, a payload might contain only 775 the associated representation's header fields (e.g., responses to 776 HEAD) or only some part(s) of the representation data (e.g., the 206 777 (Partial Content) status code). 779 The purpose of a payload in a request is defined by the method 780 semantics. For example, a representation in the payload of a PUT 781 request (Section 4.3.4) represents the desired state of the target 782 resource if the request is successfully applied, whereas a 783 representation in the payload of a POST request (Section 4.3.3) 784 represents an anonymous resource for providing data to be processed, 785 such as the information that a user entered within an HTML form. 787 In a response, the payload's purpose is defined by both the request 788 method and the response status code. For example, the payload of a 789 200 (OK) response to GET (Section 4.3.1) represents the current state 790 of the target resource, as observed at the time of the message 791 origination date (Section 7.1.1.2), whereas the payload of the same 792 status code in a response to POST might represent either the 793 processing result or the new state of the target resource after 794 applying the processing. Response messages with an error status code 795 usually contain a payload that represents the error condition, such 796 that it describes the error state and what next steps are suggested 797 for resolving it. 799 Header fields that specifically describe the payload, rather than the 800 associated representation, are referred to as "payload header 801 fields". Payload header fields are defined in other parts of this 802 specification, due to their impact on message parsing. 804 +-------------------+--------------------------+ 805 | Header Field Name | Defined in... | 806 +-------------------+--------------------------+ 807 | Content-Length | Section 3.3.2 of [Part1] | 808 | Content-Range | Section 4.2 of [Part5] | 809 | Transfer-Encoding | Section 3.3.1 of [Part1] | 810 +-------------------+--------------------------+ 812 3.4. Content Negotiation 814 When responses convey payload information, whether indicating a 815 success or an error, the origin server often has different ways of 816 representing that information; for example, in different formats, 817 languages, or encodings. Likewise, different users or user agents 818 might have differing capabilities, characteristics, or preferences 819 that could influence which representation, among those available, 820 would be best to deliver. For this reason, HTTP provides mechanisms 821 for content negotiation. 823 This specification defines two patterns of content negotiation that 824 can be made visible within the protocol: "proactive", where the 825 server selects the representation based upon the user agent's stated 826 preferences, and "reactive" negotiation, where the server provides a 827 list of representations for the user agent to choose from. Other 828 patterns of content negotiation include "conditional content", where 829 the representation consists of multiple parts that are selectively 830 rendered based on user agent parameters, "active content", where the 831 representation contains a script that makes additional (more 832 specific) requests based on the user agent characteristics, and 833 "Transparent Content Negotiation" ([RFC2295]), where content 834 selection is performed by an intermediary. These patterns are not 835 mutually exclusive, and each has trade-offs in applicability and 836 practicality. 838 Note that, in all cases, HTTP is not aware of the resource semantics. 839 The consistency with which an origin server responds to requests, 840 over time and over the varying dimensions of content negotiation, and 841 thus the "sameness" of a resource's observed representations over 842 time, is determined entirely by whatever entity or algorithm selects 843 or generates those responses. HTTP pays no attention to the man 844 behind the curtain. 846 3.4.1. Proactive Negotiation 848 When content negotiation preferences are sent by the user agent in a 849 request to encourage an algorithm located at the server to select the 850 preferred representation, it is called proactive negotiation (a.k.a., 851 server-driven negotiation). Selection is based on the available 852 representations for a response (the dimensions over which it might 853 vary, such as language, content-coding, etc.) compared to various 854 information supplied in the request, including both the explicit 855 negotiation fields of Section 5.3 and implicit characteristics, such 856 as the client's network address or parts of the User-Agent field. 858 Proactive negotiation is advantageous when the algorithm for 859 selecting from among the available representations is difficult to 860 describe to a user agent, or when the server desires to send its 861 "best guess" to the user agent along with the first response (hoping 862 to avoid the round-trip delay of a subsequent request if the "best 863 guess" is good enough for the user). In order to improve the 864 server's guess, a user agent MAY send request header fields that 865 describe its preferences. 867 Proactive negotiation has serious disadvantages: 869 o It is impossible for the server to accurately determine what might 870 be "best" for any given user, since that would require complete 871 knowledge of both the capabilities of the user agent and the 872 intended use for the response (e.g., does the user want to view it 873 on screen or print it on paper?); 875 o Having the user agent describe its capabilities in every request 876 can be both very inefficient (given that only a small percentage 877 of responses have multiple representations) and a potential risk 878 to the user's privacy; 880 o It complicates the implementation of an origin server and the 881 algorithms for generating responses to a request; and, 883 o It limits the reusability of responses for shared caching. 885 A user agent cannot rely on proactive negotiation preferences being 886 consistently honored, since the origin server might not implement 887 proactive negotiation for the requested resource or might decide that 888 sending a response that doesn't conform to the user agent's 889 preferences is better than sending a 406 (Not Acceptable) response. 891 An origin server MAY generate a Vary header field (Section 7.1.4) in 892 responses that are subject to proactive negotiation to indicate what 893 parameters of request information might be used in its selection 894 algorithm, thereby providing a means for recipients to determine the 895 reusability of that same response for user agents with differing 896 request information. 898 3.4.2. Reactive Negotiation 900 With reactive negotiation (a.k.a., agent-driven negotiation), 901 selection of the best response representation (regardless of the 902 status code) is performed by the user agent after receiving an 903 initial response from the origin server that contains a list of 904 resources for alternative representations. If the user agent is not 905 satisfied by the initial response representation, it can perform a 906 GET request on one or more of the alternative resources, selected 907 based on metadata included in the list, to obtain a different form of 908 representation for that response. Selection of alternatives might be 909 performed automatically by the user agent or manually by the user 910 selecting from a generated (possibly hypertext) menu. 912 Note that the above refers to representations of the response, in 913 general, not representations of the resource. The alternative 914 representations are only considered representations of the target 915 resource if the response in which those alternatives are provided has 916 the semantics of being a representation of the target resource (e.g., 917 a 200 (OK) response to a GET request) or has the semantics of 918 providing links to alternative representations for the target 919 resource (e.g., a 300 (Multiple Choices) response to a GET request). 921 A server might choose not to send an initial representation, other 922 than the list of alternatives, and thereby indicate that reactive 923 negotiation by the user agent is preferred. For example, the 924 alternatives listed in responses with the 300 (Multiple Choices) and 925 406 (Not Acceptable) status codes include information about the 926 available representations so that the user or user agent can react by 927 making a selection. 929 Reactive negotiation is advantageous when the response would vary 930 over commonly-used dimensions (such as type, language, or encoding), 931 when the origin server is unable to determine a user agent's 932 capabilities from examining the request, and generally when public 933 caches are used to distribute server load and reduce network usage. 935 Reactive negotiation suffers from the disadvantages of transmitting a 936 list of alternatives to the user agent, which degrades user-perceived 937 latency if transmitted in the header section, and needing a second 938 request to obtain an alternate representation. Furthermore, this 939 specification does not define a mechanism for supporting automatic 940 selection, though it does not prevent such a mechanism from being 941 developed as an extension. 943 4. Request Methods 945 4.1. Overview 947 The request method token is the primary source of request semantics; 948 it indicates the purpose for which the client has made this request 949 and what is expected by the client as a successful result. 951 The request method's semantics might be further specialized by the 952 semantics of some header fields when present in a request (Section 5) 953 if those additional semantics do not conflict with the method. For 954 example, a client can send conditional request header fields 955 (Section 5.2) to make the requested action conditional on the current 956 state of the target resource ([Part4]). 958 method = token 960 HTTP was originally designed to be usable as an interface to 961 distributed object systems. The request method was envisioned as 962 applying semantics to a target resource in much the same way as 963 invoking a defined method on an identified object would apply 964 semantics. The method token is case-sensitive because it might be 965 used as a gateway to object-based systems with case-sensitive method 966 names. 968 Unlike distributed objects, the standardized request methods in HTTP 969 are not resource-specific, since uniform interfaces provide for 970 better visibility and reuse in network-based systems [REST]. Once 971 defined, a standardized method ought to have the same semantics when 972 applied to any resource, though each resource determines for itself 973 whether those semantics are implemented or allowed. 975 This specification defines a number of standardized methods that are 976 commonly used in HTTP, as outlined by the following table. By 977 convention, standardized methods are defined in all-uppercase ASCII 978 letters. 980 +---------+-------------------------------------------------+-------+ 981 | Method | Description | Sec. | 982 +---------+-------------------------------------------------+-------+ 983 | GET | Transfer a current representation of the target | 4.3.1 | 984 | | resource. | | 985 | HEAD | Same as GET, but only transfer the status line | 4.3.2 | 986 | | and header section. | | 987 | POST | Perform resource-specific processing on the | 4.3.3 | 988 | | request payload. | | 989 | PUT | Replace all current representations of the | 4.3.4 | 990 | | target resource with the request payload. | | 991 | DELETE | Remove all current representations of the | 4.3.5 | 992 | | target resource. | | 993 | CONNECT | Establish a tunnel to the server identified by | 4.3.6 | 994 | | the target resource. | | 995 | OPTIONS | Describe the communication options for the | 4.3.7 | 996 | | target resource. | | 997 | TRACE | Perform a message loop-back test along the path | 4.3.8 | 998 | | to the target resource. | | 999 +---------+-------------------------------------------------+-------+ 1001 All general-purpose servers MUST support the methods GET and HEAD. 1002 All other methods are OPTIONAL; when implemented, a server MUST 1003 implement the above methods according to the semantics defined for 1004 them in Section 4.3. 1006 Additional methods, outside the scope of this specification, have 1007 been standardized for use in HTTP. All such methods ought to be 1008 registered within the HTTP Method Registry maintained by IANA, as 1009 defined in Section 8.1. 1011 The set of methods allowed by a target resource can be listed in an 1012 Allow header field (Section 7.4.1). However, the set of allowed 1013 methods can change dynamically. When a request method is received 1014 that is unrecognized or not implemented by an origin server, the 1015 origin server SHOULD respond with the 501 (Not Implemented) status 1016 code. When a request method is received that is known by an origin 1017 server but not allowed for the target resource, the origin server 1018 SHOULD respond with the 405 (Method Not Allowed) status code. 1020 4.2. Common Method Properties 1022 4.2.1. Safe Methods 1024 Request methods are considered "safe" if their defined semantics are 1025 essentially read-only; i.e., the client does not request, and does 1026 not expect, any state change on the origin server as a result of 1027 applying a safe method to a target resource. Likewise, reasonable 1028 use of a safe method is not expected to cause any harm, loss of 1029 property, or unusual burden on the origin server. 1031 This definition of safe methods does not prevent an implementation 1032 from including behavior that is potentially harmful, not entirely 1033 read-only, or which causes side-effects while invoking a safe method. 1034 What is important, however, is that the client did not request that 1035 additional behavior and cannot be held accountable for it. For 1036 example, most servers append request information to access log files 1037 at the completion of every response, regardless of the method, and 1038 that is considered safe even though the log storage might become full 1039 and crash the server. Likewise, a safe request initiated by 1040 selecting an advertisement on the Web will often have the side-effect 1041 of charging an advertising account. 1043 Of the request methods defined by this specification, the GET, HEAD, 1044 OPTIONS, and TRACE methods are defined to be safe. 1046 The purpose of distinguishing between safe and unsafe methods is to 1047 allow automated retrieval processes (spiders) and cache performance 1048 optimization (pre-fetching) to work without fear of causing harm. In 1049 addition, it allows a user agent to apply appropriate constraints on 1050 the automated use of unsafe methods when processing potentially 1051 untrusted content. 1053 A user agent SHOULD distinguish between safe and unsafe methods when 1054 presenting potential actions to a user, such that the user can be 1055 made aware of an unsafe action before it is requested. 1057 When a resource is constructed such that parameters within the 1058 effective request URI have the effect of selecting an action, it is 1059 the resource owner's responsibility to ensure that the action is 1060 consistent with the request method semantics. For example, it is 1061 common for Web-based content editing software to use actions within 1062 query parameters, such as "page?do=delete". If the purpose of such a 1063 resource is to perform an unsafe action, then the resource owner MUST 1064 disable or disallow that action when it is accessed using a safe 1065 request method. Failure to do so will result in unfortunate side- 1066 effects when automated processes perform a GET on every URI reference 1067 for the sake of link maintenance, pre-fetching, building a search 1068 index, etc. 1070 4.2.2. Idempotent Methods 1072 A request method is considered "idempotent" if the intended effect on 1073 the server of multiple identical requests with that method is the 1074 same as the effect for a single such request. Of the request methods 1075 defined by this specification, PUT, DELETE, and safe request methods 1076 are idempotent. 1078 Like the definition of safe, the idempotent property only applies to 1079 what has been requested by the user; a server is free to log each 1080 request separately, retain a revision control history, or implement 1081 other non-idempotent side-effects for each idempotent request. 1083 Idempotent methods are distinguished because the request can be 1084 repeated automatically if a communication failure occurs before the 1085 client is able to read the server's response. For example, if a 1086 client sends a PUT request and the underlying connection is closed 1087 before any response is received, then the client can establish a new 1088 connection and retry the idempotent request because it knows that 1089 repeating the request will have the same effect (even if the original 1090 request succeeded, though the status codes might differ in response). 1091 Note, however, that repeated communication failures might indicate 1092 that the server has failed in general, or that something in the 1093 request is triggering a connection drop. 1095 4.2.3. Cacheable Methods 1097 Request methods can be defined as "cacheable" to indicate that 1098 responses to them are allowed to be stored for future reuse; for 1099 specific requirements see [Part6]. In general, safe methods that do 1100 not depend on a current or authoritative response are defined as 1101 cacheable; this specification defines GET, HEAD and POST as 1102 cacheable, although the overwhelming majority of cache 1103 implementations only support GET and HEAD. 1105 4.3. Method Definitions 1107 4.3.1. GET 1109 The GET method requests transfer of a current selected representation 1110 for the target resource. GET is the primary mechanism of information 1111 retrieval and the focus of almost all performance optimizations. 1112 Hence, when people speak of retrieving some identifiable information 1113 via HTTP, they are generally referring to making a GET request. 1115 It is tempting to think of resource identifiers as remote filesystem 1116 pathnames, and of representations as being a copy of the contents of 1117 such files. In fact, that is how many resources are implemented (see 1118 Section 9.1 for related security considerations). However, there are 1119 no such limitations in practice. The HTTP interface for a resource 1120 is just as likely to be implemented as a tree of content objects, a 1121 programmatic view on various database records, or a gateway to other 1122 information systems. Even when the URI mapping mechanism is tied to 1123 a filesystem, an origin server might be configured to execute the 1124 files with the request as input and send the output as the 1125 representation, rather than transfer the files directly. Regardless, 1126 only the origin server needs to know how each of its resource 1127 identifiers corresponds to an implementation, and how each 1128 implementation manages to select and send a current representation of 1129 the target resource in a response to GET. 1131 A client can alter the semantics of GET to be a "range request", 1132 requesting transfer of only some part(s) of the selected 1133 representation, by sending a Range header field in the request 1134 ([Part5]). 1136 A payload within a GET request message has no defined semantics; 1137 sending a payload body on a GET request might cause some existing 1138 implementations to reject the request. 1140 The response to a GET request is cacheable; a cache MAY use it to 1141 satisfy subsequent GET and HEAD requests unless otherwise indicated 1142 by the Cache-Control header field (Section 5.2 of [Part6]). 1144 4.3.2. HEAD 1146 The HEAD method is identical to GET except that the server MUST NOT 1147 send a message body in the response (i.e., the response terminates at 1148 the end of the header section). The server SHOULD send the same 1149 header fields in response to a HEAD request as it would have sent if 1150 the request had been a GET, except that the payload header fields 1151 (Section 3.3) MAY be omitted. This method can be used for obtaining 1152 metadata about the selected representation without transferring the 1153 representation data and is often used for testing hypertext links for 1154 validity, accessibility, and recent modification. 1156 A payload within a HEAD request message has no defined semantics; 1157 sending a payload body on a HEAD request might cause some existing 1158 implementations to reject the request. 1160 The response to a HEAD request is cacheable; a cache MAY use it to 1161 satisfy subsequent HEAD requests unless otherwise indicated by the 1162 Cache-Control header field (Section 5.2 of [Part6]). A HEAD response 1163 might also have an effect on previously cached responses to GET; see 1164 Section 4.3.5 of [Part6]. 1166 4.3.3. POST 1168 The POST method requests that the target resource process the 1169 representation enclosed in the request according to the resource's 1170 own specific semantics. For example, POST is used for the following 1171 functions (among others): 1173 o Providing a block of data, such as the fields entered into an HTML 1174 form, to a data-handling process; 1176 o Posting a message to a bulletin board, newsgroup, mailing list, 1177 blog, or similar group of articles; 1179 o Creating a new resource that has yet to be identified by the 1180 origin server; and 1182 o Appending data to a resource's existing representation(s). 1184 An origin server indicates response semantics by choosing an 1185 appropriate status code depending on the result of processing the 1186 POST request; almost all of the status codes defined by this 1187 specification might be received in a response to POST (the exceptions 1188 being 206, 304, and 416). 1190 If one or more resources has been created on the origin server as a 1191 result of successfully processing a POST request, the origin server 1192 SHOULD send a 201 (Created) response containing a Location header 1193 field that provides an identifier for the primary resource created 1194 (Section 7.1.2) and a representation that describes the status of the 1195 request while referring to the new resource(s). 1197 Responses to POST requests are only cacheable when they include 1198 explicit freshness information (see Section 4.2.1 of [Part6]). 1199 However, POST caching is not widely implemented. For cases where an 1200 origin server wishes the client to be able to cache the result of a 1201 POST in a way that can be reused by a later GET, the origin server 1202 MAY send a 200 (OK) response containing the result and a Content- 1203 Location header field that has the same value as the POST's effective 1204 request URI (Section 3.1.4.2). 1206 If the result of processing a POST would be equivalent to a 1207 representation of an existing resource, an origin server MAY redirect 1208 the user agent to that resource by sending a 303 (See Other) response 1209 with the existing resource's identifier in the Location field. This 1210 has the benefits of providing the user agent a resource identifier 1211 and transferring the representation via a method more amenable to 1212 shared caching, though at the cost of an extra request if the user 1213 agent does not already have the representation cached. 1215 4.3.4. PUT 1217 The PUT method requests that the state of the target resource be 1218 created or replaced with the state defined by the representation 1219 enclosed in the request message payload. A successful PUT of a given 1220 representation would suggest that a subsequent GET on that same 1221 target resource will result in an equivalent representation being 1222 sent in a 200 (OK) response. However, there is no guarantee that 1223 such a state change will be observable, since the target resource 1224 might be acted upon by other user agents in parallel, or might be 1225 subject to dynamic processing by the origin server, before any 1226 subsequent GET is received. A successful response only implies that 1227 the user agent's intent was achieved at the time of its processing by 1228 the origin server. 1230 If the target resource does not have a current representation and the 1231 PUT successfully creates one, then the origin server MUST inform the 1232 user agent by sending a 201 (Created) response. If the target 1233 resource does have a current representation and that representation 1234 is successfully modified in accordance with the state of the enclosed 1235 representation, then the origin server MUST send either a 200 (OK) or 1236 a 204 (No Content) response to indicate successful completion of the 1237 request. 1239 An origin server SHOULD ignore unrecognized header fields received in 1240 a PUT request (i.e., do not save them as part of the resource state). 1242 An origin server SHOULD verify that the PUT representation is 1243 consistent with any constraints the server has for the target 1244 resource that cannot or will not be changed by the PUT. This is 1245 particularly important when the origin server uses internal 1246 configuration information related to the URI in order to set the 1247 values for representation metadata on GET responses. When a PUT 1248 representation is inconsistent with the target resource, the origin 1249 server SHOULD either make them consistent, by transforming the 1250 representation or changing the resource configuration, or respond 1251 with an appropriate error message containing sufficient information 1252 to explain why the representation is unsuitable. The 409 (Conflict) 1253 or 415 (Unsupported Media Type) status codes are suggested, with the 1254 latter being specific to constraints on Content-Type values. 1256 For example, if the target resource is configured to always have a 1257 Content-Type of "text/html" and the representation being PUT has a 1258 Content-Type of "image/jpeg", the origin server ought to do one of: 1260 a. reconfigure the target resource to reflect the new media type; 1262 b. transform the PUT representation to a format consistent with that 1263 of the resource before saving it as the new resource state; or, 1265 c. reject the request with a 415 (Unsupported Media Type) response 1266 indicating that the target resource is limited to "text/html", 1267 perhaps including a link to a different resource that would be a 1268 suitable target for the new representation. 1270 HTTP does not define exactly how a PUT method affects the state of an 1271 origin server beyond what can be expressed by the intent of the user 1272 agent request and the semantics of the origin server response. It 1273 does not define what a resource might be, in any sense of that word, 1274 beyond the interface provided via HTTP. It does not define how 1275 resource state is "stored", nor how such storage might change as a 1276 result of a change in resource state, nor how the origin server 1277 translates resource state into representations. Generally speaking, 1278 all implementation details behind the resource interface are 1279 intentionally hidden by the server. 1281 An origin server MUST NOT send a validator header field 1282 (Section 7.2), such as an ETag or Last-Modified field, in a 1283 successful response to PUT unless the request's representation data 1284 was saved without any transformation applied to the body (i.e., the 1285 resource's new representation data is identical to the representation 1286 data received in the PUT request) and the validator field value 1287 reflects the new representation. This requirement allows a user 1288 agent to know when the representation body it has in memory remains 1289 current as a result of the PUT, thus not in need of retrieving again 1290 from the origin server, and that the new validator(s) received in the 1291 response can be used for future conditional requests in order to 1292 prevent accidental overwrites (Section 5.2). 1294 The fundamental difference between the POST and PUT methods is 1295 highlighted by the different intent for the enclosed representation. 1296 The target resource in a POST request is intended to handle the 1297 enclosed representation according to the resource's own semantics, 1298 whereas the enclosed representation in a PUT request is defined as 1299 replacing the state of the target resource. Hence, the intent of PUT 1300 is idempotent and visible to intermediaries, even though the exact 1301 effect is only known by the origin server. 1303 Proper interpretation of a PUT request presumes that the user agent 1304 knows which target resource is desired. A service that selects a 1305 proper URI on behalf of the client, after receiving a state-changing 1306 request, SHOULD be implemented using the POST method rather than PUT. 1307 If the origin server will not make the requested PUT state change to 1308 the target resource and instead wishes to have it applied to a 1309 different resource, such as when the resource has been moved to a 1310 different URI, then the origin server MUST send an appropriate 3xx 1311 (Redirection) response; the user agent MAY then make its own decision 1312 regarding whether or not to redirect the request. 1314 A PUT request applied to the target resource can have side-effects on 1315 other resources. For example, an article might have a URI for 1316 identifying "the current version" (a resource) that is separate from 1317 the URIs identifying each particular version (different resources 1318 that at one point shared the same state as the current version 1319 resource). A successful PUT request on "the current version" URI 1320 might therefore create a new version resource in addition to changing 1321 the state of the target resource, and might also cause links to be 1322 added between the related resources. 1324 An origin server that allows PUT on a given target resource MUST send 1325 a 400 (Bad Request) response to a PUT request that contains a 1326 Content-Range header field (Section 4.2 of [Part5]), since the 1327 payload is likely to be partial content that has been mistakenly PUT 1328 as a full representation. Partial content updates are possible by 1329 targeting a separately identified resource with state that overlaps a 1330 portion of the larger resource, or by using a different method that 1331 has been specifically defined for partial updates (for example, the 1332 PATCH method defined in [RFC5789]). 1334 Responses to the PUT method are not cacheable. If a successful PUT 1335 request passes through a cache that has one or more stored responses 1336 for the effective request URI, those stored responses will be 1337 invalidated (see Section 4.4 of [Part6]). 1339 4.3.5. DELETE 1341 The DELETE method requests that the origin server remove the 1342 association between the target resource and its current 1343 functionality. In effect, this method is similar to the rm command 1344 in UNIX: it expresses a deletion operation on the URI mapping of the 1345 origin server, rather than an expectation that the previously 1346 associated information be deleted. 1348 If the target resource has one or more current representations, they 1349 might or might not be destroyed by the origin server, and the 1350 associated storage might or might not be reclaimed, depending 1351 entirely on the nature of the resource and its implementation by the 1352 origin server (which are beyond the scope of this specification). 1353 Likewise, other implementation aspects of a resource might need to be 1354 deactivated or archived as a result of a DELETE, such as database or 1355 gateway connections. In general, it is assumed that the origin 1356 server will only allow DELETE on resources for which it has a 1357 prescribed mechanism for accomplishing the deletion. 1359 Relatively few resources allow the DELETE method -- its primary use 1360 is for remote authoring environments, where the user has some 1361 direction regarding its effect. For example, a resource that was 1362 previously created using a PUT request, or identified via the 1363 Location header field after a 201 (Created) response to a POST 1364 request, might allow a corresponding DELETE request to undo those 1365 actions. Similarly, custom user agent implementations that implement 1366 an authoring function, such as revision control clients using HTTP 1367 for remote operations, might use DELETE based on an assumption that 1368 the server's URI space has been crafted to correspond to a version 1369 repository. 1371 If a DELETE method is successfully applied, the origin server SHOULD 1372 send a 202 (Accepted) status code if the action will likely succeed 1373 but has not yet been enacted, a 204 (No Content) status code if the 1374 action has been enacted and no further information is to be supplied, 1375 or a 200 (OK) status code if the action has been enacted and the 1376 response message includes a representation describing the status. 1378 A payload within a DELETE request message has no defined semantics; 1379 sending a payload body on a DELETE request might cause some existing 1380 implementations to reject the request. 1382 Responses to the DELETE method are not cacheable. If a DELETE 1383 request passes through a cache that has one or more stored responses 1384 for the effective request URI, those stored responses will be 1385 invalidated (see Section 4.4 of [Part6]). 1387 4.3.6. CONNECT 1389 The CONNECT method requests that the recipient establish a tunnel to 1390 the destination origin server identified by the request-target and, 1391 if successful, thereafter restrict its behavior to blind forwarding 1392 of packets, in both directions, until the tunnel is closed. 1394 CONNECT is intended only for use in requests to a proxy. An origin 1395 server that receives a CONNECT request for itself MAY respond with a 1396 2xx status code to indicate that a connection is established. 1397 However, most origin servers do not implement CONNECT. 1399 A client sending a CONNECT request MUST send the authority form of 1400 request-target (Section 5.3 of [Part1]); i.e., the request-target 1401 consists of only the host name and port number of the tunnel 1402 destination, separated by a colon. For example, 1404 CONNECT server.example.com:80 HTTP/1.1 1405 Host: server.example.com:80 1407 The recipient proxy can establish a tunnel either by directly 1408 connecting to the request-target or, if configured to use another 1409 proxy, by forwarding the CONNECT request to the next inbound proxy. 1410 Any 2xx (Successful) response indicates that the sender (and all 1411 inbound proxies) will switch to tunnel mode immediately after the 1412 blank line that concludes the successful response's header section; 1413 data received after that blank line is from the server identified by 1414 the request-target. Any response other than a successful response 1415 indicates that the tunnel has not yet been formed and that the 1416 connection remains governed by HTTP. 1418 A tunnel is closed when a tunnel intermediary detects that either 1419 side has closed its connection: the intermediary MUST attempt to send 1420 any outstanding data that came from the closed side to the other 1421 side, close both connections, and then discard any remaining data 1422 left undelivered. 1424 Proxy authentication might be used to establish the authority to 1425 create a tunnel. For example, 1427 CONNECT server.example.com:80 HTTP/1.1 1428 Host: server.example.com:80 1429 Proxy-Authorization: basic aGVsbG86d29ybGQ= 1431 There are significant risks in establishing a tunnel to arbitrary 1432 servers, particularly when the destination is a well-known or 1433 reserved TCP port that is not intended for Web traffic. For example, 1434 a CONNECT to a request-target of "example.com:25" would suggest that 1435 the proxy connect to the reserved port for SMTP traffic; if allowed, 1436 that could trick the proxy into relaying spam email. Proxies that 1437 support CONNECT SHOULD restrict its use to a limited set of known 1438 ports or a configurable whitelist of safe request targets. 1440 A server MUST NOT send any Transfer-Encoding or Content-Length header 1441 fields in a 2xx (Successful) response to CONNECT. A client MUST 1442 ignore any Content-Length or Transfer-Encoding header fields received 1443 in a successful response to CONNECT. 1445 A payload within a CONNECT request message has no defined semantics; 1446 sending a payload body on a CONNECT request might cause some existing 1447 implementations to reject the request. 1449 Responses to the CONNECT method are not cacheable. 1451 4.3.7. OPTIONS 1453 The OPTIONS method requests information about the communication 1454 options available for the target resource, either at the origin 1455 server or an intervening intermediary. This method allows a client 1456 to determine the options and/or requirements associated with a 1457 resource, or the capabilities of a server, without implying a 1458 resource action. 1460 An OPTIONS request with an asterisk ("*") as the request-target 1461 (Section 5.3 of [Part1]) applies to the server in general rather than 1462 to a specific resource. Since a server's communication options 1463 typically depend on the resource, the "*" request is only useful as a 1464 "ping" or "no-op" type of method; it does nothing beyond allowing the 1465 client to test the capabilities of the server. For example, this can 1466 be used to test a proxy for HTTP/1.1 conformance (or lack thereof). 1468 If the request-target is not an asterisk, the OPTIONS request applies 1469 to the options that are available when communicating with the target 1470 resource. 1472 A server generating a successful response to OPTIONS SHOULD send any 1473 header fields that might indicate optional features implemented by 1474 the server and applicable to the target resource (e.g., Allow), 1475 including potential extensions not defined by this specification. 1476 The response payload, if any, might also describe the communication 1477 options in a machine or human-readable representation. A standard 1478 format for such a representation is not defined by this 1479 specification, but might be defined by future extensions to HTTP. A 1480 server MUST generate a Content-Length field with a value of "0" if no 1481 payload body is to be sent in the response. 1483 A client MAY send a Max-Forwards header field in an OPTIONS request 1484 to target a specific recipient in the request chain (see 1485 Section 5.1.2). A proxy MUST NOT generate a Max-Forwards header 1486 field while forwarding a request unless that request was received 1487 with a Max-Forwards field. 1489 A client that generates an OPTIONS request containing a payload body 1490 MUST send a valid Content-Type header field describing the 1491 representation media type. Although this specification does not 1492 define any use for such a payload, future extensions to HTTP might 1493 use the OPTIONS body to make more detailed queries about the target 1494 resource. 1496 Responses to the OPTIONS method are not cacheable. 1498 4.3.8. TRACE 1500 The TRACE method requests a remote, application-level loop-back of 1501 the request message. The final recipient of the request SHOULD 1502 reflect the message received, excluding some fields described below, 1503 back to the client as the message body of a 200 (OK) response with a 1504 Content-Type of "message/http" (Section 8.3.1 of [Part1]). The final 1505 recipient is either the origin server or the first server to receive 1506 a Max-Forwards value of zero (0) in the request (Section 5.1.2). 1508 A client MUST NOT generate header fields in a TRACE request 1509 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 The Referer header field allows servers to generate back-links to 2091 other resources for simple analytics, logging, optimized caching, 2092 etc. It also allows obsolete or mistyped links to be found for 2093 maintenance. Some servers use the Referer header field as a means of 2094 denying links from other sites (so-called "deep linking") or 2095 restricting cross-site request forgery (CSRF), but not all requests 2096 contain it. 2098 Example: 2100 Referer: http://www.example.org/hypertext/Overview.html 2102 If the target URI was obtained from a source that does not have its 2103 own URI (e.g., input from the user keyboard, or an entry within the 2104 user's bookmarks/favorites), the user agent MUST either exclude 2105 Referer or send it with a value of "about:blank". 2107 The Referer field has the potential to reveal information about the 2108 request context or browsing history of the user, which is a privacy 2109 concern if the referring resource's identifier reveals personal 2110 information (such as an account name) or a resource that is supposed 2111 to be confidential (such as behind a firewall or internal to a 2112 secured service). Most general-purpose user agents do not send the 2113 Referer header field when the referring resource is a local "file" or 2114 "data" URI. A user agent MUST NOT send a Referer header field in an 2115 unsecured HTTP request if the referring page was received with a 2116 secure protocol. See Section 9.3 for additional security 2117 considerations. 2119 Some intermediaries have been known to indiscriminately remove 2120 Referer header fields from outgoing requests. This has the 2121 unfortunate side-effect of interfering with protection against CSRF 2122 attacks, which can be far more harmful to their users. 2123 Intermediaries and user agent extensions that wish to limit 2124 information disclosure in Referer ought to restrict their changes to 2125 specific edits, such as replacing internal domain names with 2126 pseudonyms or truncating the query and/or path components. An 2127 intermediary SHOULD NOT modify or delete the Referer header field 2128 when the field value shares the same scheme and host as the request 2129 target. 2131 5.5.3. User-Agent 2133 The "User-Agent" header field contains information about the user 2134 agent originating the request, which is often used by servers to help 2135 identify the scope of reported interoperability problems, to work 2136 around or tailor responses to avoid particular user agent 2137 limitations, and for analytics regarding browser or operating system 2138 use. A user agent SHOULD send a User-Agent field in each request 2139 unless specifically configured not to do so. 2141 User-Agent = product *( RWS ( product / comment ) ) 2143 The User-Agent field-value consists of one or more product 2144 identifiers, each followed by zero or more comments (Section 3.2 of 2145 [Part1]), which together identify the user agent software and its 2146 significant subproducts. By convention, the product identifiers are 2147 listed in decreasing order of their significance for identifying the 2148 user agent software. Each product identifier consists of a name and 2149 optional version. 2151 product = token ["/" product-version] 2152 product-version = token 2154 A sender SHOULD limit generated product identifiers to what is 2155 necessary to identify the product; a sender MUST NOT generate 2156 advertising or other non-essential information within the product 2157 identifier. A sender SHOULD NOT generate information in product- 2158 version that is not a version identifier (i.e., successive versions 2159 of the same product name ought to only differ in the product-version 2160 portion of the product identifier). 2162 Example: 2164 User-Agent: CERN-LineMode/2.15 libwww/2.17b3 2166 A user agent SHOULD NOT generate a User-Agent field containing 2167 needlessly fine-grained detail and SHOULD limit the addition of 2168 subproducts by third parties. Overly long and detailed User-Agent 2169 field values increase request latency and the risk of a user being 2170 identified against their wishes ("fingerprinting"). 2172 Likewise, implementations are encouraged not to use the product 2173 tokens of other implementations in order to declare compatibility 2174 with them, as this circumvents the purpose of the field. If a user 2175 agent masquerades as a different user agent, recipients can assume 2176 that the user intentionally desires to see responses tailored for 2177 that identified user agent, even if they might not work as well for 2178 the actual user agent being used. 2180 6. Response Status Codes 2182 The status-code element is a 3-digit integer code giving the result 2183 of the attempt to understand and satisfy the request. 2185 HTTP status codes are extensible. HTTP clients are not required to 2186 understand the meaning of all registered status codes, though such 2187 understanding is obviously desirable. However, a client MUST 2188 understand the class of any status code, as indicated by the first 2189 digit, and treat an unrecognized status code as being equivalent to 2190 the x00 status code of that class, with the exception that a 2191 recipient MUST NOT cache a response with an unrecognized status code. 2193 For example, if an unrecognized status code of 471 is received by a 2194 client, the client can assume that there was something wrong with its 2195 request and treat the response as if it had received a 400 status 2196 code. The response message will usually contain a representation 2197 that explains the status. 2199 The first digit of the status-code defines the class of response. 2200 The last two digits do not have any categorization role. There are 5 2201 values for the first digit: 2203 o 1xx (Informational): The request was received, continuing process 2205 o 2xx (Successful): The request was successfully received, 2206 understood, and accepted 2208 o 3xx (Redirection): Further action needs to be taken in order to 2209 complete the request 2211 o 4xx (Client Error): The request contains bad syntax or cannot be 2212 fulfilled 2214 o 5xx (Server Error): The server failed to fulfill an apparently 2215 valid request 2217 6.1. Overview of Status Codes 2219 The status codes listed below are defined in this specification, 2220 Section 4 of [Part4], Section 4 of [Part5], and Section 3 of [Part7]. 2221 The reason phrases listed here are only recommendations -- they can 2222 be replaced by local equivalents without affecting the protocol. 2224 Responses with status codes that are defined as cacheable by default 2225 (e.g., 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501 in this 2226 specification) can be reused by a cache with heuristic expiration 2227 unless otherwise indicated by the method definition or explicit cache 2228 controls [Part6]; all other status codes are not cacheable by 2229 default. 2231 +------+-------------------------------+------------------------+ 2232 | code | reason-phrase | Defined in... | 2233 +------+-------------------------------+------------------------+ 2234 | 100 | Continue | Section 6.2.1 | 2235 | 101 | Switching Protocols | Section 6.2.2 | 2236 | 200 | OK | Section 6.3.1 | 2237 | 201 | Created | Section 6.3.2 | 2238 | 202 | Accepted | Section 6.3.3 | 2239 | 203 | Non-Authoritative Information | Section 6.3.4 | 2240 | 204 | No Content | Section 6.3.5 | 2241 | 205 | Reset Content | Section 6.3.6 | 2242 | 206 | Partial Content | Section 4.1 of [Part5] | 2243 | 300 | Multiple Choices | Section 6.4.1 | 2244 | 301 | Moved Permanently | Section 6.4.2 | 2245 | 302 | Found | Section 6.4.3 | 2246 | 303 | See Other | Section 6.4.4 | 2247 | 304 | Not Modified | Section 4.1 of [Part4] | 2248 | 305 | Use Proxy | Section 6.4.5 | 2249 | 307 | Temporary Redirect | Section 6.4.7 | 2250 | 400 | Bad Request | Section 6.5.1 | 2251 | 401 | Unauthorized | Section 3.1 of [Part7] | 2252 | 402 | Payment Required | Section 6.5.2 | 2253 | 403 | Forbidden | Section 6.5.3 | 2254 | 404 | Not Found | Section 6.5.4 | 2255 | 405 | Method Not Allowed | Section 6.5.5 | 2256 | 406 | Not Acceptable | Section 6.5.6 | 2257 | 407 | Proxy Authentication Required | Section 3.2 of [Part7] | 2258 | 408 | Request Time-out | Section 6.5.7 | 2259 | 409 | Conflict | Section 6.5.8 | 2260 | 410 | Gone | Section 6.5.9 | 2261 | 411 | Length Required | Section 6.5.10 | 2262 | 412 | Precondition Failed | Section 4.2 of [Part4] | 2263 | 413 | Payload Too Large | Section 6.5.11 | 2264 | 414 | URI Too Long | Section 6.5.12 | 2265 | 415 | Unsupported Media Type | Section 6.5.13 | 2266 | 416 | Range Not Satisfiable | Section 4.4 of [Part5] | 2267 | 417 | Expectation Failed | Section 6.5.14 | 2268 | 426 | Upgrade Required | Section 6.5.15 | 2269 | 500 | Internal Server Error | Section 6.6.1 | 2270 | 501 | Not Implemented | Section 6.6.2 | 2271 | 502 | Bad Gateway | Section 6.6.3 | 2272 | 503 | Service Unavailable | Section 6.6.4 | 2273 | 504 | Gateway Time-out | Section 6.6.5 | 2274 | 505 | HTTP Version Not Supported | Section 6.6.6 | 2275 +------+-------------------------------+------------------------+ 2277 Note that this list is not exhaustive -- it does not include 2278 extension status codes defined in other specifications. The complete 2279 list of status codes is maintained by IANA. See Section 8.2 for 2280 details. 2282 6.2. Informational 1xx 2284 The 1xx (Informational) class of status code indicates an interim 2285 response for communicating connection status or request progress 2286 prior to completing the requested action and sending a final 2287 response. All 1xx responses consist of only the status-line and 2288 optional header fields, and thus are terminated by the empty line at 2289 the end of the header section. Since HTTP/1.0 did not define any 1xx 2290 status codes, a server MUST NOT send a 1xx response to an HTTP/1.0 2291 client. 2293 A client MUST be able to parse one or more 1xx responses received 2294 prior to a final response, even if the client does not expect one. A 2295 user agent MAY ignore unexpected 1xx responses. 2297 A proxy MUST forward 1xx responses unless the proxy itself requested 2298 the generation of the 1xx response. For example, if a proxy adds an 2299 "Expect: 100-continue" field when it forwards a request, then it need 2300 not forward the corresponding 100 (Continue) response(s). 2302 6.2.1. 100 Continue 2304 The 100 (Continue) status code indicates that the initial part of a 2305 request has been received and has not yet been rejected by the 2306 server. The server intends to send a final response after the 2307 request has been fully received and acted upon. 2309 When the request contains an Expect header field that includes a 100- 2310 continue expectation, the 100 response indicates that the server 2311 wishes to receive the request payload body, as described in 2312 Section 5.1.1. The client ought to continue sending the request and 2313 discard the 100 response. 2315 If the request did not contain an Expect header field containing the 2316 100-continue expectation, the client can simply discard this interim 2317 response. 2319 6.2.2. 101 Switching Protocols 2321 The 101 (Switching Protocols) status code indicates that the server 2322 understands and is willing to comply with the client's request, via 2323 the Upgrade header field (Section 6.7 of [Part1]), for a change in 2324 the application protocol being used on this connection. The server 2325 MUST generate an Upgrade header field in the response that indicates 2326 which protocol(s) will be switched to immediately after the empty 2327 line that terminates the 101 response. 2329 It is assumed that the server will only agree to switch protocols 2330 when it is advantageous to do so. For example, switching to a newer 2331 version of HTTP might be advantageous over older versions, and 2332 switching to a real-time, synchronous protocol might be advantageous 2333 when delivering resources that use such features. 2335 6.3. Successful 2xx 2337 The 2xx (Successful) class of status code indicates that the client's 2338 request was successfully received, understood, and accepted. 2340 6.3.1. 200 OK 2342 The 2343 200 (OK) status code indicates that the request has succeeded. The 2344 payload sent in a 200 response depends on the request method. For 2345 the methods defined by this specification, the intended meaning of 2346 the payload can be summarized as: 2348 GET a representation of the target resource; 2350 HEAD the same representation as GET, but without the representation 2351 data; 2353 POST a representation of the status of, or results obtained from, 2354 the action; 2356 PUT, DELETE a representation of the status of the action; 2358 OPTIONS a representation of the communications options; 2360 TRACE a representation of the request message as received by the end 2361 server. 2363 Aside from responses to CONNECT, a 200 response always has a payload, 2364 though an origin server MAY generate a payload body of zero length. 2365 If no payload is desired, an origin server ought to send 204 (No 2366 Content) instead. For CONNECT, no payload is allowed because the 2367 successful result is a tunnel, which begins immediately after the 200 2368 response header section. 2370 A 200 response is cacheable by default; i.e., unless otherwise 2371 indicated by the method definition or explicit cache controls (see 2372 Section 4.2.2 of [Part6]). 2374 6.3.2. 201 Created 2376 The 201 (Created) status code indicates that the request has been 2377 fulfilled and has resulted in one or more new resources being 2378 created. The primary resource created by the request is identified 2379 by either a Location header field in the response or, if no Location 2380 field is received, by the effective request URI. 2382 The 201 response payload typically describes and links to the 2383 resource(s) created. See Section 7.2 for a discussion of the meaning 2384 and purpose of validator header fields, such as ETag and Last- 2385 Modified, in a 201 response. 2387 6.3.3. 202 Accepted 2389 The 202 (Accepted) status code indicates that the request has been 2390 accepted for processing, but the processing has not been completed. 2391 The request might or might not eventually be acted upon, as it might 2392 be disallowed when processing actually takes place. There is no 2393 facility in HTTP for re-sending a status code from an asynchronous 2394 operation. 2396 The 202 response is intentionally non-committal. Its purpose is to 2397 allow a server to accept a request for some other process (perhaps a 2398 batch-oriented process that is only run once per day) without 2399 requiring that the user agent's connection to the server persist 2400 until the process is completed. The representation sent with this 2401 response ought to describe the request's current status and point to 2402 (or embed) a status monitor that can provide the user with an 2403 estimate of when the request will be fulfilled. 2405 6.3.4. 203 Non-Authoritative Information 2407 The 203 (Non-Authoritative Information) status code indicates that 2408 the request was successful but the enclosed payload has been modified 2409 from that of the origin server's 200 (OK) response by a transforming 2410 proxy (Section 5.7.2 of [Part1]). This status code allows the proxy 2411 to notify recipients when a transformation has been applied, since 2412 that knowledge might impact later decisions regarding the content. 2413 For example, future cache validation requests for the content might 2414 only be applicable along the same request path (through the same 2415 proxies). 2417 The 203 response is similar to the Warning code of 214 Transformation 2418 Applied (Section 5.5 of [Part6]), which has the advantage of being 2419 applicable to responses with any status code. 2421 A 203 response is cacheable by default; i.e., unless otherwise 2422 indicated by the method definition or explicit cache controls (see 2423 Section 4.2.2 of [Part6]). 2425 6.3.5. 204 No Content 2427 The 204 (No Content) status code indicates that the server has 2428 successfully fulfilled the request and that there is no additional 2429 content to send in the response payload body. Metadata in the 2430 response header fields refer to the target resource and its selected 2431 representation after the requested action was applied. 2433 For example, if a 204 status code is received in response to a PUT 2434 request and the response contains an ETag header field, then the PUT 2435 was successful and the ETag field-value contains the entity-tag for 2436 the new representation of that target resource. 2438 The 204 response allows a server to indicate that the action has been 2439 successfully applied to the target resource, while implying that the 2440 user agent does not need to traverse away from its current "document 2441 view" (if any). The server assumes that the user agent will provide 2442 some indication of the success to its user, in accord with its own 2443 interface, and apply any new or updated metadata in the response to 2444 its active representation. 2446 For example, a 204 status code is commonly used with document editing 2447 interfaces corresponding to a "save" action, such that the document 2448 being saved remains available to the user for editing. It is also 2449 frequently used with interfaces that expect automated data transfers 2450 to be prevalent, such as within distributed version control systems. 2452 A 204 response is terminated by the first empty line after the header 2453 fields because it cannot contain a message body. 2455 A 204 response is cacheable by default; i.e., unless otherwise 2456 indicated by the method definition or explicit cache controls (see 2457 Section 4.2.2 of [Part6]). 2459 6.3.6. 205 Reset Content 2461 The 205 (Reset Content) status code indicates that the server has 2462 fulfilled the request and desires that the user agent reset the 2463 "document view", which caused the request to be sent, to its original 2464 state as received from the origin server. 2466 This response is intended to support a common data entry use case 2467 where the user receives content that supports data entry (a form, 2468 notepad, canvas, etc.), enters or manipulates data in that space, 2469 causes the entered data to be submitted in a request, and then the 2470 data entry mechanism is reset for the next entry so that the user can 2471 easily initiate another input action. 2473 Since the 205 status code implies that no additional content will be 2474 provided, a server MUST NOT generate a payload in a 205 response. In 2475 other words, a server MUST do one of the following for a 205 2476 response: a) indicate a zero-length body for the response by 2477 including a Content-Length header field with a value of 0; b) 2478 indicate a zero-length payload for the response by including a 2479 Transfer-Encoding header field with a value of chunked and a message 2480 body consisting of a single chunk of zero-length; or, c) close the 2481 connection immediately after sending the blank line terminating the 2482 header section. 2484 6.4. Redirection 3xx 2486 The 3xx (Redirection) class of status code indicates that further 2487 action needs to be taken by the user agent in order to fulfill the 2488 request. If a Location header field (Section 7.1.2) is provided, the 2489 user agent MAY automatically redirect its request to the URI 2490 referenced by the Location field value, even if the specific status 2491 code is not understood. Automatic redirection needs to done with 2492 care for methods not known to be safe, as defined in Section 4.2.1, 2493 since the user might not wish to redirect an unsafe request. 2495 There are several types of redirects: 2497 1. Redirects that indicate the resource might be available at a 2498 different URI, as provided by the Location field, as in the 2499 status codes 301 (Moved Permanently), 302 (Found), and 307 2500 (Temporary Redirect). 2502 2. Redirection that offers a choice of matching resources, each 2503 capable of representing the original request target, as in the 2504 300 (Multiple Choices) status code. 2506 3. Redirection to a different resource, identified by the Location 2507 field, that can represent an indirect response to the request, as 2508 in the 303 (See Other) status code. 2510 4. Redirection to a previously cached result, as in the 304 (Not 2511 Modified) status code. 2513 Note: In HTTP/1.0, the status codes 301 (Moved Permanently) and 2514 302 (Found) were defined for the first type of redirect 2515 ([RFC1945], Section 9.3). Early user agents split on whether the 2516 method applied to the redirect target would be the same as the 2517 original request or would be rewritten as GET. Although HTTP 2518 originally defined the former semantics for 301 and 302 (to match 2519 its original implementation at CERN), and defined 303 (See Other) 2520 to match the latter semantics, prevailing practice gradually 2521 converged on the latter semantics for 301 and 302 as well. The 2522 first revision of HTTP/1.1 added 307 (Temporary Redirect) to 2523 indicate the former semantics without being impacted by divergent 2524 practice. Over 10 years later, most user agents still do method 2525 rewriting for 301 and 302; therefore, this specification makes 2526 that behavior conformant when the original request is POST. 2528 A client SHOULD detect and intervene in cyclical redirections (i.e., 2529 "infinite" redirection loops). 2531 Note: An earlier version of this specification recommended a 2532 maximum of five redirections ([RFC2068], Section 10.3). Content 2533 developers need to be aware that some clients might implement such 2534 a fixed limitation. 2536 6.4.1. 300 Multiple Choices 2538 The 300 (Multiple Choices) status code indicates that the target 2539 resource has more than one representation, each with its own more 2540 specific identifier, and information about the alternatives is being 2541 provided so that the user (or user agent) can select a preferred 2542 representation by redirecting its request to one or more of those 2543 identifiers. In other words, the server desires that the user agent 2544 engage in reactive negotiation to select the most appropriate 2545 representation(s) for its needs (Section 3.4). 2547 If the server has a preferred choice, the server SHOULD generate a 2548 Location header field containing a preferred choice's URI reference. 2549 The user agent MAY use the Location field value for automatic 2550 redirection. 2552 For request methods other than HEAD, the server SHOULD generate a 2553 payload in the 300 response containing a list of representation 2554 metadata and URI reference(s) from which the user or user agent can 2555 choose the one most preferred. The user agent MAY make a selection 2556 from that list automatically, depending upon the list format, but 2557 this specification does not define a standard for such automatic 2558 selection. 2560 A 300 response is cacheable by default; i.e., unless otherwise 2561 indicated by the method definition or explicit cache controls (see 2562 Section 4.2.2 of [Part6]). 2564 Note: The original proposal for 300 defined the URI header field 2565 as providing a list of alternative representations, such that it 2566 would be usable for 200, 300, and 406 responses and be transferred 2567 in responses to the HEAD method. However, lack of deployment and 2568 disagreement over syntax led to both URI and Alternates (a 2569 subsequent proposal) being dropped from this specification. It is 2570 possible to communicate the list using a set of Link header fields 2571 [RFC5988], each with a relationship of "alternate", though 2572 deployment is a chicken-and-egg problem. 2574 6.4.2. 301 Moved Permanently 2576 The 301 (Moved Permanently) status code indicates that the target 2577 resource has been assigned a new permanent URI and any future 2578 references to this resource ought to use one of the enclosed URIs. 2579 Clients with link editing capabilities ought to automatically re-link 2580 references to the effective request URI to one or more of the new 2581 references sent by the server, where possible. 2583 The server SHOULD generate a Location header field in the response 2584 containing a preferred URI reference for the new permanent URI. The 2585 user agent MAY use the Location field value for automatic 2586 redirection. The server's response payload usually contains a short 2587 hypertext note with a hyperlink to the new URI(s). 2589 Note: For historic reasons, a user agent MAY change the request 2590 method from POST to GET for the subsequent request. If this 2591 behavior is undesired, the 307 (Temporary Redirect) status code 2592 can be used instead. 2594 A 301 response is cacheable by default; i.e., unless otherwise 2595 indicated by the method definition or explicit cache controls (see 2596 Section 4.2.2 of [Part6]). 2598 6.4.3. 302 Found 2600 The 302 (Found) status code indicates that the target resource 2601 resides temporarily under a different URI. Since the redirection 2602 might be altered on occasion, the client ought to continue to use the 2603 effective request URI for future requests. 2605 The server SHOULD generate a Location header field in the response 2606 containing a URI reference for the different URI. The user agent MAY 2607 use the Location field value for automatic redirection. The server's 2608 response payload usually contains a short hypertext note with a 2609 hyperlink to the different URI(s). 2611 Note: For historic reasons, a user agent MAY change the request 2612 method from POST to GET for the subsequent request. If this 2613 behavior is undesired, the 307 (Temporary Redirect) status code 2614 can be used instead. 2616 6.4.4. 303 See Other 2618 The 303 (See Other) status code indicates that the server is 2619 redirecting the user agent to a different resource, as indicated by a 2620 URI in the Location header field, that is intended to provide an 2621 indirect response to the original request. In order to satisfy the 2622 original request, a user agent ought to perform a retrieval request 2623 using the Location URI (a GET or HEAD request if using HTTP), which 2624 can itself be redirected further, and present the eventual result as 2625 an answer to the original request. Note that the new URI in the 2626 Location header field is not considered equivalent to the effective 2627 request URI. 2629 This status code is applicable to any HTTP method. It is primarily 2630 used to allow the output of a POST action to redirect the user agent 2631 to a selected resource, since doing so provides the information 2632 corresponding to the POST response in a form that can be separately 2633 identified, bookmarked, and cached independent of the original 2634 request. 2636 A 303 response to a GET request indicates that the origin server does 2637 not have a representation of the target resource that can be 2638 transferred by the server over HTTP. However, the Location field 2639 value refers to a resource that is descriptive of the target 2640 resource, such that making a retrieval request on that other resource 2641 might result in a representation that is useful to recipients without 2642 implying that it represents the original target resource. Note that 2643 answers to the questions of what can be represented, what 2644 representations are adequate, and what might be a useful description 2645 are outside the scope of HTTP. 2647 Except for responses to a HEAD request, the representation of a 303 2648 response ought to contain a short hypertext note with a hyperlink to 2649 the same URI reference provided in the Location header field. 2651 6.4.5. 305 Use Proxy 2653 The 305 (Use Proxy) status code was defined in a previous version of 2654 this specification and is now deprecated (Appendix B). 2656 6.4.6. 306 (Unused) 2658 The 306 status code was defined in a previous version of this 2659 specification, is no longer used, and the code is reserved. 2661 6.4.7. 307 Temporary Redirect 2663 The 307 (Temporary Redirect) status code indicates that the target 2664 resource resides temporarily under a different URI and the user agent 2665 MUST NOT change the request method if it performs an automatic 2666 redirection to that URI. Since the redirection can change over time, 2667 the client ought to continue using the original effective request URI 2668 for future requests. 2670 The server SHOULD generate a Location header field in the response 2671 containing a URI reference for the different URI. The user agent MAY 2672 use the Location field value for automatic redirection. The server's 2673 response payload usually contains a short hypertext note with a 2674 hyperlink to the different URI(s). 2676 Note: This status code is similar to 302 (Found), except that it 2677 does not allow changing the request method from POST to GET. This 2678 specification defines no equivalent counterpart for 301 (Moved 2679 Permanently) ([status-308], however, defines the status code 308 2680 (Permanent Redirect) for this purpose). 2682 6.5. Client Error 4xx 2684 The 4xx (Client Error) class of status code indicates that the client 2685 seems to have erred. Except when responding to a HEAD request, the 2686 server SHOULD send a representation containing an explanation of the 2687 error situation, and whether it is a temporary or permanent 2688 condition. These status codes are applicable to any request method. 2689 User agents SHOULD display any included representation to the user. 2691 6.5.1. 400 Bad Request 2693 The 400 (Bad Request) status code indicates that the server cannot or 2694 will not process the request due to something which is perceived to 2695 be a client error (e.g., malformed request syntax, invalid request 2696 message framing, or deceptive request routing). 2698 6.5.2. 402 Payment Required 2700 The 402 (Payment Required) status code is reserved for future use. 2702 6.5.3. 403 Forbidden 2704 The 403 (Forbidden) status code indicates that the server understood 2705 the request but refuses to authorize it. A server that wishes to 2706 make public why the request has been forbidden can describe that 2707 reason in the response payload (if any). 2709 If authentication credentials were provided in the request, the 2710 server considers them insufficient to grant access. The client 2711 SHOULD NOT automatically repeat the request with the same 2712 credentials. The client MAY repeat the request with new or different 2713 credentials. However, a request might be forbidden for reasons 2714 unrelated to the credentials. 2716 An origin server that wishes to "hide" the current existence of a 2717 forbidden target resource MAY instead respond with a status code of 2718 404 (Not Found). 2720 6.5.4. 404 Not Found 2722 The 404 (Not Found) status code indicates that the origin server did 2723 not find a current representation for the target resource or is not 2724 willing to disclose that one exists. A 404 status code does not 2725 indicate whether this lack of representation is temporary or 2726 permanent; the 410 (Gone) status code is preferred over 404 if the 2727 origin server knows, presumably through some configurable means, that 2728 the condition is likely to be permanent. 2730 A 404 response is cacheable by default; i.e., unless otherwise 2731 indicated by the method definition or explicit cache controls (see 2732 Section 4.2.2 of [Part6]). 2734 6.5.5. 405 Method Not Allowed 2736 The 405 (Method Not Allowed) status code indicates that the method 2737 received in the request-line is known by the origin server but not 2738 supported by the target resource. The origin server MUST generate an 2739 Allow header field in a 405 response containing a list of the target 2740 resource's currently supported methods. 2742 A 405 response is cacheable by default; i.e., unless otherwise 2743 indicated by the method definition or explicit cache controls (see 2744 Section 4.2.2 of [Part6]). 2746 6.5.6. 406 Not Acceptable 2748 The 406 (Not Acceptable) status code indicates that the target 2749 resource does not have a current representation that would be 2750 acceptable to the user agent, according to the proactive negotiation 2751 header fields received in the request (Section 5.3), and the server 2752 is unwilling to supply a default representation. 2754 The server SHOULD generate a payload containing a list of available 2755 representation characteristics and corresponding resource identifiers 2756 from which the user or user agent can choose the one most 2757 appropriate. A user agent MAY automatically select the most 2758 appropriate choice from that list. However, this specification does 2759 not define any standard for such automatic selection, as described in 2760 Section 6.4.1. 2762 6.5.7. 408 Request Timeout 2764 The 408 (Request Timeout) status code indicates that the server did 2765 not receive a complete request message within the time that it was 2766 prepared to wait. A server SHOULD send the close connection option 2767 (Section 6.1 of [Part1]) in the response, since 408 implies that the 2768 server has decided to close the connection rather than continue 2769 waiting. If the client has an outstanding request in transit, the 2770 client MAY repeat that request on a new connection. 2772 6.5.8. 409 Conflict 2774 The 409 (Conflict) status code indicates that the request could not 2775 be completed due to a conflict with the current state of the target 2776 resource. This code is used in situations where the user might be 2777 able to resolve the conflict and resubmit the request. The server 2778 SHOULD generate a payload that includes enough information for a user 2779 to recognize the source of the conflict. 2781 Conflicts are most likely to occur in response to a PUT request. For 2782 example, if versioning were being used and the representation being 2783 PUT included changes to a resource that conflict with those made by 2784 an earlier (third-party) request, the origin server might use a 409 2785 response to indicate that it can't complete the request. In this 2786 case, the response representation would likely contain information 2787 useful for merging the differences based on the revision history. 2789 6.5.9. 410 Gone 2791 The 410 (Gone) status code indicates that access to the target 2792 resource is no longer available at the origin server and that this 2793 condition is likely to be permanent. If the origin server does not 2794 know, or has no facility to determine, whether or not the condition 2795 is permanent, the status code 404 (Not Found) ought to be used 2796 instead. 2798 The 410 response is primarily intended to assist the task of web 2799 maintenance by notifying the recipient that the resource is 2800 intentionally unavailable and that the server owners desire that 2801 remote links to that resource be removed. Such an event is common 2802 for limited-time, promotional services and for resources belonging to 2803 individuals no longer associated with the origin server's site. It 2804 is not necessary to mark all permanently unavailable resources as 2805 "gone" or to keep the mark for any length of time -- that is left to 2806 the discretion of the server owner. 2808 A 410 response is cacheable by default; i.e., unless otherwise 2809 indicated by the method definition or explicit cache controls (see 2810 Section 4.2.2 of [Part6]). 2812 6.5.10. 411 Length Required 2814 The 411 (Length Required) status code indicates that the server 2815 refuses to accept the request without a defined Content-Length 2816 (Section 3.3.2 of [Part1]). The client MAY repeat the request if it 2817 adds a valid Content-Length header field containing the length of the 2818 message body in the request message. 2820 6.5.11. 413 Payload Too Large 2822 The 413 (Payload Too Large) status code indicates that the server is 2823 refusing to process a request because the request payload is larger 2824 than the server is willing or able to process. The server MAY close 2825 the connection to prevent the client from continuing the request. 2827 If the condition is temporary, the server SHOULD generate a Retry- 2828 After header field to indicate that it is temporary and after what 2829 time the client MAY try again. 2831 6.5.12. 414 URI Too Long 2833 The 414 (URI Too Long) status code indicates that the server is 2834 refusing to service the request because the request-target (Section 2835 5.3 of [Part1]) is longer than the server is willing to interpret. 2836 This rare condition is only likely to occur when a client has 2837 improperly converted a POST request to a GET request with long query 2838 information, when the client has descended into a "black hole" of 2839 redirection (e.g., a redirected URI prefix that points to a suffix of 2840 itself), or when the server is under attack by a client attempting to 2841 exploit potential security holes. 2843 A 414 response is cacheable by default; i.e., unless otherwise 2844 indicated by the method definition or explicit cache controls (see 2845 Section 4.2.2 of [Part6]). 2847 6.5.13. 415 Unsupported Media Type 2849 The 415 (Unsupported Media Type) status code indicates that the 2850 origin server is refusing to service the request because the payload 2851 is in a format not supported by this method on the target resource. 2852 The format problem might be due to the request's indicated Content- 2853 Type or Content-Encoding, or as a result of inspecting the data 2854 directly. 2856 6.5.14. 417 Expectation Failed 2858 The 417 (Expectation Failed) status code indicates that the 2859 expectation given in the request's Expect header field 2860 (Section 5.1.1) could not be met by at least one of the inbound 2861 servers. 2863 6.5.15. 426 Upgrade Required 2865 The 426 (Upgrade Required) status code indicates that the server 2866 refuses to perform the request using the current protocol but might 2867 be willing to do so after the client upgrades to a different 2868 protocol. The server MUST send an Upgrade header field in a 426 2869 response to indicate the required protocol(s) (Section 6.7 of 2870 [Part1]). 2872 Example: 2874 HTTP/1.1 426 Upgrade Required 2875 Upgrade: HTTP/3.0 2876 Connection: Upgrade 2877 Content-Length: 53 2878 Content-Type: text/plain 2880 This service requires use of the HTTP/3.0 protocol. 2882 6.6. Server Error 5xx 2884 The 5xx (Server Error) class of status code indicates that the server 2885 is aware that it has erred or is incapable of performing the 2886 requested method. Except when responding to a HEAD request, the 2887 server SHOULD send a representation containing an explanation of the 2888 error situation, and whether it is a temporary or permanent 2889 condition. A user agent SHOULD display any included representation 2890 to the user. These response codes are applicable to any request 2891 method. 2893 6.6.1. 500 Internal Server Error 2895 The 500 (Internal Server Error) status code indicates that the server 2896 encountered an unexpected condition that prevented it from fulfilling 2897 the request. 2899 6.6.2. 501 Not Implemented 2901 The 501 (Not Implemented) status code indicates that the server does 2902 not support the functionality required to fulfill the request. This 2903 is the appropriate response when the server does not recognize the 2904 request method and is not capable of supporting it for any resource. 2906 A 501 response is cacheable by default; i.e., unless otherwise 2907 indicated by the method definition or explicit cache controls (see 2908 Section 4.2.2 of [Part6]). 2910 6.6.3. 502 Bad Gateway 2912 The 502 (Bad Gateway) status code indicates that the server, while 2913 acting as a gateway or proxy, received an invalid response from an 2914 inbound server it accessed while attempting to fulfill the request. 2916 6.6.4. 503 Service Unavailable 2918 The 503 (Service Unavailable) status code indicates that the server 2919 is currently unable to handle the request due to a temporary overload 2920 or scheduled maintenance, which will likely be alleviated after some 2921 delay. The server MAY send a Retry-After header field 2922 (Section 7.1.3) to suggest an appropriate amount of time for the 2923 client to wait before retrying the request. 2925 Note: The existence of the 503 status code does not imply that a 2926 server has to use it when becoming overloaded. Some servers might 2927 simply refuse the connection. 2929 6.6.5. 504 Gateway Timeout 2931 The 504 (Gateway Timeout) status code indicates that the server, 2932 while acting as a gateway or proxy, did not receive a timely response 2933 from an upstream server it needed to access in order to complete the 2934 request. 2936 6.6.6. 505 HTTP Version Not Supported 2938 The 505 (HTTP Version Not Supported) status code indicates that the 2939 server does not support, or refuses to support, the major version of 2940 HTTP that was used in the request message. The server is indicating 2941 that it is unable or unwilling to complete the request using the same 2942 major version as the client, as described in Section 2.6 of [Part1], 2943 other than with this error message. The server SHOULD generate a 2944 representation for the 505 response that describes why that version 2945 is not supported and what other protocols are supported by that 2946 server. 2948 7. Response Header Fields 2950 The response header fields allow the server to pass additional 2951 information about the response beyond what is placed in the status- 2952 line. These header fields give information about the server, about 2953 further access to the target resource, or about related resources. 2955 Although each response header field has a defined meaning, in 2956 general, the precise semantics might be further refined by the 2957 semantics of the request method and/or response status code. 2959 7.1. Control Data 2961 Response header fields can supply control data that supplements the 2962 status code, directs caching, or instructs the client where to go 2963 next. 2965 +-------------------+------------------------+ 2966 | Header Field Name | Defined in... | 2967 +-------------------+------------------------+ 2968 | Age | Section 5.1 of [Part6] | 2969 | Cache-Control | Section 5.2 of [Part6] | 2970 | Expires | Section 5.3 of [Part6] | 2971 | Date | Section 7.1.1.2 | 2972 | Location | Section 7.1.2 | 2973 | Retry-After | Section 7.1.3 | 2974 | Vary | Section 7.1.4 | 2975 | Warning | Section 5.5 of [Part6] | 2976 +-------------------+------------------------+ 2978 7.1.1. Origination Date 2980 7.1.1.1. Date/Time Formats 2982 Prior to 1995, there were three different formats commonly used by 2983 servers to communicate timestamps. For compatibility with old 2984 implementations, all three are defined here. The preferred format is 2985 a fixed-length and single-zone subset of the date and time 2986 specification used by the Internet Message Format [RFC5322]. 2988 HTTP-date = IMF-fixdate / obs-date 2990 An example of the preferred format is 2992 Sun, 06 Nov 1994 08:49:37 GMT ; IMF-fixdate 2994 Examples of the two obsolete formats are 2996 Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format 2997 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format 2999 A recipient that parses a timestamp value in an HTTP header field 3000 MUST accept all three HTTP-date formats. When a sender generates a 3001 header field that contains one or more timestamps defined as HTTP- 3002 date, the sender MUST generate those timestamps in the IMF-fixdate 3003 format. 3005 An HTTP-date value represents time as an instance of Coordinated 3006 Universal Time (UTC). The first two formats indicate UTC by the 3007 three-letter abbreviation for Greenwich Mean Time, "GMT", a 3008 predecessor of the UTC name; values in the asctime format are assumed 3009 to be in UTC. A sender that generates HTTP-date values from a local 3010 clock ought to use NTP ([RFC5905]) or some similar protocol to 3011 synchronize its clock to UTC. 3013 Preferred format: 3015 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 3016 ; fixed length/zone subset of the format defined in 3017 ; Section 3.3 of [RFC5322] 3019 day-name = %x4D.6F.6E ; "Mon", case-sensitive 3020 / %x54.75.65 ; "Tue", case-sensitive 3021 / %x57.65.64 ; "Wed", case-sensitive 3022 / %x54.68.75 ; "Thu", case-sensitive 3023 / %x46.72.69 ; "Fri", case-sensitive 3024 / %x53.61.74 ; "Sat", case-sensitive 3025 / %x53.75.6E ; "Sun", case-sensitive 3027 date1 = day SP month SP year 3028 ; e.g., 02 Jun 1982 3030 day = 2DIGIT 3031 month = %x4A.61.6E ; "Jan", case-sensitive 3032 / %x46.65.62 ; "Feb", case-sensitive 3033 / %x4D.61.72 ; "Mar", case-sensitive 3034 / %x41.70.72 ; "Apr", case-sensitive 3035 / %x4D.61.79 ; "May", case-sensitive 3036 / %x4A.75.6E ; "Jun", case-sensitive 3037 / %x4A.75.6C ; "Jul", case-sensitive 3038 / %x41.75.67 ; "Aug", case-sensitive 3039 / %x53.65.70 ; "Sep", case-sensitive 3040 / %x4F.63.74 ; "Oct", case-sensitive 3041 / %x4E.6F.76 ; "Nov", case-sensitive 3042 / %x44.65.63 ; "Dec", case-sensitive 3043 year = 4DIGIT 3045 GMT = %x47.4D.54 ; "GMT", case-sensitive 3047 time-of-day = hour ":" minute ":" second 3048 ; 00:00:00 - 23:59:60 (leap second) 3050 hour = 2DIGIT 3051 minute = 2DIGIT 3052 second = 2DIGIT 3054 Obsolete formats: 3056 obs-date = rfc850-date / asctime-date 3057 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 3058 date2 = day "-" month "-" 2DIGIT 3059 ; e.g., 02-Jun-82 3061 day-name-l = %x4D.6F.6E.64.61.79 ; "Monday", case-sensitive 3062 / %x54.75.65.73.64.61.79 ; "Tuesday", case-sensitive 3063 / %x57.65.64.6E.65.73.64.61.79 ; "Wednesday", case-sensitive 3064 / %x54.68.75.72.73.64.61.79 ; "Thursday", case-sensitive 3065 / %x46.72.69.64.61.79 ; "Friday", case-sensitive 3066 / %x53.61.74.75.72.64.61.79 ; "Saturday", case-sensitive 3067 / %x53.75.6E.64.61.79 ; "Sunday", case-sensitive 3069 asctime-date = day-name SP date3 SP time-of-day SP year 3070 date3 = month SP ( 2DIGIT / ( SP 1DIGIT )) 3071 ; e.g., Jun 2 3073 HTTP-date is case sensitive. A sender MUST NOT generate additional 3074 whitespace in an HTTP-date beyond that specifically included as SP in 3075 the grammar. The semantics of day-name, day, month, year, and time- 3076 of-day are the same as those defined for the Internet Message Format 3077 constructs with the corresponding name ([RFC5322], Section 3.3). 3079 Recipients of a timestamp value in rfc850-date format, which uses a 3080 two-digit year, MUST interpret a timestamp that appears to be more 3081 than 50 years in the future as representing the most recent year in 3082 the past that had the same last two digits. 3084 Recipients of timestamp values are encouraged to be robust in parsing 3085 timestamps unless otherwise restricted by the field definition. For 3086 example, messages are occasionally forwarded over HTTP from a non- 3087 HTTP source that might generate any of the date and time 3088 specifications defined by the Internet Message Format. 3090 Note: HTTP requirements for the date/time stamp format apply only 3091 to their usage within the protocol stream. Implementations are 3092 not required to use these formats for user presentation, request 3093 logging, etc. 3095 7.1.1.2. Date 3097 The "Date" header field represents the date and time at which the 3098 message was originated, having the same semantics as the Origination 3099 Date Field (orig-date) defined in Section 3.6.1 of [RFC5322]. The 3100 field value is an HTTP-date, as defined in Section 7.1.1.1. 3102 Date = HTTP-date 3104 An example is 3106 Date: Tue, 15 Nov 1994 08:12:31 GMT 3108 When a Date header field is generated, the sender SHOULD generate its 3109 field value as the best available approximation of the date and time 3110 of message generation. In theory, the date ought to represent the 3111 moment just before the payload is generated. In practice, the date 3112 can be generated at any time during message origination. 3114 An origin server MUST NOT send a Date header field if it does not 3115 have a clock capable of providing a reasonable approximation of the 3116 current instance in Coordinated Universal Time. An origin server MAY 3117 send a Date header field if the response is in the 1xx 3118 (Informational) or 5xx (Server Error) class of status codes. An 3119 origin server MUST send a Date header field in all other cases. 3121 A recipient with a clock that receives a response message without a 3122 Date header field MUST record the time it was received and append a 3123 corresponding Date header field to the message's header section if it 3124 is cached or forwarded downstream. 3126 A user agent MAY send a Date header field in a request, though 3127 generally will not do so unless it is believed to convey useful 3128 information to the server. For example, custom applications of HTTP 3129 might convey a Date if the server is expected to adjust its 3130 interpretation of the user's request based on differences between the 3131 user agent and server clocks. 3133 7.1.2. Location 3135 The "Location" header field is used in some responses to refer to a 3136 specific resource in relation to the response. The type of 3137 relationship is defined by the combination of request method and 3138 status code semantics. 3140 Location = URI-reference 3142 The field value consists of a single URI-reference. When it has the 3143 form of a relative reference ([RFC3986], Section 4.2), the final 3144 value is computed by resolving it against the effective request URI 3145 ([RFC3986], Section 5). 3147 For 201 (Created) responses, the Location value refers to the primary 3148 resource created by the request. For 3xx (Redirection) responses, 3149 the Location value refers to the preferred target resource for 3150 automatically redirecting the request. 3152 If the Location value provided in a 3xx (Redirection) does not have a 3153 fragment component, a user agent MUST process the redirection as if 3154 the value inherits the fragment component of the URI reference used 3155 to generate the request target (i.e., the redirection inherits the 3156 original reference's fragment, if any). 3158 For example, a GET request generated for the URI reference 3159 "http://www.example.org/~tim" might result in a 303 (See Other) 3160 response containing the header field: 3162 Location: /People.html#tim 3164 which suggests that the user agent redirect to 3165 "http://www.example.org/People.html#tim" 3167 Likewise, a GET request generated for the URI reference 3168 "http://www.example.org/index.html#larry" might result in a 301 3169 (Moved Permanently) response containing the header field: 3171 Location: http://www.example.net/index.html 3173 which suggests that the user agent redirect to 3174 "http://www.example.net/index.html#larry", preserving the original 3175 fragment identifier. 3177 There are circumstances in which a fragment identifier in a Location 3178 value would not be appropriate. For example, the Location header 3179 field in a 201 (Created) response is supposed to provide a URI that 3180 is specific to the created resource. 3182 Note: Some recipients attempt to recover from Location fields that 3183 are not valid URI references. This specification does not mandate 3184 or define such processing, but does allow it for the sake of 3185 robustness. 3187 Note: The Content-Location header field (Section 3.1.4.2) differs 3188 from Location in that the Content-Location refers to the most 3189 specific resource corresponding to the enclosed representation. 3190 It is therefore possible for a response to contain both the 3191 Location and Content-Location header fields. 3193 7.1.3. Retry-After 3195 Servers send the "Retry-After" header field to indicate how long the 3196 user agent ought to wait before making a follow-up request. When 3197 sent with a 503 (Service Unavailable) response, Retry-After indicates 3198 how long the service is expected to be unavailable to the client. 3199 When sent with any 3xx (Redirection) response, Retry-After indicates 3200 the minimum time that the user agent is asked to wait before issuing 3201 the redirected request. 3203 The value of this field can be either an HTTP-date or a number of 3204 seconds to delay after the response is received. 3206 Retry-After = HTTP-date / delay-seconds 3208 A delay-seconds value is a non-negative decimal integer, representing 3209 time in seconds. 3211 delay-seconds = 1*DIGIT 3213 Two examples of its use are 3215 Retry-After: Fri, 31 Dec 1999 23:59:59 GMT 3216 Retry-After: 120 3218 In the latter example, the delay is 2 minutes. 3220 7.1.4. Vary 3222 The "Vary" header field in a response describes what parts of a 3223 request message, aside from the method, Host header field, and 3224 request target, might influence the origin server's process for 3225 selecting and representing this response. The value consists of 3226 either a single asterisk ("*") or a list of header field names (case- 3227 insensitive). 3229 Vary = "*" / 1#field-name 3231 A Vary field value of "*" signals that anything about the request 3232 might play a role in selecting the response representation, possibly 3233 including elements outside the message syntax (e.g., the client's 3234 network address), and thus a recipient will not be able to determine 3235 whether this response is appropriate for a later request without 3236 forwarding the request to the origin server. A proxy MUST NOT 3237 generate a Vary field with a "*" value. 3239 A Vary field value consisting of a comma-separated list of names 3240 indicates that the named request header fields, known as the 3241 selecting header fields, might have a role in selecting the 3242 representation. The potential selecting header fields are not 3243 limited to those defined by this specification. 3245 For example, a response that contains 3247 Vary: accept-encoding, accept-language 3249 indicates that the origin server might have used the request's 3250 Accept-Encoding and Accept-Language fields (or lack thereof) as 3251 determining factors while choosing the content for this response. 3253 An origin server might send Vary with a list of fields for two 3254 purposes: 3256 1. To inform cache recipients that they MUST NOT use this response 3257 to satisfy a later request unless the later request has the same 3258 values for the listed fields as the original request (Section 4.1 3259 of [Part6]). In other words, Vary expands the cache key required 3260 to match a new request to the stored cache entry. 3262 2. To inform user agent recipients that this response is subject to 3263 content negotiation (Section 5.3) and that a different 3264 representation might be sent in a subsequent request if 3265 additional parameters are provided in the listed header fields 3266 (proactive negotiation). 3268 An origin server SHOULD send a Vary header field when its algorithm 3269 for selecting a representation varies based on aspects of the request 3270 message other than the method and request target, unless the variance 3271 cannot be crossed or the origin server has been deliberately 3272 configured to prevent cache transparency. For example, there is no 3273 need to send the Authorization field name in Vary because reuse 3274 across users is constrained by the field definition (Section 4.1 of 3275 [Part7]). Likewise, an origin server might use Cache-Control 3276 directives (Section 5.2 of [Part6]) to supplant Vary if it considers 3277 the variance less significant than the performance cost of Vary's 3278 impact on caching. 3280 7.2. Validator Header Fields 3282 Validator header fields convey metadata about the selected 3283 representation (Section 3). In responses to safe requests, validator 3284 fields describe the selected representation chosen by the origin 3285 server while handling the response. Note that, depending on the 3286 status code semantics, the selected representation for a given 3287 response is not necessarily the same as the representation enclosed 3288 as response payload. 3290 In a successful response to a state-changing request, validator 3291 fields describe the new representation that has replaced the prior 3292 selected representation as a result of processing the request. 3294 For example, an ETag header field in a 201 response communicates the 3295 entity-tag of the newly created resource's representation, so that it 3296 can be used in later conditional requests to prevent the "lost 3297 update" problem [Part4]. 3299 +-------------------+------------------------+ 3300 | Header Field Name | Defined in... | 3301 +-------------------+------------------------+ 3302 | ETag | Section 2.3 of [Part4] | 3303 | Last-Modified | Section 2.2 of [Part4] | 3304 +-------------------+------------------------+ 3306 7.3. Authentication Challenges 3308 Authentication challenges indicate what mechanisms are available for 3309 the client to provide authentication credentials in future requests. 3311 +--------------------+------------------------+ 3312 | Header Field Name | Defined in... | 3313 +--------------------+------------------------+ 3314 | WWW-Authenticate | Section 4.4 of [Part7] | 3315 | Proxy-Authenticate | Section 4.2 of [Part7] | 3316 +--------------------+------------------------+ 3318 7.4. Response Context 3320 The remaining response header fields provide more information about 3321 the target resource for potential use in later requests. 3323 +-------------------+------------------------+ 3324 | Header Field Name | Defined in... | 3325 +-------------------+------------------------+ 3326 | Accept-Ranges | Section 2.3 of [Part5] | 3327 | Allow | Section 7.4.1 | 3328 | Server | Section 7.4.2 | 3329 +-------------------+------------------------+ 3331 7.4.1. Allow 3333 The "Allow" header field lists the set of methods advertised as 3334 supported by the target resource. The purpose of this field is 3335 strictly to inform the recipient of valid request methods associated 3336 with the resource. 3338 Allow = #method 3340 Example of use: 3342 Allow: GET, HEAD, PUT 3344 The actual set of allowed methods is defined by the origin server at 3345 the time of each request. An origin server MUST generate an Allow 3346 field in a 405 (Method Not Allowed) response and MAY do so in any 3347 other response. An empty Allow field value indicates that the 3348 resource allows no methods, which might occur in a 405 response if 3349 the resource has been temporarily disabled by configuration. 3351 A proxy MUST NOT modify the Allow header field -- it does not need to 3352 understand all of the indicated methods in order to handle them 3353 according to the generic message handling rules. 3355 7.4.2. Server 3357 The "Server" header field contains information about the software 3358 used by the origin server to handle the request, which is often used 3359 by clients to help identify the scope of reported interoperability 3360 problems, to work around or tailor requests to avoid particular 3361 server limitations, and for analytics regarding server or operating 3362 system use. An origin server MAY generate a Server field in its 3363 responses. 3365 Server = product *( RWS ( product / comment ) ) 3367 The Server field-value consists of one or more product identifiers, 3368 each followed by zero or more comments (Section 3.2 of [Part1]), 3369 which together identify the origin server software and its 3370 significant subproducts. By convention, the product identifiers are 3371 listed in decreasing order of their significance for identifying the 3372 origin server software. Each product identifier consists of a name 3373 and optional version, as defined in Section 5.5.3. 3375 Example: 3377 Server: CERN/3.0 libwww/2.17 3379 An origin server SHOULD NOT generate a Server field containing 3380 needlessly fine-grained detail and SHOULD limit the addition of 3381 subproducts by third parties. Overly long and detailed Server field 3382 values increase response latency and potentially reveal internal 3383 implementation details that might make it (slightly) easier for 3384 attackers to find and exploit known security holes. 3386 8. IANA Considerations 3387 8.1. Method Registry 3389 The HTTP Method Registry defines the name space for the request 3390 method token (Section 4). The method registry will be created and 3391 maintained at (the suggested URI) 3392 . 3394 8.1.1. Procedure 3396 HTTP method registrations MUST include the following fields: 3398 o Method Name (see Section 4) 3400 o Safe ("yes" or "no", see Section 4.2.1) 3402 o Idempotent ("yes" or "no", see Section 4.2.2) 3404 o Pointer to specification text 3406 Values to be added to this name space require IETF Review (see 3407 [RFC5226], Section 4.1). 3409 8.1.2. Considerations for New Methods 3411 Standardized methods are generic; that is, they are potentially 3412 applicable to any resource, not just one particular media type, kind 3413 of resource, or application. As such, it is preferred that new 3414 methods be registered in a document that isn't specific to a single 3415 application or data format, since orthogonal technologies deserve 3416 orthogonal specification. 3418 Since message parsing (Section 3.3 of [Part1]) needs to be 3419 independent of method semantics (aside from responses to HEAD), 3420 definitions of new methods cannot change the parsing algorithm or 3421 prohibit the presence of a message body on either the request or the 3422 response message. Definitions of new methods can specify that only a 3423 zero-length message body is allowed by requiring a Content-Length 3424 header field with a value of "0". 3426 A new method definition needs to indicate whether it is safe 3427 (Section 4.2.1), idempotent (Section 4.2.2), cacheable 3428 (Section 4.2.3), what semantics are to be associated with the payload 3429 body if any is present in the request, and what refinements the 3430 method makes to header field or status code semantics. If the new 3431 method is cacheable, its definition ought to describe how, and under 3432 what conditions, a cache can store a response and use it to satisfy a 3433 subsequent request. The new method ought to describe whether it can 3434 be made conditional (Section 5.2) and, if so, how a server responds 3435 when the condition is false. Likewise, if the new method might have 3436 some use for partial response semantics ([Part5]), it ought to 3437 document this too. 3439 Note: Avoid defining a method name that starts with "M-", since 3440 that prefix might be misinterpreted as having the semantics 3441 assigned to it by [RFC2774]. 3443 8.1.3. Registrations 3445 The HTTP Method Registry shall be populated with the registrations 3446 below: 3448 +---------+------+------------+---------------+ 3449 | Method | Safe | Idempotent | Reference | 3450 +---------+------+------------+---------------+ 3451 | CONNECT | no | no | Section 4.3.6 | 3452 | DELETE | no | yes | Section 4.3.5 | 3453 | GET | yes | yes | Section 4.3.1 | 3454 | HEAD | yes | yes | Section 4.3.2 | 3455 | OPTIONS | yes | yes | Section 4.3.7 | 3456 | POST | no | no | Section 4.3.3 | 3457 | PUT | no | yes | Section 4.3.4 | 3458 | TRACE | yes | yes | Section 4.3.8 | 3459 +---------+------+------------+---------------+ 3461 8.2. Status Code Registry 3463 The HTTP Status Code Registry defines the name space for the response 3464 status-code token (Section 6). The status code registry is 3465 maintained at . 3467 This Section replaces the registration procedure for HTTP Status 3468 Codes previously defined in Section 7.1 of [RFC2817]. 3470 8.2.1. Procedure 3472 A registration MUST include the following fields: 3474 o Status Code (3 digits) 3476 o Short Description 3478 o Pointer to specification text 3480 Values to be added to the HTTP status code name space require IETF 3481 Review (see [RFC5226], Section 4.1). 3483 8.2.2. Considerations for New Status Codes 3485 When it is necessary to express semantics for a response that are not 3486 defined by current status codes, a new status code can be registered. 3487 Status codes are generic; they are potentially applicable to any 3488 resource, not just one particular media type, kind of resource, or 3489 application of HTTP. As such, it is preferred that new status codes 3490 be registered in a document that isn't specific to a single 3491 application. 3493 New status codes are required to fall under one of the categories 3494 defined in Section 6. To allow existing parsers to process the 3495 response message, new status codes cannot disallow a payload, 3496 although they can mandate a zero-length payload body. 3498 Proposals for new status codes that are not yet widely deployed ought 3499 to avoid allocating a specific number for the code until there is 3500 clear consensus that it will be registered; instead, early drafts can 3501 use a notation such as "4NN", or "3N0" .. "3N9", to indicate the 3502 class of the proposed status code(s) without consuming a number 3503 prematurely. 3505 The definition of a new status code ought to explain the request 3506 conditions that would cause a response containing that status code 3507 (e.g., combinations of request header fields and/or method(s)) along 3508 with any dependencies on response header fields (e.g., what fields 3509 are required, what fields can modify the semantics, and what header 3510 field semantics are further refined when used with the new status 3511 code). 3513 The definition of a new status code ought to specify whether or not 3514 it is cacheable. Note that all status codes can be cached if the 3515 response they occur in has explicit freshness information; however, 3516 status codes that are defined as being cacheable are allowed to be 3517 cached without explicit freshness information. Likewise, the 3518 definition of a status code can place constraints upon cache 3519 behavior. See [Part6] for more information. 3521 Finally, the definition of a new status code ought to indicate 3522 whether the payload has any implied association with an identified 3523 resource (Section 3.1.4.1). 3525 8.2.3. Registrations 3527 The HTTP Status Code Registry shall be updated with the registrations 3528 below: 3530 +-------+-------------------------------+----------------+ 3531 | Value | Description | Reference | 3532 +-------+-------------------------------+----------------+ 3533 | 100 | Continue | Section 6.2.1 | 3534 | 101 | Switching Protocols | Section 6.2.2 | 3535 | 200 | OK | Section 6.3.1 | 3536 | 201 | Created | Section 6.3.2 | 3537 | 202 | Accepted | Section 6.3.3 | 3538 | 203 | Non-Authoritative Information | Section 6.3.4 | 3539 | 204 | No Content | Section 6.3.5 | 3540 | 205 | Reset Content | Section 6.3.6 | 3541 | 300 | Multiple Choices | Section 6.4.1 | 3542 | 301 | Moved Permanently | Section 6.4.2 | 3543 | 302 | Found | Section 6.4.3 | 3544 | 303 | See Other | Section 6.4.4 | 3545 | 305 | Use Proxy | Section 6.4.5 | 3546 | 306 | (Unused) | Section 6.4.6 | 3547 | 307 | Temporary Redirect | Section 6.4.7 | 3548 | 400 | Bad Request | Section 6.5.1 | 3549 | 402 | Payment Required | Section 6.5.2 | 3550 | 403 | Forbidden | Section 6.5.3 | 3551 | 404 | Not Found | Section 6.5.4 | 3552 | 405 | Method Not Allowed | Section 6.5.5 | 3553 | 406 | Not Acceptable | Section 6.5.6 | 3554 | 408 | Request Timeout | Section 6.5.7 | 3555 | 409 | Conflict | Section 6.5.8 | 3556 | 410 | Gone | Section 6.5.9 | 3557 | 411 | Length Required | Section 6.5.10 | 3558 | 413 | Payload Too Large | Section 6.5.11 | 3559 | 414 | URI Too Long | Section 6.5.12 | 3560 | 415 | Unsupported Media Type | Section 6.5.13 | 3561 | 417 | Expectation Failed | Section 6.5.14 | 3562 | 426 | Upgrade Required | Section 6.5.15 | 3563 | 500 | Internal Server Error | Section 6.6.1 | 3564 | 501 | Not Implemented | Section 6.6.2 | 3565 | 502 | Bad Gateway | Section 6.6.3 | 3566 | 503 | Service Unavailable | Section 6.6.4 | 3567 | 504 | Gateway Timeout | Section 6.6.5 | 3568 | 505 | HTTP Version Not Supported | Section 6.6.6 | 3569 +-------+-------------------------------+----------------+ 3571 8.3. Header Field Registry 3573 HTTP header fields are registered within the Message Header Field 3574 Registry located at , as defined by [BCP90]. 3577 8.3.1. Considerations for New Header Fields 3579 Header fields are key:value pairs that can be used to communicate 3580 data about the message, its payload, the target resource, or the 3581 connection (i.e., control data). See Section 3.2 of [Part1] for a 3582 general definition of header field syntax in HTTP messages. 3584 The requirements for header field names are defined in [BCP90]. 3586 Authors of specifications defining new fields are advised to keep the 3587 name as short as practical and to not prefix the name with "X-" 3588 unless the header field will never be used on the Internet. (The 3589 "x-" prefix idiom has been extensively misused in practice; it was 3590 intended to only be used as a mechanism for avoiding name collisions 3591 inside proprietary software or intranet processing, since the prefix 3592 would ensure that private names never collide with a newly registered 3593 Internet name; see [BCP178] for further information) 3595 New header field values typically have their syntax defined using 3596 ABNF ([RFC5234]), using the extension defined in Section 7 of [Part1] 3597 as necessary, and are usually constrained to the range of ASCII 3598 characters. Header fields needing a greater range of characters can 3599 use an encoding such as the one defined in [RFC5987]. 3601 Leading and trailing whitespace in raw field values is removed upon 3602 field parsing (Section 3.2.4 of [Part1]). Field definitions where 3603 leading or trailing whitespace in values is significant will have to 3604 use a container syntax such as quoted-string. 3606 Because commas (",") are used as a generic delimiter between field- 3607 values, they need to be treated with care if they are allowed in the 3608 field-value. Typically, components that might contain a comma are 3609 protected with double-quotes using the quoted-string ABNF production 3610 (Section 3.2.6 of [Part1]). 3612 For example, a textual date and a URI (either of which might contain 3613 a comma) could be safely carried in field-values like these: 3615 Example-URI-Field: "http://example.com/a.html,foo", 3616 "http://without-a-comma.example.com/" 3617 Example-Date-Field: "Sat, 04 May 1996", "Wed, 14 Sep 2005" 3619 Note that double-quote delimiters almost always are used with the 3620 quoted-string production; using a different syntax inside double- 3621 quotes will likely cause unnecessary confusion. 3623 Many header fields use a format including (case-insensitively) named 3624 parameters (for instance, Content-Type, defined in Section 3.1.1.5). 3626 Allowing both unquoted (token) and quoted (quoted-string) syntax for 3627 the parameter value enables recipients to use existing parser 3628 components. When allowing both forms, the meaning of a parameter 3629 value ought to be independent of the syntax used for it (for an 3630 example, see the notes on parameter handling for media types in 3631 Section 3.1.1.1). 3633 Authors of specifications defining new header fields are advised to 3634 consider documenting: 3636 o Whether the field is a single value, or whether it can be a list 3637 (delimited by commas; see Section 3.2 of [Part1]). 3639 If it does not use the list syntax, document how to treat messages 3640 where the field occurs multiple times (a sensible default would be 3641 to ignore the field, but this might not always be the right 3642 choice). 3644 Note that intermediaries and software libraries might combine 3645 multiple header field instances into a single one, despite the 3646 field's definition not allowing the list syntax. A robust format 3647 enables recipients to discover these situations (good example: 3648 "Content-Type", as the comma can only appear inside quoted 3649 strings; bad example: "Location", as a comma can occur inside a 3650 URI). 3652 o Under what conditions the header field can be used; e.g., only in 3653 responses or requests, in all messages, only on responses to a 3654 particular request method, etc. 3656 o Whether the field should be stored by origin servers that 3657 understand it upon a PUT request. 3659 o Whether the field semantics are further refined by the context, 3660 such as by existing request methods or status codes. 3662 o Whether it is appropriate to list the field-name in the Connection 3663 header field (i.e., if the header field is to be hop-by-hop; see 3664 Section 6.1 of [Part1]). 3666 o Under what conditions intermediaries are allowed to insert, 3667 delete, or modify the field's value. 3669 o Whether it is appropriate to list the field-name in a Vary 3670 response header field (e.g., when the request header field is used 3671 by an origin server's content selection algorithm; see 3672 Section 7.1.4). 3674 o Whether the header field is useful or allowable in trailers (see 3675 Section 4.1 of [Part1]). 3677 o Whether the header field ought to be preserved across redirects. 3679 8.3.2. Registrations 3681 The Message Header Field Registry shall be updated with the following 3682 permanent registrations: 3684 +-------------------+----------+----------+-----------------+ 3685 | Header Field Name | Protocol | Status | Reference | 3686 +-------------------+----------+----------+-----------------+ 3687 | Accept | http | standard | Section 5.3.2 | 3688 | Accept-Charset | http | standard | Section 5.3.3 | 3689 | Accept-Encoding | http | standard | Section 5.3.4 | 3690 | Accept-Language | http | standard | Section 5.3.5 | 3691 | Allow | http | standard | Section 7.4.1 | 3692 | Content-Encoding | http | standard | Section 3.1.2.2 | 3693 | Content-Language | http | standard | Section 3.1.3.2 | 3694 | Content-Location | http | standard | Section 3.1.4.2 | 3695 | Content-Type | http | standard | Section 3.1.1.5 | 3696 | Date | http | standard | Section 7.1.1.2 | 3697 | Expect | http | standard | Section 5.1.1 | 3698 | From | http | standard | Section 5.5.1 | 3699 | Location | http | standard | Section 7.1.2 | 3700 | MIME-Version | http | standard | Appendix A.1 | 3701 | Max-Forwards | http | standard | Section 5.1.2 | 3702 | Referer | http | standard | Section 5.5.2 | 3703 | Retry-After | http | standard | Section 7.1.3 | 3704 | Server | http | standard | Section 7.4.2 | 3705 | User-Agent | http | standard | Section 5.5.3 | 3706 | Vary | http | standard | Section 7.1.4 | 3707 +-------------------+----------+----------+-----------------+ 3709 The change controller for the above registrations is: "IETF 3710 (iesg@ietf.org) - Internet Engineering Task Force". 3712 8.4. Content Coding Registry 3714 The HTTP Content Coding Registry defines the name space for content 3715 coding names (Section 4.2 of [Part1]). The content coding registry 3716 is maintained at . 3718 8.4.1. Procedure 3720 Content Coding registrations MUST include the following fields: 3722 o Name 3724 o Description 3726 o Pointer to specification text 3728 Names of content codings MUST NOT overlap with names of transfer 3729 codings (Section 4 of [Part1]), unless the encoding transformation is 3730 identical (as is the case for the compression codings defined in 3731 Section 4.2 of [Part1]). 3733 Values to be added to this name space require IETF Review (see 3734 Section 4.1 of [RFC5226]), and MUST conform to the purpose of content 3735 coding defined in this section. 3737 8.4.2. Registrations 3739 The HTTP Content Codings Registry shall be updated with the 3740 registrations below: 3742 +----------+----------------------------------------+---------------+ 3743 | Name | Description | Reference | 3744 +----------+----------------------------------------+---------------+ 3745 | identity | Reserved (synonym for "no encoding" in | Section 5.3.4 | 3746 | | Accept-Encoding) | | 3747 +----------+----------------------------------------+---------------+ 3749 9. Security Considerations 3751 This section is meant to inform developers, information providers, 3752 and users of known security concerns relevant to HTTP/1.1 semantics 3753 and its use for transferring information over the Internet. 3755 9.1. Attacks Based On File and Path Names 3757 Origin servers frequently make use of their local file system to 3758 manage the mapping from effective request URI to resource 3759 representations. Implementers need to be aware that most file 3760 systems are not designed to protect against malicious file or path 3761 names, and thus depend on the origin server to avoid mapping to file 3762 names, folders, or directories that have special significance to the 3763 system. 3765 For example, UNIX, Microsoft Windows, and other operating systems use 3766 ".." as a path component to indicate a directory level above the 3767 current one, and use specially named paths or file names to send data 3768 to system devices. Similar naming conventions might exist within 3769 other types of storage systems. Likewise, local storage systems have 3770 an annoying tendency to prefer user-friendliness over security when 3771 handling invalid or unexpected characters, recomposition of 3772 decomposed characters, and case-normalization of case-insensitive 3773 names. 3775 Attacks based on such special names tend to focus on either denial of 3776 service (e.g., telling the server to read from a COM port) or 3777 disclosure of configuration and source files that are not meant to be 3778 served. 3780 9.2. Personal Information 3782 Clients are often privy to large amounts of personal information, 3783 including both information provided by the user to interact with 3784 resources (e.g., the user's name, location, mail address, passwords, 3785 encryption keys, etc.) and information about the user's browsing 3786 activity over time (e.g., history, bookmarks, etc.). Implementations 3787 need to prevent unintentional leakage of personal information. 3789 9.3. Sensitive Information in URIs 3791 URIs are intended to be shared, not secured, even when they identify 3792 secure resources. URIs are often shown on displays, added to 3793 templates when a page is printed, and stored in a variety of 3794 unprotected bookmark lists. It is therefore unwise to include 3795 information within a URI that is sensitive, personally identifiable, 3796 or a risk to disclose. 3798 Authors of services ought to avoid GET-based forms for the submission 3799 of sensitive data because that data will be placed in the request- 3800 target. Many existing servers, proxies, and user agents log or 3801 display the request-target in places where it might be visible to 3802 third parties. Such services ought to use POST-based form submission 3803 instead. 3805 Since the Referer header field tells a target site about the context 3806 that resulted in a request, it has the potential to reveal 3807 information about the user's immediate browsing history and any 3808 personal information that might be found in the referring resource's 3809 URI. Limitations on Referer are described in Section 5.5.2 to 3810 address some of its security considerations. 3812 9.4. Product Information 3814 The User-Agent (Section 5.5.3), Via (Section 5.7.1 of [Part1]), and 3815 Server (Section 7.4.2) header fields often reveal information about 3816 the respective sender's software systems. In theory, this can make 3817 it easier for an attacker to exploit known security holes; in 3818 practice, attackers tend to try all potential holes regardless of the 3819 apparent software versions being used. 3821 Proxies that serve as a portal through a network firewall ought to 3822 take special precautions regarding the transfer of header information 3823 that might identify hosts behind the firewall. The Via header field 3824 allows intermediaries to replace sensitive machine names with 3825 pseudonyms. 3827 9.5. Fragment after Redirects 3829 Although fragment identifiers used within URI references are not sent 3830 in requests, implementers ought to be aware that they will be visible 3831 to the user agent and any extensions or scripts running as a result 3832 of the response. In particular, when a redirect occurs and the 3833 original request's fragment identifier is inherited by the new 3834 reference in Location (Section 7.1.2), this might have the effect of 3835 leaking one site's fragment to another site. If the first site uses 3836 personal information in fragments, it ought to ensure that redirects 3837 to other sites include a (possibly empty) fragment component in order 3838 to block that inheritance. 3840 9.6. Browser Fingerprinting 3842 Browser fingerprinting is a set of techniques for identifying a 3843 specific user agent over time through its unique set of 3844 characteristics. These characteristics might include information 3845 related to its TCP behavior, feature capabilities, and scripting 3846 environment, though of particular interest here is the set of unique 3847 characteristics that might be communicated via HTTP. Fingerprinting 3848 is considered a privacy concern because it enables tracking of a user 3849 agent's behavior over time without the corresponding controls that 3850 the user might have over other forms of data collection (e.g., 3851 cookies). Many general-purpose user agents (i.e., Web browsers) have 3852 taken steps to reduce their fingerprints. 3854 There are a number of request header fields that might reveal 3855 information to servers that is sufficiently unique to enable 3856 fingerprinting. The From header field is the most obvious, though it 3857 is expected that From will only be sent when self-identification is 3858 desired by the user. Likewise, Cookie header fields are deliberately 3859 designed to enable re-identification, so we can assume that 3860 fingerprinting concerns only apply to situations where cookies are 3861 disabled or restricted by the user agent's configuration. 3863 The User-Agent header field might contain enough information to 3864 uniquely identify a specific device, usually when combined with other 3865 characteristics, particularly if the user agent sends excessive 3866 details about the user's system or extensions. However, the source 3867 of unique information that is least expected by users is proactive 3868 negotiation (Section 5.3), including the Accept, Accept-Charset, 3869 Accept-Encoding, and Accept-Language header fields. 3871 In addition to the fingerprinting concern, detailed use of the 3872 Accept-Language header field can reveal information the user might 3873 consider to be of a private nature, because the understanding of 3874 particular languages is often strongly correlated to membership in a 3875 particular ethnic group. An approach that limits such loss of 3876 privacy would be for a user agent to omit the sending of Accept- 3877 Language except for sites that have been whitelisted, perhaps via 3878 interaction after detecting a Vary header field that would indicate 3879 language negotiation might be useful. 3881 In environments where proxies are used to enhance privacy, user 3882 agents ought to be conservative in sending proactive negotiation 3883 header fields. General-purpose user agents that provide a high 3884 degree of header field configurability ought to inform users about 3885 the loss of privacy that might result if too much detail is provided. 3886 As an extreme privacy measure, proxies could filter the proactive 3887 negotiation header fields in relayed requests. 3889 10. Acknowledgments 3891 See Section 10 of [Part1]. 3893 11. References 3895 11.1. Normative References 3897 [Part1] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext 3898 Transfer Protocol (HTTP/1.1): Message Syntax and 3899 Routing", draft-ietf-httpbis-p1-messaging-25 (work in 3900 progress), November 2013. 3902 [Part4] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext 3903 Transfer Protocol (HTTP/1.1): Conditional Requests", 3904 draft-ietf-httpbis-p4-conditional-25 (work in 3905 progress), November 2013. 3907 [Part5] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., 3908 "Hypertext Transfer Protocol (HTTP/1.1): Range 3909 Requests", draft-ietf-httpbis-p5-range-25 (work in 3910 progress), November 2013. 3912 [Part6] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 3913 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 3914 draft-ietf-httpbis-p6-cache-25 (work in progress), 3915 November 2013. 3917 [Part7] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext 3918 Transfer Protocol (HTTP/1.1): Authentication", 3919 draft-ietf-httpbis-p7-auth-25 (work in progress), 3920 November 2013. 3922 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet 3923 Mail Extensions (MIME) Part One: Format of Internet 3924 Message Bodies", RFC 2045, November 1996. 3926 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet 3927 Mail Extensions (MIME) Part Two: Media Types", 3928 RFC 2046, November 1996. 3930 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3931 Requirement Levels", BCP 14, RFC 2119, March 1997. 3933 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, 3934 "Uniform Resource Identifier (URI): Generic Syntax", 3935 STD 66, RFC 3986, January 2005. 3937 [RFC4647] Phillips, A., Ed. and M. Davis, Ed., "Matching of 3938 Language Tags", BCP 47, RFC 4647, September 2006. 3940 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for 3941 Syntax Specifications: ABNF", STD 68, RFC 5234, 3942 January 2008. 3944 [RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for 3945 Identifying Languages", BCP 47, RFC 5646, 3946 September 2009. 3948 [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in 3949 Internationalization in the IETF", BCP 166, RFC 6365, 3950 September 2011. 3952 11.2. Informative References 3954 [BCP13] Freed, N., Klensin, J., and T. Hansen, "Media Type 3955 Specifications and Registration Procedures", BCP 13, 3956 RFC 6838, January 2013. 3958 [BCP178] Saint-Andre, P., Crocker, D., and M. Nottingham, 3959 "Deprecating the "X-" Prefix and Similar Constructs in 3960 Application Protocols", BCP 178, RFC 6648, June 2012. 3962 [BCP90] Klyne, G., Nottingham, M., and J. Mogul, "Registration 3963 Procedures for Message Header Fields", BCP 90, 3964 RFC 3864, September 2004. 3966 [REST] Fielding, R., "Architectural Styles and the Design of 3967 Network-based Software Architectures", Doctoral 3968 Dissertation, University of California, Irvine , 3969 September 2000, 3970 . 3972 [RFC1945] Berners-Lee, T., Fielding, R., and H. Nielsen, 3973 "Hypertext Transfer Protocol -- HTTP/1.0", RFC 1945, 3974 May 1996. 3976 [RFC2049] Freed, N. and N. Borenstein, "Multipurpose Internet 3977 Mail Extensions (MIME) Part Five: Conformance Criteria 3978 and Examples", RFC 2049, November 1996. 3980 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and 3981 T. Berners-Lee, "Hypertext Transfer Protocol -- 3982 HTTP/1.1", RFC 2068, January 1997. 3984 [RFC2295] Holtman, K. and A. Mutz, "Transparent Content 3985 Negotiation in HTTP", RFC 2295, March 1998. 3987 [RFC2388] Masinter, L., "Returning Values from Forms: multipart/ 3988 form-data", RFC 2388, August 1998. 3990 [RFC2557] Palme, F., Hopmann, A., Shelness, N., and E. Stefferud, 3991 "MIME Encapsulation of Aggregate Documents, such as 3992 HTML (MHTML)", RFC 2557, March 1999. 3994 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 3995 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 3996 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 3998 [RFC2774] Frystyk, H., Leach, P., and S. Lawrence, "An HTTP 3999 Extension Framework", RFC 2774, February 2000. 4001 [RFC2817] Khare, R. and S. Lawrence, "Upgrading to TLS Within 4002 HTTP/1.1", RFC 2817, May 2000. 4004 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 4005 Procedures", BCP 19, RFC 2978, October 2000. 4007 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing 4008 an IANA Considerations Section in RFCs", BCP 26, 4009 RFC 5226, May 2008. 4011 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 4012 October 2008. 4014 [RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP", 4015 RFC 5789, March 2010. 4017 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 4018 "Network Time Protocol Version 4: Protocol and 4019 Algorithms Specification", RFC 5905, June 2010. 4021 [RFC5987] Reschke, J., "Character Set and Language Encoding for 4022 Hypertext Transfer Protocol (HTTP) Header Field 4023 Parameters", RFC 5987, August 2010. 4025 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 4027 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 4028 April 2011. 4030 [RFC6266] Reschke, J., "Use of the Content-Disposition Header 4031 Field in the Hypertext Transfer Protocol (HTTP)", 4032 RFC 6266, June 2011. 4034 [status-308] Reschke, J., "The Hypertext Transfer Protocol (HTTP) 4035 Status Code 308 (Permanent Redirect)", 4036 draft-reschke-http-status-308-07 (work in progress), 4037 March 2012. 4039 Appendix A. Differences between HTTP and MIME 4041 HTTP/1.1 uses many of the constructs defined for the Internet Message 4042 Format [RFC5322] and the Multipurpose Internet Mail Extensions (MIME) 4043 [RFC2045] to allow a message body to be transmitted in an open 4044 variety of representations and with extensible header fields. 4045 However, RFC 2045 is focused only on email; applications of HTTP have 4046 many characteristics that differ from email, and hence HTTP has 4047 features that differ from MIME. These differences were carefully 4048 chosen to optimize performance over binary connections, to allow 4049 greater freedom in the use of new media types, to make date 4050 comparisons easier, and to acknowledge the practice of some early 4051 HTTP servers and clients. 4053 This appendix describes specific areas where HTTP differs from MIME. 4054 Proxies and gateways to and from strict MIME environments need to be 4055 aware of these differences and provide the appropriate conversions 4056 where necessary. 4058 A.1. MIME-Version 4060 HTTP is not a MIME-compliant protocol. However, messages can include 4061 a single MIME-Version header field to indicate what version of the 4062 MIME protocol was used to construct the message. Use of the MIME- 4063 Version header field indicates that the message is in full 4064 conformance with the MIME protocol (as defined in [RFC2045]). 4065 Senders are responsible for ensuring full conformance (where 4066 possible) when exporting HTTP messages to strict MIME environments. 4068 A.2. Conversion to Canonical Form 4070 MIME requires that an Internet mail body part be converted to 4071 canonical form prior to being transferred, as described in Section 4 4072 of [RFC2049]. Section 3.1.1.3 of this document describes the forms 4073 allowed for subtypes of the "text" media type when transmitted over 4074 HTTP. [RFC2046] requires that content with a type of "text" 4075 represent line breaks as CRLF and forbids the use of CR or LF outside 4076 of line break sequences. HTTP allows CRLF, bare CR, and bare LF to 4077 indicate a line break within text content. 4079 A proxy or gateway from HTTP to a strict MIME environment ought to 4080 translate all line breaks within the text media types described in 4081 Section 3.1.1.3 of this document to the RFC 2049 canonical form of 4082 CRLF. Note, however, this might be complicated by the presence of a 4083 Content-Encoding and by the fact that HTTP allows the use of some 4084 charsets that do not use octets 13 and 10 to represent CR and LF, 4085 respectively. 4087 Conversion will break any cryptographic checksums applied to the 4088 original content unless the original content is already in canonical 4089 form. Therefore, the canonical form is recommended for any content 4090 that uses such checksums in HTTP. 4092 A.3. Conversion of Date Formats 4094 HTTP/1.1 uses a restricted set of date formats (Section 7.1.1.1) to 4095 simplify the process of date comparison. Proxies and gateways from 4096 other protocols ought to ensure that any Date header field present in 4097 a message conforms to one of the HTTP/1.1 formats and rewrite the 4098 date if necessary. 4100 A.4. Conversion of Content-Encoding 4102 MIME does not include any concept equivalent to HTTP/1.1's Content- 4103 Encoding header field. Since this acts as a modifier on the media 4104 type, proxies and gateways from HTTP to MIME-compliant protocols 4105 ought to either change the value of the Content-Type header field or 4106 decode the representation before forwarding the message. (Some 4107 experimental applications of Content-Type for Internet mail have used 4108 a media-type parameter of ";conversions=" to perform 4109 a function equivalent to Content-Encoding. However, this parameter 4110 is not part of the MIME standards). 4112 A.5. Conversion of Content-Transfer-Encoding 4114 HTTP does not use the Content-Transfer-Encoding field of MIME. 4115 Proxies and gateways from MIME-compliant protocols to HTTP need to 4116 remove any Content-Transfer-Encoding prior to delivering the response 4117 message to an HTTP client. 4119 Proxies and gateways from HTTP to MIME-compliant protocols are 4120 responsible for ensuring that the message is in the correct format 4121 and encoding for safe transport on that protocol, where "safe 4122 transport" is defined by the limitations of the protocol being used. 4123 Such a proxy or gateway ought to transform and label the data with an 4124 appropriate Content-Transfer-Encoding if doing so will improve the 4125 likelihood of safe transport over the destination protocol. 4127 A.6. MHTML and Line Length Limitations 4129 HTTP implementations that share code with MHTML [RFC2557] 4130 implementations need to be aware of MIME line length limitations. 4131 Since HTTP does not have this limitation, HTTP does not fold long 4132 lines. MHTML messages being transported by HTTP follow all 4133 conventions of MHTML, including line length limitations and folding, 4134 canonicalization, etc., since HTTP transfers message-bodies as 4135 payload and, aside from the "multipart/byteranges" type (Appendix A 4136 of [Part5]), does not interpret the content or any MIME header lines 4137 that might be contained therein. 4139 Appendix B. Changes from RFC 2616 4141 The primary changes in this revision have been editorial in nature: 4142 extracting the messaging syntax and partitioning HTTP semantics into 4143 separate documents for the core features, conditional requests, 4144 partial requests, caching, and authentication. The conformance 4145 language has been revised to clearly target requirements and the 4146 terminology has been improved to distinguish payload from 4147 representations and representations from resources. 4149 A new requirement has been added that semantics embedded in a URI 4150 should be disabled when those semantics are inconsistent with the 4151 request method, since this is a common cause of interoperability 4152 failure. (Section 2) 4153 An algorithm has been added for determining if a payload is 4154 associated with a specific identifier. (Section 3.1.4.1) 4156 The default charset of ISO-8859-1 for text media types has been 4157 removed; the default is now whatever the media type definition says. 4158 Likewise, special treatment of ISO-8859-1 has been removed from the 4159 Accept-Charset header field. (Section 3.1.1.3 and Section 5.3.3) 4161 The definition of Content-Location has been changed to no longer 4162 affect the base URI for resolving relative URI references, due to 4163 poor implementation support and the undesirable effect of potentially 4164 breaking relative links in content-negotiated resources. 4165 (Section 3.1.4.2) 4167 To be consistent with the method-neutral parsing algorithm of 4168 [Part1], the definition of GET has been relaxed so that requests can 4169 have a body, even though a body has no meaning for GET. 4170 (Section 4.3.1) 4172 Servers are no longer required to handle all Content-* header fields 4173 and use of Content-Range has been explicitly banned in PUT requests. 4174 (Section 4.3.4) 4176 Definition of the CONNECT method has been moved from [RFC2817] to 4177 this specification. (Section 4.3.6) 4179 The OPTIONS and TRACE request methods have been defined as being 4180 safe. (Section 4.3.7 and Section 4.3.8) 4182 The Expect header field's extension mechanism has been removed due to 4183 widely-deployed broken implementations. (Section 5.1.1) 4185 The Max-Forwards header field has been restricted to the OPTIONS and 4186 TRACE methods; previously, extension methods could have used it as 4187 well. (Section 5.1.2) 4189 The "about:blank" URI has been suggested as a value for the Referer 4190 header field when no referring URI is applicable, which distinguishes 4191 that case from others where the Referer field is not sent or has been 4192 removed. (Section 5.5.2) 4194 The following status codes are now cacheable (that is, they can be 4195 stored and reused by a cache without explicit freshness information 4196 present): 204, 404, 405, 414, 501. (Section 6) 4198 The 201 (Created) status description has been changed to allow for 4199 the possibility that more than one resource has been created. 4200 (Section 6.3.2) 4201 The definition of 203 (Non-Authoritative Information) has been 4202 broadened to include cases of payload transformations as well. 4203 (Section 6.3.4) 4205 The set of request methods that are safe to automatically redirect is 4206 no longer closed; user agents are able to make that determination 4207 based upon the request method semantics. The redirect status codes 4208 301, 302, and 307 no longer have normative requirements on response 4209 payloads and user interaction. (Section 6.4) 4211 The status codes 301 and 302 have been changed to allow user agents 4212 to rewrite the method from POST to GET. (Sections 6.4.2 and 6.4.3) 4214 The description of 303 (See Other) status code has been changed to 4215 allow it to be cached if explicit freshness information is given, and 4216 a specific definition has been added for a 303 response to GET. 4217 (Section 6.4.4) 4219 The 305 (Use Proxy) status code has been deprecated due to security 4220 concerns regarding in-band configuration of a proxy. (Section 6.4.5) 4222 The 400 (Bad Request) status code has been relaxed so that it isn't 4223 limited to syntax errors. (Section 6.5.1) 4225 The 426 (Upgrade Required) status code has been incorporated from 4226 [RFC2817]. (Section 6.5.15) 4228 The target of requirements on HTTP-date and the Date header field 4229 have been reduced to those systems generating the date, rather than 4230 all systems sending a date. (Section 7.1.1) 4232 The syntax of the Location header field has been changed to allow all 4233 URI references, including relative references and fragments, along 4234 with some clarifications as to when use of fragments would not be 4235 appropriate. (Section 7.1.2) 4237 Allow has been reclassified as a response header field, removing the 4238 option to specify it in a PUT request. Requirements relating to the 4239 content of Allow have been relaxed; correspondingly, clients are not 4240 required to always trust its value. (Section 7.4.1) 4242 A Method Registry has been defined. (Section 8.1) 4244 The Status Code Registry has been redefined by this specification; 4245 previously, it was defined in Section 7.1 of [RFC2817]. 4246 (Section 8.2) 4248 Registration of Content Codings has been changed to require IETF 4249 Review. (Section 8.4) 4251 The Content-Disposition header field has been removed since it is now 4252 defined by [RFC6266]. 4254 The Content-MD5 header field has been removed because it was 4255 inconsistently implemented with respect to partial responses. 4257 Appendix C. Imported ABNF 4259 The following core rules are included by reference, as defined in 4260 Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return), 4261 CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double 4262 quote), HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF 4263 (line feed), OCTET (any 8-bit sequence of data), SP (space), and 4264 VCHAR (any visible US-ASCII character). 4266 The rules below are defined in [Part1]: 4268 BWS = 4269 OWS = 4270 RWS = 4271 URI-reference = 4272 absolute-URI = 4273 comment = 4274 field-name = 4275 partial-URI = 4276 quoted-string = 4277 token = 4278 word = 4280 Appendix D. Collected ABNF 4282 In the collected ABNF below, list rules are expanded as per Section 4283 1.2 of [Part1]. 4285 Accept = [ ( "," / ( media-range [ accept-params ] ) ) *( OWS "," [ 4286 OWS ( media-range [ accept-params ] ) ] ) ] 4287 Accept-Charset = *( "," OWS ) ( ( charset / "*" ) [ weight ] ) *( OWS 4288 "," [ OWS ( ( charset / "*" ) [ weight ] ) ] ) 4289 Accept-Encoding = [ ( "," / ( codings [ weight ] ) ) *( OWS "," [ OWS 4290 ( codings [ weight ] ) ] ) ] 4291 Accept-Language = *( "," OWS ) ( language-range [ weight ] ) *( OWS 4292 "," [ OWS ( language-range [ weight ] ) ] ) 4293 Allow = [ ( "," / method ) *( OWS "," [ OWS method ] ) ] 4295 BWS = 4296 Content-Encoding = *( "," OWS ) content-coding *( OWS "," [ OWS 4297 content-coding ] ) 4298 Content-Language = *( "," OWS ) language-tag *( OWS "," [ OWS 4299 language-tag ] ) 4300 Content-Location = absolute-URI / partial-URI 4301 Content-Type = media-type 4303 Date = HTTP-date 4305 Expect = "100-continue" 4307 From = mailbox 4309 GMT = %x47.4D.54 ; GMT 4311 HTTP-date = IMF-fixdate / obs-date 4313 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 4315 Location = URI-reference 4317 Max-Forwards = 1*DIGIT 4319 OWS = 4321 RWS = 4322 Referer = absolute-URI / partial-URI 4323 Retry-After = HTTP-date / delay-seconds 4325 Server = product *( RWS ( product / comment ) ) 4327 URI-reference = 4328 User-Agent = product *( RWS ( product / comment ) ) 4330 Vary = "*" / ( *( "," OWS ) field-name *( OWS "," [ OWS field-name ] 4331 ) ) 4333 absolute-URI = 4334 accept-ext = OWS ";" OWS token [ "=" word ] 4335 accept-params = weight *accept-ext 4336 asctime-date = day-name SP date3 SP time-of-day SP year 4337 attribute = token 4339 charset = token 4340 codings = content-coding / "identity" / "*" 4341 comment = 4342 content-coding = token 4343 date1 = day SP month SP year 4344 date2 = day "-" month "-" 2DIGIT 4345 date3 = month SP ( 2DIGIT / ( SP DIGIT ) ) 4346 day = 2DIGIT 4347 day-name = %x4D.6F.6E ; Mon 4348 / %x54.75.65 ; Tue 4349 / %x57.65.64 ; Wed 4350 / %x54.68.75 ; Thu 4351 / %x46.72.69 ; Fri 4352 / %x53.61.74 ; Sat 4353 / %x53.75.6E ; Sun 4354 day-name-l = %x4D.6F.6E.64.61.79 ; Monday 4355 / %x54.75.65.73.64.61.79 ; Tuesday 4356 / %x57.65.64.6E.65.73.64.61.79 ; Wednesday 4357 / %x54.68.75.72.73.64.61.79 ; Thursday 4358 / %x46.72.69.64.61.79 ; Friday 4359 / %x53.61.74.75.72.64.61.79 ; Saturday 4360 / %x53.75.6E.64.61.79 ; Sunday 4361 delay-seconds = 1*DIGIT 4363 field-name = 4365 hour = 2DIGIT 4367 language-range = 4368 language-tag = 4370 mailbox = 4371 media-range = ( "*/*" / ( type "/*" ) / ( type "/" subtype ) ) *( OWS 4372 ";" OWS parameter ) 4373 media-type = type "/" subtype *( OWS ";" OWS parameter ) 4374 method = token 4375 minute = 2DIGIT 4376 month = %x4A.61.6E ; Jan 4377 / %x46.65.62 ; Feb 4378 / %x4D.61.72 ; Mar 4379 / %x41.70.72 ; Apr 4380 / %x4D.61.79 ; May 4381 / %x4A.75.6E ; Jun 4382 / %x4A.75.6C ; Jul 4383 / %x41.75.67 ; Aug 4384 / %x53.65.70 ; Sep 4385 / %x4F.63.74 ; Oct 4386 / %x4E.6F.76 ; Nov 4387 / %x44.65.63 ; Dec 4389 obs-date = rfc850-date / asctime-date 4390 parameter = attribute "=" value 4391 partial-URI = 4392 product = token [ "/" product-version ] 4393 product-version = token 4395 quoted-string = 4396 qvalue = ( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] ) 4398 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 4400 second = 2DIGIT 4401 subtype = token 4403 time-of-day = hour ":" minute ":" second 4404 token = 4405 type = token 4407 value = word 4409 weight = OWS ";" OWS "q=" qvalue 4410 word = 4412 year = 4DIGIT 4414 Appendix E. Change Log (to be removed by RFC Editor before publication) 4416 E.1. Since RFC 2616 4418 Changes up to the IETF Last Call draft are summarized in . 4422 E.2. Since draft-ietf-httpbis-p2-semantics-24 4424 Closed issues: 4426 o : "Review 4427 Cachability of Status Codes WRT 'Negative Caching'" 4429 o : "RFC 1305 ref 4430 needs to be updated to 5905" 4432 o : "idempotency: 4433 clarify 'effect'" 4435 o : "APPSDIR 4436 review of draft-ietf-httpbis-p2-semantics-24" 4438 o : "move IANA 4439 registrations to correct draft" 4441 Index 4443 1 4444 1xx Informational (status code class) 50 4446 2 4447 2xx Successful (status code class) 51 4449 3 4450 3xx Redirection (status code class) 54 4452 4 4453 4xx Client Error (status code class) 58 4455 5 4456 5xx Server Error (status code class) 62 4458 1 4459 100 Continue (status code) 50 4460 100-continue (expect value) 34 4461 101 Switching Protocols (status code) 50 4463 2 4464 200 OK (status code) 51 4465 201 Created (status code) 52 4466 202 Accepted (status code) 52 4467 203 Non-Authoritative Information (status code) 52 4468 204 No Content (status code) 53 4469 205 Reset Content (status code) 53 4471 3 4472 300 Multiple Choices (status code) 55 4473 301 Moved Permanently (status code) 56 4474 302 Found (status code) 56 4475 303 See Other (status code) 57 4476 305 Use Proxy (status code) 57 4477 306 (Unused) (status code) 58 4478 307 Temporary Redirect (status code) 58 4480 4 4481 400 Bad Request (status code) 58 4482 402 Payment Required (status code) 58 4483 403 Forbidden (status code) 59 4484 404 Not Found (status code) 59 4485 405 Method Not Allowed (status code) 59 4486 406 Not Acceptable (status code) 59 4487 408 Request Timeout (status code) 60 4488 409 Conflict (status code) 60 4489 410 Gone (status code) 60 4490 411 Length Required (status code) 61 4491 413 Payload Too Large (status code) 61 4492 414 URI Too Long (status code) 61 4493 415 Unsupported Media Type (status code) 62 4494 417 Expectation Failed (status code) 62 4495 426 Upgrade Required (status code) 62 4497 5 4498 500 Internal Server Error (status code) 63 4499 501 Not Implemented (status code) 63 4500 502 Bad Gateway (status code) 63 4501 503 Service Unavailable (status code) 63 4502 504 Gateway Timeout (status code) 63 4503 505 HTTP Version Not Supported (status code) 63 4505 A 4506 Accept header field 38 4507 Accept-Charset header field 40 4508 Accept-Encoding header field 41 4509 Accept-Language header field 42 4510 Allow header field 72 4512 C 4513 cacheable 24 4514 compress (content coding) 11 4515 conditional request 36 4516 CONNECT method 30 4517 content coding 11 4518 content negotiation 6 4519 Content-Encoding header field 12 4520 Content-Language header field 13 4521 Content-Location header field 15 4522 Content-Transfer-Encoding header field 89 4523 Content-Type header field 10 4525 D 4526 Date header field 67 4527 deflate (content coding) 11 4528 DELETE method 29 4530 E 4531 Expect header field 34 4533 F 4534 From header field 44 4536 G 4537 GET method 24 4538 Grammar 4539 Accept 38 4540 Accept-Charset 40 4541 Accept-Encoding 41 4542 accept-ext 38 4543 Accept-Language 42 4544 accept-params 38 4545 Allow 72 4546 asctime-date 67 4547 attribute 8 4548 charset 9 4549 codings 41 4550 content-coding 11 4551 Content-Encoding 12 4552 Content-Language 13 4553 Content-Location 15 4554 Content-Type 10 4555 Date 67 4556 date1 66 4557 day 66 4558 day-name 66 4559 day-name-l 66 4560 delay-seconds 70 4561 Expect 34 4562 From 44 4563 GMT 66 4564 hour 66 4565 HTTP-date 64 4566 IMF-fixdate 66 4567 language-range 42 4568 language-tag 13 4569 Location 68 4570 Max-Forwards 36 4571 media-range 38 4572 media-type 8 4573 method 21 4574 minute 66 4575 month 66 4576 obs-date 66 4577 parameter 8 4578 product 46 4579 product-version 46 4580 qvalue 38 4581 Referer 45 4582 Retry-After 70 4583 rfc850-date 67 4584 second 66 4585 Server 73 4586 subtype 8 4587 time-of-day 66 4588 type 8 4589 User-Agent 46 4590 value 8 4591 Vary 70 4592 weight 38 4593 year 66 4594 gzip (content coding) 11 4596 H 4597 HEAD method 25 4599 I 4600 idempotent 23 4602 L 4603 Location header field 68 4605 M 4606 Max-Forwards header field 36 4607 MIME-Version header field 88 4609 O 4610 OPTIONS method 31 4612 P 4613 payload 17 4614 POST method 25 4615 PUT method 26 4617 R 4618 Referer header field 45 4619 representation 7 4620 Retry-After header field 69 4622 S 4623 safe 22 4624 selected representation 7, 71 4625 Server header field 73 4626 Status Codes Classes 4627 1xx Informational 50 4628 2xx Successful 51 4629 3xx Redirection 54 4630 4xx Client Error 58 4631 5xx Server Error 62 4633 T 4634 TRACE method 32 4636 U 4637 User-Agent header field 46 4639 V 4640 Vary header field 70 4642 X 4643 x-compress (content coding) 11 4644 x-gzip (content coding) 11 4646 Authors' Addresses 4648 Roy T. Fielding (editor) 4649 Adobe Systems Incorporated 4650 345 Park Ave 4651 San Jose, CA 95110 4652 USA 4654 EMail: fielding@gbiv.com 4655 URI: http://roy.gbiv.com/ 4657 Julian F. Reschke (editor) 4658 greenbytes GmbH 4659 Hafenweg 16 4660 Muenster, NW 48155 4661 Germany 4663 EMail: julian.reschke@greenbytes.de 4664 URI: http://greenbytes.de/tech/webdav/