idnits 2.17.1 draft-ietf-httpbis-p2-semantics-26.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 (February 6, 2014) is 3703 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) -- 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 5246 (Obsoleted by RFC 8446) -- 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 (~~), 1 warning (==), 12 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 February 6, 2014 7 Expires: August 10, 2014 9 Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content 10 draft-ietf-httpbis-p2-semantics-26 12 Abstract 14 The Hypertext Transfer Protocol (HTTP) is a stateless application- 15 level 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.3. 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 August 10, 2014. 51 Copyright Notice 53 Copyright (c) 2014 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 . . . . . . . . . . . . . . . . . . . . . . . . 33 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 . . . . . . . . . . . . . . . . . . . . . . . 44 125 5.5.3. User-Agent . . . . . . . . . . . . . . . . . . . . . . 46 126 6. Response Status Codes . . . . . . . . . . . . . . . . . . . . 47 127 6.1. Overview of Status Codes . . . . . . . . . . . . . . . . . 47 128 6.2. Informational 1xx . . . . . . . . . . . . . . . . . . . . 49 129 6.2.1. 100 Continue . . . . . . . . . . . . . . . . . . . . . 49 130 6.2.2. 101 Switching Protocols . . . . . . . . . . . . . . . 49 131 6.3. Successful 2xx . . . . . . . . . . . . . . . . . . . . . . 50 132 6.3.1. 200 OK . . . . . . . . . . . . . . . . . . . . . . . . 50 133 6.3.2. 201 Created . . . . . . . . . . . . . . . . . . . . . 51 134 6.3.3. 202 Accepted . . . . . . . . . . . . . . . . . . . . . 51 135 6.3.4. 203 Non-Authoritative Information . . . . . . . . . . 51 136 6.3.5. 204 No Content . . . . . . . . . . . . . . . . . . . . 52 137 6.3.6. 205 Reset Content . . . . . . . . . . . . . . . . . . 52 138 6.4. Redirection 3xx . . . . . . . . . . . . . . . . . . . . . 53 139 6.4.1. 300 Multiple Choices . . . . . . . . . . . . . . . . . 54 140 6.4.2. 301 Moved Permanently . . . . . . . . . . . . . . . . 55 141 6.4.3. 302 Found . . . . . . . . . . . . . . . . . . . . . . 55 142 6.4.4. 303 See Other . . . . . . . . . . . . . . . . . . . . 56 143 6.4.5. 305 Use Proxy . . . . . . . . . . . . . . . . . . . . 56 144 6.4.6. 306 (Unused) . . . . . . . . . . . . . . . . . . . . . 56 145 6.4.7. 307 Temporary Redirect . . . . . . . . . . . . . . . . 57 146 6.5. Client Error 4xx . . . . . . . . . . . . . . . . . . . . . 57 147 6.5.1. 400 Bad Request . . . . . . . . . . . . . . . . . . . 57 148 6.5.2. 402 Payment Required . . . . . . . . . . . . . . . . . 57 149 6.5.3. 403 Forbidden . . . . . . . . . . . . . . . . . . . . 57 150 6.5.4. 404 Not Found . . . . . . . . . . . . . . . . . . . . 58 151 6.5.5. 405 Method Not Allowed . . . . . . . . . . . . . . . . 58 152 6.5.6. 406 Not Acceptable . . . . . . . . . . . . . . . . . . 58 153 6.5.7. 408 Request Timeout . . . . . . . . . . . . . . . . . 59 154 6.5.8. 409 Conflict . . . . . . . . . . . . . . . . . . . . . 59 155 6.5.9. 410 Gone . . . . . . . . . . . . . . . . . . . . . . . 59 156 6.5.10. 411 Length Required . . . . . . . . . . . . . . . . . 60 157 6.5.11. 413 Payload Too Large . . . . . . . . . . . . . . . . 60 158 6.5.12. 414 URI Too Long . . . . . . . . . . . . . . . . . . . 60 159 6.5.13. 415 Unsupported Media Type . . . . . . . . . . . . . . 60 160 6.5.14. 417 Expectation Failed . . . . . . . . . . . . . . . . 61 161 6.5.15. 426 Upgrade Required . . . . . . . . . . . . . . . . . 61 162 6.6. Server Error 5xx . . . . . . . . . . . . . . . . . . . . . 61 163 6.6.1. 500 Internal Server Error . . . . . . . . . . . . . . 61 164 6.6.2. 501 Not Implemented . . . . . . . . . . . . . . . . . 62 165 6.6.3. 502 Bad Gateway . . . . . . . . . . . . . . . . . . . 62 166 6.6.4. 503 Service Unavailable . . . . . . . . . . . . . . . 62 167 6.6.5. 504 Gateway Timeout . . . . . . . . . . . . . . . . . 62 168 6.6.6. 505 HTTP Version Not Supported . . . . . . . . . . . . 62 169 7. Response Header Fields . . . . . . . . . . . . . . . . . . . . 63 170 7.1. Control Data . . . . . . . . . . . . . . . . . . . . . . . 63 171 7.1.1. Origination Date . . . . . . . . . . . . . . . . . . . 63 172 7.1.2. Location . . . . . . . . . . . . . . . . . . . . . . . 67 173 7.1.3. Retry-After . . . . . . . . . . . . . . . . . . . . . 68 174 7.1.4. Vary . . . . . . . . . . . . . . . . . . . . . . . . . 69 175 7.2. Validator Header Fields . . . . . . . . . . . . . . . . . 70 176 7.3. Authentication Challenges . . . . . . . . . . . . . . . . 71 177 7.4. Response Context . . . . . . . . . . . . . . . . . . . . . 71 178 7.4.1. Allow . . . . . . . . . . . . . . . . . . . . . . . . 71 179 7.4.2. Server . . . . . . . . . . . . . . . . . . . . . . . . 72 180 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 72 181 8.1. Method Registry . . . . . . . . . . . . . . . . . . . . . 73 182 8.1.1. Procedure . . . . . . . . . . . . . . . . . . . . . . 73 183 8.1.2. Considerations for New Methods . . . . . . . . . . . . 73 184 8.1.3. Registrations . . . . . . . . . . . . . . . . . . . . 74 185 8.2. Status Code Registry . . . . . . . . . . . . . . . . . . . 74 186 8.2.1. Procedure . . . . . . . . . . . . . . . . . . . . . . 74 187 8.2.2. Considerations for New Status Codes . . . . . . . . . 75 188 8.2.3. Registrations . . . . . . . . . . . . . . . . . . . . 75 189 8.3. Header Field Registry . . . . . . . . . . . . . . . . . . 76 190 8.3.1. Considerations for New Header Fields . . . . . . . . . 77 191 8.3.2. Registrations . . . . . . . . . . . . . . . . . . . . 79 192 8.4. Content Coding Registry . . . . . . . . . . . . . . . . . 79 193 8.4.1. Procedure . . . . . . . . . . . . . . . . . . . . . . 80 194 8.4.2. Registrations . . . . . . . . . . . . . . . . . . . . 80 195 9. Security Considerations . . . . . . . . . . . . . . . . . . . 80 196 9.1. Attacks Based On File and Path Names . . . . . . . . . . . 81 197 9.2. Attacks Based On Command, Code, or Query Injection . . . . 81 198 9.3. Disclosure of Personal Information . . . . . . . . . . . . 82 199 9.4. Disclosure of Sensitive Information in URIs . . . . . . . 82 200 9.5. Disclosure of Fragment after Redirects . . . . . . . . . . 82 201 9.6. Disclosure of Product Information . . . . . . . . . . . . 83 202 9.7. Browser Fingerprinting . . . . . . . . . . . . . . . . . . 83 203 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 84 204 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 84 205 11.1. Normative References . . . . . . . . . . . . . . . . . . . 84 206 11.2. Informative References . . . . . . . . . . . . . . . . . . 85 207 Appendix A. Differences between HTTP and MIME . . . . . . . . . . 87 208 A.1. MIME-Version . . . . . . . . . . . . . . . . . . . . . . . 88 209 A.2. Conversion to Canonical Form . . . . . . . . . . . . . . . 88 210 A.3. Conversion of Date Formats . . . . . . . . . . . . . . . . 88 211 A.4. Conversion of Content-Encoding . . . . . . . . . . . . . . 89 212 A.5. Conversion of Content-Transfer-Encoding . . . . . . . . . 89 213 A.6. MHTML and Line Length Limitations . . . . . . . . . . . . 89 214 Appendix B. Changes from RFC 2616 . . . . . . . . . . . . . . . . 89 215 Appendix C. Imported ABNF . . . . . . . . . . . . . . . . . . . . 92 216 Appendix D. Collected ABNF . . . . . . . . . . . . . . . . . . . 92 217 Appendix E. Change Log (to be removed by RFC Editor before 218 publication) . . . . . . . . . . . . . . . . . . . . 95 219 E.1. Since RFC 2616 . . . . . . . . . . . . . . . . . . . . . . 95 220 E.2. Since draft-ietf-httpbis-p2-semantics-24 . . . . . . . . . 95 221 E.3. Since draft-ietf-httpbis-p2-semantics-25 . . . . . . . . . 96 222 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 224 1. Introduction 226 Each Hypertext Transfer Protocol (HTTP) message is either a request 227 or a response. A server listens on a connection for a request, 228 parses each message received, interprets the message semantics in 229 relation to the identified request target, and responds to that 230 request with one or more response messages. A client constructs 231 request messages to communicate specific intentions, and examines 232 received responses to see if the intentions were carried out and 233 determine how to interpret the results. This document defines 234 HTTP/1.1 request and response semantics in terms of the architecture 235 defined in [Part1]. 237 HTTP provides a uniform interface for interacting with a resource 238 (Section 2), regardless of its type, nature, or implementation, via 239 the manipulation and transfer of representations (Section 3). 241 HTTP semantics include the intentions defined by each request method 242 (Section 4), extensions to those semantics that might be described in 243 request header fields (Section 5), the meaning of status codes to 244 indicate a machine-readable response (Section 6), and the meaning of 245 other control data and resource metadata that might be given in 246 response header fields (Section 7). 248 This document also defines representation metadata that describe how 249 a payload is intended to be interpreted by a recipient, the request 250 header fields that might influence content selection, and the various 251 selection algorithms that are collectively referred to as "content 252 negotiation" (Section 3.4). 254 1.1. Conformance and Error Handling 256 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 257 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 258 document are to be interpreted as described in [RFC2119]. 260 Conformance criteria and considerations regarding error handling are 261 defined in Section 2.5 of [Part1]. 263 1.2. Syntax Notation 265 This specification uses the Augmented Backus-Naur Form (ABNF) 266 notation of [RFC5234] with a list extension, defined in Section 7 of 267 [Part1], that allows for compact definition of comma-separated lists 268 using a '#' operator (similar to how the '*' operator indicates 269 repetition). Appendix C describes rules imported from other 270 documents. Appendix D shows the collected grammar with all list 271 operators expanded to standard ABNF notation. 273 This specification uses the terms "character", "character encoding 274 scheme", "charset", and "protocol element" as they are defined in 275 [RFC6365]. 277 2. Resources 279 The target of an HTTP request is called a resource. HTTP does not 280 limit the nature of a resource; it merely defines an interface that 281 might be used to interact with resources. Each resource is 282 identified by a Uniform Resource Identifier (URI), as described in 283 Section 2.7 of [Part1]. 285 When a client constructs an HTTP/1.1 request message, it sends the 286 target URI in one of various forms, as defined in (Section 5.3 of 287 [Part1]). When a request is received, the server reconstructs an 288 effective request URI for the target resource (Section 5.5 of 289 [Part1]). 291 One design goal of HTTP is to separate resource identification from 292 request semantics, which is made possible by vesting the request 293 semantics in the request method (Section 4) and a few request- 294 modifying header fields (Section 5). If there is a conflict between 295 the method semantics and any semantic implied by the URI itself, as 296 described in Section 4.2.1, the method semantics take precedence. 298 3. Representations 300 Considering that a resource could be anything, and that the uniform 301 interface provided by HTTP is similar to a window through which one 302 can observe and act upon such a thing only through the communication 303 of messages to some independent actor on the other side, an 304 abstraction is needed to represent ("take the place of") the current 305 or desired state of that thing in our communications. That 306 abstraction is called a representation [REST]. 308 For the purposes of HTTP, a "representation" is information that is 309 intended to reflect a past, current, or desired state of a given 310 resource, in a format that can be readily communicated via the 311 protocol, and that consists of a set of representation metadata and a 312 potentially unbounded stream of representation data. 314 An origin server might be provided with, or capable of generating, 315 multiple representations that are each intended to reflect the 316 current state of a target resource. In such cases, some algorithm is 317 used by the origin server to select one of those representations as 318 most applicable to a given request, usually based on content 319 negotiation. This "selected representation" is used to provide the 320 data and metadata for evaluating conditional requests [Part4] and 321 constructing the payload for 200 (OK) and 304 (Not Modified) 322 responses to GET (Section 4.3.1). 324 3.1. Representation Metadata 326 Representation header fields provide metadata about the 327 representation. When a message includes a payload body, the 328 representation header fields describe how to interpret the 329 representation data enclosed in the payload body. In a response to a 330 HEAD request, the representation header fields describe the 331 representation data that would have been enclosed in the payload body 332 if the same request had been a GET. 334 The following header fields convey representation metadata: 336 +-------------------+-----------------+ 337 | Header Field Name | Defined in... | 338 +-------------------+-----------------+ 339 | Content-Type | Section 3.1.1.5 | 340 | Content-Encoding | Section 3.1.2.2 | 341 | Content-Language | Section 3.1.3.2 | 342 | Content-Location | Section 3.1.4.2 | 343 +-------------------+-----------------+ 345 3.1.1. Processing Representation Data 347 3.1.1.1. Media Type 349 HTTP uses Internet Media Types [RFC2046] in the Content-Type 350 (Section 3.1.1.5) and Accept (Section 5.3.2) header fields in order 351 to provide open and extensible data typing and type negotiation. 352 Media types define both a data format and various processing models: 353 how to process that data in accordance with each context in which it 354 is received. 356 media-type = type "/" subtype *( OWS ";" OWS parameter ) 357 type = token 358 subtype = token 360 The type/subtype MAY be followed by parameters in the form of 361 name=value pairs. 363 parameter = token "=" ( token / quoted-string ) 365 The type, subtype, and parameter name tokens are case-insensitive. 366 Parameter values might or might not be case-sensitive, depending on 367 the semantics of the parameter name. The presence or absence of a 368 parameter might be significant to the processing of a media-type, 369 depending on its definition within the media type registry. 371 A parameter value that matches the token production can be 372 transmitted as either a token or within a quoted-string. The quoted 373 and unquoted values are equivalent. For example, the following 374 examples are all equivalent, but the first is preferred for 375 consistency: 377 text/html;charset=utf-8 378 text/html;charset=UTF-8 379 Text/HTML;Charset="utf-8" 380 text/html; charset="utf-8" 382 Internet media types ought to be registered with IANA according to 383 the procedures defined in [BCP13]. 385 Note: Unlike some similar constructs in other header fields, media 386 type parameters do not allow whitespace (even "bad" whitespace) 387 around the "=" character. 389 3.1.1.2. Charset 391 HTTP uses charset names to indicate or negotiate the character 392 encoding scheme of a textual representation [RFC6365]. A charset is 393 identified by a case-insensitive token. 395 charset = token 397 Charset names ought to be registered in IANA Character Set registry 398 () according to the 399 procedures defined in [RFC2978]. 401 3.1.1.3. Canonicalization and Text Defaults 403 Internet media types are registered with a canonical form in order to 404 be interoperable among systems with varying native encoding formats. 405 Representations selected or transferred via HTTP ought to be in 406 canonical form, for many of the same reasons described by the 407 Multipurpose Internet Mail Extensions (MIME) [RFC2045]. However, the 408 performance characteristics of email deployments (i.e., store and 409 forward messages to peers) are significantly different from those 410 common to HTTP and the Web (server-based information services). 411 Furthermore, MIME's constraints for the sake of compatibility with 412 older mail transfer protocols do not apply to HTTP (see Appendix A). 414 MIME's canonical form requires that media subtypes of the "text" type 415 use CRLF as the text line break. HTTP allows the transfer of text 416 media with plain CR or LF alone representing a line break, when such 417 line breaks are consistent for an entire representation. An HTTP 418 sender MAY generate, and a recipient MUST be able to parse, line 419 breaks in text media that consist of CRLF, bare CR, or bare LF. In 420 addition, text media in HTTP is not limited to charsets that use 421 octets 13 and 10 for CR and LF, respectively. This flexibility 422 regarding line breaks applies only to text within a representation 423 that has been assigned a "text" media type; it does not apply to 424 "multipart" types or HTTP elements outside the payload body (e.g., 425 header fields). 427 If a representation is encoded with a content-coding, the underlying 428 data ought to be in a form defined above prior to being encoded. 430 3.1.1.4. Multipart Types 432 MIME provides for a number of "multipart" types -- encapsulations of 433 one or more representations within a single message body. All 434 multipart types share a common syntax, as defined in Section 5.1.1 of 435 [RFC2046], and include a boundary parameter as part of the media type 436 value. The message body is itself a protocol element; a sender MUST 437 generate only CRLF to represent line breaks between body parts. 439 HTTP message framing does not use the multipart boundary as an 440 indicator of message body length, though it might be used by 441 implementations that generate or process the payload. For example, 442 the "multipart/form-data" type is often used for carrying form data 443 in a request, as described in [RFC2388], and the "multipart/ 444 byteranges" type is defined by this specification for use in some 206 445 (Partial Content) responses [Part5]. 447 3.1.1.5. Content-Type 449 The "Content-Type" header field indicates the media type of the 450 associated representation: either the representation enclosed in the 451 message payload or the selected representation, as determined by the 452 message semantics. The indicated media type defines both the data 453 format and how that data is intended to be processed by a recipient, 454 within the scope of the received message semantics, after any content 455 codings indicated by Content-Encoding are decoded. 457 Content-Type = media-type 459 Media types are defined in Section 3.1.1.1. An example of the field 460 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 can 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 method is GET or HEAD and the response status code 649 is 200 (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 method is GET or HEAD and the response status code 654 is 203 (Non-Authoritative Information), the payload is a 655 potentially modified or enhanced representation of the target 656 resource as 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 (Section 4.3.1) or HEAD (Section 4.3.2) request, this is the 697 same as the default semantics when no Content-Location is provided by 698 the server. For a state-changing request like PUT (Section 4.3.4) or 699 POST (Section 4.3.3), it implies that the server's response contains 700 the new representation of that resource, thereby distinguishing it 701 from representations that might only report about the action (e.g., 702 "It worked!"). This allows authoring applications to update their 703 local copies without the need for a subsequent GET 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 information to be processed by the target resource. 786 In a response, the payload's purpose is defined by both the request 787 method and the response status code. For example, the payload of a 788 200 (OK) response to GET (Section 4.3.1) represents the current state 789 of the target resource, as observed at the time of the message 790 origination date (Section 7.1.1.2), whereas the payload of the same 791 status code in a response to POST might represent either the 792 processing result or the new state of the target resource after 793 applying the processing. Response messages with an error status code 794 usually contain a payload that represents the error condition, such 795 that it describes the error state and what next steps are suggested 796 for resolving it. 798 Header fields that specifically describe the payload, rather than the 799 associated representation, are referred to as "payload header 800 fields". Payload header fields are defined in other parts of this 801 specification, due to their impact on message parsing. 803 +-------------------+--------------------------+ 804 | Header Field Name | Defined in... | 805 +-------------------+--------------------------+ 806 | Content-Length | Section 3.3.2 of [Part1] | 807 | Content-Range | Section 4.2 of [Part5] | 808 | Trailer | Section 4.4 of [Part1] | 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 A Vary header field (Section 7.1.4) is often sent in a response 892 subject to proactive negotiation to indicate what parts of the 893 request information were used in the selection algorithm. 895 3.4.2. Reactive Negotiation 897 With reactive negotiation (a.k.a., agent-driven negotiation), 898 selection of the best response representation (regardless of the 899 status code) is performed by the user agent after receiving an 900 initial response from the origin server that contains a list of 901 resources for alternative representations. If the user agent is not 902 satisfied by the initial response representation, it can perform a 903 GET request on one or more of the alternative resources, selected 904 based on metadata included in the list, to obtain a different form of 905 representation for that response. Selection of alternatives might be 906 performed automatically by the user agent or manually by the user 907 selecting from a generated (possibly hypertext) menu. 909 Note that the above refers to representations of the response, in 910 general, not representations of the resource. The alternative 911 representations are only considered representations of the target 912 resource if the response in which those alternatives are provided has 913 the semantics of being a representation of the target resource (e.g., 914 a 200 (OK) response to a GET request) or has the semantics of 915 providing links to alternative representations for the target 916 resource (e.g., a 300 (Multiple Choices) response to a GET request). 918 A server might choose not to send an initial representation, other 919 than the list of alternatives, and thereby indicate that reactive 920 negotiation by the user agent is preferred. For example, the 921 alternatives listed in responses with the 300 (Multiple Choices) and 922 406 (Not Acceptable) status codes include information about the 923 available representations so that the user or user agent can react by 924 making a selection. 926 Reactive negotiation is advantageous when the response would vary 927 over commonly-used dimensions (such as type, language, or encoding), 928 when the origin server is unable to determine a user agent's 929 capabilities from examining the request, and generally when public 930 caches are used to distribute server load and reduce network usage. 932 Reactive negotiation suffers from the disadvantages of transmitting a 933 list of alternatives to the user agent, which degrades user-perceived 934 latency if transmitted in the header section, and needing a second 935 request to obtain an alternate representation. Furthermore, this 936 specification does not define a mechanism for supporting automatic 937 selection, though it does not prevent such a mechanism from being 938 developed as an extension. 940 4. Request Methods 942 4.1. Overview 944 The request method token is the primary source of request semantics; 945 it indicates the purpose for which the client has made this request 946 and what is expected by the client as a successful result. 948 The request method's semantics might be further specialized by the 949 semantics of some header fields when present in a request (Section 5) 950 if those additional semantics do not conflict with the method. For 951 example, a client can send conditional request header fields 952 (Section 5.2) to make the requested action conditional on the current 953 state of the target resource ([Part4]). 955 method = token 957 HTTP was originally designed to be usable as an interface to 958 distributed object systems. The request method was envisioned as 959 applying semantics to a target resource in much the same way as 960 invoking a defined method on an identified object would apply 961 semantics. The method token is case-sensitive because it might be 962 used as a gateway to object-based systems with case-sensitive method 963 names. 965 Unlike distributed objects, the standardized request methods in HTTP 966 are not resource-specific, since uniform interfaces provide for 967 better visibility and reuse in network-based systems [REST]. Once 968 defined, a standardized method ought to have the same semantics when 969 applied to any resource, though each resource determines for itself 970 whether those semantics are implemented or allowed. 972 This specification defines a number of standardized methods that are 973 commonly used in HTTP, as outlined by the following table. By 974 convention, standardized methods are defined in all-uppercase ASCII 975 letters. 977 +---------+-------------------------------------------------+-------+ 978 | Method | Description | Sec. | 979 +---------+-------------------------------------------------+-------+ 980 | GET | Transfer a current representation of the target | 4.3.1 | 981 | | resource. | | 982 | HEAD | Same as GET, but only transfer the status line | 4.3.2 | 983 | | and header section. | | 984 | POST | Perform resource-specific processing on the | 4.3.3 | 985 | | request payload. | | 986 | PUT | Replace all current representations of the | 4.3.4 | 987 | | target resource with the request payload. | | 988 | DELETE | Remove all current representations of the | 4.3.5 | 989 | | target resource. | | 990 | CONNECT | Establish a tunnel to the server identified by | 4.3.6 | 991 | | the target resource. | | 992 | OPTIONS | Describe the communication options for the | 4.3.7 | 993 | | target resource. | | 994 | TRACE | Perform a message loop-back test along the path | 4.3.8 | 995 | | to the target resource. | | 996 +---------+-------------------------------------------------+-------+ 998 All general-purpose servers MUST support the methods GET and HEAD. 999 All other methods are OPTIONAL. 1001 Additional methods, outside the scope of this specification, have 1002 been standardized for use in HTTP. All such methods ought to be 1003 registered within the HTTP Method Registry maintained by IANA, as 1004 defined in Section 8.1. 1006 The set of methods allowed by a target resource can be listed in an 1007 Allow header field (Section 7.4.1). However, the set of allowed 1008 methods can change dynamically. When a request method is received 1009 that is unrecognized or not implemented by an origin server, the 1010 origin server SHOULD respond with the 501 (Not Implemented) status 1011 code. When a request method is received that is known by an origin 1012 server but not allowed for the target resource, the origin server 1013 SHOULD respond with the 405 (Method Not Allowed) status code. 1015 4.2. Common Method Properties 1017 4.2.1. Safe Methods 1019 Request methods are considered "safe" if their defined semantics are 1020 essentially read-only; i.e., the client does not request, and does 1021 not expect, any state change on the origin server as a result of 1022 applying a safe method to a target resource. Likewise, reasonable 1023 use of a safe method is not expected to cause any harm, loss of 1024 property, or unusual burden on the origin server. 1026 This definition of safe methods does not prevent an implementation 1027 from including behavior that is potentially harmful, not entirely 1028 read-only, or which causes side-effects while invoking a safe method. 1029 What is important, however, is that the client did not request that 1030 additional behavior and cannot be held accountable for it. For 1031 example, most servers append request information to access log files 1032 at the completion of every response, regardless of the method, and 1033 that is considered safe even though the log storage might become full 1034 and crash the server. Likewise, a safe request initiated by 1035 selecting an advertisement on the Web will often have the side-effect 1036 of charging an advertising account. 1038 Of the request methods defined by this specification, the GET, HEAD, 1039 OPTIONS, and TRACE methods are defined to be safe. 1041 The purpose of distinguishing between safe and unsafe methods is to 1042 allow automated retrieval processes (spiders) and cache performance 1043 optimization (pre-fetching) to work without fear of causing harm. In 1044 addition, it allows a user agent to apply appropriate constraints on 1045 the automated use of unsafe methods when processing potentially 1046 untrusted content. 1048 A user agent SHOULD distinguish between safe and unsafe methods when 1049 presenting potential actions to a user, such that the user can be 1050 made aware of an unsafe action before it is requested. 1052 When a resource is constructed such that parameters within the 1053 effective request URI have the effect of selecting an action, it is 1054 the resource owner's responsibility to ensure that the action is 1055 consistent with the request method semantics. For example, it is 1056 common for Web-based content editing software to use actions within 1057 query parameters, such as "page?do=delete". If the purpose of such a 1058 resource is to perform an unsafe action, then the resource owner MUST 1059 disable or disallow that action when it is accessed using a safe 1060 request method. Failure to do so will result in unfortunate side- 1061 effects when automated processes perform a GET on every URI reference 1062 for the sake of link maintenance, pre-fetching, building a search 1063 index, etc. 1065 4.2.2. Idempotent Methods 1067 A request method is considered "idempotent" if the intended effect on 1068 the server of multiple identical requests with that method is the 1069 same as the effect for a single such request. Of the request methods 1070 defined by this specification, PUT, DELETE, and safe request methods 1071 are idempotent. 1073 Like the definition of safe, the idempotent property only applies to 1074 what has been requested by the user; a server is free to log each 1075 request separately, retain a revision control history, or implement 1076 other non-idempotent side-effects for each idempotent request. 1078 Idempotent methods are distinguished because the request can be 1079 repeated automatically if a communication failure occurs before the 1080 client is able to read the server's response. For example, if a 1081 client sends a PUT request and the underlying connection is closed 1082 before any response is received, then the client can establish a new 1083 connection and retry the idempotent request. It knows that repeating 1084 the request will have the same intended effect, even if the original 1085 request succeeded, though the response might differ. 1087 4.2.3. Cacheable Methods 1089 Request methods can be defined as "cacheable" to indicate that 1090 responses to them are allowed to be stored for future reuse; for 1091 specific requirements see [Part6]. In general, safe methods that do 1092 not depend on a current or authoritative response are defined as 1093 cacheable; this specification defines GET, HEAD and POST as 1094 cacheable, although the overwhelming majority of cache 1095 implementations only support GET and HEAD. 1097 4.3. Method Definitions 1099 4.3.1. GET 1101 The GET method requests transfer of a current selected representation 1102 for the target resource. GET is the primary mechanism of information 1103 retrieval and the focus of almost all performance optimizations. 1104 Hence, when people speak of retrieving some identifiable information 1105 via HTTP, they are generally referring to making a GET request. 1107 It is tempting to think of resource identifiers as remote file system 1108 pathnames, and of representations as being a copy of the contents of 1109 such files. In fact, that is how many resources are implemented (see 1110 Section 9.1 for related security considerations). However, there are 1111 no such limitations in practice. The HTTP interface for a resource 1112 is just as likely to be implemented as a tree of content objects, a 1113 programmatic view on various database records, or a gateway to other 1114 information systems. Even when the URI mapping mechanism is tied to 1115 a file system, an origin server might be configured to execute the 1116 files with the request as input and send the output as the 1117 representation, rather than transfer the files directly. Regardless, 1118 only the origin server needs to know how each of its resource 1119 identifiers corresponds to an implementation, and how each 1120 implementation manages to select and send a current representation of 1121 the target resource in a response to GET. 1123 A client can alter the semantics of GET to be a "range request", 1124 requesting transfer of only some part(s) of the selected 1125 representation, by sending a Range header field in the request 1126 ([Part5]). 1128 A payload within a GET request message has no defined semantics; 1129 sending a payload body on a GET request might cause some existing 1130 implementations to reject the request. 1132 The response to a GET request is cacheable; a cache MAY use it to 1133 satisfy subsequent GET and HEAD requests unless otherwise indicated 1134 by the Cache-Control header field (Section 5.2 of [Part6]). 1136 4.3.2. HEAD 1138 The HEAD method is identical to GET except that the server MUST NOT 1139 send a message body in the response (i.e., the response terminates at 1140 the end of the header section). The server SHOULD send the same 1141 header fields in response to a HEAD request as it would have sent if 1142 the request had been a GET, except that the payload header fields 1143 (Section 3.3) MAY be omitted. This method can be used for obtaining 1144 metadata about the selected representation without transferring the 1145 representation data and is often used for testing hypertext links for 1146 validity, accessibility, and recent modification. 1148 A payload within a HEAD request message has no defined semantics; 1149 sending a payload body on a HEAD request might cause some existing 1150 implementations to reject the request. 1152 The response to a HEAD request is cacheable; a cache MAY use it to 1153 satisfy subsequent HEAD requests unless otherwise indicated by the 1154 Cache-Control header field (Section 5.2 of [Part6]). A HEAD response 1155 might also have an effect on previously cached responses to GET; see 1156 Section 4.3.5 of [Part6]. 1158 4.3.3. POST 1160 The POST method requests that the target resource process the 1161 representation enclosed in the request according to the resource's 1162 own specific semantics. For example, POST is used for the following 1163 functions (among others): 1165 o Providing a block of data, such as the fields entered into an HTML 1166 form, to a data-handling process; 1168 o Posting a message to a bulletin board, newsgroup, mailing list, 1169 blog, or similar group of articles; 1171 o Creating a new resource that has yet to be identified by the 1172 origin server; and 1174 o Appending data to a resource's existing representation(s). 1176 An origin server indicates response semantics by choosing an 1177 appropriate status code depending on the result of processing the 1178 POST request; almost all of the status codes defined by this 1179 specification might be received in a response to POST (the exceptions 1180 being 206, 304, and 416). 1182 If one or more resources has been created on the origin server as a 1183 result of successfully processing a POST request, the origin server 1184 SHOULD send a 201 (Created) response containing a Location header 1185 field that provides an identifier for the primary resource created 1186 (Section 7.1.2) and a representation that describes the status of the 1187 request while referring to the new resource(s). 1189 Responses to POST requests are only cacheable when they include 1190 explicit freshness information (see Section 4.2.1 of [Part6]). 1191 However, POST caching is not widely implemented. For cases where an 1192 origin server wishes the client to be able to cache the result of a 1193 POST in a way that can be reused by a later GET, the origin server 1194 MAY send a 200 (OK) response containing the result and a Content- 1195 Location header field that has the same value as the POST's effective 1196 request URI (Section 3.1.4.2). 1198 If the result of processing a POST would be equivalent to a 1199 representation of an existing resource, an origin server MAY redirect 1200 the user agent to that resource by sending a 303 (See Other) response 1201 with the existing resource's identifier in the Location field. This 1202 has the benefits of providing the user agent a resource identifier 1203 and transferring the representation via a method more amenable to 1204 shared caching, though at the cost of an extra request if the user 1205 agent does not already have the representation cached. 1207 4.3.4. PUT 1209 The PUT method requests that the state of the target resource be 1210 created or replaced with the state defined by the representation 1211 enclosed in the request message payload. A successful PUT of a given 1212 representation would suggest that a subsequent GET on that same 1213 target resource will result in an equivalent representation being 1214 sent in a 200 (OK) response. However, there is no guarantee that 1215 such a state change will be observable, since the target resource 1216 might be acted upon by other user agents in parallel, or might be 1217 subject to dynamic processing by the origin server, before any 1218 subsequent GET is received. A successful response only implies that 1219 the user agent's intent was achieved at the time of its processing by 1220 the origin server. 1222 If the target resource does not have a current representation and the 1223 PUT successfully creates one, then the origin server MUST inform the 1224 user agent by sending a 201 (Created) response. If the target 1225 resource does have a current representation and that representation 1226 is successfully modified in accordance with the state of the enclosed 1227 representation, then the origin server MUST send either a 200 (OK) or 1228 a 204 (No Content) response to indicate successful completion of the 1229 request. 1231 An origin server SHOULD ignore unrecognized header fields received in 1232 a PUT request (i.e., do not save them as part of the resource state). 1234 An origin server SHOULD verify that the PUT representation is 1235 consistent with any constraints the server has for the target 1236 resource that cannot or will not be changed by the PUT. This is 1237 particularly important when the origin server uses internal 1238 configuration information related to the URI in order to set the 1239 values for representation metadata on GET responses. When a PUT 1240 representation is inconsistent with the target resource, the origin 1241 server SHOULD either make them consistent, by transforming the 1242 representation or changing the resource configuration, or respond 1243 with an appropriate error message containing sufficient information 1244 to explain why the representation is unsuitable. The 409 (Conflict) 1245 or 415 (Unsupported Media Type) status codes are suggested, with the 1246 latter being specific to constraints on Content-Type values. 1248 For example, if the target resource is configured to always have a 1249 Content-Type of "text/html" and the representation being PUT has a 1250 Content-Type of "image/jpeg", the origin server ought to do one of: 1252 a. reconfigure the target resource to reflect the new media type; 1254 b. transform the PUT representation to a format consistent with that 1255 of the resource before saving it as the new resource state; or, 1257 c. reject the request with a 415 (Unsupported Media Type) response 1258 indicating that the target resource is limited to "text/html", 1259 perhaps including a link to a different resource that would be a 1260 suitable target for the new representation. 1262 HTTP does not define exactly how a PUT method affects the state of an 1263 origin server beyond what can be expressed by the intent of the user 1264 agent request and the semantics of the origin server response. It 1265 does not define what a resource might be, in any sense of that word, 1266 beyond the interface provided via HTTP. It does not define how 1267 resource state is "stored", nor how such storage might change as a 1268 result of a change in resource state, nor how the origin server 1269 translates resource state into representations. Generally speaking, 1270 all implementation details behind the resource interface are 1271 intentionally hidden by the server. 1273 An origin server MUST NOT send a validator header field 1274 (Section 7.2), such as an ETag or Last-Modified field, in a 1275 successful response to PUT unless the request's representation data 1276 was saved without any transformation applied to the body (i.e., the 1277 resource's new representation data is identical to the representation 1278 data received in the PUT request) and the validator field value 1279 reflects the new representation. This requirement allows a user 1280 agent to know when the representation body it has in memory remains 1281 current as a result of the PUT, thus not in need of retrieving again 1282 from the origin server, and that the new validator(s) received in the 1283 response can be used for future conditional requests in order to 1284 prevent accidental overwrites (Section 5.2). 1286 The fundamental difference between the POST and PUT methods is 1287 highlighted by the different intent for the enclosed representation. 1288 The target resource in a POST request is intended to handle the 1289 enclosed representation according to the resource's own semantics, 1290 whereas the enclosed representation in a PUT request is defined as 1291 replacing the state of the target resource. Hence, the intent of PUT 1292 is idempotent and visible to intermediaries, even though the exact 1293 effect is only known by the origin server. 1295 Proper interpretation of a PUT request presumes that the user agent 1296 knows which target resource is desired. A service that selects a 1297 proper URI on behalf of the client, after receiving a state-changing 1298 request, SHOULD be implemented using the POST method rather than PUT. 1299 If the origin server will not make the requested PUT state change to 1300 the target resource and instead wishes to have it applied to a 1301 different resource, such as when the resource has been moved to a 1302 different URI, then the origin server MUST send an appropriate 3xx 1303 (Redirection) response; the user agent MAY then make its own decision 1304 regarding whether or not to redirect the request. 1306 A PUT request applied to the target resource can have side-effects on 1307 other resources. For example, an article might have a URI for 1308 identifying "the current version" (a resource) that is separate from 1309 the URIs identifying each particular version (different resources 1310 that at one point shared the same state as the current version 1311 resource). A successful PUT request on "the current version" URI 1312 might therefore create a new version resource in addition to changing 1313 the state of the target resource, and might also cause links to be 1314 added between the related resources. 1316 An origin server that allows PUT on a given target resource MUST send 1317 a 400 (Bad Request) response to a PUT request that contains a 1318 Content-Range header field (Section 4.2 of [Part5]), since the 1319 payload is likely to be partial content that has been mistakenly PUT 1320 as a full representation. Partial content updates are possible by 1321 targeting a separately identified resource with state that overlaps a 1322 portion of the larger resource, or by using a different method that 1323 has been specifically defined for partial updates (for example, the 1324 PATCH method defined in [RFC5789]). 1326 Responses to the PUT method are not cacheable. If a successful PUT 1327 request passes through a cache that has one or more stored responses 1328 for the effective request URI, those stored responses will be 1329 invalidated (see Section 4.4 of [Part6]). 1331 4.3.5. DELETE 1333 The DELETE method requests that the origin server remove the 1334 association between the target resource and its current 1335 functionality. In effect, this method is similar to the rm command 1336 in UNIX: it expresses a deletion operation on the URI mapping of the 1337 origin server, rather than an expectation that the previously 1338 associated information be deleted. 1340 If the target resource has one or more current representations, they 1341 might or might not be destroyed by the origin server, and the 1342 associated storage might or might not be reclaimed, depending 1343 entirely on the nature of the resource and its implementation by the 1344 origin server (which are beyond the scope of this specification). 1345 Likewise, other implementation aspects of a resource might need to be 1346 deactivated or archived as a result of a DELETE, such as database or 1347 gateway connections. In general, it is assumed that the origin 1348 server will only allow DELETE on resources for which it has a 1349 prescribed mechanism for accomplishing the deletion. 1351 Relatively few resources allow the DELETE method -- its primary use 1352 is for remote authoring environments, where the user has some 1353 direction regarding its effect. For example, a resource that was 1354 previously created using a PUT request, or identified via the 1355 Location header field after a 201 (Created) response to a POST 1356 request, might allow a corresponding DELETE request to undo those 1357 actions. Similarly, custom user agent implementations that implement 1358 an authoring function, such as revision control clients using HTTP 1359 for remote operations, might use DELETE based on an assumption that 1360 the server's URI space has been crafted to correspond to a version 1361 repository. 1363 If a DELETE method is successfully applied, the origin server SHOULD 1364 send a 202 (Accepted) status code if the action will likely succeed 1365 but has not yet been enacted, a 204 (No Content) status code if the 1366 action has been enacted and no further information is to be supplied, 1367 or a 200 (OK) status code if the action has been enacted and the 1368 response message includes a representation describing the status. 1370 A payload within a DELETE request message has no defined semantics; 1371 sending a payload body on a DELETE request might cause some existing 1372 implementations to reject the request. 1374 Responses to the DELETE method are not cacheable. If a DELETE 1375 request passes through a cache that has one or more stored responses 1376 for the effective request URI, those stored responses will be 1377 invalidated (see Section 4.4 of [Part6]). 1379 4.3.6. CONNECT 1381 The CONNECT method requests that the recipient establish a tunnel to 1382 the destination origin server identified by the request-target and, 1383 if successful, thereafter restrict its behavior to blind forwarding 1384 of packets, in both directions, until the tunnel is closed. Tunnels 1385 are commonly used to create an end-to-end virtual connection, through 1386 one or more proxies, which can then be secured using TLS (Transport 1387 Layer Security, [RFC5246]). 1389 CONNECT is intended only for use in requests to a proxy. An origin 1390 server that receives a CONNECT request for itself MAY respond with a 1391 2xx status code to indicate that a connection is established. 1392 However, most origin servers do not implement CONNECT. 1394 A client sending a CONNECT request MUST send the authority form of 1395 request-target (Section 5.3 of [Part1]); i.e., the request-target 1396 consists of only the host name and port number of the tunnel 1397 destination, separated by a colon. For example, 1399 CONNECT server.example.com:80 HTTP/1.1 1400 Host: server.example.com:80 1402 The recipient proxy can establish a tunnel either by directly 1403 connecting to the request-target or, if configured to use another 1404 proxy, by forwarding the CONNECT request to the next inbound proxy. 1405 Any 2xx (Successful) response indicates that the sender (and all 1406 inbound proxies) will switch to tunnel mode immediately after the 1407 blank line that concludes the successful response's header section; 1408 data received after that blank line is from the server identified by 1409 the request-target. Any response other than a successful response 1410 indicates that the tunnel has not yet been formed and that the 1411 connection remains governed by HTTP. 1413 A tunnel is closed when a tunnel intermediary detects that either 1414 side has closed its connection: the intermediary MUST attempt to send 1415 any outstanding data that came from the closed side to the other 1416 side, close both connections, and then discard any remaining data 1417 left undelivered. 1419 Proxy authentication might be used to establish the authority to 1420 create a tunnel. For example, 1422 CONNECT server.example.com:80 HTTP/1.1 1423 Host: server.example.com:80 1424 Proxy-Authorization: basic aGVsbG86d29ybGQ= 1426 There are significant risks in establishing a tunnel to arbitrary 1427 servers, particularly when the destination is a well-known or 1428 reserved TCP port that is not intended for Web traffic. For example, 1429 a CONNECT to a request-target of "example.com:25" would suggest that 1430 the proxy connect to the reserved port for SMTP traffic; if allowed, 1431 that could trick the proxy into relaying spam email. Proxies that 1432 support CONNECT SHOULD restrict its use to a limited set of known 1433 ports or a configurable whitelist of safe request targets. 1435 A server MUST NOT send any Transfer-Encoding or Content-Length header 1436 fields in a 2xx (Successful) response to CONNECT. A client MUST 1437 ignore any Content-Length or Transfer-Encoding header fields received 1438 in a successful response to CONNECT. 1440 A payload within a CONNECT request message has no defined semantics; 1441 sending a payload body on a CONNECT request might cause some existing 1442 implementations to reject the request. 1444 Responses to the CONNECT method are not cacheable. 1446 4.3.7. OPTIONS 1448 The OPTIONS method requests information about the communication 1449 options available for the target resource, either at the origin 1450 server or an intervening intermediary. This method allows a client 1451 to determine the options and/or requirements associated with a 1452 resource, or the capabilities of a server, without implying a 1453 resource action. 1455 An OPTIONS request with an asterisk ("*") as the request-target 1456 (Section 5.3 of [Part1]) applies to the server in general rather than 1457 to a specific resource. Since a server's communication options 1458 typically depend on the resource, the "*" request is only useful as a 1459 "ping" or "no-op" type of method; it does nothing beyond allowing the 1460 client to test the capabilities of the server. For example, this can 1461 be used to test a proxy for HTTP/1.1 conformance (or lack thereof). 1463 If the request-target is not an asterisk, the OPTIONS request applies 1464 to the options that are available when communicating with the target 1465 resource. 1467 A server generating a successful response to OPTIONS SHOULD send any 1468 header fields that might indicate optional features implemented by 1469 the server and applicable to the target resource (e.g., Allow), 1470 including potential extensions not defined by this specification. 1471 The response payload, if any, might also describe the communication 1472 options in a machine or human-readable representation. A standard 1473 format for such a representation is not defined by this 1474 specification, but might be defined by future extensions to HTTP. A 1475 server MUST generate a Content-Length field with a value of "0" if no 1476 payload body is to be sent in the response. 1478 A client MAY send a Max-Forwards header field in an OPTIONS request 1479 to target a specific recipient in the request chain (see 1480 Section 5.1.2). A proxy MUST NOT generate a Max-Forwards header 1481 field while forwarding a request unless that request was received 1482 with a Max-Forwards field. 1484 A client that generates an OPTIONS request containing a payload body 1485 MUST send a valid Content-Type header field describing the 1486 representation media type. Although this specification does not 1487 define any use for such a payload, future extensions to HTTP might 1488 use the OPTIONS body to make more detailed queries about the target 1489 resource. 1491 Responses to the OPTIONS method are not cacheable. 1493 4.3.8. TRACE 1495 The TRACE method requests a remote, application-level loop-back of 1496 the request message. The final recipient of the request SHOULD 1497 reflect the message received, excluding some fields described below, 1498 back to the client as the message body of a 200 (OK) response with a 1499 Content-Type of "message/http" (Section 8.3.1 of [Part1]). The final 1500 recipient is either the origin server or the first server to receive 1501 a Max-Forwards value of zero (0) in the request (Section 5.1.2). 1503 A client MUST NOT generate header fields in a TRACE request 1504 containing sensitive data that might be disclosed by the response. 1505 For example, it would be foolish for a user agent to send stored user 1506 credentials [Part7] or cookies [RFC6265] in a TRACE request. The 1507 final recipient of the request SHOULD exclude any request header 1508 fields that are likely to contain sensitive data when that recipient 1509 generates the response body. 1511 TRACE allows the client to see what is being received at the other 1512 end of the request chain and use that data for testing or diagnostic 1513 information. The value of the Via header field (Section 5.7.1 of 1514 [Part1]) is of particular interest, since it acts as a trace of the 1515 request chain. Use of the Max-Forwards header field allows the 1516 client to limit the length of the request chain, which is useful for 1517 testing a chain of proxies forwarding messages in an infinite loop. 1519 A client MUST NOT send a message body in a TRACE request. 1521 Responses to the TRACE method are not cacheable. 1523 5. Request Header Fields 1525 A client sends request header fields to provide more information 1526 about the request context, make the request conditional based on the 1527 target resource state, suggest preferred formats for the response, 1528 supply authentication credentials, or modify the expected request 1529 processing. These fields act as request modifiers, similar to the 1530 parameters on a programming language method invocation. 1532 5.1. Controls 1534 Controls are request header fields that direct specific handling of 1535 the request. 1537 +-------------------+------------------------+ 1538 | Header Field Name | Defined in... | 1539 +-------------------+------------------------+ 1540 | Cache-Control | Section 5.2 of [Part6] | 1541 | Expect | Section 5.1.1 | 1542 | Host | Section 5.4 of [Part1] | 1543 | Max-Forwards | Section 5.1.2 | 1544 | Pragma | Section 5.4 of [Part6] | 1545 | Range | Section 3.1 of [Part5] | 1546 | TE | Section 4.3 of [Part1] | 1547 +-------------------+------------------------+ 1549 5.1.1. Expect 1551 The "Expect" header field in a request indicates a certain set of 1552 behaviors (expectations) that need to be supported by the server in 1553 order to properly handle this request. The only such expectation 1554 defined by this specification is 100-continue. 1556 Expect = "100-continue" 1558 The Expect field-value is case-insensitive. 1560 A server that receives an Expect field-value other than 100-continue 1561 MAY respond with a 417 (Expectation Failed) status code to indicate 1562 that the unexpected expectation cannot be met. 1564 A 100-continue expectation informs recipients that the client is 1565 about to send a (presumably large) message body in this request and 1566 wishes to receive a 100 (Continue) interim response if the request- 1567 line and header fields are not sufficient to cause an immediate 1568 success, redirect, or error response. This allows the client to wait 1569 for an indication that it is worthwhile to send the message body 1570 before actually doing so, which can improve efficiency when the 1571 message body is huge or when the client anticipates that an error is 1572 likely (e.g., when sending a state-changing method, for the first 1573 time, without previously verified authentication credentials). 1575 For example, a request that begins with 1577 PUT /somewhere/fun HTTP/1.1 1578 Host: origin.example.com 1579 Content-Type: video/h264 1580 Content-Length: 1234567890987 1581 Expect: 100-continue 1583 allows the origin server to immediately respond with an error 1584 message, such as 401 (Unauthorized) or 405 (Method Not Allowed), 1585 before the client starts filling the pipes with an unnecessary data 1586 transfer. 1588 Requirements for clients: 1590 o A client MUST NOT generate a 100-continue expectation in a request 1591 that does not include a message body. 1593 o A client that will wait for a 100 (Continue) response before 1594 sending the request message body MUST send an Expect header field 1595 containing a 100-continue expectation. 1597 o A client that sends a 100-continue expectation is not required to 1598 wait for any specific length of time; such a client MAY proceed to 1599 send the message body even if it has not yet received a response. 1600 Furthermore, since 100 (Continue) responses cannot be sent through 1601 an HTTP/1.0 intermediary, such a client SHOULD NOT wait for an 1602 indefinite period before sending the message body. 1604 o A client that receives a 417 (Expectation Failed) status code in 1605 response to a request containing a 100-continue expectation SHOULD 1606 repeat that request without a 100-continue expectation, since the 1607 417 response merely indicates that the response chain does not 1608 support expectations (e.g., it passes through an HTTP/1.0 server). 1610 Requirements for servers: 1612 o A server that receives a 100-continue expectation in an HTTP/1.0 1613 request MUST ignore that expectation. 1615 o A server MAY omit sending a 100 (Continue) response if it has 1616 already received some or all of the message body for the 1617 corresponding request, or if the framing indicates that there is 1618 no message body. 1620 o A server that sends a 100 (Continue) response MUST ultimately send 1621 a final status code, once the message body is received and 1622 processed, unless the connection is closed prematurely. 1624 o A server that responds with a final status code before reading the 1625 entire message body SHOULD indicate in that response whether it 1626 intends to close the connection or continue reading and discarding 1627 the request message (see Section 6.6 of [Part1]). 1629 An origin server MUST, upon receiving an HTTP/1.1 (or later) request- 1630 line and a complete header section that contains a 100-continue 1631 expectation and indicates a request message body will follow, either 1632 send an immediate response with a final status code, if that status 1633 can be determined by examining just the request-line and header 1634 fields, or send an immediate 100 (Continue) response to encourage the 1635 client to send the request's message body. The origin server MUST 1636 NOT wait for the message body before sending the 100 (Continue) 1637 response. 1639 A proxy MUST, upon receiving an HTTP/1.1 (or later) request-line and 1640 a complete header section that contains a 100-continue expectation 1641 and indicates a request message body will follow, either send an 1642 immediate response with a final status code, if that status can be 1643 determined by examining just the request-line and header fields, or 1644 begin forwarding the request toward the origin server by sending a 1645 corresponding request-line and header section to the next inbound 1646 server. If the proxy believes (from configuration or past 1647 interaction) that the next inbound server only supports HTTP/1.0, the 1648 proxy MAY generate an immediate 100 (Continue) response to encourage 1649 the client to begin sending the message body. 1651 Note: The Expect header field was added after the original 1652 publication of HTTP/1.1 [RFC2068] as both the means to request an 1653 interim 100 response and the general mechanism for indicating 1654 must-understand extensions. However, the extension mechanism has 1655 not been used by clients and the must-understand requirements have 1656 not been implemented by many servers, rendering the extension 1657 mechanism useless. This specification has removed the extension 1658 mechanism in order to simplify the definition and processing of 1659 100-continue. 1661 5.1.2. Max-Forwards 1663 The "Max-Forwards" header field provides a mechanism with the TRACE 1664 (Section 4.3.8) and OPTIONS (Section 4.3.7) request methods to limit 1665 the number of times that the request is forwarded by proxies. This 1666 can be useful when the client is attempting to trace a request that 1667 appears to be failing or looping mid-chain. 1669 Max-Forwards = 1*DIGIT 1671 The Max-Forwards value is a decimal integer indicating the remaining 1672 number of times this request message can be forwarded. 1674 Each intermediary that receives a TRACE or OPTIONS request containing 1675 a Max-Forwards header field MUST check and update its value prior to 1676 forwarding the request. If the received value is zero (0), the 1677 intermediary MUST NOT forward the request; instead, the intermediary 1678 MUST respond as the final recipient. If the received Max-Forwards 1679 value is greater than zero, the intermediary MUST generate an updated 1680 Max-Forwards field in the forwarded message with a field-value that 1681 is the lesser of: a) the received value decremented by one (1), or b) 1682 the recipient's maximum supported value for Max-Forwards. 1684 A recipient MAY ignore a Max-Forwards header field received with any 1685 other request methods. 1687 5.2. Conditionals 1689 The HTTP conditional request header fields [Part4] allow a client to 1690 place a precondition on the state of the target resource, so that the 1691 action corresponding to the method semantics will not be applied if 1692 the precondition evaluates to false. Each precondition defined by 1693 this specification consists of a comparison between a set of 1694 validators obtained from prior representations of the target resource 1695 to the current state of validators for the selected representation 1696 (Section 7.2). Hence, these preconditions evaluate whether the state 1697 of the target resource has changed since a given state known by the 1698 client. The effect of such an evaluation depends on the method 1699 semantics and choice of conditional, as defined in Section 5 of 1700 [Part4]. 1702 +---------------------+------------------------+ 1703 | Header Field Name | Defined in... | 1704 +---------------------+------------------------+ 1705 | If-Match | Section 3.1 of [Part4] | 1706 | If-None-Match | Section 3.2 of [Part4] | 1707 | If-Modified-Since | Section 3.3 of [Part4] | 1708 | If-Unmodified-Since | Section 3.4 of [Part4] | 1709 | If-Range | Section 3.2 of [Part5] | 1710 +---------------------+------------------------+ 1712 5.3. Content Negotiation 1714 The following request header fields are sent by a user agent to 1715 engage in proactive negotiation of the response content, as defined 1716 in Section 3.4.1. The preferences sent in these fields apply to any 1717 content in the response, including representations of the target 1718 resource, representations of error or processing status, and 1719 potentially even the miscellaneous text strings that might appear 1720 within the protocol. 1722 +-------------------+---------------+ 1723 | Header Field Name | Defined in... | 1724 +-------------------+---------------+ 1725 | Accept | Section 5.3.2 | 1726 | Accept-Charset | Section 5.3.3 | 1727 | Accept-Encoding | Section 5.3.4 | 1728 | Accept-Language | Section 5.3.5 | 1729 +-------------------+---------------+ 1731 5.3.1. Quality Values 1733 Many of the request header fields for proactive negotiation use a 1734 common parameter, named "q" (case-insensitive), to assign a relative 1735 "weight" to the preference for that associated kind of content. This 1736 weight is referred to as a "quality value" (or "qvalue") because the 1737 same parameter name is often used within server configurations to 1738 assign a weight to the relative quality of the various 1739 representations that can be selected for a resource. 1741 The weight is normalized to a real number in the range 0 through 1, 1742 where 0.001 is the least preferred and 1 is the most preferred; a 1743 value of 0 means "not acceptable". If no "q" parameter is present, 1744 the default weight is 1. 1746 weight = OWS ";" OWS "q=" qvalue 1747 qvalue = ( "0" [ "." 0*3DIGIT ] ) 1748 / ( "1" [ "." 0*3("0") ] ) 1750 A sender of qvalue MUST NOT generate more than three digits after the 1751 decimal point. User configuration of these values ought to be 1752 limited in the same fashion. 1754 5.3.2. Accept 1756 The "Accept" header field can be used by user agents to specify 1757 response media types that are acceptable. Accept header fields can 1758 be used to indicate that the request is specifically limited to a 1759 small set of desired types, as in the case of a request for an in- 1760 line image. 1762 Accept = #( media-range [ accept-params ] ) 1764 media-range = ( "*/*" 1765 / ( type "/" "*" ) 1766 / ( type "/" subtype ) 1767 ) *( OWS ";" OWS parameter ) 1768 accept-params = weight *( accept-ext ) 1769 accept-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ] 1771 The asterisk "*" character is used to group media types into ranges, 1772 with "*/*" indicating all media types and "type/*" indicating all 1773 subtypes of that type. The media-range can include media type 1774 parameters that are applicable to that range. 1776 Each media-range might be followed by zero or more applicable media 1777 type parameters (e.g., charset), an optional "q" parameter for 1778 indicating a relative weight (Section 5.3.1), and then zero or more 1779 extension parameters. The "q" parameter is necessary if any 1780 extensions (accept-ext) are present, since it acts as a separator 1781 between the two parameter sets. 1783 Note: Use of the "q" parameter name to separate media type 1784 parameters from Accept extension parameters is due to historical 1785 practice. Although this prevents any media type parameter named 1786 "q" from being used with a media range, such an event is believed 1787 to be unlikely given the lack of any "q" parameters in the IANA 1788 media type registry and the rare usage of any media type 1789 parameters in Accept. Future media types are discouraged from 1790 registering any parameter named "q". 1792 The example 1793 Accept: audio/*; q=0.2, audio/basic 1795 is interpreted as "I prefer audio/basic, but send me any audio type 1796 if it is the best available after an 80% mark-down in quality". 1798 A request without any Accept header field implies that the user agent 1799 will accept any media type in response. If the header field is 1800 present in a request and none of the available representations for 1801 the response have a media type that is listed as acceptable, the 1802 origin server can either honor the header field by sending a 406 (Not 1803 Acceptable) response or disregard the header field by treating the 1804 response as if it is not subject to content negotiation. 1806 A more elaborate example is 1808 Accept: text/plain; q=0.5, text/html, 1809 text/x-dvi; q=0.8, text/x-c 1811 Verbally, this would be interpreted as "text/html and text/x-c are 1812 the equally preferred media types, but if they do not exist, then 1813 send the text/x-dvi representation, and if that does not exist, send 1814 the text/plain representation". 1816 Media ranges can be overridden by more specific media ranges or 1817 specific media types. If more than one media range applies to a 1818 given type, the most specific reference has precedence. For example, 1820 Accept: text/*, text/plain, text/plain;format=flowed, */* 1822 have the following precedence: 1824 1. text/plain;format=flowed 1826 2. text/plain 1828 3. text/* 1830 4. */* 1832 The media type quality factor associated with a given type is 1833 determined by finding the media range with the highest precedence 1834 that matches the type. For example, 1836 Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1, 1837 text/html;level=2;q=0.4, */*;q=0.5 1839 would cause the following values to be associated: 1841 +-------------------+---------------+ 1842 | Media Type | Quality Value | 1843 +-------------------+---------------+ 1844 | text/html;level=1 | 1 | 1845 | text/html | 0.7 | 1846 | text/plain | 0.3 | 1847 | image/jpeg | 0.5 | 1848 | text/html;level=2 | 0.4 | 1849 | text/html;level=3 | 0.7 | 1850 +-------------------+---------------+ 1852 Note: A user agent might be provided with a default set of quality 1853 values for certain media ranges. However, unless the user agent is a 1854 closed system that cannot interact with other rendering agents, this 1855 default set ought to be configurable by the user. 1857 5.3.3. Accept-Charset 1859 The "Accept-Charset" header field can be sent by a user agent to 1860 indicate what charsets are acceptable in textual response content. 1861 This field allows user agents capable of understanding more 1862 comprehensive or special-purpose charsets to signal that capability 1863 to an origin server that is capable of representing information in 1864 those charsets. 1866 Accept-Charset = 1#( ( charset / "*" ) [ weight ] ) 1868 Charset names are defined in Section 3.1.1.2. A user agent MAY 1869 associate a quality value with each charset to indicate the user's 1870 relative preference for that charset, as defined in Section 5.3.1. 1871 An example is 1873 Accept-Charset: iso-8859-5, unicode-1-1;q=0.8 1875 The special value "*", if present in the Accept-Charset field, 1876 matches every charset that is not mentioned elsewhere in the Accept- 1877 Charset field. If no "*" is present in an Accept-Charset field, then 1878 any charsets not explicitly mentioned in the field are considered 1879 "not acceptable" to the client. 1881 A request without any Accept-Charset header field implies that the 1882 user agent will accept any charset in response. Most general-purpose 1883 user agents do not send Accept-Charset, unless specifically 1884 configured to do so, because a detailed list of supported charsets 1885 makes it easier for a server to identify an individual by virtue of 1886 the user agent's request characteristics (Section 9.7). 1888 If an Accept-Charset header field is present in a request and none of 1889 the available representations for the response has a charset that is 1890 listed as acceptable, the origin server can either honor the header 1891 field, by sending a 406 (Not Acceptable) response, or disregard the 1892 header field by treating the resource as if it is not subject to 1893 content negotiation. 1895 5.3.4. Accept-Encoding 1897 The "Accept-Encoding" header field can be used by user agents to 1898 indicate what response content-codings (Section 3.1.2.1) are 1899 acceptable in the response. An "identity" token is used as a synonym 1900 for "no encoding" in order to communicate when no encoding is 1901 preferred. 1903 Accept-Encoding = #( codings [ weight ] ) 1904 codings = content-coding / "identity" / "*" 1906 Each codings value MAY be given an associated quality value 1907 representing the preference for that encoding, as defined in 1908 Section 5.3.1. The asterisk "*" symbol in an Accept-Encoding field 1909 matches any available content-coding not explicitly listed in the 1910 header field. 1912 For example, 1914 Accept-Encoding: compress, gzip 1915 Accept-Encoding: 1916 Accept-Encoding: * 1917 Accept-Encoding: compress;q=0.5, gzip;q=1.0 1918 Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0 1920 A request without an Accept-Encoding header field implies that the 1921 user agent has no preferences regarding content-codings. Although 1922 this allows the server to use any content-coding in a response, it 1923 does not imply that the user agent will be able to correctly process 1924 all encodings. 1926 A server tests whether a content-coding for a given representation is 1927 acceptable using these rules: 1929 1. If no Accept-Encoding field is in the request, any content-coding 1930 is considered acceptable by the user agent. 1932 2. If the representation has no content-coding, then it is 1933 acceptable by default unless specifically excluded by the Accept- 1934 Encoding field stating either "identity;q=0" or "*;q=0" without a 1935 more specific entry for "identity". 1937 3. If the representation's content-coding is one of the content- 1938 codings listed in the Accept-Encoding field, then it is 1939 acceptable unless it is accompanied by a qvalue of 0. (As 1940 defined in Section 5.3.1, a qvalue of 0 means "not acceptable".) 1942 4. If multiple content-codings are acceptable, then the acceptable 1943 content-coding with the highest non-zero qvalue is preferred. 1945 An Accept-Encoding header field with a combined field-value that is 1946 empty implies that the user agent does not want any content-coding in 1947 response. If an Accept-Encoding header field is present in a request 1948 and none of the available representations for the response have a 1949 content-coding that is listed as acceptable, the origin server SHOULD 1950 send a response without any content-coding. 1952 Note: Most HTTP/1.0 applications do not recognize or obey qvalues 1953 associated with content-codings. This means that qvalues might 1954 not work and are not permitted with x-gzip or x-compress. 1956 5.3.5. Accept-Language 1958 The "Accept-Language" header field can be used by user agents to 1959 indicate the set of natural languages that are preferred in the 1960 response. Language tags are defined in Section 3.1.3.1. 1962 Accept-Language = 1#( language-range [ weight ] ) 1963 language-range = 1964 1966 Each language-range can be given an associated quality value 1967 representing an estimate of the user's preference for the languages 1968 specified by that range, as defined in Section 5.3.1. For example, 1970 Accept-Language: da, en-gb;q=0.8, en;q=0.7 1972 would mean: "I prefer Danish, but will accept British English and 1973 other types of English". 1975 A request without any Accept-Language header field implies that the 1976 user agent will accept any language in response. If the header field 1977 is present in a request and none of the available representations for 1978 the response have a matching language tag, the origin server can 1979 either disregard the header field by treating the response as if it 1980 is not subject to content negotiation, or honor the header field by 1981 sending a 406 (Not Acceptable) response. However, the latter is not 1982 encouraged, as doing so can prevent users from accessing content that 1983 they might be able to use (with translation software, for example). 1985 Note that some recipients treat the order in which language tags are 1986 listed as an indication of descending priority, particularly for tags 1987 that are assigned equal quality values (no value is the same as q=1). 1988 However, this behavior cannot be relied upon. For consistency and to 1989 maximize interoperability, many user agents assign each language tag 1990 a unique quality value while also listing them in order of decreasing 1991 quality. Additional discussion of language priority lists can be 1992 found in Section 2.3 of [RFC4647]. 1994 For matching, Section 3 of [RFC4647] defines several matching 1995 schemes. Implementations can offer the most appropriate matching 1996 scheme for their requirements. The "Basic Filtering" scheme 1997 ([RFC4647], Section 3.3.1) is identical to the matching scheme that 1998 was previously defined for HTTP in Section 14.4 of [RFC2616]. 2000 It might be contrary to the privacy expectations of the user to send 2001 an Accept-Language header field with the complete linguistic 2002 preferences of the user in every request (Section 9.7). 2004 Since intelligibility is highly dependent on the individual user, 2005 user agents need to allow user control over the linguistic preference 2006 (either through configuration of the user agent itself, or by 2007 defaulting to a user controllable system setting). A user agent that 2008 does not provide such control to the user MUST NOT send an Accept- 2009 Language header field. 2011 Note: User agents ought to provide guidance to users when setting 2012 a preference, since users are rarely familiar with the details of 2013 language matching as described above. For example, users might 2014 assume that on selecting "en-gb", they will be served any kind of 2015 English document if British English is not available. A user 2016 agent might suggest, in such a case, to add "en" to the list for 2017 better matching behavior. 2019 5.4. Authentication Credentials 2021 Two header fields are used for carrying authentication credentials, 2022 as defined in [Part7]. Note that various custom mechanisms for user 2023 authentication use the Cookie header field for this purpose, as 2024 defined in [RFC6265]. 2026 +---------------------+------------------------+ 2027 | Header Field Name | Defined in... | 2028 +---------------------+------------------------+ 2029 | Authorization | Section 4.2 of [Part7] | 2030 | Proxy-Authorization | Section 4.4 of [Part7] | 2031 +---------------------+------------------------+ 2033 5.5. Request Context 2035 The following request header fields provide additional information 2036 about the request context, including information about the user, user 2037 agent, and resource behind the request. 2039 +-------------------+---------------+ 2040 | Header Field Name | Defined in... | 2041 +-------------------+---------------+ 2042 | From | Section 5.5.1 | 2043 | Referer | Section 5.5.2 | 2044 | User-Agent | Section 5.5.3 | 2045 +-------------------+---------------+ 2047 5.5.1. From 2049 The "From" header field contains an Internet email address for a 2050 human user who controls the requesting user agent. The address ought 2051 to be machine-usable, as defined by "mailbox" in Section 3.4 of 2052 [RFC5322]: 2054 From = mailbox 2056 mailbox = 2058 An example is: 2060 From: webmaster@example.org 2062 The From header field is rarely sent by non-robotic user agents. A 2063 user agent SHOULD NOT send a From header field without explicit 2064 configuration by the user, since that might conflict with the user's 2065 privacy interests or their site's security policy. 2067 A robotic user agent SHOULD send a valid From header field so that 2068 the person responsible for running the robot can be contacted if 2069 problems occur on servers, such as if the robot is sending excessive, 2070 unwanted, or invalid requests. 2072 A server SHOULD NOT use the From header field for access control or 2073 authentication, since most recipients will assume that the field 2074 value is public information. 2076 5.5.2. Referer 2078 The "Referer" [sic] header field allows the user agent to specify a 2079 URI reference for the resource from which the target URI was obtained 2080 (i.e., the "referrer", though the field name is misspelled). A user 2081 agent MUST NOT include the fragment and userinfo components of the 2082 URI reference [RFC3986], if any, when generating the Referer field 2083 value. 2085 Referer = absolute-URI / partial-URI 2087 The Referer header field allows servers to generate back-links to 2088 other resources for simple analytics, logging, optimized caching, 2089 etc. It also allows obsolete or mistyped links to be found for 2090 maintenance. Some servers use the Referer header field as a means of 2091 denying links from other sites (so-called "deep linking") or 2092 restricting cross-site request forgery (CSRF), but not all requests 2093 contain it. 2095 Example: 2097 Referer: http://www.example.org/hypertext/Overview.html 2099 If the target URI was obtained from a source that does not have its 2100 own URI (e.g., input from the user keyboard, or an entry within the 2101 user's bookmarks/favorites), the user agent MUST either exclude 2102 Referer or send it with a value of "about:blank". 2104 The Referer field has the potential to reveal information about the 2105 request context or browsing history of the user, which is a privacy 2106 concern if the referring resource's identifier reveals personal 2107 information (such as an account name) or a resource that is supposed 2108 to be confidential (such as behind a firewall or internal to a 2109 secured service). Most general-purpose user agents do not send the 2110 Referer header field when the referring resource is a local "file" or 2111 "data" URI. A user agent MUST NOT send a Referer header field in an 2112 unsecured HTTP request if the referring page was received with a 2113 secure protocol. See Section 9.4 for additional security 2114 considerations. 2116 Some intermediaries have been known to indiscriminately remove 2117 Referer header fields from outgoing requests. This has the 2118 unfortunate side-effect of interfering with protection against CSRF 2119 attacks, which can be far more harmful to their users. 2120 Intermediaries and user agent extensions that wish to limit 2121 information disclosure in Referer ought to restrict their changes to 2122 specific edits, such as replacing internal domain names with 2123 pseudonyms or truncating the query and/or path components. An 2124 intermediary SHOULD NOT modify or delete the Referer header field 2125 when the field value shares the same scheme and host as the request 2126 target. 2128 5.5.3. User-Agent 2130 The "User-Agent" header field contains information about the user 2131 agent originating the request, which is often used by servers to help 2132 identify the scope of reported interoperability problems, to work 2133 around or tailor responses to avoid particular user agent 2134 limitations, and for analytics regarding browser or operating system 2135 use. A user agent SHOULD send a User-Agent field in each request 2136 unless specifically configured not to do so. 2138 User-Agent = product *( RWS ( product / comment ) ) 2140 The User-Agent field-value consists of one or more product 2141 identifiers, each followed by zero or more comments (Section 3.2 of 2142 [Part1]), which together identify the user agent software and its 2143 significant subproducts. By convention, the product identifiers are 2144 listed in decreasing order of their significance for identifying the 2145 user agent software. Each product identifier consists of a name and 2146 optional version. 2148 product = token ["/" product-version] 2149 product-version = token 2151 A sender SHOULD limit generated product identifiers to what is 2152 necessary to identify the product; a sender MUST NOT generate 2153 advertising or other non-essential information within the product 2154 identifier. A sender SHOULD NOT generate information in product- 2155 version that is not a version identifier (i.e., successive versions 2156 of the same product name ought to only differ in the product-version 2157 portion of the product identifier). 2159 Example: 2161 User-Agent: CERN-LineMode/2.15 libwww/2.17b3 2163 A user agent SHOULD NOT generate a User-Agent field containing 2164 needlessly fine-grained detail and SHOULD limit the addition of 2165 subproducts by third parties. Overly long and detailed User-Agent 2166 field values increase request latency and the risk of a user being 2167 identified against their wishes ("fingerprinting"). 2169 Likewise, implementations are encouraged not to use the product 2170 tokens of other implementations in order to declare compatibility 2171 with them, as this circumvents the purpose of the field. If a user 2172 agent masquerades as a different user agent, recipients can assume 2173 that the user intentionally desires to see responses tailored for 2174 that identified user agent, even if they might not work as well for 2175 the actual user agent being used. 2177 6. Response Status Codes 2179 The status-code element is a 3-digit integer code giving the result 2180 of the attempt to understand and satisfy the request. 2182 HTTP status codes are extensible. HTTP clients are not required to 2183 understand the meaning of all registered status codes, though such 2184 understanding is obviously desirable. However, a client MUST 2185 understand the class of any status code, as indicated by the first 2186 digit, and treat an unrecognized status code as being equivalent to 2187 the x00 status code of that class, with the exception that a 2188 recipient MUST NOT cache a response with an unrecognized status code. 2190 For example, if an unrecognized status code of 471 is received by a 2191 client, the client can assume that there was something wrong with its 2192 request and treat the response as if it had received a 400 status 2193 code. The response message will usually contain a representation 2194 that explains the status. 2196 The first digit of the status-code defines the class of response. 2197 The last two digits do not have any categorization role. There are 5 2198 values for the first digit: 2200 o 1xx (Informational): The request was received, continuing process 2202 o 2xx (Successful): The request was successfully received, 2203 understood, and accepted 2205 o 3xx (Redirection): Further action needs to be taken in order to 2206 complete the request 2208 o 4xx (Client Error): The request contains bad syntax or cannot be 2209 fulfilled 2211 o 5xx (Server Error): The server failed to fulfill an apparently 2212 valid request 2214 6.1. Overview of Status Codes 2216 The status codes listed below are defined in this specification, 2217 Section 4 of [Part4], Section 4 of [Part5], and Section 3 of [Part7]. 2218 The reason phrases listed here are only recommendations -- they can 2219 be replaced by local equivalents without affecting the protocol. 2221 Responses with status codes that are defined as cacheable by default 2222 (e.g., 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501 in this 2223 specification) can be reused by a cache with heuristic expiration 2224 unless otherwise indicated by the method definition or explicit cache 2225 controls [Part6]; all other status codes are not cacheable by 2226 default. 2228 +------+-------------------------------+------------------------+ 2229 | code | reason-phrase | Defined in... | 2230 +------+-------------------------------+------------------------+ 2231 | 100 | Continue | Section 6.2.1 | 2232 | 101 | Switching Protocols | Section 6.2.2 | 2233 | 200 | OK | Section 6.3.1 | 2234 | 201 | Created | Section 6.3.2 | 2235 | 202 | Accepted | Section 6.3.3 | 2236 | 203 | Non-Authoritative Information | Section 6.3.4 | 2237 | 204 | No Content | Section 6.3.5 | 2238 | 205 | Reset Content | Section 6.3.6 | 2239 | 206 | Partial Content | Section 4.1 of [Part5] | 2240 | 300 | Multiple Choices | Section 6.4.1 | 2241 | 301 | Moved Permanently | Section 6.4.2 | 2242 | 302 | Found | Section 6.4.3 | 2243 | 303 | See Other | Section 6.4.4 | 2244 | 304 | Not Modified | Section 4.1 of [Part4] | 2245 | 305 | Use Proxy | Section 6.4.5 | 2246 | 307 | Temporary Redirect | Section 6.4.7 | 2247 | 400 | Bad Request | Section 6.5.1 | 2248 | 401 | Unauthorized | Section 3.1 of [Part7] | 2249 | 402 | Payment Required | Section 6.5.2 | 2250 | 403 | Forbidden | Section 6.5.3 | 2251 | 404 | Not Found | Section 6.5.4 | 2252 | 405 | Method Not Allowed | Section 6.5.5 | 2253 | 406 | Not Acceptable | Section 6.5.6 | 2254 | 407 | Proxy Authentication Required | Section 3.2 of [Part7] | 2255 | 408 | Request Time-out | Section 6.5.7 | 2256 | 409 | Conflict | Section 6.5.8 | 2257 | 410 | Gone | Section 6.5.9 | 2258 | 411 | Length Required | Section 6.5.10 | 2259 | 412 | Precondition Failed | Section 4.2 of [Part4] | 2260 | 413 | Payload Too Large | Section 6.5.11 | 2261 | 414 | URI Too Long | Section 6.5.12 | 2262 | 415 | Unsupported Media Type | Section 6.5.13 | 2263 | 416 | Range Not Satisfiable | Section 4.4 of [Part5] | 2264 | 417 | Expectation Failed | Section 6.5.14 | 2265 | 426 | Upgrade Required | Section 6.5.15 | 2266 | 500 | Internal Server Error | Section 6.6.1 | 2267 | 501 | Not Implemented | Section 6.6.2 | 2268 | 502 | Bad Gateway | Section 6.6.3 | 2269 | 503 | Service Unavailable | Section 6.6.4 | 2270 | 504 | Gateway Time-out | Section 6.6.5 | 2271 | 505 | HTTP Version Not Supported | Section 6.6.6 | 2272 +------+-------------------------------+------------------------+ 2273 Note that this list is not exhaustive -- it does not include 2274 extension status codes defined in other specifications. The complete 2275 list of status codes is maintained by IANA. See Section 8.2 for 2276 details. 2278 6.2. Informational 1xx 2280 The 1xx (Informational) class of status code indicates an interim 2281 response for communicating connection status or request progress 2282 prior to completing the requested action and sending a final 2283 response. All 1xx responses consist of only the status-line and 2284 optional header fields, and thus are terminated by the empty line at 2285 the end of the header section. Since HTTP/1.0 did not define any 1xx 2286 status codes, a server MUST NOT send a 1xx response to an HTTP/1.0 2287 client. 2289 A client MUST be able to parse one or more 1xx responses received 2290 prior to a final response, even if the client does not expect one. A 2291 user agent MAY ignore unexpected 1xx responses. 2293 A proxy MUST forward 1xx responses unless the proxy itself requested 2294 the generation of the 1xx response. For example, if a proxy adds an 2295 "Expect: 100-continue" field when it forwards a request, then it need 2296 not forward the corresponding 100 (Continue) response(s). 2298 6.2.1. 100 Continue 2300 The 100 (Continue) status code indicates that the initial part of a 2301 request has been received and has not yet been rejected by the 2302 server. The server intends to send a final response after the 2303 request has been fully received and acted upon. 2305 When the request contains an Expect header field that includes a 100- 2306 continue expectation, the 100 response indicates that the server 2307 wishes to receive the request payload body, as described in 2308 Section 5.1.1. The client ought to continue sending the request and 2309 discard the 100 response. 2311 If the request did not contain an Expect header field containing the 2312 100-continue expectation, the client can simply discard this interim 2313 response. 2315 6.2.2. 101 Switching Protocols 2317 The 101 (Switching Protocols) status code indicates that the server 2318 understands and is willing to comply with the client's request, via 2319 the Upgrade header field (Section 6.7 of [Part1]), for a change in 2320 the application protocol being used on this connection. The server 2321 MUST generate an Upgrade header field in the response that indicates 2322 which protocol(s) will be switched to immediately after the empty 2323 line that terminates the 101 response. 2325 It is assumed that the server will only agree to switch protocols 2326 when it is advantageous to do so. For example, switching to a newer 2327 version of HTTP might be advantageous over older versions, and 2328 switching to a real-time, synchronous protocol might be advantageous 2329 when delivering resources that use such features. 2331 6.3. Successful 2xx 2333 The 2xx (Successful) class of status code indicates that the client's 2334 request was successfully received, understood, and accepted. 2336 6.3.1. 200 OK 2338 The 200 (OK) status code indicates that the request has succeeded. 2339 The payload sent in a 200 response depends on the request method. 2340 For the methods defined by this specification, the intended meaning 2341 of the payload can be summarized as: 2343 GET a representation of the target resource; 2345 HEAD the same representation as GET, but without the representation 2346 data; 2348 POST a representation of the status of, or results obtained from, 2349 the action; 2351 PUT, DELETE a representation of the status of the action; 2353 OPTIONS a representation of the communications options; 2355 TRACE a representation of the request message as received by the end 2356 server. 2358 Aside from responses to CONNECT, a 200 response always has a payload, 2359 though an origin server MAY generate a payload body of zero length. 2360 If no payload is desired, an origin server ought to send 204 (No 2361 Content) instead. For CONNECT, no payload is allowed because the 2362 successful result is a tunnel, which begins immediately after the 200 2363 response header section. 2365 A 200 response is cacheable by default; i.e., unless otherwise 2366 indicated by the method definition or explicit cache controls (see 2367 Section 4.2.2 of [Part6]). 2369 6.3.2. 201 Created 2371 The 201 (Created) status code indicates that the request has been 2372 fulfilled and has resulted in one or more new resources being 2373 created. The primary resource created by the request is identified 2374 by either a Location header field in the response or, if no Location 2375 field is received, by the effective request URI. 2377 The 201 response payload typically describes and links to the 2378 resource(s) created. See Section 7.2 for a discussion of the meaning 2379 and purpose of validator header fields, such as ETag and Last- 2380 Modified, in a 201 response. 2382 6.3.3. 202 Accepted 2384 The 202 (Accepted) status code indicates that the request has been 2385 accepted for processing, but the processing has not been completed. 2386 The request might or might not eventually be acted upon, as it might 2387 be disallowed when processing actually takes place. There is no 2388 facility in HTTP for re-sending a status code from an asynchronous 2389 operation. 2391 The 202 response is intentionally non-committal. Its purpose is to 2392 allow a server to accept a request for some other process (perhaps a 2393 batch-oriented process that is only run once per day) without 2394 requiring that the user agent's connection to the server persist 2395 until the process is completed. The representation sent with this 2396 response ought to describe the request's current status and point to 2397 (or embed) a status monitor that can provide the user with an 2398 estimate of when the request will be fulfilled. 2400 6.3.4. 203 Non-Authoritative Information 2402 The 203 (Non-Authoritative Information) status code indicates that 2403 the request was successful but the enclosed payload has been modified 2404 from that of the origin server's 200 (OK) response by a transforming 2405 proxy (Section 5.7.2 of [Part1]). This status code allows the proxy 2406 to notify recipients when a transformation has been applied, since 2407 that knowledge might impact later decisions regarding the content. 2408 For example, future cache validation requests for the content might 2409 only be applicable along the same request path (through the same 2410 proxies). 2412 The 203 response is similar to the Warning code of 214 Transformation 2413 Applied (Section 5.5 of [Part6]), which has the advantage of being 2414 applicable to responses with any status code. 2416 A 203 response is cacheable by default; i.e., unless otherwise 2417 indicated by the method definition or explicit cache controls (see 2418 Section 4.2.2 of [Part6]). 2420 6.3.5. 204 No Content 2422 The 204 (No Content) status code indicates that the server has 2423 successfully fulfilled the request and that there is no additional 2424 content to send in the response payload body. Metadata in the 2425 response header fields refer to the target resource and its selected 2426 representation after the requested action was applied. 2428 For example, if a 204 status code is received in response to a PUT 2429 request and the response contains an ETag header field, then the PUT 2430 was successful and the ETag field-value contains the entity-tag for 2431 the new representation of that target resource. 2433 The 204 response allows a server to indicate that the action has been 2434 successfully applied to the target resource, while implying that the 2435 user agent does not need to traverse away from its current "document 2436 view" (if any). The server assumes that the user agent will provide 2437 some indication of the success to its user, in accord with its own 2438 interface, and apply any new or updated metadata in the response to 2439 its active representation. 2441 For example, a 204 status code is commonly used with document editing 2442 interfaces corresponding to a "save" action, such that the document 2443 being saved remains available to the user for editing. It is also 2444 frequently used with interfaces that expect automated data transfers 2445 to be prevalent, such as within distributed version control systems. 2447 A 204 response is terminated by the first empty line after the header 2448 fields because it cannot contain a message body. 2450 A 204 response is cacheable by default; i.e., unless otherwise 2451 indicated by the method definition or explicit cache controls (see 2452 Section 4.2.2 of [Part6]). 2454 6.3.6. 205 Reset Content 2456 The 205 (Reset Content) status code indicates that the server has 2457 fulfilled the request and desires that the user agent reset the 2458 "document view", which caused the request to be sent, to its original 2459 state as received from the origin server. 2461 This response is intended to support a common data entry use case 2462 where the user receives content that supports data entry (a form, 2463 notepad, canvas, etc.), enters or manipulates data in that space, 2464 causes the entered data to be submitted in a request, and then the 2465 data entry mechanism is reset for the next entry so that the user can 2466 easily initiate another input action. 2468 Since the 205 status code implies that no additional content will be 2469 provided, a server MUST NOT generate a payload in a 205 response. In 2470 other words, a server MUST do one of the following for a 205 2471 response: a) indicate a zero-length body for the response by 2472 including a Content-Length header field with a value of 0; b) 2473 indicate a zero-length payload for the response by including a 2474 Transfer-Encoding header field with a value of chunked and a message 2475 body consisting of a single chunk of zero-length; or, c) close the 2476 connection immediately after sending the blank line terminating the 2477 header section. 2479 6.4. Redirection 3xx 2481 The 3xx (Redirection) class of status code indicates that further 2482 action needs to be taken by the user agent in order to fulfill the 2483 request. If a Location header field (Section 7.1.2) is provided, the 2484 user agent MAY automatically redirect its request to the URI 2485 referenced by the Location field value, even if the specific status 2486 code is not understood. Automatic redirection needs to done with 2487 care for methods not known to be safe, as defined in Section 4.2.1, 2488 since the user might not wish to redirect an unsafe request. 2490 There are several types of redirects: 2492 1. Redirects that indicate the resource might be available at a 2493 different URI, as provided by the Location field, as in the 2494 status codes 301 (Moved Permanently), 302 (Found), and 307 2495 (Temporary Redirect). 2497 2. Redirection that offers a choice of matching resources, each 2498 capable of representing the original request target, as in the 2499 300 (Multiple Choices) status code. 2501 3. Redirection to a different resource, identified by the Location 2502 field, that can represent an indirect response to the request, as 2503 in the 303 (See Other) status code. 2505 4. Redirection to a previously cached result, as in the 304 (Not 2506 Modified) status code. 2508 Note: In HTTP/1.0, the status codes 301 (Moved Permanently) and 2509 302 (Found) were defined for the first type of redirect 2510 ([RFC1945], Section 9.3). Early user agents split on whether the 2511 method applied to the redirect target would be the same as the 2512 original request or would be rewritten as GET. Although HTTP 2513 originally defined the former semantics for 301 and 302 (to match 2514 its original implementation at CERN), and defined 303 (See Other) 2515 to match the latter semantics, prevailing practice gradually 2516 converged on the latter semantics for 301 and 302 as well. The 2517 first revision of HTTP/1.1 added 307 (Temporary Redirect) to 2518 indicate the former semantics without being impacted by divergent 2519 practice. Over 10 years later, most user agents still do method 2520 rewriting for 301 and 302; therefore, this specification makes 2521 that behavior conformant when the original request is POST. 2523 A client SHOULD detect and intervene in cyclical redirections (i.e., 2524 "infinite" redirection loops). 2526 Note: An earlier version of this specification recommended a 2527 maximum of five redirections ([RFC2068], Section 10.3). Content 2528 developers need to be aware that some clients might implement such 2529 a fixed limitation. 2531 6.4.1. 300 Multiple Choices 2533 The 300 (Multiple Choices) status code indicates that the target 2534 resource has more than one representation, each with its own more 2535 specific identifier, and information about the alternatives is being 2536 provided so that the user (or user agent) can select a preferred 2537 representation by redirecting its request to one or more of those 2538 identifiers. In other words, the server desires that the user agent 2539 engage in reactive negotiation to select the most appropriate 2540 representation(s) for its needs (Section 3.4). 2542 If the server has a preferred choice, the server SHOULD generate a 2543 Location header field containing a preferred choice's URI reference. 2544 The user agent MAY use the Location field value for automatic 2545 redirection. 2547 For request methods other than HEAD, the server SHOULD generate a 2548 payload in the 300 response containing a list of representation 2549 metadata and URI reference(s) from which the user or user agent can 2550 choose the one most preferred. The user agent MAY make a selection 2551 from that list automatically if it understands the provided media 2552 type. A specific format for automatic selection is not defined by 2553 this specification because HTTP tries to remain orthogonal to the 2554 definition of its payloads. In practice, the representation is 2555 provided in some easily parsed format believed to be acceptable to 2556 the user agent, as determined by shared design or content 2557 negotiation, or in some commonly accepted hypertext format. 2559 A 300 response is cacheable by default; i.e., unless otherwise 2560 indicated by the method definition or explicit cache controls (see 2561 Section 4.2.2 of [Part6]). 2563 Note: The original proposal for 300 defined the URI header field 2564 as providing a list of alternative representations, such that it 2565 would be usable for 200, 300, and 406 responses and be transferred 2566 in responses to the HEAD method. However, lack of deployment and 2567 disagreement over syntax led to both URI and Alternates (a 2568 subsequent proposal) being dropped from this specification. It is 2569 possible to communicate the list using a set of Link header fields 2570 [RFC5988], each with a relationship of "alternate", though 2571 deployment is a chicken-and-egg problem. 2573 6.4.2. 301 Moved Permanently 2575 The 301 (Moved Permanently) status code indicates that the target 2576 resource has been assigned a new permanent URI and any future 2577 references to this resource ought to use one of the enclosed URIs. 2578 Clients with link editing capabilities ought to automatically re-link 2579 references to the effective request URI to one or more of the new 2580 references sent by the server, where possible. 2582 The server SHOULD generate a Location header field in the response 2583 containing a preferred URI reference for the new permanent URI. The 2584 user agent MAY use the Location field value for automatic 2585 redirection. The server's response payload usually contains a short 2586 hypertext note with a hyperlink to the new URI(s). 2588 Note: For historical reasons, a user agent MAY change the request 2589 method from POST to GET for the subsequent request. If this 2590 behavior is undesired, the 307 (Temporary Redirect) status code 2591 can be used instead. 2593 A 301 response is cacheable by default; i.e., unless otherwise 2594 indicated by the method definition or explicit cache controls (see 2595 Section 4.2.2 of [Part6]). 2597 6.4.3. 302 Found 2599 The 302 (Found) status code indicates that the target resource 2600 resides temporarily under a different URI. Since the redirection 2601 might be altered on occasion, the client ought to continue to use the 2602 effective request URI for future requests. 2604 The server SHOULD generate a Location header field in the response 2605 containing a URI reference for the different URI. The user agent MAY 2606 use the Location field value for automatic redirection. The server's 2607 response payload usually contains a short hypertext note with a 2608 hyperlink to the different URI(s). 2610 Note: For historical reasons, a user agent MAY change the request 2611 method from POST to GET for the subsequent request. If this 2612 behavior is undesired, the 307 (Temporary Redirect) status code 2613 can be used instead. 2615 6.4.4. 303 See Other 2617 The 303 (See Other) status code indicates that the server is 2618 redirecting the user agent to a different resource, as indicated by a 2619 URI in the Location header field, which is intended to provide an 2620 indirect response to the original request. A user agent can perform 2621 a retrieval request targeting that URI (a GET or HEAD request if 2622 using HTTP), which might also be redirected, and present the eventual 2623 result as an answer to the original request. Note that the new URI 2624 in the Location header field is not considered equivalent to the 2625 effective request URI. 2627 This status code is applicable to any HTTP method. It is primarily 2628 used to allow the output of a POST action to redirect the user agent 2629 to a selected resource, since doing so provides the information 2630 corresponding to the POST response in a form that can be separately 2631 identified, bookmarked, and cached independent of the original 2632 request. 2634 A 303 response to a GET request indicates that the origin server does 2635 not have a representation of the target resource that can be 2636 transferred by the server over HTTP. However, the Location field 2637 value refers to a resource that is descriptive of the target 2638 resource, such that making a retrieval request on that other resource 2639 might result in a representation that is useful to recipients without 2640 implying that it represents the original target resource. Note that 2641 answers to the questions of what can be represented, what 2642 representations are adequate, and what might be a useful description 2643 are outside the scope of HTTP. 2645 Except for responses to a HEAD request, the representation of a 303 2646 response ought to contain a short hypertext note with a hyperlink to 2647 the same URI reference provided in the Location header field. 2649 6.4.5. 305 Use Proxy 2651 The 305 (Use Proxy) status code was defined in a previous version of 2652 this specification and is now deprecated (Appendix B). 2654 6.4.6. 306 (Unused) 2656 The 306 status code was defined in a previous version of this 2657 specification, is no longer used, and the code is reserved. 2659 6.4.7. 307 Temporary Redirect 2661 The 307 (Temporary Redirect) status code indicates that the target 2662 resource resides temporarily under a different URI and the user agent 2663 MUST NOT change the request method if it performs an automatic 2664 redirection to that URI. Since the redirection can change over time, 2665 the client ought to continue using the original effective request URI 2666 for future requests. 2668 The server SHOULD generate a Location header field in the response 2669 containing a URI reference for the different URI. The user agent MAY 2670 use the Location field value for automatic redirection. The server's 2671 response payload usually contains a short hypertext note with a 2672 hyperlink to the different URI(s). 2674 Note: This status code is similar to 302 (Found), except that it 2675 does not allow changing the request method from POST to GET. This 2676 specification defines no equivalent counterpart for 301 (Moved 2677 Permanently) ([status-308], however, defines the status code 308 2678 (Permanent Redirect) for this purpose). 2680 6.5. Client Error 4xx 2682 The 4xx (Client Error) class of status code indicates that the client 2683 seems to have erred. Except when responding to a HEAD request, the 2684 server SHOULD send a representation containing an explanation of the 2685 error situation, and whether it is a temporary or permanent 2686 condition. These status codes are applicable to any request method. 2687 User agents SHOULD display any included representation to the user. 2689 6.5.1. 400 Bad Request 2691 The 400 (Bad Request) status code indicates that the server cannot or 2692 will not process the request due to something which is perceived to 2693 be a client error (e.g., malformed request syntax, invalid request 2694 message framing, or deceptive request routing). 2696 6.5.2. 402 Payment Required 2698 The 402 (Payment Required) status code is reserved for future use. 2700 6.5.3. 403 Forbidden 2702 The 403 (Forbidden) status code indicates that the server understood 2703 the request but refuses to authorize it. A server that wishes to 2704 make public why the request has been forbidden can describe that 2705 reason in the response payload (if any). 2707 If authentication credentials were provided in the request, the 2708 server considers them insufficient to grant access. The client 2709 SHOULD NOT automatically repeat the request with the same 2710 credentials. The client MAY repeat the request with new or different 2711 credentials. However, a request might be forbidden for reasons 2712 unrelated to the credentials. 2714 An origin server that wishes to "hide" the current existence of a 2715 forbidden target resource MAY instead respond with a status code of 2716 404 (Not Found). 2718 6.5.4. 404 Not Found 2720 The 404 (Not Found) status code indicates that the origin server did 2721 not find a current representation for the target resource or is not 2722 willing to disclose that one exists. A 404 status code does not 2723 indicate whether this lack of representation is temporary or 2724 permanent; the 410 (Gone) status code is preferred over 404 if the 2725 origin server knows, presumably through some configurable means, that 2726 the condition is likely to be permanent. 2728 A 404 response is cacheable by default; i.e., unless otherwise 2729 indicated by the method definition or explicit cache controls (see 2730 Section 4.2.2 of [Part6]). 2732 6.5.5. 405 Method Not Allowed 2734 The 405 (Method Not Allowed) status code indicates that the method 2735 received in the request-line is known by the origin server but not 2736 supported by the target resource. The origin server MUST generate an 2737 Allow header field in a 405 response containing a list of the target 2738 resource's currently supported methods. 2740 A 405 response is cacheable by default; i.e., unless otherwise 2741 indicated by the method definition or explicit cache controls (see 2742 Section 4.2.2 of [Part6]). 2744 6.5.6. 406 Not Acceptable 2746 The 406 (Not Acceptable) status code indicates that the target 2747 resource does not have a current representation that would be 2748 acceptable to the user agent, according to the proactive negotiation 2749 header fields received in the request (Section 5.3), and the server 2750 is unwilling to supply a default representation. 2752 The server SHOULD generate a payload containing a list of available 2753 representation characteristics and corresponding resource identifiers 2754 from which the user or user agent can choose the one most 2755 appropriate. A user agent MAY automatically select the most 2756 appropriate choice from that list. However, this specification does 2757 not define any standard for such automatic selection, as described in 2758 Section 6.4.1. 2760 6.5.7. 408 Request Timeout 2762 The 408 (Request Timeout) status code indicates that the server did 2763 not receive a complete request message within the time that it was 2764 prepared to wait. A server SHOULD send the close connection option 2765 (Section 6.1 of [Part1]) in the response, since 408 implies that the 2766 server has decided to close the connection rather than continue 2767 waiting. If the client has an outstanding request in transit, the 2768 client MAY repeat that request on a new connection. 2770 6.5.8. 409 Conflict 2772 The 409 (Conflict) status code indicates that the request could not 2773 be completed due to a conflict with the current state of the target 2774 resource. This code is used in situations where the user might be 2775 able to resolve the conflict and resubmit the request. The server 2776 SHOULD generate a payload that includes enough information for a user 2777 to recognize the source of the conflict. 2779 Conflicts are most likely to occur in response to a PUT request. For 2780 example, if versioning were being used and the representation being 2781 PUT included changes to a resource that conflict with those made by 2782 an earlier (third-party) request, the origin server might use a 409 2783 response to indicate that it can't complete the request. In this 2784 case, the response representation would likely contain information 2785 useful for merging the differences based on the revision history. 2787 6.5.9. 410 Gone 2789 The 410 (Gone) status code indicates that access to the target 2790 resource is no longer available at the origin server and that this 2791 condition is likely to be permanent. If the origin server does not 2792 know, or has no facility to determine, whether or not the condition 2793 is permanent, the status code 404 (Not Found) ought to be used 2794 instead. 2796 The 410 response is primarily intended to assist the task of web 2797 maintenance by notifying the recipient that the resource is 2798 intentionally unavailable and that the server owners desire that 2799 remote links to that resource be removed. Such an event is common 2800 for limited-time, promotional services and for resources belonging to 2801 individuals no longer associated with the origin server's site. It 2802 is not necessary to mark all permanently unavailable resources as 2803 "gone" or to keep the mark for any length of time -- that is left to 2804 the discretion of the server owner. 2806 A 410 response is cacheable by default; i.e., unless otherwise 2807 indicated by the method definition or explicit cache controls (see 2808 Section 4.2.2 of [Part6]). 2810 6.5.10. 411 Length Required 2812 The 411 (Length Required) status code indicates that the server 2813 refuses to accept the request without a defined Content-Length 2814 (Section 3.3.2 of [Part1]). The client MAY repeat the request if it 2815 adds a valid Content-Length header field containing the length of the 2816 message body in the request message. 2818 6.5.11. 413 Payload Too Large 2820 The 413 (Payload Too Large) status code indicates that the server is 2821 refusing to process a request because the request payload is larger 2822 than the server is willing or able to process. The server MAY close 2823 the connection to prevent the client from continuing the request. 2825 If the condition is temporary, the server SHOULD generate a Retry- 2826 After header field to indicate that it is temporary and after what 2827 time the client MAY try again. 2829 6.5.12. 414 URI Too Long 2831 The 414 (URI Too Long) status code indicates that the server is 2832 refusing to service the request because the request-target (Section 2833 5.3 of [Part1]) is longer than the server is willing to interpret. 2834 This rare condition is only likely to occur when a client has 2835 improperly converted a POST request to a GET request with long query 2836 information, when the client has descended into a "black hole" of 2837 redirection (e.g., a redirected URI prefix that points to a suffix of 2838 itself), or when the server is under attack by a client attempting to 2839 exploit potential security holes. 2841 A 414 response is cacheable by default; i.e., unless otherwise 2842 indicated by the method definition or explicit cache controls (see 2843 Section 4.2.2 of [Part6]). 2845 6.5.13. 415 Unsupported Media Type 2847 The 415 (Unsupported Media Type) status code indicates that the 2848 origin server is refusing to service the request because the payload 2849 is in a format not supported by this method on the target resource. 2850 The format problem might be due to the request's indicated Content- 2851 Type or Content-Encoding, or as a result of inspecting the data 2852 directly. 2854 6.5.14. 417 Expectation Failed 2856 The 417 (Expectation Failed) status code indicates that the 2857 expectation given in the request's Expect header field 2858 (Section 5.1.1) could not be met by at least one of the inbound 2859 servers. 2861 6.5.15. 426 Upgrade Required 2863 The 426 (Upgrade Required) status code indicates that the server 2864 refuses to perform the request using the current protocol but might 2865 be willing to do so after the client upgrades to a different 2866 protocol. The server MUST send an Upgrade header field in a 426 2867 response to indicate the required protocol(s) (Section 6.7 of 2868 [Part1]). 2870 Example: 2872 HTTP/1.1 426 Upgrade Required 2873 Upgrade: HTTP/3.0 2874 Connection: Upgrade 2875 Content-Length: 53 2876 Content-Type: text/plain 2878 This service requires use of the HTTP/3.0 protocol. 2880 6.6. Server Error 5xx 2882 The 5xx (Server Error) class of status code indicates that the server 2883 is aware that it has erred or is incapable of performing the 2884 requested method. Except when responding to a HEAD request, the 2885 server SHOULD send a representation containing an explanation of the 2886 error situation, and whether it is a temporary or permanent 2887 condition. A user agent SHOULD display any included representation 2888 to the user. These response codes are applicable to any request 2889 method. 2891 6.6.1. 500 Internal Server Error 2893 The 500 (Internal Server Error) status code indicates that the server 2894 encountered an unexpected condition that prevented it from fulfilling 2895 the request. 2897 6.6.2. 501 Not Implemented 2899 The 501 (Not Implemented) status code indicates that the server does 2900 not support the functionality required to fulfill the request. This 2901 is the appropriate response when the server does not recognize the 2902 request method and is not capable of supporting it for any resource. 2904 A 501 response is cacheable by default; i.e., unless otherwise 2905 indicated by the method definition or explicit cache controls (see 2906 Section 4.2.2 of [Part6]). 2908 6.6.3. 502 Bad Gateway 2910 The 502 (Bad Gateway) status code indicates that the server, while 2911 acting as a gateway or proxy, received an invalid response from an 2912 inbound server it accessed while attempting to fulfill the request. 2914 6.6.4. 503 Service Unavailable 2916 The 503 (Service Unavailable) status code indicates that the server 2917 is currently unable to handle the request due to a temporary overload 2918 or scheduled maintenance, which will likely be alleviated after some 2919 delay. The server MAY send a Retry-After header field 2920 (Section 7.1.3) to suggest an appropriate amount of time for the 2921 client to wait before retrying the request. 2923 Note: The existence of the 503 status code does not imply that a 2924 server has to use it when becoming overloaded. Some servers might 2925 simply refuse the connection. 2927 6.6.5. 504 Gateway Timeout 2929 The 504 (Gateway Timeout) status code indicates that the server, 2930 while acting as a gateway or proxy, did not receive a timely response 2931 from an upstream server it needed to access in order to complete the 2932 request. 2934 6.6.6. 505 HTTP Version Not Supported 2936 The 505 (HTTP Version Not Supported) status code indicates that the 2937 server does not support, or refuses to support, the major version of 2938 HTTP that was used in the request message. The server is indicating 2939 that it is unable or unwilling to complete the request using the same 2940 major version as the client, as described in Section 2.6 of [Part1], 2941 other than with this error message. The server SHOULD generate a 2942 representation for the 505 response that describes why that version 2943 is not supported and what other protocols are supported by that 2944 server. 2946 7. Response Header Fields 2948 The response header fields allow the server to pass additional 2949 information about the response beyond what is placed in the status- 2950 line. These header fields give information about the server, about 2951 further access to the target resource, or about related resources. 2953 Although each response header field has a defined meaning, in 2954 general, the precise semantics might be further refined by the 2955 semantics of the request method and/or response status code. 2957 7.1. Control Data 2959 Response header fields can supply control data that supplements the 2960 status code, directs caching, or instructs the client where to go 2961 next. 2963 +-------------------+------------------------+ 2964 | Header Field Name | Defined in... | 2965 +-------------------+------------------------+ 2966 | Age | Section 5.1 of [Part6] | 2967 | Cache-Control | Section 5.2 of [Part6] | 2968 | Expires | Section 5.3 of [Part6] | 2969 | Date | Section 7.1.1.2 | 2970 | Location | Section 7.1.2 | 2971 | Retry-After | Section 7.1.3 | 2972 | Vary | Section 7.1.4 | 2973 | Warning | Section 5.5 of [Part6] | 2974 +-------------------+------------------------+ 2976 7.1.1. Origination Date 2978 7.1.1.1. Date/Time Formats 2980 Prior to 1995, there were three different formats commonly used by 2981 servers to communicate timestamps. For compatibility with old 2982 implementations, all three are defined here. The preferred format is 2983 a fixed-length and single-zone subset of the date and time 2984 specification used by the Internet Message Format [RFC5322]. 2986 HTTP-date = IMF-fixdate / obs-date 2988 An example of the preferred format is 2990 Sun, 06 Nov 1994 08:49:37 GMT ; IMF-fixdate 2992 Examples of the two obsolete formats are 2994 Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format 2995 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format 2997 A recipient that parses a timestamp value in an HTTP header field 2998 MUST accept all three HTTP-date formats. When a sender generates a 2999 header field that contains one or more timestamps defined as HTTP- 3000 date, the sender MUST generate those timestamps in the IMF-fixdate 3001 format. 3003 An HTTP-date value represents time as an instance of Coordinated 3004 Universal Time (UTC). The first two formats indicate UTC by the 3005 three-letter abbreviation for Greenwich Mean Time, "GMT", a 3006 predecessor of the UTC name; values in the asctime format are assumed 3007 to be in UTC. A sender that generates HTTP-date values from a local 3008 clock ought to use NTP ([RFC5905]) or some similar protocol to 3009 synchronize its clock to UTC. 3011 Preferred format: 3013 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 3014 ; fixed length/zone/capitalization subset of the format 3015 ; defined in Section 3.3 of [RFC5322] 3017 day-name = %x4D.6F.6E ; "Mon", case-sensitive 3018 / %x54.75.65 ; "Tue", case-sensitive 3019 / %x57.65.64 ; "Wed", case-sensitive 3020 / %x54.68.75 ; "Thu", case-sensitive 3021 / %x46.72.69 ; "Fri", case-sensitive 3022 / %x53.61.74 ; "Sat", case-sensitive 3023 / %x53.75.6E ; "Sun", case-sensitive 3025 date1 = day SP month SP year 3026 ; e.g., 02 Jun 1982 3028 day = 2DIGIT 3029 month = %x4A.61.6E ; "Jan", case-sensitive 3030 / %x46.65.62 ; "Feb", case-sensitive 3031 / %x4D.61.72 ; "Mar", case-sensitive 3032 / %x41.70.72 ; "Apr", case-sensitive 3033 / %x4D.61.79 ; "May", case-sensitive 3034 / %x4A.75.6E ; "Jun", case-sensitive 3035 / %x4A.75.6C ; "Jul", case-sensitive 3036 / %x41.75.67 ; "Aug", case-sensitive 3037 / %x53.65.70 ; "Sep", case-sensitive 3038 / %x4F.63.74 ; "Oct", case-sensitive 3039 / %x4E.6F.76 ; "Nov", case-sensitive 3040 / %x44.65.63 ; "Dec", case-sensitive 3041 year = 4DIGIT 3043 GMT = %x47.4D.54 ; "GMT", case-sensitive 3045 time-of-day = hour ":" minute ":" second 3046 ; 00:00:00 - 23:59:60 (leap second) 3048 hour = 2DIGIT 3049 minute = 2DIGIT 3050 second = 2DIGIT 3052 Obsolete formats: 3054 obs-date = rfc850-date / asctime-date 3055 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 3056 date2 = day "-" month "-" 2DIGIT 3057 ; e.g., 02-Jun-82 3059 day-name-l = %x4D.6F.6E.64.61.79 ; "Monday", case-sensitive 3060 / %x54.75.65.73.64.61.79 ; "Tuesday", case-sensitive 3061 / %x57.65.64.6E.65.73.64.61.79 ; "Wednesday", case-sensitive 3062 / %x54.68.75.72.73.64.61.79 ; "Thursday", case-sensitive 3063 / %x46.72.69.64.61.79 ; "Friday", case-sensitive 3064 / %x53.61.74.75.72.64.61.79 ; "Saturday", case-sensitive 3065 / %x53.75.6E.64.61.79 ; "Sunday", case-sensitive 3067 asctime-date = day-name SP date3 SP time-of-day SP year 3068 date3 = month SP ( 2DIGIT / ( SP 1DIGIT )) 3069 ; e.g., Jun 2 3071 HTTP-date is case sensitive. A sender MUST NOT generate additional 3072 whitespace in an HTTP-date beyond that specifically included as SP in 3073 the grammar. The semantics of day-name, day, month, year, and time- 3074 of-day are the same as those defined for the Internet Message Format 3075 constructs with the corresponding name ([RFC5322], Section 3.3). 3077 Recipients of a timestamp value in rfc850-date format, which uses a 3078 two-digit year, MUST interpret a timestamp that appears to be more 3079 than 50 years in the future as representing the most recent year in 3080 the past that had the same last two digits. 3082 Recipients of timestamp values are encouraged to be robust in parsing 3083 timestamps unless otherwise restricted by the field definition. For 3084 example, messages are occasionally forwarded over HTTP from a non- 3085 HTTP source that might generate any of the date and time 3086 specifications defined by the Internet Message Format. 3088 Note: HTTP requirements for the date/time stamp format apply only 3089 to their usage within the protocol stream. Implementations are 3090 not required to use these formats for user presentation, request 3091 logging, etc. 3093 7.1.1.2. Date 3095 The "Date" header field represents the date and time at which the 3096 message was originated, having the same semantics as the Origination 3097 Date Field (orig-date) defined in Section 3.6.1 of [RFC5322]. The 3098 field value is an HTTP-date, as defined in Section 7.1.1.1. 3100 Date = HTTP-date 3102 An example is 3104 Date: Tue, 15 Nov 1994 08:12:31 GMT 3106 When a Date header field is generated, the sender SHOULD generate its 3107 field value as the best available approximation of the date and time 3108 of message generation. In theory, the date ought to represent the 3109 moment just before the payload is generated. In practice, the date 3110 can be generated at any time during message origination. 3112 An origin server MUST NOT send a Date header field if it does not 3113 have a clock capable of providing a reasonable approximation of the 3114 current instance in Coordinated Universal Time. An origin server MAY 3115 send a Date header field if the response is in the 1xx 3116 (Informational) or 5xx (Server Error) class of status codes. An 3117 origin server MUST send a Date header field in all other cases. 3119 A recipient with a clock that receives a response message without a 3120 Date header field MUST record the time it was received and append a 3121 corresponding Date header field to the message's header section if it 3122 is cached or forwarded downstream. 3124 A user agent MAY send a Date header field in a request, though 3125 generally will not do so unless it is believed to convey useful 3126 information to the server. For example, custom applications of HTTP 3127 might convey a Date if the server is expected to adjust its 3128 interpretation of the user's request based on differences between the 3129 user agent and server clocks. 3131 7.1.2. Location 3133 The "Location" header field is used in some responses to refer to a 3134 specific resource in relation to the response. The type of 3135 relationship is defined by the combination of request method and 3136 status code semantics. 3138 Location = URI-reference 3140 The field value consists of a single URI-reference. When it has the 3141 form of a relative reference ([RFC3986], Section 4.2), the final 3142 value is computed by resolving it against the effective request URI 3143 ([RFC3986], Section 5). 3145 For 201 (Created) responses, the Location value refers to the primary 3146 resource created by the request. For 3xx (Redirection) responses, 3147 the Location value refers to the preferred target resource for 3148 automatically redirecting the request. 3150 If the Location value provided in a 3xx (Redirection) does not have a 3151 fragment component, a user agent MUST process the redirection as if 3152 the value inherits the fragment component of the URI reference used 3153 to generate the request target (i.e., the redirection inherits the 3154 original reference's fragment, if any). 3156 For example, a GET request generated for the URI reference 3157 "http://www.example.org/~tim" might result in a 303 (See Other) 3158 response containing the header field: 3160 Location: /People.html#tim 3162 which suggests that the user agent redirect to 3163 "http://www.example.org/People.html#tim" 3165 Likewise, a GET request generated for the URI reference 3166 "http://www.example.org/index.html#larry" might result in a 301 3167 (Moved Permanently) response containing the header field: 3169 Location: http://www.example.net/index.html 3171 which suggests that the user agent redirect to 3172 "http://www.example.net/index.html#larry", preserving the original 3173 fragment identifier. 3175 There are circumstances in which a fragment identifier in a Location 3176 value would not be appropriate. For example, the Location header 3177 field in a 201 (Created) response is supposed to provide a URI that 3178 is specific to the created resource. 3180 Note: Some recipients attempt to recover from Location fields that 3181 are not valid URI references. This specification does not mandate 3182 or define such processing, but does allow it for the sake of 3183 robustness. 3185 Note: The Content-Location header field (Section 3.1.4.2) differs 3186 from Location in that the Content-Location refers to the most 3187 specific resource corresponding to the enclosed representation. 3188 It is therefore possible for a response to contain both the 3189 Location and Content-Location header fields. 3191 7.1.3. Retry-After 3193 Servers send the "Retry-After" header field to indicate how long the 3194 user agent ought to wait before making a follow-up request. When 3195 sent with a 503 (Service Unavailable) response, Retry-After indicates 3196 how long the service is expected to be unavailable to the client. 3197 When sent with any 3xx (Redirection) response, Retry-After indicates 3198 the minimum time that the user agent is asked to wait before issuing 3199 the redirected request. 3201 The value of this field can be either an HTTP-date or a number of 3202 seconds to delay after the response is received. 3204 Retry-After = HTTP-date / delay-seconds 3206 A delay-seconds value is a non-negative decimal integer, representing 3207 time in seconds. 3209 delay-seconds = 1*DIGIT 3211 Two examples of its use are 3213 Retry-After: Fri, 31 Dec 1999 23:59:59 GMT 3214 Retry-After: 120 3216 In the latter example, the delay is 2 minutes. 3218 7.1.4. Vary 3220 The "Vary" header field in a response describes what parts of a 3221 request message, aside from the method, Host header field, and 3222 request target, might influence the origin server's process for 3223 selecting and representing this response. The value consists of 3224 either a single asterisk ("*") or a list of header field names (case- 3225 insensitive). 3227 Vary = "*" / 1#field-name 3229 A Vary field value of "*" signals that anything about the request 3230 might play a role in selecting the response representation, possibly 3231 including elements outside the message syntax (e.g., the client's 3232 network address). A recipient will not be able to determine whether 3233 this response is appropriate for a later request without forwarding 3234 the request to the origin server. A proxy MUST NOT generate a Vary 3235 field with a "*" value. 3237 A Vary field value consisting of a comma-separated list of names 3238 indicates that the named request header fields, known as the 3239 selecting header fields, might have a role in selecting the 3240 representation. The potential selecting header fields are not 3241 limited to those defined by this specification. 3243 For example, a response that contains 3245 Vary: accept-encoding, accept-language 3247 indicates that the origin server might have used the request's 3248 Accept-Encoding and Accept-Language fields (or lack thereof) as 3249 determining factors while choosing the content for this response. 3251 An origin server might send Vary with a list of fields for two 3252 purposes: 3254 1. To inform cache recipients that they MUST NOT use this response 3255 to satisfy a later request unless the later request has the same 3256 values for the listed fields as the original request (Section 4.1 3257 of [Part6]). In other words, Vary expands the cache key required 3258 to match a new request to the stored cache entry. 3260 2. To inform user agent recipients that this response is subject to 3261 content negotiation (Section 5.3) and that a different 3262 representation might be sent in a subsequent request if 3263 additional parameters are provided in the listed header fields 3264 (proactive negotiation). 3266 An origin server SHOULD send a Vary header field when its algorithm 3267 for selecting a representation varies based on aspects of the request 3268 message other than the method and request target, unless the variance 3269 cannot be crossed or the origin server has been deliberately 3270 configured to prevent cache transparency. For example, there is no 3271 need to send the Authorization field name in Vary because reuse 3272 across users is constrained by the field definition (Section 4.2 of 3273 [Part7]). Likewise, an origin server might use Cache-Control 3274 directives (Section 5.2 of [Part6]) to supplant Vary if it considers 3275 the variance less significant than the performance cost of Vary's 3276 impact on caching. 3278 7.2. Validator Header Fields 3280 Validator header fields convey metadata about the selected 3281 representation (Section 3). In responses to safe requests, validator 3282 fields describe the selected representation chosen by the origin 3283 server while handling the response. Note that, depending on the 3284 status code semantics, the selected representation for a given 3285 response is not necessarily the same as the representation enclosed 3286 as response payload. 3288 In a successful response to a state-changing request, validator 3289 fields describe the new representation that has replaced the prior 3290 selected representation as a result of processing the request. 3292 For example, an ETag header field in a 201 response communicates the 3293 entity-tag of the newly created resource's representation, so that it 3294 can be used in later conditional requests to prevent the "lost 3295 update" problem [Part4]. 3297 +-------------------+------------------------+ 3298 | Header Field Name | Defined in... | 3299 +-------------------+------------------------+ 3300 | ETag | Section 2.3 of [Part4] | 3301 | Last-Modified | Section 2.2 of [Part4] | 3302 +-------------------+------------------------+ 3304 7.3. Authentication Challenges 3306 Authentication challenges indicate what mechanisms are available for 3307 the client to provide authentication credentials in future requests. 3309 +--------------------+------------------------+ 3310 | Header Field Name | Defined in... | 3311 +--------------------+------------------------+ 3312 | WWW-Authenticate | Section 4.1 of [Part7] | 3313 | Proxy-Authenticate | Section 4.3 of [Part7] | 3314 +--------------------+------------------------+ 3316 7.4. Response Context 3318 The remaining response header fields provide more information about 3319 the target resource for potential use in later requests. 3321 +-------------------+------------------------+ 3322 | Header Field Name | Defined in... | 3323 +-------------------+------------------------+ 3324 | Accept-Ranges | Section 2.3 of [Part5] | 3325 | Allow | Section 7.4.1 | 3326 | Server | Section 7.4.2 | 3327 +-------------------+------------------------+ 3329 7.4.1. Allow 3331 The "Allow" header field lists the set of methods advertised as 3332 supported by the target resource. The purpose of this field is 3333 strictly to inform the recipient of valid request methods associated 3334 with the resource. 3336 Allow = #method 3338 Example of use: 3340 Allow: GET, HEAD, PUT 3342 The actual set of allowed methods is defined by the origin server at 3343 the time of each request. An origin server MUST generate an Allow 3344 field in a 405 (Method Not Allowed) response and MAY do so in any 3345 other response. An empty Allow field value indicates that the 3346 resource allows no methods, which might occur in a 405 response if 3347 the resource has been temporarily disabled by configuration. 3349 A proxy MUST NOT modify the Allow header field -- it does not need to 3350 understand all of the indicated methods in order to handle them 3351 according to the generic message handling rules. 3353 7.4.2. Server 3355 The "Server" header field contains information about the software 3356 used by the origin server to handle the request, which is often used 3357 by clients to help identify the scope of reported interoperability 3358 problems, to work around or tailor requests to avoid particular 3359 server limitations, and for analytics regarding server or operating 3360 system use. An origin server MAY generate a Server field in its 3361 responses. 3363 Server = product *( RWS ( product / comment ) ) 3365 The Server field-value consists of one or more product identifiers, 3366 each followed by zero or more comments (Section 3.2 of [Part1]), 3367 which together identify the origin server software and its 3368 significant subproducts. By convention, the product identifiers are 3369 listed in decreasing order of their significance for identifying the 3370 origin server software. Each product identifier consists of a name 3371 and optional version, as defined in Section 5.5.3. 3373 Example: 3375 Server: CERN/3.0 libwww/2.17 3377 An origin server SHOULD NOT generate a Server field containing 3378 needlessly fine-grained detail and SHOULD limit the addition of 3379 subproducts by third parties. Overly long and detailed Server field 3380 values increase response latency and potentially reveal internal 3381 implementation details that might make it (slightly) easier for 3382 attackers to find and exploit known security holes. 3384 8. IANA Considerations 3385 8.1. Method Registry 3387 The HTTP Method Registry defines the name space for the request 3388 method token (Section 4). The method registry will be created and 3389 maintained at (the suggested URI) 3390 . 3392 8.1.1. Procedure 3394 HTTP method registrations MUST include the following fields: 3396 o Method Name (see Section 4) 3398 o Safe ("yes" or "no", see Section 4.2.1) 3400 o Idempotent ("yes" or "no", see Section 4.2.2) 3402 o Pointer to specification text 3404 Values to be added to this name space require IETF Review (see 3405 [RFC5226], Section 4.1). 3407 8.1.2. Considerations for New Methods 3409 Standardized methods are generic; that is, they are potentially 3410 applicable to any resource, not just one particular media type, kind 3411 of resource, or application. As such, it is preferred that new 3412 methods be registered in a document that isn't specific to a single 3413 application or data format, since orthogonal technologies deserve 3414 orthogonal specification. 3416 Since message parsing (Section 3.3 of [Part1]) needs to be 3417 independent of method semantics (aside from responses to HEAD), 3418 definitions of new methods cannot change the parsing algorithm or 3419 prohibit the presence of a message body on either the request or the 3420 response message. Definitions of new methods can specify that only a 3421 zero-length message body is allowed by requiring a Content-Length 3422 header field with a value of "0". 3424 A new method definition needs to indicate whether it is safe 3425 (Section 4.2.1), idempotent (Section 4.2.2), cacheable 3426 (Section 4.2.3), what semantics are to be associated with the payload 3427 body if any is present in the request, and what refinements the 3428 method makes to header field or status code semantics. If the new 3429 method is cacheable, its definition ought to describe how, and under 3430 what conditions, a cache can store a response and use it to satisfy a 3431 subsequent request. The new method ought to describe whether it can 3432 be made conditional (Section 5.2) and, if so, how a server responds 3433 when the condition is false. Likewise, if the new method might have 3434 some use for partial response semantics ([Part5]), it ought to 3435 document this too. 3437 Note: Avoid defining a method name that starts with "M-", since 3438 that prefix might be misinterpreted as having the semantics 3439 assigned to it by [RFC2774]. 3441 8.1.3. Registrations 3443 The HTTP Method Registry shall be populated with the registrations 3444 below: 3446 +---------+------+------------+---------------+ 3447 | Method | Safe | Idempotent | Reference | 3448 +---------+------+------------+---------------+ 3449 | CONNECT | no | no | Section 4.3.6 | 3450 | DELETE | no | yes | Section 4.3.5 | 3451 | GET | yes | yes | Section 4.3.1 | 3452 | HEAD | yes | yes | Section 4.3.2 | 3453 | OPTIONS | yes | yes | Section 4.3.7 | 3454 | POST | no | no | Section 4.3.3 | 3455 | PUT | no | yes | Section 4.3.4 | 3456 | TRACE | yes | yes | Section 4.3.8 | 3457 +---------+------+------------+---------------+ 3459 8.2. Status Code Registry 3461 The HTTP Status Code Registry defines the name space for the response 3462 status-code token (Section 6). The status code registry is 3463 maintained at . 3465 This Section replaces the registration procedure for HTTP Status 3466 Codes previously defined in Section 7.1 of [RFC2817]. 3468 8.2.1. Procedure 3470 A registration MUST include the following fields: 3472 o Status Code (3 digits) 3474 o Short Description 3476 o Pointer to specification text 3478 Values to be added to the HTTP status code name space require IETF 3479 Review (see [RFC5226], Section 4.1). 3481 8.2.2. Considerations for New Status Codes 3483 When it is necessary to express semantics for a response that are not 3484 defined by current status codes, a new status code can be registered. 3485 Status codes are generic; they are potentially applicable to any 3486 resource, not just one particular media type, kind of resource, or 3487 application of HTTP. As such, it is preferred that new status codes 3488 be registered in a document that isn't specific to a single 3489 application. 3491 New status codes are required to fall under one of the categories 3492 defined in Section 6. To allow existing parsers to process the 3493 response message, new status codes cannot disallow a payload, 3494 although they can mandate a zero-length payload body. 3496 Proposals for new status codes that are not yet widely deployed ought 3497 to avoid allocating a specific number for the code until there is 3498 clear consensus that it will be registered; instead, early drafts can 3499 use a notation such as "4NN", or "3N0" .. "3N9", to indicate the 3500 class of the proposed status code(s) without consuming a number 3501 prematurely. 3503 The definition of a new status code ought to explain the request 3504 conditions that would cause a response containing that status code 3505 (e.g., combinations of request header fields and/or method(s)) along 3506 with any dependencies on response header fields (e.g., what fields 3507 are required, what fields can modify the semantics, and what header 3508 field semantics are further refined when used with the new status 3509 code). 3511 The definition of a new status code ought to specify whether or not 3512 it is cacheable. Note that all status codes can be cached if the 3513 response they occur in has explicit freshness information; however, 3514 status codes that are defined as being cacheable are allowed to be 3515 cached without explicit freshness information. Likewise, the 3516 definition of a status code can place constraints upon cache 3517 behavior. See [Part6] for more information. 3519 Finally, the definition of a new status code ought to indicate 3520 whether the payload has any implied association with an identified 3521 resource (Section 3.1.4.1). 3523 8.2.3. Registrations 3525 The HTTP Status Code Registry shall be updated with the registrations 3526 below: 3528 +-------+-------------------------------+----------------+ 3529 | Value | Description | Reference | 3530 +-------+-------------------------------+----------------+ 3531 | 100 | Continue | Section 6.2.1 | 3532 | 101 | Switching Protocols | Section 6.2.2 | 3533 | 200 | OK | Section 6.3.1 | 3534 | 201 | Created | Section 6.3.2 | 3535 | 202 | Accepted | Section 6.3.3 | 3536 | 203 | Non-Authoritative Information | Section 6.3.4 | 3537 | 204 | No Content | Section 6.3.5 | 3538 | 205 | Reset Content | Section 6.3.6 | 3539 | 300 | Multiple Choices | Section 6.4.1 | 3540 | 301 | Moved Permanently | Section 6.4.2 | 3541 | 302 | Found | Section 6.4.3 | 3542 | 303 | See Other | Section 6.4.4 | 3543 | 305 | Use Proxy | Section 6.4.5 | 3544 | 306 | (Unused) | Section 6.4.6 | 3545 | 307 | Temporary Redirect | Section 6.4.7 | 3546 | 400 | Bad Request | Section 6.5.1 | 3547 | 402 | Payment Required | Section 6.5.2 | 3548 | 403 | Forbidden | Section 6.5.3 | 3549 | 404 | Not Found | Section 6.5.4 | 3550 | 405 | Method Not Allowed | Section 6.5.5 | 3551 | 406 | Not Acceptable | Section 6.5.6 | 3552 | 408 | Request Timeout | Section 6.5.7 | 3553 | 409 | Conflict | Section 6.5.8 | 3554 | 410 | Gone | Section 6.5.9 | 3555 | 411 | Length Required | Section 6.5.10 | 3556 | 413 | Payload Too Large | Section 6.5.11 | 3557 | 414 | URI Too Long | Section 6.5.12 | 3558 | 415 | Unsupported Media Type | Section 6.5.13 | 3559 | 417 | Expectation Failed | Section 6.5.14 | 3560 | 426 | Upgrade Required | Section 6.5.15 | 3561 | 500 | Internal Server Error | Section 6.6.1 | 3562 | 501 | Not Implemented | Section 6.6.2 | 3563 | 502 | Bad Gateway | Section 6.6.3 | 3564 | 503 | Service Unavailable | Section 6.6.4 | 3565 | 504 | Gateway Timeout | Section 6.6.5 | 3566 | 505 | HTTP Version Not Supported | Section 6.6.6 | 3567 +-------+-------------------------------+----------------+ 3569 8.3. Header Field Registry 3571 HTTP header fields are registered within the Message Header Field 3572 Registry located at , as defined by [BCP90]. 3575 8.3.1. Considerations for New Header Fields 3577 Header fields are key:value pairs that can be used to communicate 3578 data about the message, its payload, the target resource, or the 3579 connection (i.e., control data). See Section 3.2 of [Part1] for a 3580 general definition of header field syntax in HTTP messages. 3582 The requirements for header field names are defined in [BCP90]. 3584 Authors of specifications defining new fields are advised to keep the 3585 name as short as practical and to not prefix the name with "X-" 3586 unless the header field will never be used on the Internet. (The 3587 "x-" prefix idiom has been extensively misused in practice; it was 3588 intended to only be used as a mechanism for avoiding name collisions 3589 inside proprietary software or intranet processing, since the prefix 3590 would ensure that private names never collide with a newly registered 3591 Internet name; see [BCP178] for further information) 3593 New header field values typically have their syntax defined using 3594 ABNF ([RFC5234]), using the extension defined in Section 7 of [Part1] 3595 as necessary, and are usually constrained to the range of ASCII 3596 characters. Header fields needing a greater range of characters can 3597 use an encoding such as the one defined in [RFC5987]. 3599 Leading and trailing whitespace in raw field values is removed upon 3600 field parsing (Section 3.2.4 of [Part1]). Field definitions where 3601 leading or trailing whitespace in values is significant will have to 3602 use a container syntax such as quoted-string (Section 3.2.6 of 3603 [Part1]). 3605 Because commas (",") are used as a generic delimiter between field- 3606 values, they need to be treated with care if they are allowed in the 3607 field-value. Typically, components that might contain a comma are 3608 protected with double-quotes using the quoted-string ABNF production. 3610 For example, a textual date and a URI (either of which might contain 3611 a comma) could be safely carried in field-values like these: 3613 Example-URI-Field: "http://example.com/a.html,foo", 3614 "http://without-a-comma.example.com/" 3615 Example-Date-Field: "Sat, 04 May 1996", "Wed, 14 Sep 2005" 3617 Note that double-quote delimiters almost always are used with the 3618 quoted-string production; using a different syntax inside double- 3619 quotes will likely cause unnecessary confusion. 3621 Many header fields use a format including (case-insensitively) named 3622 parameters (for instance, Content-Type, defined in Section 3.1.1.5). 3624 Allowing both unquoted (token) and quoted (quoted-string) syntax for 3625 the parameter value enables recipients to use existing parser 3626 components. When allowing both forms, the meaning of a parameter 3627 value ought to be independent of the syntax used for it (for an 3628 example, see the notes on parameter handling for media types in 3629 Section 3.1.1.1). 3631 Authors of specifications defining new header fields are advised to 3632 consider documenting: 3634 o Whether the field is a single value, or whether it can be a list 3635 (delimited by commas; see Section 3.2 of [Part1]). 3637 If it does not use the list syntax, document how to treat messages 3638 where the field occurs multiple times (a sensible default would be 3639 to ignore the field, but this might not always be the right 3640 choice). 3642 Note that intermediaries and software libraries might combine 3643 multiple header field instances into a single one, despite the 3644 field's definition not allowing the list syntax. A robust format 3645 enables recipients to discover these situations (good example: 3646 "Content-Type", as the comma can only appear inside quoted 3647 strings; bad example: "Location", as a comma can occur inside a 3648 URI). 3650 o Under what conditions the header field can be used; e.g., only in 3651 responses or requests, in all messages, only on responses to a 3652 particular request method, etc. 3654 o Whether the field should be stored by origin servers that 3655 understand it upon a PUT request. 3657 o Whether the field semantics are further refined by the context, 3658 such as by existing request methods or status codes. 3660 o Whether it is appropriate to list the field-name in the Connection 3661 header field (i.e., if the header field is to be hop-by-hop; see 3662 Section 6.1 of [Part1]). 3664 o Under what conditions intermediaries are allowed to insert, 3665 delete, or modify the field's value. 3667 o Whether it is appropriate to list the field-name in a Vary 3668 response header field (e.g., when the request header field is used 3669 by an origin server's content selection algorithm; see 3670 Section 7.1.4). 3672 o Whether the header field is useful or allowable in trailers (see 3673 Section 4.1 of [Part1]). 3675 o Whether the header field ought to be preserved across redirects. 3677 o Whether it introduces any additional security considerations, such 3678 as disclosure of privacy-related data. 3680 8.3.2. Registrations 3682 The Message Header Field Registry shall be updated with the following 3683 permanent registrations: 3685 +-------------------+----------+----------+-----------------+ 3686 | Header Field Name | Protocol | Status | Reference | 3687 +-------------------+----------+----------+-----------------+ 3688 | Accept | http | standard | Section 5.3.2 | 3689 | Accept-Charset | http | standard | Section 5.3.3 | 3690 | Accept-Encoding | http | standard | Section 5.3.4 | 3691 | Accept-Language | http | standard | Section 5.3.5 | 3692 | Allow | http | standard | Section 7.4.1 | 3693 | Content-Encoding | http | standard | Section 3.1.2.2 | 3694 | Content-Language | http | standard | Section 3.1.3.2 | 3695 | Content-Location | http | standard | Section 3.1.4.2 | 3696 | Content-Type | http | standard | Section 3.1.1.5 | 3697 | Date | http | standard | Section 7.1.1.2 | 3698 | Expect | http | standard | Section 5.1.1 | 3699 | From | http | standard | Section 5.5.1 | 3700 | Location | http | standard | Section 7.1.2 | 3701 | MIME-Version | http | standard | Appendix A.1 | 3702 | Max-Forwards | http | standard | Section 5.1.2 | 3703 | Referer | http | standard | Section 5.5.2 | 3704 | Retry-After | http | standard | Section 7.1.3 | 3705 | Server | http | standard | Section 7.4.2 | 3706 | User-Agent | http | standard | Section 5.5.3 | 3707 | Vary | http | standard | Section 7.1.4 | 3708 +-------------------+----------+----------+-----------------+ 3710 The change controller for the above registrations is: "IETF 3711 (iesg@ietf.org) - Internet Engineering Task Force". 3713 8.4. Content Coding Registry 3715 The HTTP Content Coding Registry defines the name space for content 3716 coding names (Section 4.2 of [Part1]). The content coding registry 3717 is maintained at . 3719 8.4.1. Procedure 3721 Content Coding registrations MUST include the following fields: 3723 o Name 3725 o Description 3727 o Pointer to specification text 3729 Names of content codings MUST NOT overlap with names of transfer 3730 codings (Section 4 of [Part1]), unless the encoding transformation is 3731 identical (as is the case for the compression codings defined in 3732 Section 4.2 of [Part1]). 3734 Values to be added to this name space require IETF Review (see 3735 Section 4.1 of [RFC5226]), and MUST conform to the purpose of content 3736 coding defined in this section. 3738 8.4.2. Registrations 3740 The HTTP Content Codings Registry shall be updated with the 3741 registrations below: 3743 +----------+----------------------------------------+---------------+ 3744 | Name | Description | Reference | 3745 +----------+----------------------------------------+---------------+ 3746 | identity | Reserved (synonym for "no encoding" in | Section 5.3.4 | 3747 | | Accept-Encoding) | | 3748 +----------+----------------------------------------+---------------+ 3750 9. Security Considerations 3752 This section is meant to inform developers, information providers, 3753 and users of known security concerns relevant to HTTP semantics and 3754 its use for transferring information over the Internet. 3755 Considerations related to message syntax, parsing, and routing are 3756 discussed in Section 9 of [Part1]. 3758 The list of considerations below is not exhaustive. Most security 3759 concerns related to HTTP semantics are about securing server-side 3760 applications (code behind the HTTP interface), securing user agent 3761 processing of payloads received via HTTP, or secure use of the 3762 Internet in general, rather than security of the protocol. Various 3763 organizations maintain topical information and links to current 3764 research on Web application security (e.g., [OWASP]). 3766 9.1. Attacks Based On File and Path Names 3768 Origin servers frequently make use of their local file system to 3769 manage the mapping from effective request URI to resource 3770 representations. Implementers need to be aware that most file 3771 systems are not designed to protect against malicious file or path 3772 names, and thus depend on the origin server to avoid mapping to file 3773 names, folders, or directories that have special significance to the 3774 system. 3776 For example, UNIX, Microsoft Windows, and other operating systems use 3777 ".." as a path component to indicate a directory level above the 3778 current one, and use specially named paths or file names to send data 3779 to system devices. Similar naming conventions might exist within 3780 other types of storage systems. Likewise, local storage systems have 3781 an annoying tendency to prefer user-friendliness over security when 3782 handling invalid or unexpected characters, recomposition of 3783 decomposed characters, and case-normalization of case-insensitive 3784 names. 3786 Attacks based on such special names tend to focus on either denial of 3787 service (e.g., telling the server to read from a COM port) or 3788 disclosure of configuration and source files that are not meant to be 3789 served. 3791 9.2. Attacks Based On Command, Code, or Query Injection 3793 Origin servers often use parameters within the URI as a means of 3794 identifying system services, selecting database entries, or choosing 3795 a data source. However, data received in a request cannot be 3796 trusted. An attacker could construct any of the request data 3797 elements (method, request-target, header fields, or body) to contain 3798 data that might be misinterpreted as a command, code, or query when 3799 passed through a command invocation, language interpreter, or 3800 database interface. 3802 For example, SQL injection is a common attack wherein additional 3803 query language is inserted within some part of the request-target or 3804 header fields (e.g., Host, Referer, etc.). If the received data is 3805 used directly within a SELECT statement, the query language might be 3806 interpreted as a database command instead of a simple string value. 3807 This type of implementation vulnerability is extremely common, in 3808 spite of being easy to prevent. 3810 In general, resource implementations ought to avoid use of request 3811 data in contexts that are processed or interpreted as instructions. 3812 Parameters ought to be compared to fixed strings and acted upon as a 3813 result of that comparison, rather than passed through an interface 3814 that is not prepared for untrusted data. Received data that isn't 3815 based on fixed parameters ought to be carefully filtered or encoded 3816 to avoid being misinterpreted. 3818 Similar considerations apply to request data when it is stored and 3819 later processed, such as within log files, monitoring tools, or when 3820 included within a data format that allows embedded scripts. 3822 9.3. Disclosure of Personal Information 3824 Clients are often privy to large amounts of personal information, 3825 including both information provided by the user to interact with 3826 resources (e.g., the user's name, location, mail address, passwords, 3827 encryption keys, etc.) and information about the user's browsing 3828 activity over time (e.g., history, bookmarks, etc.). Implementations 3829 need to prevent unintentional disclosure of personal information. 3831 9.4. Disclosure of Sensitive Information in URIs 3833 URIs are intended to be shared, not secured, even when they identify 3834 secure resources. URIs are often shown on displays, added to 3835 templates when a page is printed, and stored in a variety of 3836 unprotected bookmark lists. It is therefore unwise to include 3837 information within a URI that is sensitive, personally identifiable, 3838 or a risk to disclose. 3840 Authors of services ought to avoid GET-based forms for the submission 3841 of sensitive data because that data will be placed in the request- 3842 target. Many existing servers, proxies, and user agents log or 3843 display the request-target in places where it might be visible to 3844 third parties. Such services ought to use POST-based form submission 3845 instead. 3847 Since the Referer header field tells a target site about the context 3848 that resulted in a request, it has the potential to reveal 3849 information about the user's immediate browsing history and any 3850 personal information that might be found in the referring resource's 3851 URI. Limitations on Referer are described in Section 5.5.2 to 3852 address some of its security considerations. 3854 9.5. Disclosure of Fragment after Redirects 3856 Although fragment identifiers used within URI references are not sent 3857 in requests, implementers ought to be aware that they will be visible 3858 to the user agent and any extensions or scripts running as a result 3859 of the response. In particular, when a redirect occurs and the 3860 original request's fragment identifier is inherited by the new 3861 reference in Location (Section 7.1.2), this might have the effect of 3862 disclosing one site's fragment to another site. If the first site 3863 uses personal information in fragments, it ought to ensure that 3864 redirects to other sites include a (possibly empty) fragment 3865 component in order to block that inheritance. 3867 9.6. Disclosure of Product Information 3869 The User-Agent (Section 5.5.3), Via (Section 5.7.1 of [Part1]), and 3870 Server (Section 7.4.2) header fields often reveal information about 3871 the respective sender's software systems. In theory, this can make 3872 it easier for an attacker to exploit known security holes; in 3873 practice, attackers tend to try all potential holes regardless of the 3874 apparent software versions being used. 3876 Proxies that serve as a portal through a network firewall ought to 3877 take special precautions regarding the transfer of header information 3878 that might identify hosts behind the firewall. The Via header field 3879 allows intermediaries to replace sensitive machine names with 3880 pseudonyms. 3882 9.7. Browser Fingerprinting 3884 Browser fingerprinting is a set of techniques for identifying a 3885 specific user agent over time through its unique set of 3886 characteristics. These characteristics might include information 3887 related to its TCP behavior, feature capabilities, and scripting 3888 environment, though of particular interest here is the set of unique 3889 characteristics that might be communicated via HTTP. Fingerprinting 3890 is considered a privacy concern because it enables tracking of a user 3891 agent's behavior over time without the corresponding controls that 3892 the user might have over other forms of data collection (e.g., 3893 cookies). Many general-purpose user agents (i.e., Web browsers) have 3894 taken steps to reduce their fingerprints. 3896 There are a number of request header fields that might reveal 3897 information to servers that is sufficiently unique to enable 3898 fingerprinting. The From header field is the most obvious, though it 3899 is expected that From will only be sent when self-identification is 3900 desired by the user. Likewise, Cookie header fields are deliberately 3901 designed to enable re-identification, so fingerprinting concerns only 3902 apply to situations where cookies are disabled or restricted by the 3903 user agent's configuration. 3905 The User-Agent header field might contain enough information to 3906 uniquely identify a specific device, usually when combined with other 3907 characteristics, particularly if the user agent sends excessive 3908 details about the user's system or extensions. However, the source 3909 of unique information that is least expected by users is proactive 3910 negotiation (Section 5.3), including the Accept, Accept-Charset, 3911 Accept-Encoding, and Accept-Language header fields. 3913 In addition to the fingerprinting concern, detailed use of the 3914 Accept-Language header field can reveal information the user might 3915 consider to be of a private nature. For example, understanding a 3916 given language set might be strongly correlated to membership in a 3917 particular ethnic group. An approach that limits such loss of 3918 privacy would be for a user agent to omit the sending of Accept- 3919 Language except for sites that have been whitelisted, perhaps via 3920 interaction after detecting a Vary header field that indicates 3921 language negotiation might be useful. 3923 In environments where proxies are used to enhance privacy, user 3924 agents ought to be conservative in sending proactive negotiation 3925 header fields. General-purpose user agents that provide a high 3926 degree of header field configurability ought to inform users about 3927 the loss of privacy that might result if too much detail is provided. 3928 As an extreme privacy measure, proxies could filter the proactive 3929 negotiation header fields in relayed requests. 3931 10. Acknowledgments 3933 See Section 10 of [Part1]. 3935 11. References 3937 11.1. Normative References 3939 [Part1] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext 3940 Transfer Protocol (HTTP/1.1): Message Syntax and 3941 Routing", draft-ietf-httpbis-p1-messaging-26 (work in 3942 progress), February 2014. 3944 [Part4] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext 3945 Transfer Protocol (HTTP/1.1): Conditional Requests", 3946 draft-ietf-httpbis-p4-conditional-26 (work in 3947 progress), February 2014. 3949 [Part5] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., 3950 "Hypertext Transfer Protocol (HTTP/1.1): Range 3951 Requests", draft-ietf-httpbis-p5-range-26 (work in 3952 progress), February 2014. 3954 [Part6] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 3955 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 3956 draft-ietf-httpbis-p6-cache-26 (work in progress), 3957 February 2014. 3959 [Part7] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext 3960 Transfer Protocol (HTTP/1.1): Authentication", 3961 draft-ietf-httpbis-p7-auth-26 (work in progress), 3962 February 2014. 3964 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet 3965 Mail Extensions (MIME) Part One: Format of Internet 3966 Message Bodies", RFC 2045, November 1996. 3968 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet 3969 Mail Extensions (MIME) Part Two: Media Types", 3970 RFC 2046, November 1996. 3972 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3973 Requirement Levels", BCP 14, RFC 2119, March 1997. 3975 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, 3976 "Uniform Resource Identifier (URI): Generic Syntax", 3977 STD 66, RFC 3986, January 2005. 3979 [RFC4647] Phillips, A., Ed. and M. Davis, Ed., "Matching of 3980 Language Tags", BCP 47, RFC 4647, September 2006. 3982 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for 3983 Syntax Specifications: ABNF", STD 68, RFC 5234, 3984 January 2008. 3986 [RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for 3987 Identifying Languages", BCP 47, RFC 5646, 3988 September 2009. 3990 [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in 3991 Internationalization in the IETF", BCP 166, RFC 6365, 3992 September 2011. 3994 11.2. Informative References 3996 [BCP13] Freed, N., Klensin, J., and T. Hansen, "Media Type 3997 Specifications and Registration Procedures", BCP 13, 3998 RFC 6838, January 2013. 4000 [BCP178] Saint-Andre, P., Crocker, D., and M. Nottingham, 4001 "Deprecating the "X-" Prefix and Similar Constructs in 4002 Application Protocols", BCP 178, RFC 6648, June 2012. 4004 [BCP90] Klyne, G., Nottingham, M., and J. Mogul, "Registration 4005 Procedures for Message Header Fields", BCP 90, 4006 RFC 3864, September 2004. 4008 [OWASP] van der Stock, A., Ed., "A Guide to Building Secure Web 4009 Applications and Web Services", The Open Web 4010 Application Security Project (OWASP) 2.0.1, July 2005, 4011 . 4013 [REST] Fielding, R., "Architectural Styles and the Design of 4014 Network-based Software Architectures", 4015 Doctoral Dissertation, University of California, 4016 Irvine, September 2000, 4017 . 4019 [RFC1945] Berners-Lee, T., Fielding, R., and H. Nielsen, 4020 "Hypertext Transfer Protocol -- HTTP/1.0", RFC 1945, 4021 May 1996. 4023 [RFC2049] Freed, N. and N. Borenstein, "Multipurpose Internet 4024 Mail Extensions (MIME) Part Five: Conformance Criteria 4025 and Examples", RFC 2049, November 1996. 4027 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and 4028 T. Berners-Lee, "Hypertext Transfer Protocol -- 4029 HTTP/1.1", RFC 2068, January 1997. 4031 [RFC2295] Holtman, K. and A. Mutz, "Transparent Content 4032 Negotiation in HTTP", RFC 2295, March 1998. 4034 [RFC2388] Masinter, L., "Returning Values from Forms: multipart/ 4035 form-data", RFC 2388, August 1998. 4037 [RFC2557] Palme, F., Hopmann, A., Shelness, N., and E. Stefferud, 4038 "MIME Encapsulation of Aggregate Documents, such as 4039 HTML (MHTML)", RFC 2557, March 1999. 4041 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 4042 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 4043 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 4045 [RFC2774] Frystyk, H., Leach, P., and S. Lawrence, "An HTTP 4046 Extension Framework", RFC 2774, February 2000. 4048 [RFC2817] Khare, R. and S. Lawrence, "Upgrading to TLS Within 4049 HTTP/1.1", RFC 2817, May 2000. 4051 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 4052 Procedures", BCP 19, RFC 2978, October 2000. 4054 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing 4055 an IANA Considerations Section in RFCs", BCP 26, 4056 RFC 5226, May 2008. 4058 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer 4059 Security (TLS) Protocol Version 1.2", RFC 5246, 4060 August 2008. 4062 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 4063 October 2008. 4065 [RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP", 4066 RFC 5789, March 2010. 4068 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 4069 "Network Time Protocol Version 4: Protocol and 4070 Algorithms Specification", RFC 5905, June 2010. 4072 [RFC5987] Reschke, J., "Character Set and Language Encoding for 4073 Hypertext Transfer Protocol (HTTP) Header Field 4074 Parameters", RFC 5987, August 2010. 4076 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 4078 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 4079 April 2011. 4081 [RFC6266] Reschke, J., "Use of the Content-Disposition Header 4082 Field in the Hypertext Transfer Protocol (HTTP)", 4083 RFC 6266, June 2011. 4085 [status-308] Reschke, J., "The Hypertext Transfer Protocol (HTTP) 4086 Status Code 308 (Permanent Redirect)", 4087 draft-reschke-http-status-308-07 (work in progress), 4088 March 2012. 4090 Appendix A. Differences between HTTP and MIME 4092 HTTP/1.1 uses many of the constructs defined for the Internet Message 4093 Format [RFC5322] and the Multipurpose Internet Mail Extensions (MIME) 4094 [RFC2045] to allow a message body to be transmitted in an open 4095 variety of representations and with extensible header fields. 4096 However, RFC 2045 is focused only on email; applications of HTTP have 4097 many characteristics that differ from email, and hence HTTP has 4098 features that differ from MIME. These differences were carefully 4099 chosen to optimize performance over binary connections, to allow 4100 greater freedom in the use of new media types, to make date 4101 comparisons easier, and to acknowledge the practice of some early 4102 HTTP servers and clients. 4104 This appendix describes specific areas where HTTP differs from MIME. 4105 Proxies and gateways to and from strict MIME environments need to be 4106 aware of these differences and provide the appropriate conversions 4107 where necessary. 4109 A.1. MIME-Version 4111 HTTP is not a MIME-compliant protocol. However, messages can include 4112 a single MIME-Version header field to indicate what version of the 4113 MIME protocol was used to construct the message. Use of the MIME- 4114 Version header field indicates that the message is in full 4115 conformance with the MIME protocol (as defined in [RFC2045]). 4116 Senders are responsible for ensuring full conformance (where 4117 possible) when exporting HTTP messages to strict MIME environments. 4119 A.2. Conversion to Canonical Form 4121 MIME requires that an Internet mail body part be converted to 4122 canonical form prior to being transferred, as described in Section 4 4123 of [RFC2049]. Section 3.1.1.3 of this document describes the forms 4124 allowed for subtypes of the "text" media type when transmitted over 4125 HTTP. [RFC2046] requires that content with a type of "text" 4126 represent line breaks as CRLF and forbids the use of CR or LF outside 4127 of line break sequences. HTTP allows CRLF, bare CR, and bare LF to 4128 indicate a line break within text content. 4130 A proxy or gateway from HTTP to a strict MIME environment ought to 4131 translate all line breaks within the text media types described in 4132 Section 3.1.1.3 of this document to the RFC 2049 canonical form of 4133 CRLF. Note, however, this might be complicated by the presence of a 4134 Content-Encoding and by the fact that HTTP allows the use of some 4135 charsets that do not use octets 13 and 10 to represent CR and LF, 4136 respectively. 4138 Conversion will break any cryptographic checksums applied to the 4139 original content unless the original content is already in canonical 4140 form. Therefore, the canonical form is recommended for any content 4141 that uses such checksums in HTTP. 4143 A.3. Conversion of Date Formats 4145 HTTP/1.1 uses a restricted set of date formats (Section 7.1.1.1) to 4146 simplify the process of date comparison. Proxies and gateways from 4147 other protocols ought to ensure that any Date header field present in 4148 a message conforms to one of the HTTP/1.1 formats and rewrite the 4149 date if necessary. 4151 A.4. Conversion of Content-Encoding 4153 MIME does not include any concept equivalent to HTTP/1.1's Content- 4154 Encoding header field. Since this acts as a modifier on the media 4155 type, proxies and gateways from HTTP to MIME-compliant protocols 4156 ought to either change the value of the Content-Type header field or 4157 decode the representation before forwarding the message. (Some 4158 experimental applications of Content-Type for Internet mail have used 4159 a media-type parameter of ";conversions=" to perform 4160 a function equivalent to Content-Encoding. However, this parameter 4161 is not part of the MIME standards). 4163 A.5. Conversion of Content-Transfer-Encoding 4165 HTTP does not use the Content-Transfer-Encoding field of MIME. 4166 Proxies and gateways from MIME-compliant protocols to HTTP need to 4167 remove any Content-Transfer-Encoding prior to delivering the response 4168 message to an HTTP client. 4170 Proxies and gateways from HTTP to MIME-compliant protocols are 4171 responsible for ensuring that the message is in the correct format 4172 and encoding for safe transport on that protocol, where "safe 4173 transport" is defined by the limitations of the protocol being used. 4174 Such a proxy or gateway ought to transform and label the data with an 4175 appropriate Content-Transfer-Encoding if doing so will improve the 4176 likelihood of safe transport over the destination protocol. 4178 A.6. MHTML and Line Length Limitations 4180 HTTP implementations that share code with MHTML [RFC2557] 4181 implementations need to be aware of MIME line length limitations. 4182 Since HTTP does not have this limitation, HTTP does not fold long 4183 lines. MHTML messages being transported by HTTP follow all 4184 conventions of MHTML, including line length limitations and folding, 4185 canonicalization, etc., since HTTP transfers message-bodies as 4186 payload and, aside from the "multipart/byteranges" type (Appendix A 4187 of [Part5]), does not interpret the content or any MIME header lines 4188 that might be contained therein. 4190 Appendix B. Changes from RFC 2616 4192 The primary changes in this revision have been editorial in nature: 4193 extracting the messaging syntax and partitioning HTTP semantics into 4194 separate documents for the core features, conditional requests, 4195 partial requests, caching, and authentication. The conformance 4196 language has been revised to clearly target requirements and the 4197 terminology has been improved to distinguish payload from 4198 representations and representations from resources. 4200 A new requirement has been added that semantics embedded in a URI 4201 should be disabled when those semantics are inconsistent with the 4202 request method, since this is a common cause of interoperability 4203 failure. (Section 2) 4205 An algorithm has been added for determining if a payload is 4206 associated with a specific identifier. (Section 3.1.4.1) 4208 The default charset of ISO-8859-1 for text media types has been 4209 removed; the default is now whatever the media type definition says. 4210 Likewise, special treatment of ISO-8859-1 has been removed from the 4211 Accept-Charset header field. (Section 3.1.1.3 and Section 5.3.3) 4213 The definition of Content-Location has been changed to no longer 4214 affect the base URI for resolving relative URI references, due to 4215 poor implementation support and the undesirable effect of potentially 4216 breaking relative links in content-negotiated resources. 4217 (Section 3.1.4.2) 4219 To be consistent with the method-neutral parsing algorithm of 4220 [Part1], the definition of GET has been relaxed so that requests can 4221 have a body, even though a body has no meaning for GET. 4222 (Section 4.3.1) 4224 Servers are no longer required to handle all Content-* header fields 4225 and use of Content-Range has been explicitly banned in PUT requests. 4226 (Section 4.3.4) 4228 Definition of the CONNECT method has been moved from [RFC2817] to 4229 this specification. (Section 4.3.6) 4231 The OPTIONS and TRACE request methods have been defined as being 4232 safe. (Section 4.3.7 and Section 4.3.8) 4234 The Expect header field's extension mechanism has been removed due to 4235 widely-deployed broken implementations. (Section 5.1.1) 4237 The Max-Forwards header field has been restricted to the OPTIONS and 4238 TRACE methods; previously, extension methods could have used it as 4239 well. (Section 5.1.2) 4241 The "about:blank" URI has been suggested as a value for the Referer 4242 header field when no referring URI is applicable, which distinguishes 4243 that case from others where the Referer field is not sent or has been 4244 removed. (Section 5.5.2) 4246 The following status codes are now cacheable (that is, they can be 4247 stored and reused by a cache without explicit freshness information 4248 present): 204, 404, 405, 414, 501. (Section 6) 4250 The 201 (Created) status description has been changed to allow for 4251 the possibility that more than one resource has been created. 4252 (Section 6.3.2) 4254 The definition of 203 (Non-Authoritative Information) has been 4255 broadened to include cases of payload transformations as well. 4256 (Section 6.3.4) 4258 The set of request methods that are safe to automatically redirect is 4259 no longer closed; user agents are able to make that determination 4260 based upon the request method semantics. The redirect status codes 4261 301, 302, and 307 no longer have normative requirements on response 4262 payloads and user interaction. (Section 6.4) 4264 The status codes 301 and 302 have been changed to allow user agents 4265 to rewrite the method from POST to GET. (Sections 6.4.2 and 6.4.3) 4267 The description of 303 (See Other) status code has been changed to 4268 allow it to be cached if explicit freshness information is given, and 4269 a specific definition has been added for a 303 response to GET. 4270 (Section 6.4.4) 4272 The 305 (Use Proxy) status code has been deprecated due to security 4273 concerns regarding in-band configuration of a proxy. (Section 6.4.5) 4275 The 400 (Bad Request) status code has been relaxed so that it isn't 4276 limited to syntax errors. (Section 6.5.1) 4278 The 426 (Upgrade Required) status code has been incorporated from 4279 [RFC2817]. (Section 6.5.15) 4281 The target of requirements on HTTP-date and the Date header field 4282 have been reduced to those systems generating the date, rather than 4283 all systems sending a date. (Section 7.1.1) 4285 The syntax of the Location header field has been changed to allow all 4286 URI references, including relative references and fragments, along 4287 with some clarifications as to when use of fragments would not be 4288 appropriate. (Section 7.1.2) 4290 Allow has been reclassified as a response header field, removing the 4291 option to specify it in a PUT request. Requirements relating to the 4292 content of Allow have been relaxed; correspondingly, clients are not 4293 required to always trust its value. (Section 7.4.1) 4295 A Method Registry has been defined. (Section 8.1) 4296 The Status Code Registry has been redefined by this specification; 4297 previously, it was defined in Section 7.1 of [RFC2817]. 4298 (Section 8.2) 4300 Registration of Content Codings has been changed to require IETF 4301 Review. (Section 8.4) 4303 The Content-Disposition header field has been removed since it is now 4304 defined by [RFC6266]. 4306 The Content-MD5 header field has been removed because it was 4307 inconsistently implemented with respect to partial responses. 4309 Appendix C. Imported ABNF 4311 The following core rules are included by reference, as defined in 4312 Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return), 4313 CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double 4314 quote), HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF 4315 (line feed), OCTET (any 8-bit sequence of data), SP (space), and 4316 VCHAR (any visible US-ASCII character). 4318 The rules below are defined in [Part1]: 4320 BWS = 4321 OWS = 4322 RWS = 4323 URI-reference = 4324 absolute-URI = 4325 comment = 4326 field-name = 4327 partial-URI = 4328 quoted-string = 4329 token = 4331 Appendix D. Collected ABNF 4333 In the collected ABNF below, list rules are expanded as per Section 4334 1.2 of [Part1]. 4336 Accept = [ ( "," / ( media-range [ accept-params ] ) ) *( OWS "," [ 4337 OWS ( media-range [ accept-params ] ) ] ) ] 4338 Accept-Charset = *( "," OWS ) ( ( charset / "*" ) [ weight ] ) *( OWS 4339 "," [ OWS ( ( charset / "*" ) [ weight ] ) ] ) 4340 Accept-Encoding = [ ( "," / ( codings [ weight ] ) ) *( OWS "," [ OWS 4341 ( codings [ weight ] ) ] ) ] 4342 Accept-Language = *( "," OWS ) ( language-range [ weight ] ) *( OWS 4343 "," [ OWS ( language-range [ weight ] ) ] ) 4345 Allow = [ ( "," / method ) *( OWS "," [ OWS method ] ) ] 4347 BWS = 4349 Content-Encoding = *( "," OWS ) content-coding *( OWS "," [ OWS 4350 content-coding ] ) 4351 Content-Language = *( "," OWS ) language-tag *( OWS "," [ OWS 4352 language-tag ] ) 4353 Content-Location = absolute-URI / partial-URI 4354 Content-Type = media-type 4356 Date = HTTP-date 4358 Expect = "100-continue" 4360 From = mailbox 4362 GMT = %x47.4D.54 ; GMT 4364 HTTP-date = IMF-fixdate / obs-date 4366 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 4368 Location = URI-reference 4370 Max-Forwards = 1*DIGIT 4372 OWS = 4374 RWS = 4375 Referer = absolute-URI / partial-URI 4376 Retry-After = HTTP-date / delay-seconds 4378 Server = product *( RWS ( product / comment ) ) 4380 URI-reference = 4381 User-Agent = product *( RWS ( product / comment ) ) 4383 Vary = "*" / ( *( "," OWS ) field-name *( OWS "," [ OWS field-name ] 4384 ) ) 4386 absolute-URI = 4387 accept-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ] 4388 accept-params = weight *accept-ext 4389 asctime-date = day-name SP date3 SP time-of-day SP year 4391 charset = token 4392 codings = content-coding / "identity" / "*" 4393 comment = 4394 content-coding = token 4396 date1 = day SP month SP year 4397 date2 = day "-" month "-" 2DIGIT 4398 date3 = month SP ( 2DIGIT / ( SP DIGIT ) ) 4399 day = 2DIGIT 4400 day-name = %x4D.6F.6E ; Mon 4401 / %x54.75.65 ; Tue 4402 / %x57.65.64 ; Wed 4403 / %x54.68.75 ; Thu 4404 / %x46.72.69 ; Fri 4405 / %x53.61.74 ; Sat 4406 / %x53.75.6E ; Sun 4407 day-name-l = %x4D.6F.6E.64.61.79 ; Monday 4408 / %x54.75.65.73.64.61.79 ; Tuesday 4409 / %x57.65.64.6E.65.73.64.61.79 ; Wednesday 4410 / %x54.68.75.72.73.64.61.79 ; Thursday 4411 / %x46.72.69.64.61.79 ; Friday 4412 / %x53.61.74.75.72.64.61.79 ; Saturday 4413 / %x53.75.6E.64.61.79 ; Sunday 4414 delay-seconds = 1*DIGIT 4416 field-name = 4418 hour = 2DIGIT 4420 language-range = 4421 language-tag = 4423 mailbox = 4424 media-range = ( "*/*" / ( type "/*" ) / ( type "/" subtype ) ) *( OWS 4425 ";" OWS parameter ) 4426 media-type = type "/" subtype *( OWS ";" OWS parameter ) 4427 method = token 4428 minute = 2DIGIT 4429 month = %x4A.61.6E ; Jan 4430 / %x46.65.62 ; Feb 4431 / %x4D.61.72 ; Mar 4432 / %x41.70.72 ; Apr 4433 / %x4D.61.79 ; May 4434 / %x4A.75.6E ; Jun 4435 / %x4A.75.6C ; Jul 4436 / %x41.75.67 ; Aug 4437 / %x53.65.70 ; Sep 4438 / %x4F.63.74 ; Oct 4439 / %x4E.6F.76 ; Nov 4440 / %x44.65.63 ; Dec 4442 obs-date = rfc850-date / asctime-date 4444 parameter = token "=" ( token / quoted-string ) 4445 partial-URI = 4446 product = token [ "/" product-version ] 4447 product-version = token 4449 quoted-string = 4450 qvalue = ( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] ) 4452 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 4454 second = 2DIGIT 4455 subtype = token 4457 time-of-day = hour ":" minute ":" second 4458 token = 4459 type = token 4461 weight = OWS ";" OWS "q=" qvalue 4463 year = 4DIGIT 4465 Appendix E. Change Log (to be removed by RFC Editor before publication) 4467 E.1. Since RFC 2616 4469 Changes up to the IETF Last Call draft are summarized in . 4473 E.2. Since draft-ietf-httpbis-p2-semantics-24 4475 Closed issues: 4477 o : "Review 4478 Cachability of Status Codes WRT 'Negative Caching'" 4480 o : "RFC 1305 ref 4481 needs to be updated to 5905" 4483 o : "idempotency: 4484 clarify 'effect'" 4486 o : "APPSDIR 4487 review of draft-ietf-httpbis-p2-semantics-24" 4489 o : "move IANA 4490 registrations to correct draft" 4492 E.3. Since draft-ietf-httpbis-p2-semantics-25 4494 Closed issues: 4496 o : "Gen-Art 4497 review of draft-ietf-httpbis-p2-semantics-24 with security 4498 considerations" 4500 o : "IESG ballot 4501 on draft-ietf-httpbis-p2-semantics-25" 4503 o : "add 4504 'stateless' to Abstract" 4506 o : "improve 4507 introduction of list rule" 4509 o : "requirement 4510 on implementing methods according to their semantics" 4512 o : 4513 "considerations for new headers: privacy" 4515 o : "augment 4516 security considerations with pointers to current research" 4518 Index 4520 1 4521 1xx Informational (status code class) 49 4523 2 4524 2xx Successful (status code class) 50 4526 3 4527 3xx Redirection (status code class) 53 4529 4 4530 4xx Client Error (status code class) 57 4532 5 4533 5xx Server Error (status code class) 61 4535 1 4536 100 Continue (status code) 49 4537 100-continue (expect value) 33 4538 101 Switching Protocols (status code) 49 4540 2 4541 200 OK (status code) 50 4542 201 Created (status code) 51 4543 202 Accepted (status code) 51 4544 203 Non-Authoritative Information (status code) 51 4545 204 No Content (status code) 52 4546 205 Reset Content (status code) 52 4548 3 4549 300 Multiple Choices (status code) 54 4550 301 Moved Permanently (status code) 55 4551 302 Found (status code) 55 4552 303 See Other (status code) 56 4553 305 Use Proxy (status code) 56 4554 306 (Unused) (status code) 56 4555 307 Temporary Redirect (status code) 57 4557 4 4558 400 Bad Request (status code) 57 4559 402 Payment Required (status code) 57 4560 403 Forbidden (status code) 57 4561 404 Not Found (status code) 58 4562 405 Method Not Allowed (status code) 58 4563 406 Not Acceptable (status code) 58 4564 408 Request Timeout (status code) 59 4565 409 Conflict (status code) 59 4566 410 Gone (status code) 59 4567 411 Length Required (status code) 60 4568 413 Payload Too Large (status code) 60 4569 414 URI Too Long (status code) 60 4570 415 Unsupported Media Type (status code) 60 4571 417 Expectation Failed (status code) 61 4572 426 Upgrade Required (status code) 61 4574 5 4575 500 Internal Server Error (status code) 61 4576 501 Not Implemented (status code) 62 4577 502 Bad Gateway (status code) 62 4578 503 Service Unavailable (status code) 62 4579 504 Gateway Timeout (status code) 62 4580 505 HTTP Version Not Supported (status code) 62 4582 A 4583 Accept header field 38 4584 Accept-Charset header field 40 4585 Accept-Encoding header field 41 4586 Accept-Language header field 42 4587 Allow header field 71 4589 C 4590 cacheable 24 4591 compress (content coding) 11 4592 conditional request 36 4593 CONNECT method 30 4594 content coding 11 4595 content negotiation 6 4596 Content-Encoding header field 12 4597 Content-Language header field 13 4598 Content-Location header field 15 4599 Content-Transfer-Encoding header field 89 4600 Content-Type header field 10 4602 D 4603 Date header field 66 4604 deflate (content coding) 11 4605 DELETE method 29 4607 E 4608 Expect header field 33 4610 F 4611 From header field 44 4613 G 4614 GET method 24 4615 Grammar 4616 Accept 38 4617 Accept-Charset 40 4618 Accept-Encoding 41 4619 accept-ext 38 4620 Accept-Language 42 4621 accept-params 38 4622 Allow 71 4623 asctime-date 66 4624 charset 9 4625 codings 41 4626 content-coding 11 4627 Content-Encoding 12 4628 Content-Language 13 4629 Content-Location 15 4630 Content-Type 10 4631 Date 66 4632 date1 65 4633 day 65 4634 day-name 65 4635 day-name-l 65 4636 delay-seconds 69 4637 Expect 34 4638 From 44 4639 GMT 65 4640 hour 65 4641 HTTP-date 63 4642 IMF-fixdate 65 4643 language-range 42 4644 language-tag 13 4645 Location 67 4646 Max-Forwards 36 4647 media-range 38 4648 media-type 8 4649 method 21 4650 minute 65 4651 month 65 4652 obs-date 65 4653 parameter 8 4654 product 46 4655 product-version 46 4656 qvalue 38 4657 Referer 45 4658 Retry-After 69 4659 rfc850-date 66 4660 second 65 4661 Server 72 4662 subtype 8 4663 time-of-day 65 4664 type 8 4665 User-Agent 46 4666 Vary 69 4667 weight 38 4668 year 65 4669 gzip (content coding) 11 4671 H 4672 HEAD method 25 4674 I 4675 idempotent 23 4677 L 4678 Location header field 67 4680 M 4681 Max-Forwards header field 36 4682 MIME-Version header field 88 4684 O 4685 OPTIONS method 31 4687 P 4688 payload 17 4689 POST method 25 4690 PUT method 26 4692 R 4693 Referer header field 44 4694 representation 7 4695 Retry-After header field 68 4697 S 4698 safe 22 4699 selected representation 7, 70 4700 Server header field 72 4701 Status Codes Classes 4702 1xx Informational 49 4703 2xx Successful 50 4704 3xx Redirection 53 4705 4xx Client Error 57 4706 5xx Server Error 61 4708 T 4709 TRACE method 32 4711 U 4712 User-Agent header field 46 4714 V 4715 Vary header field 69 4717 X 4718 x-compress (content coding) 11 4719 x-gzip (content coding) 11 4721 Authors' Addresses 4723 Roy T. Fielding (editor) 4724 Adobe Systems Incorporated 4725 345 Park Ave 4726 San Jose, CA 95110 4727 USA 4729 EMail: fielding@gbiv.com 4730 URI: http://roy.gbiv.com/ 4732 Julian F. Reschke (editor) 4733 greenbytes GmbH 4734 Hafenweg 16 4735 Muenster, NW 48155 4736 Germany 4738 EMail: julian.reschke@greenbytes.de 4739 URI: http://greenbytes.de/tech/webdav/