idnits 2.17.1 draft-fielding-httpbis-http-semantics-00.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, 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 (March 5, 2018) is 2245 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) -- Obsolete informational reference (is this intentional?): RFC 7231 (Obsoleted by RFC 9110) Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 10 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group R. Fielding, Ed. 3 Internet-Draft Adobe 4 Obsoletes: 7231 (if approved) J. Reschke, Ed. 5 Intended status: Standards Track greenbytes 6 Expires: September 6, 2018 March 5, 2018 8 Hypertext Transfer Protocol: Semantics and Content 9 draft-fielding-httpbis-http-semantics-00 11 Abstract 13 The Hypertext Transfer Protocol (HTTP) is a stateless application- 14 level protocol for distributed, collaborative, hypertext information 15 systems. This document defines the semantics of HTTP/1.1 messages, 16 as expressed by request methods, request header fields, response 17 status codes, and response header fields, along with the payload of 18 messages (metadata and body content) and mechanisms for content 19 negotiation. 21 This document obsoletes RFC 7231. 23 Editorial Note 25 This note is to be removed before publishing as an RFC. 27 _This is a temporary document for the purpose of planning the 28 revisions of RFCs 7230 to 7235. This is not yet an official work 29 item of the HTTP Working Group._ 31 Discussion of this draft takes place on the HTTP working group 32 mailing list (ietf-http-wg@w3.org), which is archived at 33 . 35 Errata for RFC 7231 have been collected at , and an additional issues list 37 lives at . 39 The changes in this draft are summarized in Appendix E.1. 41 Status of This Memo 43 This Internet-Draft is submitted in full conformance with the 44 provisions of BCP 78 and BCP 79. 46 Internet-Drafts are working documents of the Internet Engineering 47 Task Force (IETF). Note that other groups may also distribute 48 working documents as Internet-Drafts. The list of current Internet- 49 Drafts is at https://datatracker.ietf.org/drafts/current/. 51 Internet-Drafts are draft documents valid for a maximum of six months 52 and may be updated, replaced, or obsoleted by other documents at any 53 time. It is inappropriate to use Internet-Drafts as reference 54 material or to cite them other than as "work in progress." 56 This Internet-Draft will expire on September 6, 2018. 58 Copyright Notice 60 Copyright (c) 2018 IETF Trust and the persons identified as the 61 document authors. All rights reserved. 63 This document is subject to BCP 78 and the IETF Trust's Legal 64 Provisions Relating to IETF Documents 65 (https://trustee.ietf.org/license-info) in effect on the date of 66 publication of this document. Please review these documents 67 carefully, as they describe your rights and restrictions with respect 68 to this document. Code Components extracted from this document must 69 include Simplified BSD License text as described in Section 4.e of 70 the Trust Legal Provisions and are provided without warranty as 71 described in the Simplified BSD License. 73 This document may contain material from IETF Documents or IETF 74 Contributions published or made publicly available before November 75 10, 2008. The person(s) controlling the copyright in some of this 76 material may not have granted the IETF Trust the right to allow 77 modifications of such material outside the IETF Standards Process. 78 Without obtaining an adequate license from the person(s) controlling 79 the copyright in such materials, this document may not be modified 80 outside the IETF Standards Process, and derivative works of it may 81 not be created outside the IETF Standards Process, except to format 82 it for publication as an RFC or to translate it into languages other 83 than English. 85 Table of Contents 87 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 88 1.1. Conformance and Error Handling . . . . . . . . . . . . . 6 89 1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 6 90 2. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 7 91 3. Representations . . . . . . . . . . . . . . . . . . . . . . . 7 92 3.1. Representation Metadata . . . . . . . . . . . . . . . . . 8 93 3.1.1. Processing Representation Data . . . . . . . . . . . 8 94 3.1.2. Encoding for Compression or Integrity . . . . . . . . 11 95 3.1.3. Audience Language . . . . . . . . . . . . . . . . . . 12 96 3.1.4. Identification . . . . . . . . . . . . . . . . . . . 14 97 3.2. Representation Data . . . . . . . . . . . . . . . . . . . 17 98 3.3. Payload Semantics . . . . . . . . . . . . . . . . . . . . 17 99 3.4. Content Negotiation . . . . . . . . . . . . . . . . . . . 18 100 3.4.1. Proactive Negotiation . . . . . . . . . . . . . . . . 19 101 3.4.2. Reactive Negotiation . . . . . . . . . . . . . . . . 20 102 4. Request Methods . . . . . . . . . . . . . . . . . . . . . . . 21 103 4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 21 104 4.2. Common Method Properties . . . . . . . . . . . . . . . . 22 105 4.2.1. Safe Methods . . . . . . . . . . . . . . . . . . . . 22 106 4.2.2. Idempotent Methods . . . . . . . . . . . . . . . . . 23 107 4.2.3. Cacheable Methods . . . . . . . . . . . . . . . . . . 24 108 4.3. Method Definitions . . . . . . . . . . . . . . . . . . . 24 109 4.3.1. GET . . . . . . . . . . . . . . . . . . . . . . . . . 24 110 4.3.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . 25 111 4.3.3. POST . . . . . . . . . . . . . . . . . . . . . . . . 25 112 4.3.4. PUT . . . . . . . . . . . . . . . . . . . . . . . . . 26 113 4.3.5. DELETE . . . . . . . . . . . . . . . . . . . . . . . 29 114 4.3.6. CONNECT . . . . . . . . . . . . . . . . . . . . . . . 30 115 4.3.7. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . 31 116 4.3.8. TRACE . . . . . . . . . . . . . . . . . . . . . . . . 32 117 5. Request Header Fields . . . . . . . . . . . . . . . . . . . . 33 118 5.1. Controls . . . . . . . . . . . . . . . . . . . . . . . . 33 119 5.1.1. Expect . . . . . . . . . . . . . . . . . . . . . . . 34 120 5.1.2. Max-Forwards . . . . . . . . . . . . . . . . . . . . 36 121 5.2. Conditionals . . . . . . . . . . . . . . . . . . . . . . 37 122 5.3. Content Negotiation . . . . . . . . . . . . . . . . . . . 37 123 5.3.1. Quality Values . . . . . . . . . . . . . . . . . . . 38 124 5.3.2. Accept . . . . . . . . . . . . . . . . . . . . . . . 38 125 5.3.3. Accept-Charset . . . . . . . . . . . . . . . . . . . 40 126 5.3.4. Accept-Encoding . . . . . . . . . . . . . . . . . . . 41 127 5.3.5. Accept-Language . . . . . . . . . . . . . . . . . . . 43 128 5.4. Authentication Credentials . . . . . . . . . . . . . . . 44 129 5.5. Request Context . . . . . . . . . . . . . . . . . . . . . 44 130 5.5.1. From . . . . . . . . . . . . . . . . . . . . . . . . 44 131 5.5.2. Referer . . . . . . . . . . . . . . . . . . . . . . . 45 132 5.5.3. User-Agent . . . . . . . . . . . . . . . . . . . . . 46 133 6. Response Status Codes . . . . . . . . . . . . . . . . . . . . 47 134 6.1. Overview of Status Codes . . . . . . . . . . . . . . . . 48 135 6.2. Informational 1xx . . . . . . . . . . . . . . . . . . . . 50 136 6.2.1. 100 Continue . . . . . . . . . . . . . . . . . . . . 50 137 6.2.2. 101 Switching Protocols . . . . . . . . . . . . . . . 50 138 6.3. Successful 2xx . . . . . . . . . . . . . . . . . . . . . 51 139 6.3.1. 200 OK . . . . . . . . . . . . . . . . . . . . . . . 51 140 6.3.2. 201 Created . . . . . . . . . . . . . . . . . . . . . 52 141 6.3.3. 202 Accepted . . . . . . . . . . . . . . . . . . . . 52 142 6.3.4. 203 Non-Authoritative Information . . . . . . . . . . 52 143 6.3.5. 204 No Content . . . . . . . . . . . . . . . . . . . 53 144 6.3.6. 205 Reset Content . . . . . . . . . . . . . . . . . . 53 145 6.4. Redirection 3xx . . . . . . . . . . . . . . . . . . . . . 54 146 6.4.1. 300 Multiple Choices . . . . . . . . . . . . . . . . 55 147 6.4.2. 301 Moved Permanently . . . . . . . . . . . . . . . . 56 148 6.4.3. 302 Found . . . . . . . . . . . . . . . . . . . . . . 56 149 6.4.4. 303 See Other . . . . . . . . . . . . . . . . . . . . 57 150 6.4.5. 305 Use Proxy . . . . . . . . . . . . . . . . . . . . 57 151 6.4.6. 306 (Unused) . . . . . . . . . . . . . . . . . . . . 58 152 6.4.7. 307 Temporary Redirect . . . . . . . . . . . . . . . 58 153 6.5. Client Error 4xx . . . . . . . . . . . . . . . . . . . . 58 154 6.5.1. 400 Bad Request . . . . . . . . . . . . . . . . . . . 58 155 6.5.2. 402 Payment Required . . . . . . . . . . . . . . . . 58 156 6.5.3. 403 Forbidden . . . . . . . . . . . . . . . . . . . . 59 157 6.5.4. 404 Not Found . . . . . . . . . . . . . . . . . . . . 59 158 6.5.5. 405 Method Not Allowed . . . . . . . . . . . . . . . 59 159 6.5.6. 406 Not Acceptable . . . . . . . . . . . . . . . . . 60 160 6.5.7. 408 Request Timeout . . . . . . . . . . . . . . . . . 60 161 6.5.8. 409 Conflict . . . . . . . . . . . . . . . . . . . . 60 162 6.5.9. 410 Gone . . . . . . . . . . . . . . . . . . . . . . 60 163 6.5.10. 411 Length Required . . . . . . . . . . . . . . . . . 61 164 6.5.11. 413 Payload Too Large . . . . . . . . . . . . . . . . 61 165 6.5.12. 414 URI Too Long . . . . . . . . . . . . . . . . . . 61 166 6.5.13. 415 Unsupported Media Type . . . . . . . . . . . . . 62 167 6.5.14. 417 Expectation Failed . . . . . . . . . . . . . . . 62 168 6.5.15. 426 Upgrade Required . . . . . . . . . . . . . . . . 62 169 6.6. Server Error 5xx . . . . . . . . . . . . . . . . . . . . 62 170 6.6.1. 500 Internal Server Error . . . . . . . . . . . . . . 63 171 6.6.2. 501 Not Implemented . . . . . . . . . . . . . . . . . 63 172 6.6.3. 502 Bad Gateway . . . . . . . . . . . . . . . . . . . 63 173 6.6.4. 503 Service Unavailable . . . . . . . . . . . . . . . 63 174 6.6.5. 504 Gateway Timeout . . . . . . . . . . . . . . . . . 63 175 6.6.6. 505 HTTP Version Not Supported . . . . . . . . . . . 64 176 7. Response Header Fields . . . . . . . . . . . . . . . . . . . 64 177 7.1. Control Data . . . . . . . . . . . . . . . . . . . . . . 64 178 7.1.1. Origination Date . . . . . . . . . . . . . . . . . . 64 179 7.1.2. Location . . . . . . . . . . . . . . . . . . . . . . 68 180 7.1.3. Retry-After . . . . . . . . . . . . . . . . . . . . . 69 181 7.1.4. Vary . . . . . . . . . . . . . . . . . . . . . . . . 70 182 7.2. Validator Header Fields . . . . . . . . . . . . . . . . . 71 183 7.3. Authentication Challenges . . . . . . . . . . . . . . . . 72 184 7.4. Response Context . . . . . . . . . . . . . . . . . . . . 72 185 7.4.1. Allow . . . . . . . . . . . . . . . . . . . . . . . . 72 186 7.4.2. Server . . . . . . . . . . . . . . . . . . . . . . . 73 187 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 74 188 8.1. Method Registry . . . . . . . . . . . . . . . . . . . . . 74 189 8.1.1. Procedure . . . . . . . . . . . . . . . . . . . . . . 74 190 8.1.2. Considerations for New Methods . . . . . . . . . . . 74 191 8.1.3. Registrations . . . . . . . . . . . . . . . . . . . . 75 193 8.2. Status Code Registry . . . . . . . . . . . . . . . . . . 75 194 8.2.1. Procedure . . . . . . . . . . . . . . . . . . . . . . 75 195 8.2.2. Considerations for New Status Codes . . . . . . . . . 76 196 8.2.3. Registrations . . . . . . . . . . . . . . . . . . . . 77 197 8.3. Header Field Registry . . . . . . . . . . . . . . . . . . 78 198 8.3.1. Considerations for New Header Fields . . . . . . . . 78 199 8.3.2. Registrations . . . . . . . . . . . . . . . . . . . . 80 200 8.4. Content Coding Registry . . . . . . . . . . . . . . . . . 81 201 8.4.1. Procedure . . . . . . . . . . . . . . . . . . . . . . 81 202 8.4.2. Registrations . . . . . . . . . . . . . . . . . . . . 81 203 9. Security Considerations . . . . . . . . . . . . . . . . . . . 81 204 9.1. Attacks Based on File and Path Names . . . . . . . . . . 82 205 9.2. Attacks Based on Command, Code, or Query Injection . . . 82 206 9.3. Disclosure of Personal Information . . . . . . . . . . . 83 207 9.4. Disclosure of Sensitive Information in URIs . . . . . . . 83 208 9.5. Disclosure of Fragment after Redirects . . . . . . . . . 84 209 9.6. Disclosure of Product Information . . . . . . . . . . . . 84 210 9.7. Browser Fingerprinting . . . . . . . . . . . . . . . . . 84 211 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 85 212 10.1. Normative References . . . . . . . . . . . . . . . . . . 85 213 10.2. Informative References . . . . . . . . . . . . . . . . . 87 214 Appendix A. Differences between HTTP and MIME . . . . . . . . . 90 215 A.1. MIME-Version . . . . . . . . . . . . . . . . . . . . . . 90 216 A.2. Conversion to Canonical Form . . . . . . . . . . . . . . 90 217 A.3. Conversion of Date Formats . . . . . . . . . . . . . . . 91 218 A.4. Conversion of Content-Encoding . . . . . . . . . . . . . 91 219 A.5. Conversion of Content-Transfer-Encoding . . . . . . . . . 91 220 A.6. MHTML and Line Length Limitations . . . . . . . . . . . . 91 221 Appendix B. Changes from RFC 7231 . . . . . . . . . . . . . . . 92 222 Appendix C. Imported ABNF . . . . . . . . . . . . . . . . . . . 92 223 Appendix D. Collected ABNF . . . . . . . . . . . . . . . . . . . 92 224 Appendix E. Change Log . . . . . . . . . . . . . . . . . . . . . 95 225 E.1. Since RFC 7231 . . . . . . . . . . . . . . . . . . . . . 95 226 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 227 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 100 228 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 100 230 1. Introduction 232 Each Hypertext Transfer Protocol (HTTP) message is either a request 233 or a response. A server listens on a connection for a request, 234 parses each message received, interprets the message semantics in 235 relation to the identified request target, and responds to that 236 request with one or more response messages. A client constructs 237 request messages to communicate specific intentions, examines 238 received responses to see if the intentions were carried out, and 239 determines how to interpret the results. This document defines 240 HTTP/1.1 request and response semantics in terms of the architecture 241 defined in [MESSGNG]. 243 HTTP provides a uniform interface for interacting with a resource 244 (Section 2), regardless of its type, nature, or implementation, via 245 the manipulation and transfer of representations (Section 3). 247 HTTP semantics include the intentions defined by each request method 248 (Section 4), extensions to those semantics that might be described in 249 request header fields (Section 5), the meaning of status codes to 250 indicate a machine-readable response (Section 6), and the meaning of 251 other control data and resource metadata that might be given in 252 response header fields (Section 7). 254 This document also defines representation metadata that describe how 255 a payload is intended to be interpreted by a recipient, the request 256 header fields that might influence content selection, and the various 257 selection algorithms that are collectively referred to as "content 258 negotiation" (Section 3.4). 260 This specification obsoletes RFC 7231, with the changes being 261 summarized in Appendix B. 263 1.1. Conformance and Error Handling 265 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 266 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 267 document are to be interpreted as described in [RFC2119]. 269 Conformance criteria and considerations regarding error handling are 270 defined in Section 2.5 of [MESSGNG]. 272 1.2. Syntax Notation 274 This specification uses the Augmented Backus-Naur Form (ABNF) 275 notation of [RFC5234] with a list extension, defined in Section 7 of 276 [MESSGNG], that allows for compact definition of comma-separated 277 lists using a '#' operator (similar to how the '*' operator indicates 278 repetition). Appendix C describes rules imported from other 279 documents. Appendix D shows the collected grammar with all list 280 operators expanded to standard ABNF notation. 282 This specification uses the terms "character", "character encoding 283 scheme", "charset", and "protocol element" as they are defined in 284 [RFC6365]. 286 2. Resources 288 The target of an HTTP request is called a "resource". HTTP does not 289 limit the nature of a resource; it merely defines an interface that 290 might be used to interact with resources. Each resource is 291 identified by a Uniform Resource Identifier (URI), as described in 292 Section 2.7 of [MESSGNG]. 294 When a client constructs an HTTP/1.1 request message, it sends the 295 target URI in one of various forms, as defined in (Section 5.3 of 296 [MESSGNG]). When a request is received, the server reconstructs an 297 effective request URI for the target resource (Section 5.5 of 298 [MESSGNG]). 300 One design goal of HTTP is to separate resource identification from 301 request semantics, which is made possible by vesting the request 302 semantics in the request method (Section 4) and a few request- 303 modifying header fields (Section 5). If there is a conflict between 304 the method semantics and any semantic implied by the URI itself, as 305 described in Section 4.2.1, the method semantics take precedence. 307 3. Representations 309 Considering that a resource could be anything, and that the uniform 310 interface provided by HTTP is similar to a window through which one 311 can observe and act upon such a thing only through the communication 312 of messages to some independent actor on the other side, an 313 abstraction is needed to represent ("take the place of") the current 314 or desired state of that thing in our communications. That 315 abstraction is called a representation [REST]. 317 For the purposes of HTTP, a "representation" is information that is 318 intended to reflect a past, current, or desired state of a given 319 resource, in a format that can be readily communicated via the 320 protocol, and that consists of a set of representation metadata and a 321 potentially unbounded stream of representation data. 323 An origin server might be provided with, or be capable of generating, 324 multiple representations that are each intended to reflect the 325 current state of a target resource. In such cases, some algorithm is 326 used by the origin server to select one of those representations as 327 most applicable to a given request, usually based on content 328 negotiation. This "selected representation" is used to provide the 329 data and metadata for evaluating conditional requests [CONDTNL] and 330 constructing the payload for 200 (OK) and 304 (Not Modified) 331 responses to GET (Section 4.3.1). 333 3.1. Representation Metadata 335 Representation header fields provide metadata about the 336 representation. When a message includes a payload body, the 337 representation header fields describe how to interpret the 338 representation data enclosed in the payload body. In a response to a 339 HEAD request, the representation header fields describe the 340 representation data that would have been enclosed in the payload body 341 if the same request had been a GET. 343 The following header fields convey representation metadata: 345 +-------------------+-----------------+ 346 | Header Field Name | Defined in... | 347 +-------------------+-----------------+ 348 | Content-Type | Section 3.1.1.5 | 349 | Content-Encoding | Section 3.1.2.2 | 350 | Content-Language | Section 3.1.3.2 | 351 | Content-Location | Section 3.1.4.2 | 352 +-------------------+-----------------+ 354 3.1.1. Processing Representation Data 356 3.1.1.1. Media Type 358 HTTP uses Internet media types [RFC2046] in the Content-Type 359 (Section 3.1.1.5) and Accept (Section 5.3.2) header fields in order 360 to provide open and extensible data typing and type negotiation. 361 Media types define both a data format and various processing models: 362 how to process that data in accordance with each context in which it 363 is received. 365 media-type = type "/" subtype *( OWS ";" OWS parameter ) 366 type = token 367 subtype = token 369 The type/subtype MAY be followed by parameters in the form of 370 name=value pairs. 372 parameter = token "=" ( token / quoted-string ) 374 The type, subtype, and parameter name tokens are case-insensitive. 375 Parameter values might or might not be case-sensitive, depending on 376 the semantics of the parameter name. The presence or absence of a 377 parameter might be significant to the processing of a media-type, 378 depending on its definition within the media type registry. 380 A parameter value that matches the token production can be 381 transmitted either as a token or within a quoted-string. The quoted 382 and unquoted values are equivalent. For example, the following 383 examples are all equivalent, but the first is preferred for 384 consistency: 386 text/html;charset=utf-8 387 text/html;charset=UTF-8 388 Text/HTML;Charset="utf-8" 389 text/html; charset="utf-8" 391 Internet media types ought to be registered with IANA according to 392 the procedures defined in [BCP13]. 394 Note: Unlike some similar constructs in other header fields, media 395 type parameters do not allow whitespace (even "bad" whitespace) 396 around the "=" character. 398 3.1.1.2. Charset 400 HTTP uses charset names to indicate or negotiate the character 401 encoding scheme of a textual representation [RFC6365]. A charset is 402 identified by a case-insensitive token. 404 charset = token 406 Charset names ought to be registered in the IANA "Character Sets" 407 registry () according 408 to the procedures defined in [RFC2978]. 410 3.1.1.3. Canonicalization and Text Defaults 412 Internet media types are registered with a canonical form in order to 413 be interoperable among systems with varying native encoding formats. 414 Representations selected or transferred via HTTP ought to be in 415 canonical form, for many of the same reasons described by the 416 Multipurpose Internet Mail Extensions (MIME) [RFC2045]. However, the 417 performance characteristics of email deployments (i.e., store and 418 forward messages to peers) are significantly different from those 419 common to HTTP and the Web (server-based information services). 420 Furthermore, MIME's constraints for the sake of compatibility with 421 older mail transfer protocols do not apply to HTTP (see Appendix A). 423 MIME's canonical form requires that media subtypes of the "text" type 424 use CRLF as the text line break. HTTP allows the transfer of text 425 media with plain CR or LF alone representing a line break, when such 426 line breaks are consistent for an entire representation. An HTTP 427 sender MAY generate, and a recipient MUST be able to parse, line 428 breaks in text media that consist of CRLF, bare CR, or bare LF. In 429 addition, text media in HTTP is not limited to charsets that use 430 octets 13 and 10 for CR and LF, respectively. This flexibility 431 regarding line breaks applies only to text within a representation 432 that has been assigned a "text" media type; it does not apply to 433 "multipart" types or HTTP elements outside the payload body (e.g., 434 header fields). 436 If a representation is encoded with a content-coding, the underlying 437 data ought to be in a form defined above prior to being encoded. 439 3.1.1.4. Multipart Types 441 MIME provides for a number of "multipart" types -- encapsulations of 442 one or more representations within a single message body. All 443 multipart types share a common syntax, as defined in Section 5.1.1 of 444 [RFC2046], and include a boundary parameter as part of the media type 445 value. The message body is itself a protocol element; a sender MUST 446 generate only CRLF to represent line breaks between body parts. 448 HTTP message framing does not use the multipart boundary as an 449 indicator of message body length, though it might be used by 450 implementations that generate or process the payload. For example, 451 the "multipart/form-data" type is often used for carrying form data 452 in a request, as described in [RFC2388], and the "multipart/ 453 byteranges" type is defined by this specification for use in some 206 454 (Partial Content) responses [RANGERQ]. 456 3.1.1.5. Content-Type 458 The "Content-Type" header field indicates the media type of the 459 associated representation: either the representation enclosed in the 460 message payload or the selected representation, as determined by the 461 message semantics. The indicated media type defines both the data 462 format and how that data is intended to be processed by a recipient, 463 within the scope of the received message semantics, after any content 464 codings indicated by Content-Encoding are decoded. 466 Content-Type = media-type 468 Media types are defined in Section 3.1.1.1. An example of the field 469 is 471 Content-Type: text/html; charset=ISO-8859-4 473 A sender that generates a message containing a payload body SHOULD 474 generate a Content-Type header field in that message unless the 475 intended media type of the enclosed representation is unknown to the 476 sender. If a Content-Type header field is not present, the recipient 477 MAY either assume a media type of "application/octet-stream" 478 ([RFC2046], Section 4.5.1) or examine the data to determine its type. 480 In practice, resource owners do not always properly configure their 481 origin server to provide the correct Content-Type for a given 482 representation, with the result that some clients will examine a 483 payload's content and override the specified type. Clients that do 484 so risk drawing incorrect conclusions, which might expose additional 485 security risks (e.g., "privilege escalation"). Furthermore, it is 486 impossible to determine the sender's intent by examining the data 487 format: many data formats match multiple media types that differ only 488 in processing semantics. Implementers are encouraged to provide a 489 means of disabling such "content sniffing" when it is used. 491 3.1.2. Encoding for Compression or Integrity 493 3.1.2.1. Content Codings 495 Content coding values indicate an encoding transformation that has 496 been or can be applied to a representation. Content codings are 497 primarily used to allow a representation to be compressed or 498 otherwise usefully transformed without losing the identity of its 499 underlying media type and without loss of information. Frequently, 500 the representation is stored in coded form, transmitted directly, and 501 only decoded by the final recipient. 503 content-coding = token 505 All content-coding values are case-insensitive and ought to be 506 registered within the "HTTP Content Coding Registry", as defined in 507 Section 8.4. They are used in the Accept-Encoding (Section 5.3.4) 508 and Content-Encoding (Section 3.1.2.2) header fields. 510 The following content-coding values are defined by this 511 specification: 513 compress (and x-compress): See Section 4.2.1 of [MESSGNG]. 515 deflate: See Section 4.2.2 of [MESSGNG]. 517 gzip (and x-gzip): See Section 4.2.3 of [MESSGNG]. 519 3.1.2.2. Content-Encoding 521 The "Content-Encoding" header field indicates what content codings 522 have been applied to the representation, beyond those inherent in the 523 media type, and thus what decoding mechanisms have to be applied in 524 order to obtain data in the media type referenced by the Content-Type 525 header field. Content-Encoding is primarily used to allow a 526 representation's data to be compressed without losing the identity of 527 its underlying media type. 529 Content-Encoding = 1#content-coding 531 An example of its use is 533 Content-Encoding: gzip 535 If one or more encodings have been applied to a representation, the 536 sender that applied the encodings MUST generate a Content-Encoding 537 header field that lists the content codings in the order in which 538 they were applied. Additional information about the encoding 539 parameters can be provided by other header fields not defined by this 540 specification. 542 Unlike Transfer-Encoding (Section 3.3.1 of [MESSGNG]), the codings 543 listed in Content-Encoding are a characteristic of the 544 representation; the representation is defined in terms of the coded 545 form, and all other metadata about the representation is about the 546 coded form unless otherwise noted in the metadata definition. 547 Typically, the representation is only decoded just prior to rendering 548 or analogous usage. 550 If the media type includes an inherent encoding, such as a data 551 format that is always compressed, then that encoding would not be 552 restated in Content-Encoding even if it happens to be the same 553 algorithm as one of the content codings. Such a content coding would 554 only be listed if, for some bizarre reason, it is applied a second 555 time to form the representation. Likewise, an origin server might 556 choose to publish the same data as multiple representations that 557 differ only in whether the coding is defined as part of Content-Type 558 or Content-Encoding, since some user agents will behave differently 559 in their handling of each response (e.g., open a "Save as ..." dialog 560 instead of automatic decompression and rendering of content). 562 An origin server MAY respond with a status code of 415 (Unsupported 563 Media Type) if a representation in the request message has a content 564 coding that is not acceptable. 566 3.1.3. Audience Language 567 3.1.3.1. Language Tags 569 A language tag, as defined in [RFC5646], identifies a natural 570 language spoken, written, or otherwise conveyed by human beings for 571 communication of information to other human beings. Computer 572 languages are explicitly excluded. 574 HTTP uses language tags within the Accept-Language and Content- 575 Language header fields. Accept-Language uses the broader language- 576 range production defined in Section 5.3.5, whereas Content-Language 577 uses the language-tag production defined below. 579 language-tag = 581 A language tag is a sequence of one or more case-insensitive subtags, 582 each separated by a hyphen character ("-", %x2D). In most cases, a 583 language tag consists of a primary language subtag that identifies a 584 broad family of related languages (e.g., "en" = English), which is 585 optionally followed by a series of subtags that refine or narrow that 586 language's range (e.g., "en-CA" = the variety of English as 587 communicated in Canada). Whitespace is not allowed within a language 588 tag. Example tags include: 590 fr, en-US, es-419, az-Arab, x-pig-latin, man-Nkoo-GN 592 See [RFC5646] for further information. 594 3.1.3.2. Content-Language 596 The "Content-Language" header field describes the natural language(s) 597 of the intended audience for the representation. Note that this 598 might not be equivalent to all the languages used within the 599 representation. 601 Content-Language = 1#language-tag 603 Language tags are defined in Section 3.1.3.1. The primary purpose of 604 Content-Language is to allow a user to identify and differentiate 605 representations according to the users' own preferred language. 606 Thus, if the content is intended only for a Danish-literate audience, 607 the appropriate field is 609 Content-Language: da 611 If no Content-Language is specified, the default is that the content 612 is intended for all language audiences. This might mean that the 613 sender does not consider it to be specific to any natural language, 614 or that the sender does not know for which language it is intended. 616 Multiple languages MAY be listed for content that is intended for 617 multiple audiences. For example, a rendition of the "Treaty of 618 Waitangi", presented simultaneously in the original Maori and English 619 versions, would call for 621 Content-Language: mi, en 623 However, just because multiple languages are present within a 624 representation does not mean that it is intended for multiple 625 linguistic audiences. An example would be a beginner's language 626 primer, such as "A First Lesson in Latin", which is clearly intended 627 to be used by an English-literate audience. In this case, the 628 Content-Language would properly only include "en". 630 Content-Language MAY be applied to any media type -- it is not 631 limited to textual documents. 633 3.1.4. Identification 635 3.1.4.1. Identifying a Representation 637 When a complete or partial representation is transferred in a message 638 payload, it is often desirable for the sender to supply, or the 639 recipient to determine, an identifier for a resource corresponding to 640 that representation. 642 For a request message: 644 o If the request has a Content-Location header field, then the 645 sender asserts that the payload is a representation of the 646 resource identified by the Content-Location field-value. However, 647 such an assertion cannot be trusted unless it can be verified by 648 other means (not defined by this specification). The information 649 might still be useful for revision history links. 651 o Otherwise, the payload is unidentified. 653 For a response message, the following rules are applied in order 654 until a match is found: 656 1. If the request method is GET or HEAD and the response status code 657 is 200 (OK), 204 (No Content), 206 (Partial Content), or 304 (Not 658 Modified), the payload is a representation of the resource 659 identified by the effective request URI (Section 5.5 of 660 [MESSGNG]). 662 2. If the request method is GET or HEAD and the response status code 663 is 203 (Non-Authoritative Information), the payload is a 664 potentially modified or enhanced representation of the target 665 resource as provided by an intermediary. 667 3. If the response has a Content-Location header field and its 668 field-value is a reference to the same URI as the effective 669 request URI, the payload is a representation of the resource 670 identified by the effective request URI. 672 4. If the response has a Content-Location header field and its 673 field-value is a reference to a URI different from the effective 674 request URI, then the sender asserts that the payload is a 675 representation of the resource identified by the Content-Location 676 field-value. However, such an assertion cannot be trusted unless 677 it can be verified by other means (not defined by this 678 specification). 680 5. Otherwise, the payload is unidentified. 682 3.1.4.2. Content-Location 684 The "Content-Location" header field references a URI that can be used 685 as an identifier for a specific resource corresponding to the 686 representation in this message's payload. In other words, if one 687 were to perform a GET request on this URI at the time of this 688 message's generation, then a 200 (OK) response would contain the same 689 representation that is enclosed as payload in this message. 691 Content-Location = absolute-URI / partial-URI 693 The Content-Location value is not a replacement for the effective 694 Request URI (Section 5.5 of [MESSGNG]). It is representation 695 metadata. It has the same syntax and semantics as the header field 696 of the same name defined for MIME body parts in Section 4 of 697 [RFC2557]. However, its appearance in an HTTP message has some 698 special implications for HTTP recipients. 700 If Content-Location is included in a 2xx (Successful) response 701 message and its value refers (after conversion to absolute form) to a 702 URI that is the same as the effective request URI, then the recipient 703 MAY consider the payload to be a current representation of that 704 resource at the time indicated by the message origination date. For 705 a GET (Section 4.3.1) or HEAD (Section 4.3.2) request, this is the 706 same as the default semantics when no Content-Location is provided by 707 the server. For a state-changing request like PUT (Section 4.3.4) or 708 POST (Section 4.3.3), it implies that the server's response contains 709 the new representation of that resource, thereby distinguishing it 710 from representations that might only report about the action (e.g., 711 "It worked!"). This allows authoring applications to update their 712 local copies without the need for a subsequent GET request. 714 If Content-Location is included in a 2xx (Successful) response 715 message and its field-value refers to a URI that differs from the 716 effective request URI, then the origin server claims that the URI is 717 an identifier for a different resource corresponding to the enclosed 718 representation. Such a claim can only be trusted if both identifiers 719 share the same resource owner, which cannot be programmatically 720 determined via HTTP. 722 o For a response to a GET or HEAD request, this is an indication 723 that the effective request URI refers to a resource that is 724 subject to content negotiation and the Content-Location field- 725 value is a more specific identifier for the selected 726 representation. 728 o For a 201 (Created) response to a state-changing method, a 729 Content-Location field-value that is identical to the Location 730 field-value indicates that this payload is a current 731 representation of the newly created resource. 733 o Otherwise, such a Content-Location indicates that this payload is 734 a representation reporting on the requested action's status and 735 that the same report is available (for future access with GET) at 736 the given URI. For example, a purchase transaction made via a 737 POST request might include a receipt document as the payload of 738 the 200 (OK) response; the Content-Location field-value provides 739 an identifier for retrieving a copy of that same receipt in the 740 future. 742 A user agent that sends Content-Location in a request message is 743 stating that its value refers to where the user agent originally 744 obtained the content of the enclosed representation (prior to any 745 modifications made by that user agent). In other words, the user 746 agent is providing a back link to the source of the original 747 representation. 749 An origin server that receives a Content-Location field in a request 750 message MUST treat the information as transitory request context 751 rather than as metadata to be saved verbatim as part of the 752 representation. An origin server MAY use that context to guide in 753 processing the request or to save it for other uses, such as within 754 source links or versioning metadata. However, an origin server MUST 755 NOT use such context information to alter the request semantics. 757 For example, if a client makes a PUT request on a negotiated resource 758 and the origin server accepts that PUT (without redirection), then 759 the new state of that resource is expected to be consistent with the 760 one representation supplied in that PUT; the Content-Location cannot 761 be used as a form of reverse content selection identifier to update 762 only one of the negotiated representations. If the user agent had 763 wanted the latter semantics, it would have applied the PUT directly 764 to the Content-Location URI. 766 3.2. Representation Data 768 The representation data associated with an HTTP message is either 769 provided as the payload body of the message or referred to by the 770 message semantics and the effective request URI. The representation 771 data is in a format and encoding defined by the representation 772 metadata header fields. 774 The data type of the representation data is determined via the header 775 fields Content-Type and Content-Encoding. These define a two-layer, 776 ordered encoding model: 778 representation-data := Content-Encoding( Content-Type( bits ) ) 780 3.3. Payload Semantics 782 Some HTTP messages transfer a complete or partial representation as 783 the message "payload". In some cases, a payload might contain only 784 the associated representation's header fields (e.g., responses to 785 HEAD) or only some part(s) of the representation data (e.g., the 206 786 (Partial Content) status code). 788 The purpose of a payload in a request is defined by the method 789 semantics. For example, a representation in the payload of a PUT 790 request (Section 4.3.4) represents the desired state of the target 791 resource if the request is successfully applied, whereas a 792 representation in the payload of a POST request (Section 4.3.3) 793 represents information to be processed by the target resource. 795 In a response, the payload's purpose is defined by both the request 796 method and the response status code. For example, the payload of a 797 200 (OK) response to GET (Section 4.3.1) represents the current state 798 of the target resource, as observed at the time of the message 799 origination date (Section 7.1.1.2), whereas the payload of the same 800 status code in a response to POST might represent either the 801 processing result or the new state of the target resource after 802 applying the processing. Response messages with an error status code 803 usually contain a payload that represents the error condition, such 804 that it describes the error state and what next steps are suggested 805 for resolving it. 807 Header fields that specifically describe the payload, rather than the 808 associated representation, are referred to as "payload header 809 fields". Payload header fields are defined in other parts of this 810 specification, due to their impact on message parsing. 812 +-------------------+----------------------------+ 813 | Header Field Name | Defined in... | 814 +-------------------+----------------------------+ 815 | Content-Length | Section 3.3.2 of [MESSGNG] | 816 | Content-Range | Section 4.2 of [RANGERQ] | 817 | Trailer | Section 4.4 of [MESSGNG] | 818 | Transfer-Encoding | Section 3.3.1 of [MESSGNG] | 819 +-------------------+----------------------------+ 821 3.4. Content Negotiation 823 When responses convey payload information, whether indicating a 824 success or an error, the origin server often has different ways of 825 representing that information; for example, in different formats, 826 languages, or encodings. Likewise, different users or user agents 827 might have differing capabilities, characteristics, or preferences 828 that could influence which representation, among those available, 829 would be best to deliver. For this reason, HTTP provides mechanisms 830 for content negotiation. 832 This specification defines two patterns of content negotiation that 833 can be made visible within the protocol: "proactive", where the 834 server selects the representation based upon the user agent's stated 835 preferences, and "reactive" negotiation, where the server provides a 836 list of representations for the user agent to choose from. Other 837 patterns of content negotiation include "conditional content", where 838 the representation consists of multiple parts that are selectively 839 rendered based on user agent parameters, "active content", where the 840 representation contains a script that makes additional (more 841 specific) requests based on the user agent characteristics, and 842 "Transparent Content Negotiation" ([RFC2295]), where content 843 selection is performed by an intermediary. These patterns are not 844 mutually exclusive, and each has trade-offs in applicability and 845 practicality. 847 Note that, in all cases, HTTP is not aware of the resource semantics. 848 The consistency with which an origin server responds to requests, 849 over time and over the varying dimensions of content negotiation, and 850 thus the "sameness" of a resource's observed representations over 851 time, is determined entirely by whatever entity or algorithm selects 852 or generates those responses. HTTP pays no attention to the man 853 behind the curtain. 855 3.4.1. Proactive Negotiation 857 When content negotiation preferences are sent by the user agent in a 858 request to encourage an algorithm located at the server to select the 859 preferred representation, it is called proactive negotiation (a.k.a., 860 server-driven negotiation). Selection is based on the available 861 representations for a response (the dimensions over which it might 862 vary, such as language, content-coding, etc.) compared to various 863 information supplied in the request, including both the explicit 864 negotiation fields of Section 5.3 and implicit characteristics, such 865 as the client's network address or parts of the User-Agent field. 867 Proactive negotiation is advantageous when the algorithm for 868 selecting from among the available representations is difficult to 869 describe to a user agent, or when the server desires to send its 870 "best guess" to the user agent along with the first response (hoping 871 to avoid the round trip delay of a subsequent request if the "best 872 guess" is good enough for the user). In order to improve the 873 server's guess, a user agent MAY send request header fields that 874 describe its preferences. 876 Proactive negotiation has serious disadvantages: 878 o It is impossible for the server to accurately determine what might 879 be "best" for any given user, since that would require complete 880 knowledge of both the capabilities of the user agent and the 881 intended use for the response (e.g., does the user want to view it 882 on screen or print it on paper?); 884 o Having the user agent describe its capabilities in every request 885 can be both very inefficient (given that only a small percentage 886 of responses have multiple representations) and a potential risk 887 to the user's privacy; 889 o It complicates the implementation of an origin server and the 890 algorithms for generating responses to a request; and, 892 o It limits the reusability of responses for shared caching. 894 A user agent cannot rely on proactive negotiation preferences being 895 consistently honored, since the origin server might not implement 896 proactive negotiation for the requested resource or might decide that 897 sending a response that doesn't conform to the user agent's 898 preferences is better than sending a 406 (Not Acceptable) response. 900 A Vary header field (Section 7.1.4) is often sent in a response 901 subject to proactive negotiation to indicate what parts of the 902 request information were used in the selection algorithm. 904 3.4.2. Reactive Negotiation 906 With reactive negotiation (a.k.a., agent-driven negotiation), 907 selection of the best response representation (regardless of the 908 status code) is performed by the user agent after receiving an 909 initial response from the origin server that contains a list of 910 resources for alternative representations. If the user agent is not 911 satisfied by the initial response representation, it can perform a 912 GET request on one or more of the alternative resources, selected 913 based on metadata included in the list, to obtain a different form of 914 representation for that response. Selection of alternatives might be 915 performed automatically by the user agent or manually by the user 916 selecting from a generated (possibly hypertext) menu. 918 Note that the above refers to representations of the response, in 919 general, not representations of the resource. The alternative 920 representations are only considered representations of the target 921 resource if the response in which those alternatives are provided has 922 the semantics of being a representation of the target resource (e.g., 923 a 200 (OK) response to a GET request) or has the semantics of 924 providing links to alternative representations for the target 925 resource (e.g., a 300 (Multiple Choices) response to a GET request). 927 A server might choose not to send an initial representation, other 928 than the list of alternatives, and thereby indicate that reactive 929 negotiation by the user agent is preferred. For example, the 930 alternatives listed in responses with the 300 (Multiple Choices) and 931 406 (Not Acceptable) status codes include information about the 932 available representations so that the user or user agent can react by 933 making a selection. 935 Reactive negotiation is advantageous when the response would vary 936 over commonly used dimensions (such as type, language, or encoding), 937 when the origin server is unable to determine a user agent's 938 capabilities from examining the request, and generally when public 939 caches are used to distribute server load and reduce network usage. 941 Reactive negotiation suffers from the disadvantages of transmitting a 942 list of alternatives to the user agent, which degrades user-perceived 943 latency if transmitted in the header section, and needing a second 944 request to obtain an alternate representation. Furthermore, this 945 specification does not define a mechanism for supporting automatic 946 selection, though it does not prevent such a mechanism from being 947 developed as an extension. 949 4. Request Methods 951 4.1. Overview 953 The request method token is the primary source of request semantics; 954 it indicates the purpose for which the client has made this request 955 and what is expected by the client as a successful result. 957 The request method's semantics might be further specialized by the 958 semantics of some header fields when present in a request (Section 5) 959 if those additional semantics do not conflict with the method. For 960 example, a client can send conditional request header fields 961 (Section 5.2) to make the requested action conditional on the current 962 state of the target resource ([CONDTNL]). 964 method = token 966 HTTP was originally designed to be usable as an interface to 967 distributed object systems. The request method was envisioned as 968 applying semantics to a target resource in much the same way as 969 invoking a defined method on an identified object would apply 970 semantics. The method token is case-sensitive because it might be 971 used as a gateway to object-based systems with case-sensitive method 972 names. 974 Unlike distributed objects, the standardized request methods in HTTP 975 are not resource-specific, since uniform interfaces provide for 976 better visibility and reuse in network-based systems [REST]. Once 977 defined, a standardized method ought to have the same semantics when 978 applied to any resource, though each resource determines for itself 979 whether those semantics are implemented or allowed. 981 This specification defines a number of standardized methods that are 982 commonly used in HTTP, as outlined by the following table. By 983 convention, standardized methods are defined in all-uppercase US- 984 ASCII letters. 986 +---------+-------------------------------------------------+-------+ 987 | Method | Description | Sec. | 988 +---------+-------------------------------------------------+-------+ 989 | GET | Transfer a current representation of the target | 4.3.1 | 990 | | resource. | | 991 | HEAD | Same as GET, but only transfer the status line | 4.3.2 | 992 | | and header section. | | 993 | POST | Perform resource-specific processing on the | 4.3.3 | 994 | | request payload. | | 995 | PUT | Replace all current representations of the | 4.3.4 | 996 | | target resource with the request payload. | | 997 | DELETE | Remove all current representations of the | 4.3.5 | 998 | | target resource. | | 999 | CONNECT | Establish a tunnel to the server identified by | 4.3.6 | 1000 | | the target resource. | | 1001 | OPTIONS | Describe the communication options for the | 4.3.7 | 1002 | | target resource. | | 1003 | TRACE | Perform a message loop-back test along the path | 4.3.8 | 1004 | | to the target resource. | | 1005 +---------+-------------------------------------------------+-------+ 1007 All general-purpose servers MUST support the methods GET and HEAD. 1008 All other methods are OPTIONAL. 1010 Additional methods, outside the scope of this specification, have 1011 been standardized for use in HTTP. All such methods ought to be 1012 registered within the "Hypertext Transfer Protocol (HTTP) Method 1013 Registry" maintained by IANA, as defined in Section 8.1. 1015 The set of methods allowed by a target resource can be listed in an 1016 Allow header field (Section 7.4.1). However, the set of allowed 1017 methods can change dynamically. When a request method is received 1018 that is unrecognized or not implemented by an origin server, the 1019 origin server SHOULD respond with the 501 (Not Implemented) status 1020 code. When a request method is received that is known by an origin 1021 server but not allowed for the target resource, the origin server 1022 SHOULD respond with the 405 (Method Not Allowed) status code. 1024 4.2. Common Method Properties 1026 4.2.1. Safe Methods 1028 Request methods are considered "safe" if their defined semantics are 1029 essentially read-only; i.e., the client does not request, and does 1030 not expect, any state change on the origin server as a result of 1031 applying a safe method to a target resource. Likewise, reasonable 1032 use of a safe method is not expected to cause any harm, loss of 1033 property, or unusual burden on the origin server. 1035 This definition of safe methods does not prevent an implementation 1036 from including behavior that is potentially harmful, that is not 1037 entirely read-only, or that causes side effects while invoking a safe 1038 method. What is important, however, is that the client did not 1039 request that additional behavior and cannot be held accountable for 1040 it. For example, most servers append request information to access 1041 log files at the completion of every response, regardless of the 1042 method, and that is considered safe even though the log storage might 1043 become full and crash the server. Likewise, a safe request initiated 1044 by selecting an advertisement on the Web will often have the side 1045 effect of charging an advertising account. 1047 Of the request methods defined by this specification, the GET, HEAD, 1048 OPTIONS, and TRACE methods are defined to be safe. 1050 The purpose of distinguishing between safe and unsafe methods is to 1051 allow automated retrieval processes (spiders) and cache performance 1052 optimization (pre-fetching) to work without fear of causing harm. In 1053 addition, it allows a user agent to apply appropriate constraints on 1054 the automated use of unsafe methods when processing potentially 1055 untrusted content. 1057 A user agent SHOULD distinguish between safe and unsafe methods when 1058 presenting potential actions to a user, such that the user can be 1059 made aware of an unsafe action before it is requested. 1061 When a resource is constructed such that parameters within the 1062 effective request URI have the effect of selecting an action, it is 1063 the resource owner's responsibility to ensure that the action is 1064 consistent with the request method semantics. For example, it is 1065 common for Web-based content editing software to use actions within 1066 query parameters, such as "page?do=delete". If the purpose of such a 1067 resource is to perform an unsafe action, then the resource owner MUST 1068 disable or disallow that action when it is accessed using a safe 1069 request method. Failure to do so will result in unfortunate side 1070 effects when automated processes perform a GET on every URI reference 1071 for the sake of link maintenance, pre-fetching, building a search 1072 index, etc. 1074 4.2.2. Idempotent Methods 1076 A request method is considered "idempotent" if the intended effect on 1077 the server of multiple identical requests with that method is the 1078 same as the effect for a single such request. Of the request methods 1079 defined by this specification, PUT, DELETE, and safe request methods 1080 are idempotent. 1082 Like the definition of safe, the idempotent property only applies to 1083 what has been requested by the user; a server is free to log each 1084 request separately, retain a revision control history, or implement 1085 other non-idempotent side effects for each idempotent request. 1087 Idempotent methods are distinguished because the request can be 1088 repeated automatically if a communication failure occurs before the 1089 client is able to read the server's response. For example, if a 1090 client sends a PUT request and the underlying connection is closed 1091 before any response is received, then the client can establish a new 1092 connection and retry the idempotent request. It knows that repeating 1093 the request will have the same intended effect, even if the original 1094 request succeeded, though the response might differ. 1096 4.2.3. Cacheable Methods 1098 Request methods can be defined as "cacheable" to indicate that 1099 responses to them are allowed to be stored for future reuse; for 1100 specific requirements see [CACHING]. In general, safe methods that 1101 do not depend on a current or authoritative response are defined as 1102 cacheable; this specification defines GET, HEAD, and POST as 1103 cacheable, although the overwhelming majority of cache 1104 implementations only support GET and HEAD. 1106 4.3. Method Definitions 1108 4.3.1. GET 1110 The GET method requests transfer of a current selected representation 1111 for the target resource. GET is the primary mechanism of information 1112 retrieval and the focus of almost all performance optimizations. 1113 Hence, when people speak of retrieving some identifiable information 1114 via HTTP, they are generally referring to making a GET request. 1116 It is tempting to think of resource identifiers as remote file system 1117 pathnames and of representations as being a copy of the contents of 1118 such files. In fact, that is how many resources are implemented (see 1119 Section 9.1 for related security considerations). However, there are 1120 no such limitations in practice. The HTTP interface for a resource 1121 is just as likely to be implemented as a tree of content objects, a 1122 programmatic view on various database records, or a gateway to other 1123 information systems. Even when the URI mapping mechanism is tied to 1124 a file system, an origin server might be configured to execute the 1125 files with the request as input and send the output as the 1126 representation rather than transfer the files directly. Regardless, 1127 only the origin server needs to know how each of its resource 1128 identifiers corresponds to an implementation and how each 1129 implementation manages to select and send a current representation of 1130 the target resource in a response to GET. 1132 A client can alter the semantics of GET to be a "range request", 1133 requesting transfer of only some part(s) of the selected 1134 representation, by sending a Range header field in the request 1135 ([RANGERQ]). 1137 A payload within a GET request message has no defined semantics; 1138 sending a payload body on a GET request might cause some existing 1139 implementations to reject the request. 1141 The response to a GET request is cacheable; a cache MAY use it to 1142 satisfy subsequent GET and HEAD requests unless otherwise indicated 1143 by the Cache-Control header field (Section 5.2 of [CACHING]). 1145 4.3.2. HEAD 1147 The HEAD method is identical to GET except that the server MUST NOT 1148 send a message body in the response (i.e., the response terminates at 1149 the end of the header section). The server SHOULD send the same 1150 header fields in response to a HEAD request as it would have sent if 1151 the request had been a GET, except that the payload header fields 1152 (Section 3.3) MAY be omitted. This method can be used for obtaining 1153 metadata about the selected representation without transferring the 1154 representation data and is often used for testing hypertext links for 1155 validity, accessibility, and recent modification. 1157 A payload within a HEAD request message has no defined semantics; 1158 sending a payload body on a HEAD request might cause some existing 1159 implementations to reject the request. 1161 The response to a HEAD request is cacheable; a cache MAY use it to 1162 satisfy subsequent HEAD requests unless otherwise indicated by the 1163 Cache-Control header field (Section 5.2 of [CACHING]). A HEAD 1164 response might also have an effect on previously cached responses to 1165 GET; see Section 4.3.5 of [CACHING]. 1167 4.3.3. POST 1169 The POST method requests that the target resource process the 1170 representation enclosed in the request according to the resource's 1171 own specific semantics. For example, POST is used for the following 1172 functions (among others): 1174 o Providing a block of data, such as the fields entered into an HTML 1175 form, to a data-handling process; 1177 o Posting a message to a bulletin board, newsgroup, mailing list, 1178 blog, or similar group of articles; 1180 o Creating a new resource that has yet to be identified by the 1181 origin server; and 1183 o Appending data to a resource's existing representation(s). 1185 An origin server indicates response semantics by choosing an 1186 appropriate status code depending on the result of processing the 1187 POST request; almost all of the status codes defined by this 1188 specification might be received in a response to POST (the exceptions 1189 being 206 (Partial Content), 304 (Not Modified), and 416 (Range Not 1190 Satisfiable)). 1192 If one or more resources has been created on the origin server as a 1193 result of successfully processing a POST request, the origin server 1194 SHOULD send a 201 (Created) response containing a Location header 1195 field that provides an identifier for the primary resource created 1196 (Section 7.1.2) and a representation that describes the status of the 1197 request while referring to the new resource(s). 1199 Responses to POST requests are only cacheable when they include 1200 explicit freshness information (see Section 4.2.1 of [CACHING]). 1201 However, POST caching is not widely implemented. For cases where an 1202 origin server wishes the client to be able to cache the result of a 1203 POST in a way that can be reused by a later GET, the origin server 1204 MAY send a 200 (OK) response containing the result and a Content- 1205 Location header field that has the same value as the POST's effective 1206 request URI (Section 3.1.4.2). 1208 If the result of processing a POST would be equivalent to a 1209 representation of an existing resource, an origin server MAY redirect 1210 the user agent to that resource by sending a 303 (See Other) response 1211 with the existing resource's identifier in the Location field. This 1212 has the benefits of providing the user agent a resource identifier 1213 and transferring the representation via a method more amenable to 1214 shared caching, though at the cost of an extra request if the user 1215 agent does not already have the representation cached. 1217 4.3.4. PUT 1219 The PUT method requests that the state of the target resource be 1220 created or replaced with the state defined by the representation 1221 enclosed in the request message payload. A successful PUT of a given 1222 representation would suggest that a subsequent GET on that same 1223 target resource will result in an equivalent representation being 1224 sent in a 200 (OK) response. However, there is no guarantee that 1225 such a state change will be observable, since the target resource 1226 might be acted upon by other user agents in parallel, or might be 1227 subject to dynamic processing by the origin server, before any 1228 subsequent GET is received. A successful response only implies that 1229 the user agent's intent was achieved at the time of its processing by 1230 the origin server. 1232 If the target resource does not have a current representation and the 1233 PUT successfully creates one, then the origin server MUST inform the 1234 user agent by sending a 201 (Created) response. If the target 1235 resource does have a current representation and that representation 1236 is successfully modified in accordance with the state of the enclosed 1237 representation, then the origin server MUST send either a 200 (OK) or 1238 a 204 (No Content) response to indicate successful completion of the 1239 request. 1241 An origin server SHOULD ignore unrecognized header fields received in 1242 a PUT request (i.e., do not save them as part of the resource state). 1244 An origin server SHOULD verify that the PUT representation is 1245 consistent with any constraints the server has for the target 1246 resource that cannot or will not be changed by the PUT. This is 1247 particularly important when the origin server uses internal 1248 configuration information related to the URI in order to set the 1249 values for representation metadata on GET responses. When a PUT 1250 representation is inconsistent with the target resource, the origin 1251 server SHOULD either make them consistent, by transforming the 1252 representation or changing the resource configuration, or respond 1253 with an appropriate error message containing sufficient information 1254 to explain why the representation is unsuitable. The 409 (Conflict) 1255 or 415 (Unsupported Media Type) status codes are suggested, with the 1256 latter being specific to constraints on Content-Type values. 1258 For example, if the target resource is configured to always have a 1259 Content-Type of "text/html" and the representation being PUT has a 1260 Content-Type of "image/jpeg", the origin server ought to do one of: 1262 a. reconfigure the target resource to reflect the new media type; 1264 b. transform the PUT representation to a format consistent with that 1265 of the resource before saving it as the new resource state; or, 1267 c. reject the request with a 415 (Unsupported Media Type) response 1268 indicating that the target resource is limited to "text/html", 1269 perhaps including a link to a different resource that would be a 1270 suitable target for the new representation. 1272 HTTP does not define exactly how a PUT method affects the state of an 1273 origin server beyond what can be expressed by the intent of the user 1274 agent request and the semantics of the origin server response. It 1275 does not define what a resource might be, in any sense of that word, 1276 beyond the interface provided via HTTP. It does not define how 1277 resource state is "stored", nor how such storage might change as a 1278 result of a change in resource state, nor how the origin server 1279 translates resource state into representations. Generally speaking, 1280 all implementation details behind the resource interface are 1281 intentionally hidden by the server. 1283 An origin server MUST NOT send a validator header field 1284 (Section 7.2), such as an ETag or Last-Modified field, in a 1285 successful response to PUT unless the request's representation data 1286 was saved without any transformation applied to the body (i.e., the 1287 resource's new representation data is identical to the representation 1288 data received in the PUT request) and the validator field value 1289 reflects the new representation. This requirement allows a user 1290 agent to know when the representation body it has in memory remains 1291 current as a result of the PUT, thus not in need of being retrieved 1292 again from the origin server, and that the new validator(s) received 1293 in the response can be used for future conditional requests in order 1294 to prevent accidental overwrites (Section 5.2). 1296 The fundamental difference between the POST and PUT methods is 1297 highlighted by the different intent for the enclosed representation. 1298 The target resource in a POST request is intended to handle the 1299 enclosed representation according to the resource's own semantics, 1300 whereas the enclosed representation in a PUT request is defined as 1301 replacing the state of the target resource. Hence, the intent of PUT 1302 is idempotent and visible to intermediaries, even though the exact 1303 effect is only known by the origin server. 1305 Proper interpretation of a PUT request presumes that the user agent 1306 knows which target resource is desired. A service that selects a 1307 proper URI on behalf of the client, after receiving a state-changing 1308 request, SHOULD be implemented using the POST method rather than PUT. 1309 If the origin server will not make the requested PUT state change to 1310 the target resource and instead wishes to have it applied to a 1311 different resource, such as when the resource has been moved to a 1312 different URI, then the origin server MUST send an appropriate 3xx 1313 (Redirection) response; the user agent MAY then make its own decision 1314 regarding whether or not to redirect the request. 1316 A PUT request applied to the target resource can have side effects on 1317 other resources. For example, an article might have a URI for 1318 identifying "the current version" (a resource) that is separate from 1319 the URIs identifying each particular version (different resources 1320 that at one point shared the same state as the current version 1321 resource). A successful PUT request on "the current version" URI 1322 might therefore create a new version resource in addition to changing 1323 the state of the target resource, and might also cause links to be 1324 added between the related resources. 1326 An origin server that allows PUT on a given target resource MUST send 1327 a 400 (Bad Request) response to a PUT request that contains a 1328 Content-Range header field (Section 4.2 of [RANGERQ]), since the 1329 payload is likely to be partial content that has been mistakenly PUT 1330 as a full representation. Partial content updates are possible by 1331 targeting a separately identified resource with state that overlaps a 1332 portion of the larger resource, or by using a different method that 1333 has been specifically defined for partial updates (for example, the 1334 PATCH method defined in [RFC5789]). 1336 Responses to the PUT method are not cacheable. If a successful PUT 1337 request passes through a cache that has one or more stored responses 1338 for the effective request URI, those stored responses will be 1339 invalidated (see Section 4.4 of [CACHING]). 1341 4.3.5. DELETE 1343 The DELETE method requests that the origin server remove the 1344 association between the target resource and its current 1345 functionality. In effect, this method is similar to the rm command 1346 in UNIX: it expresses a deletion operation on the URI mapping of the 1347 origin server rather than an expectation that the previously 1348 associated information be deleted. 1350 If the target resource has one or more current representations, they 1351 might or might not be destroyed by the origin server, and the 1352 associated storage might or might not be reclaimed, depending 1353 entirely on the nature of the resource and its implementation by the 1354 origin server (which are beyond the scope of this specification). 1355 Likewise, other implementation aspects of a resource might need to be 1356 deactivated or archived as a result of a DELETE, such as database or 1357 gateway connections. In general, it is assumed that the origin 1358 server will only allow DELETE on resources for which it has a 1359 prescribed mechanism for accomplishing the deletion. 1361 Relatively few resources allow the DELETE method -- its primary use 1362 is for remote authoring environments, where the user has some 1363 direction regarding its effect. For example, a resource that was 1364 previously created using a PUT request, or identified via the 1365 Location header field after a 201 (Created) response to a POST 1366 request, might allow a corresponding DELETE request to undo those 1367 actions. Similarly, custom user agent implementations that implement 1368 an authoring function, such as revision control clients using HTTP 1369 for remote operations, might use DELETE based on an assumption that 1370 the server's URI space has been crafted to correspond to a version 1371 repository. 1373 If a DELETE method is successfully applied, the origin server SHOULD 1374 send a 202 (Accepted) status code if the action will likely succeed 1375 but has not yet been enacted, a 204 (No Content) status code if the 1376 action has been enacted and no further information is to be supplied, 1377 or a 200 (OK) status code if the action has been enacted and the 1378 response message includes a representation describing the status. 1380 A payload within a DELETE request message has no defined semantics; 1381 sending a payload body on a DELETE request might cause some existing 1382 implementations to reject the request. 1384 Responses to the DELETE method are not cacheable. If a DELETE 1385 request passes through a cache that has one or more stored responses 1386 for the effective request URI, those stored responses will be 1387 invalidated (see Section 4.4 of [CACHING]). 1389 4.3.6. CONNECT 1391 The CONNECT method requests that the recipient establish a tunnel to 1392 the destination origin server identified by the request-target and, 1393 if successful, thereafter restrict its behavior to blind forwarding 1394 of packets, in both directions, until the tunnel is closed. Tunnels 1395 are commonly used to create an end-to-end virtual connection, through 1396 one or more proxies, which can then be secured using TLS (Transport 1397 Layer Security, [RFC5246]). 1399 CONNECT is intended only for use in requests to a proxy. An origin 1400 server that receives a CONNECT request for itself MAY respond with a 1401 2xx (Successful) status code to indicate that a connection is 1402 established. However, most origin servers do not implement CONNECT. 1404 A client sending a CONNECT request MUST send the authority form of 1405 request-target (Section 5.3 of [MESSGNG]); i.e., the request-target 1406 consists of only the host name and port number of the tunnel 1407 destination, separated by a colon. For example, 1409 CONNECT server.example.com:80 HTTP/1.1 1410 Host: server.example.com:80 1412 The recipient proxy can establish a tunnel either by directly 1413 connecting to the request-target or, if configured to use another 1414 proxy, by forwarding the CONNECT request to the next inbound proxy. 1416 Any 2xx (Successful) response indicates that the sender (and all 1417 inbound proxies) will switch to tunnel mode immediately after the 1418 blank line that concludes the successful response's header section; 1419 data received after that blank line is from the server identified by 1420 the request-target. Any response other than a successful response 1421 indicates that the tunnel has not yet been formed and that the 1422 connection remains governed by HTTP. 1424 A tunnel is closed when a tunnel intermediary detects that either 1425 side has closed its connection: the intermediary MUST attempt to send 1426 any outstanding data that came from the closed side to the other 1427 side, close both connections, and then discard any remaining data 1428 left undelivered. 1430 Proxy authentication might be used to establish the authority to 1431 create a tunnel. For example, 1433 CONNECT server.example.com:80 HTTP/1.1 1434 Host: server.example.com:80 1435 Proxy-Authorization: basic aGVsbG86d29ybGQ= 1437 There are significant risks in establishing a tunnel to arbitrary 1438 servers, particularly when the destination is a well-known or 1439 reserved TCP port that is not intended for Web traffic. For example, 1440 a CONNECT to a request-target of "example.com:25" would suggest that 1441 the proxy connect to the reserved port for SMTP traffic; if allowed, 1442 that could trick the proxy into relaying spam email. Proxies that 1443 support CONNECT SHOULD restrict its use to a limited set of known 1444 ports or a configurable whitelist of safe request targets. 1446 A server MUST NOT send any Transfer-Encoding or Content-Length header 1447 fields in a 2xx (Successful) response to CONNECT. A client MUST 1448 ignore any Content-Length or Transfer-Encoding header fields received 1449 in a successful response to CONNECT. 1451 A payload within a CONNECT request message has no defined semantics; 1452 sending a payload body on a CONNECT request might cause some existing 1453 implementations to reject the request. 1455 Responses to the CONNECT method are not cacheable. 1457 4.3.7. OPTIONS 1459 The OPTIONS method requests information about the communication 1460 options available for the target resource, at either the origin 1461 server or an intervening intermediary. This method allows a client 1462 to determine the options and/or requirements associated with a 1463 resource, or the capabilities of a server, without implying a 1464 resource action. 1466 An OPTIONS request with an asterisk ("*") as the request-target 1467 (Section 5.3 of [MESSGNG]) applies to the server in general rather 1468 than to a specific resource. Since a server's communication options 1469 typically depend on the resource, the "*" request is only useful as a 1470 "ping" or "no-op" type of method; it does nothing beyond allowing the 1471 client to test the capabilities of the server. For example, this can 1472 be used to test a proxy for HTTP/1.1 conformance (or lack thereof). 1474 If the request-target is not an asterisk, the OPTIONS request applies 1475 to the options that are available when communicating with the target 1476 resource. 1478 A server generating a successful response to OPTIONS SHOULD send any 1479 header fields that might indicate optional features implemented by 1480 the server and applicable to the target resource (e.g., Allow), 1481 including potential extensions not defined by this specification. 1482 The response payload, if any, might also describe the communication 1483 options in a machine or human-readable representation. A standard 1484 format for such a representation is not defined by this 1485 specification, but might be defined by future extensions to HTTP. A 1486 server MUST generate a Content-Length field with a value of "0" if no 1487 payload body is to be sent in the response. 1489 A client MAY send a Max-Forwards header field in an OPTIONS request 1490 to target a specific recipient in the request chain (see 1491 Section 5.1.2). A proxy MUST NOT generate a Max-Forwards header 1492 field while forwarding a request unless that request was received 1493 with a Max-Forwards field. 1495 A client that generates an OPTIONS request containing a payload body 1496 MUST send a valid Content-Type header field describing the 1497 representation media type. Although this specification does not 1498 define any use for such a payload, future extensions to HTTP might 1499 use the OPTIONS body to make more detailed queries about the target 1500 resource. 1502 Responses to the OPTIONS method are not cacheable. 1504 4.3.8. TRACE 1506 The TRACE method requests a remote, application-level loop-back of 1507 the request message. The final recipient of the request SHOULD 1508 reflect the message received, excluding some fields described below, 1509 back to the client as the message body of a 200 (OK) response with a 1510 Content-Type of "message/http" (Section 8.3.1 of [MESSGNG]). The 1511 final recipient is either the origin server or the first server to 1512 receive a Max-Forwards value of zero (0) in the request 1513 (Section 5.1.2). 1515 A client MUST NOT generate header fields in a TRACE request 1516 containing sensitive data that might be disclosed by the response. 1517 For example, it would be foolish for a user agent to send stored user 1518 credentials [AUTHFRM] or cookies [RFC6265] in a TRACE request. The 1519 final recipient of the request SHOULD exclude any request header 1520 fields that are likely to contain sensitive data when that recipient 1521 generates the response body. 1523 TRACE allows the client to see what is being received at the other 1524 end of the request chain and use that data for testing or diagnostic 1525 information. The value of the Via header field (Section 5.7.1 of 1526 [MESSGNG]) is of particular interest, since it acts as a trace of the 1527 request chain. Use of the Max-Forwards header field allows the 1528 client to limit the length of the request chain, which is useful for 1529 testing a chain of proxies forwarding messages in an infinite loop. 1531 A client MUST NOT send a message body in a TRACE request. 1533 Responses to the TRACE method are not cacheable. 1535 5. Request Header Fields 1537 A client sends request header fields to provide more information 1538 about the request context, make the request conditional based on the 1539 target resource state, suggest preferred formats for the response, 1540 supply authentication credentials, or modify the expected request 1541 processing. These fields act as request modifiers, similar to the 1542 parameters on a programming language method invocation. 1544 5.1. Controls 1546 Controls are request header fields that direct specific handling of 1547 the request. 1549 +-------------------+--------------------------+ 1550 | Header Field Name | Defined in... | 1551 +-------------------+--------------------------+ 1552 | Cache-Control | Section 5.2 of [CACHING] | 1553 | Expect | Section 5.1.1 | 1554 | Host | Section 5.4 of [MESSGNG] | 1555 | Max-Forwards | Section 5.1.2 | 1556 | Pragma | Section 5.4 of [CACHING] | 1557 | Range | Section 3.1 of [RANGERQ] | 1558 | TE | Section 4.3 of [MESSGNG] | 1559 +-------------------+--------------------------+ 1561 5.1.1. Expect 1563 The "Expect" header field in a request indicates a certain set of 1564 behaviors (expectations) that need to be supported by the server in 1565 order to properly handle this request. The only such expectation 1566 defined by this specification is 100-continue. 1568 Expect = "100-continue" 1570 The Expect field-value is case-insensitive. 1572 A server that receives an Expect field-value other than 100-continue 1573 MAY respond with a 417 (Expectation Failed) status code to indicate 1574 that the unexpected expectation cannot be met. 1576 A 100-continue expectation informs recipients that the client is 1577 about to send a (presumably large) message body in this request and 1578 wishes to receive a 100 (Continue) interim response if the request- 1579 line and header fields are not sufficient to cause an immediate 1580 success, redirect, or error response. This allows the client to wait 1581 for an indication that it is worthwhile to send the message body 1582 before actually doing so, which can improve efficiency when the 1583 message body is huge or when the client anticipates that an error is 1584 likely (e.g., when sending a state-changing method, for the first 1585 time, without previously verified authentication credentials). 1587 For example, a request that begins with 1589 PUT /somewhere/fun HTTP/1.1 1590 Host: origin.example.com 1591 Content-Type: video/h264 1592 Content-Length: 1234567890987 1593 Expect: 100-continue 1595 allows the origin server to immediately respond with an error 1596 message, such as 401 (Unauthorized) or 405 (Method Not Allowed), 1597 before the client starts filling the pipes with an unnecessary data 1598 transfer. 1600 Requirements for clients: 1602 o A client MUST NOT generate a 100-continue expectation in a request 1603 that does not include a message body. 1605 o A client that will wait for a 100 (Continue) response before 1606 sending the request message body MUST send an Expect header field 1607 containing a 100-continue expectation. 1609 o A client that sends a 100-continue expectation is not required to 1610 wait for any specific length of time; such a client MAY proceed to 1611 send the message body even if it has not yet received a response. 1612 Furthermore, since 100 (Continue) responses cannot be sent through 1613 an HTTP/1.0 intermediary, such a client SHOULD NOT wait for an 1614 indefinite period before sending the message body. 1616 o A client that receives a 417 (Expectation Failed) status code in 1617 response to a request containing a 100-continue expectation SHOULD 1618 repeat that request without a 100-continue expectation, since the 1619 417 response merely indicates that the response chain does not 1620 support expectations (e.g., it passes through an HTTP/1.0 server). 1622 Requirements for servers: 1624 o A server that receives a 100-continue expectation in an HTTP/1.0 1625 request MUST ignore that expectation. 1627 o A server MAY omit sending a 100 (Continue) response if it has 1628 already received some or all of the message body for the 1629 corresponding request, or if the framing indicates that there is 1630 no message body. 1632 o A server that sends a 100 (Continue) response MUST ultimately send 1633 a final status code, once the message body is received and 1634 processed, unless the connection is closed prematurely. 1636 o A server that responds with a final status code before reading the 1637 entire message body SHOULD indicate in that response whether it 1638 intends to close the connection or continue reading and discarding 1639 the request message (see Section 6.6 of [MESSGNG]). 1641 An origin server MUST, upon receiving an HTTP/1.1 (or later) request- 1642 line and a complete header section that contains a 100-continue 1643 expectation and indicates a request message body will follow, either 1644 send an immediate response with a final status code, if that status 1645 can be determined by examining just the request-line and header 1646 fields, or send an immediate 100 (Continue) response to encourage the 1647 client to send the request's message body. The origin server MUST 1648 NOT wait for the message body before sending the 100 (Continue) 1649 response. 1651 A proxy MUST, upon receiving an HTTP/1.1 (or later) request-line and 1652 a complete header section that contains a 100-continue expectation 1653 and indicates a request message body will follow, either send an 1654 immediate response with a final status code, if that status can be 1655 determined by examining just the request-line and header fields, or 1656 begin forwarding the request toward the origin server by sending a 1657 corresponding request-line and header section to the next inbound 1658 server. If the proxy believes (from configuration or past 1659 interaction) that the next inbound server only supports HTTP/1.0, the 1660 proxy MAY generate an immediate 100 (Continue) response to encourage 1661 the client to begin sending the message body. 1663 Note: The Expect header field was added after the original 1664 publication of HTTP/1.1 [RFC2068] as both the means to request an 1665 interim 100 (Continue) response and the general mechanism for 1666 indicating must-understand extensions. However, the extension 1667 mechanism has not been used by clients and the must-understand 1668 requirements have not been implemented by many servers, rendering 1669 the extension mechanism useless. This specification has removed 1670 the extension mechanism in order to simplify the definition and 1671 processing of 100-continue. 1673 5.1.2. Max-Forwards 1675 The "Max-Forwards" header field provides a mechanism with the TRACE 1676 (Section 4.3.8) and OPTIONS (Section 4.3.7) request methods to limit 1677 the number of times that the request is forwarded by proxies. This 1678 can be useful when the client is attempting to trace a request that 1679 appears to be failing or looping mid-chain. 1681 Max-Forwards = 1*DIGIT 1683 The Max-Forwards value is a decimal integer indicating the remaining 1684 number of times this request message can be forwarded. 1686 Each intermediary that receives a TRACE or OPTIONS request containing 1687 a Max-Forwards header field MUST check and update its value prior to 1688 forwarding the request. If the received value is zero (0), the 1689 intermediary MUST NOT forward the request; instead, the intermediary 1690 MUST respond as the final recipient. If the received Max-Forwards 1691 value is greater than zero, the intermediary MUST generate an updated 1692 Max-Forwards field in the forwarded message with a field-value that 1693 is the lesser of a) the received value decremented by one (1) or b) 1694 the recipient's maximum supported value for Max-Forwards. 1696 A recipient MAY ignore a Max-Forwards header field received with any 1697 other request methods. 1699 5.2. Conditionals 1701 The HTTP conditional request header fields [CONDTNL] allow a client 1702 to place a precondition on the state of the target resource, so that 1703 the action corresponding to the method semantics will not be applied 1704 if the precondition evaluates to false. Each precondition defined by 1705 this specification consists of a comparison between a set of 1706 validators obtained from prior representations of the target resource 1707 to the current state of validators for the selected representation 1708 (Section 7.2). Hence, these preconditions evaluate whether the state 1709 of the target resource has changed since a given state known by the 1710 client. The effect of such an evaluation depends on the method 1711 semantics and choice of conditional, as defined in Section 5 of 1712 [CONDTNL]. 1714 +---------------------+--------------------------+ 1715 | Header Field Name | Defined in... | 1716 +---------------------+--------------------------+ 1717 | If-Match | Section 3.1 of [CONDTNL] | 1718 | If-None-Match | Section 3.2 of [CONDTNL] | 1719 | If-Modified-Since | Section 3.3 of [CONDTNL] | 1720 | If-Unmodified-Since | Section 3.4 of [CONDTNL] | 1721 | If-Range | Section 3.2 of [RANGERQ] | 1722 +---------------------+--------------------------+ 1724 5.3. Content Negotiation 1726 The following request header fields are sent by a user agent to 1727 engage in proactive negotiation of the response content, as defined 1728 in Section 3.4.1. The preferences sent in these fields apply to any 1729 content in the response, including representations of the target 1730 resource, representations of error or processing status, and 1731 potentially even the miscellaneous text strings that might appear 1732 within the protocol. 1734 +-------------------+---------------+ 1735 | Header Field Name | Defined in... | 1736 +-------------------+---------------+ 1737 | Accept | Section 5.3.2 | 1738 | Accept-Charset | Section 5.3.3 | 1739 | Accept-Encoding | Section 5.3.4 | 1740 | Accept-Language | Section 5.3.5 | 1741 +-------------------+---------------+ 1743 5.3.1. Quality Values 1745 Many of the request header fields for proactive negotiation use a 1746 common parameter, named "q" (case-insensitive), to assign a relative 1747 "weight" to the preference for that associated kind of content. This 1748 weight is referred to as a "quality value" (or "qvalue") because the 1749 same parameter name is often used within server configurations to 1750 assign a weight to the relative quality of the various 1751 representations that can be selected for a resource. 1753 The weight is normalized to a real number in the range 0 through 1, 1754 where 0.001 is the least preferred and 1 is the most preferred; a 1755 value of 0 means "not acceptable". If no "q" parameter is present, 1756 the default weight is 1. 1758 weight = OWS ";" OWS "q=" qvalue 1759 qvalue = ( "0" [ "." 0*3DIGIT ] ) 1760 / ( "1" [ "." 0*3("0") ] ) 1762 A sender of qvalue MUST NOT generate more than three digits after the 1763 decimal point. User configuration of these values ought to be 1764 limited in the same fashion. 1766 5.3.2. Accept 1768 The "Accept" header field can be used by user agents to specify 1769 response media types that are acceptable. Accept header fields can 1770 be used to indicate that the request is specifically limited to a 1771 small set of desired types, as in the case of a request for an in- 1772 line image. 1774 Accept = #( media-range [ accept-params ] ) 1776 media-range = ( "*/*" 1777 / ( type "/" "*" ) 1778 / ( type "/" subtype ) 1779 ) *( OWS ";" OWS parameter ) 1780 accept-params = weight *( accept-ext ) 1781 accept-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ] 1783 The asterisk "*" character is used to group media types into ranges, 1784 with "*/*" indicating all media types and "type/*" indicating all 1785 subtypes of that type. The media-range can include media type 1786 parameters that are applicable to that range. 1788 Each media-range might be followed by zero or more applicable media 1789 type parameters (e.g., charset), an optional "q" parameter for 1790 indicating a relative weight (Section 5.3.1), and then zero or more 1791 extension parameters. The "q" parameter is necessary if any 1792 extensions (accept-ext) are present, since it acts as a separator 1793 between the two parameter sets. 1795 Note: Use of the "q" parameter name to separate media type 1796 parameters from Accept extension parameters is due to historical 1797 practice. Although this prevents any media type parameter named 1798 "q" from being used with a media range, such an event is believed 1799 to be unlikely given the lack of any "q" parameters in the IANA 1800 media type registry and the rare usage of any media type 1801 parameters in Accept. Future media types are discouraged from 1802 registering any parameter named "q". 1804 The example 1806 Accept: audio/*; q=0.2, audio/basic 1808 is interpreted as "I prefer audio/basic, but send me any audio type 1809 if it is the best available after an 80% markdown in quality". 1811 A request without any Accept header field implies that the user agent 1812 will accept any media type in response. If the header field is 1813 present in a request and none of the available representations for 1814 the response have a media type that is listed as acceptable, the 1815 origin server can either honor the header field by sending a 406 (Not 1816 Acceptable) response or disregard the header field by treating the 1817 response as if it is not subject to content negotiation. 1819 A more elaborate example is 1821 Accept: text/plain; q=0.5, text/html, 1822 text/x-dvi; q=0.8, text/x-c 1824 Verbally, this would be interpreted as "text/html and text/x-c are 1825 the equally preferred media types, but if they do not exist, then 1826 send the text/x-dvi representation, and if that does not exist, send 1827 the text/plain representation". 1829 Media ranges can be overridden by more specific media ranges or 1830 specific media types. If more than one media range applies to a 1831 given type, the most specific reference has precedence. For example, 1833 Accept: text/*, text/plain, text/plain;format=flowed, */* 1835 have the following precedence: 1837 1. text/plain;format=flowed 1839 2. text/plain 1841 3. text/* 1843 4. */* 1845 The media type quality factor associated with a given type is 1846 determined by finding the media range with the highest precedence 1847 that matches the type. For example, 1849 Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1, 1850 text/html;level=2;q=0.4, */*;q=0.5 1852 would cause the following values to be associated: 1854 +-------------------+---------------+ 1855 | Media Type | Quality Value | 1856 +-------------------+---------------+ 1857 | text/html;level=1 | 1 | 1858 | text/html | 0.7 | 1859 | text/plain | 0.3 | 1860 | image/jpeg | 0.5 | 1861 | text/html;level=2 | 0.4 | 1862 | text/html;level=3 | 0.7 | 1863 +-------------------+---------------+ 1865 Note: A user agent might be provided with a default set of quality 1866 values for certain media ranges. However, unless the user agent is a 1867 closed system that cannot interact with other rendering agents, this 1868 default set ought to be configurable by the user. 1870 5.3.3. Accept-Charset 1872 The "Accept-Charset" header field can be sent by a user agent to 1873 indicate what charsets are acceptable in textual response content. 1874 This field allows user agents capable of understanding more 1875 comprehensive or special-purpose charsets to signal that capability 1876 to an origin server that is capable of representing information in 1877 those charsets. 1879 Accept-Charset = 1#( ( charset / "*" ) [ weight ] ) 1881 Charset names are defined in Section 3.1.1.2. A user agent MAY 1882 associate a quality value with each charset to indicate the user's 1883 relative preference for that charset, as defined in Section 5.3.1. 1884 An example is 1886 Accept-Charset: iso-8859-5, unicode-1-1;q=0.8 1888 The special value "*", if present in the Accept-Charset field, 1889 matches every charset that is not mentioned elsewhere in the Accept- 1890 Charset field. If no "*" is present in an Accept-Charset field, then 1891 any charsets not explicitly mentioned in the field are considered 1892 "not acceptable" to the client. 1894 A request without any Accept-Charset header field implies that the 1895 user agent will accept any charset in response. Most general-purpose 1896 user agents do not send Accept-Charset, unless specifically 1897 configured to do so, because a detailed list of supported charsets 1898 makes it easier for a server to identify an individual by virtue of 1899 the user agent's request characteristics (Section 9.7). 1901 If an Accept-Charset header field is present in a request and none of 1902 the available representations for the response has a charset that is 1903 listed as acceptable, the origin server can either honor the header 1904 field, by sending a 406 (Not Acceptable) response, or disregard the 1905 header field by treating the resource as if it is not subject to 1906 content negotiation. 1908 5.3.4. Accept-Encoding 1910 The "Accept-Encoding" header field can be used by user agents to 1911 indicate what response content-codings (Section 3.1.2.1) are 1912 acceptable in the response. An "identity" token is used as a synonym 1913 for "no encoding" in order to communicate when no encoding is 1914 preferred. 1916 Accept-Encoding = #( codings [ weight ] ) 1917 codings = content-coding / "identity" / "*" 1919 Each codings value MAY be given an associated quality value 1920 representing the preference for that encoding, as defined in 1921 Section 5.3.1. The asterisk "*" symbol in an Accept-Encoding field 1922 matches any available content-coding not explicitly listed in the 1923 header field. 1925 For example, 1927 Accept-Encoding: compress, gzip 1928 Accept-Encoding: 1929 Accept-Encoding: * 1930 Accept-Encoding: compress;q=0.5, gzip;q=1.0 1931 Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0 1933 A request without an Accept-Encoding header field implies that the 1934 user agent has no preferences regarding content-codings. Although 1935 this allows the server to use any content-coding in a response, it 1936 does not imply that the user agent will be able to correctly process 1937 all encodings. 1939 A server tests whether a content-coding for a given representation is 1940 acceptable using these rules: 1942 1. If no Accept-Encoding field is in the request, any content-coding 1943 is considered acceptable by the user agent. 1945 2. If the representation has no content-coding, then it is 1946 acceptable by default unless specifically excluded by the Accept- 1947 Encoding field stating either "identity;q=0" or "*;q=0" without a 1948 more specific entry for "identity". 1950 3. If the representation's content-coding is one of the content- 1951 codings listed in the Accept-Encoding field, then it is 1952 acceptable unless it is accompanied by a qvalue of 0. (As 1953 defined in Section 5.3.1, a qvalue of 0 means "not acceptable".) 1955 4. If multiple content-codings are acceptable, then the acceptable 1956 content-coding with the highest non-zero qvalue is preferred. 1958 An Accept-Encoding header field with a combined field-value that is 1959 empty implies that the user agent does not want any content-coding in 1960 response. If an Accept-Encoding header field is present in a request 1961 and none of the available representations for the response have a 1962 content-coding that is listed as acceptable, the origin server SHOULD 1963 send a response without any content-coding. 1965 Note: Most HTTP/1.0 applications do not recognize or obey qvalues 1966 associated with content-codings. This means that qvalues might 1967 not work and are not permitted with x-gzip or x-compress. 1969 5.3.5. Accept-Language 1971 The "Accept-Language" header field can be used by user agents to 1972 indicate the set of natural languages that are preferred in the 1973 response. Language tags are defined in Section 3.1.3.1. 1975 Accept-Language = 1#( language-range [ weight ] ) 1976 language-range = 1977 1979 Each language-range can be given an associated quality value 1980 representing an estimate of the user's preference for the languages 1981 specified by that range, as defined in Section 5.3.1. For example, 1983 Accept-Language: da, en-gb;q=0.8, en;q=0.7 1985 would mean: "I prefer Danish, but will accept British English and 1986 other types of English". 1988 A request without any Accept-Language header field implies that the 1989 user agent will accept any language in response. If the header field 1990 is present in a request and none of the available representations for 1991 the response have a matching language tag, the origin server can 1992 either disregard the header field by treating the response as if it 1993 is not subject to content negotiation or honor the header field by 1994 sending a 406 (Not Acceptable) response. However, the latter is not 1995 encouraged, as doing so can prevent users from accessing content that 1996 they might be able to use (with translation software, for example). 1998 Note that some recipients treat the order in which language tags are 1999 listed as an indication of descending priority, particularly for tags 2000 that are assigned equal quality values (no value is the same as q=1). 2001 However, this behavior cannot be relied upon. For consistency and to 2002 maximize interoperability, many user agents assign each language tag 2003 a unique quality value while also listing them in order of decreasing 2004 quality. Additional discussion of language priority lists can be 2005 found in Section 2.3 of [RFC4647]. 2007 For matching, Section 3 of [RFC4647] defines several matching 2008 schemes. Implementations can offer the most appropriate matching 2009 scheme for their requirements. The "Basic Filtering" scheme 2010 ([RFC4647], Section 3.3.1) is identical to the matching scheme that 2011 was previously defined for HTTP in Section 14.4 of [RFC2616]. 2013 It might be contrary to the privacy expectations of the user to send 2014 an Accept-Language header field with the complete linguistic 2015 preferences of the user in every request (Section 9.7). 2017 Since intelligibility is highly dependent on the individual user, 2018 user agents need to allow user control over the linguistic preference 2019 (either through configuration of the user agent itself or by 2020 defaulting to a user controllable system setting). A user agent that 2021 does not provide such control to the user MUST NOT send an Accept- 2022 Language header field. 2024 Note: User agents ought to provide guidance to users when setting 2025 a preference, since users are rarely familiar with the details of 2026 language matching as described above. For example, users might 2027 assume that on selecting "en-gb", they will be served any kind of 2028 English document if British English is not available. A user 2029 agent might suggest, in such a case, to add "en" to the list for 2030 better matching behavior. 2032 5.4. Authentication Credentials 2034 Two header fields are used for carrying authentication credentials, 2035 as defined in [AUTHFRM]. Note that various custom mechanisms for 2036 user authentication use the Cookie header field for this purpose, as 2037 defined in [RFC6265]. 2039 +---------------------+--------------------------+ 2040 | Header Field Name | Defined in... | 2041 +---------------------+--------------------------+ 2042 | Authorization | Section 4.2 of [AUTHFRM] | 2043 | Proxy-Authorization | Section 4.4 of [AUTHFRM] | 2044 +---------------------+--------------------------+ 2046 5.5. Request Context 2048 The following request header fields provide additional information 2049 about the request context, including information about the user, user 2050 agent, and resource behind the request. 2052 +-------------------+---------------+ 2053 | Header Field Name | Defined in... | 2054 +-------------------+---------------+ 2055 | From | Section 5.5.1 | 2056 | Referer | Section 5.5.2 | 2057 | User-Agent | Section 5.5.3 | 2058 +-------------------+---------------+ 2060 5.5.1. From 2062 The "From" header field contains an Internet email address for a 2063 human user who controls the requesting user agent. The address ought 2064 to be machine-usable, as defined by "mailbox" in Section 3.4 of 2065 [RFC5322]: 2067 From = mailbox 2069 mailbox = 2071 An example is: 2073 From: webmaster@example.org 2075 The From header field is rarely sent by non-robotic user agents. A 2076 user agent SHOULD NOT send a From header field without explicit 2077 configuration by the user, since that might conflict with the user's 2078 privacy interests or their site's security policy. 2080 A robotic user agent SHOULD send a valid From header field so that 2081 the person responsible for running the robot can be contacted if 2082 problems occur on servers, such as if the robot is sending excessive, 2083 unwanted, or invalid requests. 2085 A server SHOULD NOT use the From header field for access control or 2086 authentication, since most recipients will assume that the field 2087 value is public information. 2089 5.5.2. Referer 2091 The "Referer" [sic] header field allows the user agent to specify a 2092 URI reference for the resource from which the target URI was obtained 2093 (i.e., the "referrer", though the field name is misspelled). A user 2094 agent MUST NOT include the fragment and userinfo components of the 2095 URI reference [RFC3986], if any, when generating the Referer field 2096 value. 2098 Referer = absolute-URI / partial-URI 2100 The Referer header field allows servers to generate back-links to 2101 other resources for simple analytics, logging, optimized caching, 2102 etc. It also allows obsolete or mistyped links to be found for 2103 maintenance. Some servers use the Referer header field as a means of 2104 denying links from other sites (so-called "deep linking") or 2105 restricting cross-site request forgery (CSRF), but not all requests 2106 contain it. 2108 Example: 2110 Referer: http://www.example.org/hypertext/Overview.html 2112 If the target URI was obtained from a source that does not have its 2113 own URI (e.g., input from the user keyboard, or an entry within the 2114 user's bookmarks/favorites), the user agent MUST either exclude the 2115 Referer field or send it with a value of "about:blank". 2117 The Referer field has the potential to reveal information about the 2118 request context or browsing history of the user, which is a privacy 2119 concern if the referring resource's identifier reveals personal 2120 information (such as an account name) or a resource that is supposed 2121 to be confidential (such as behind a firewall or internal to a 2122 secured service). Most general-purpose user agents do not send the 2123 Referer header field when the referring resource is a local "file" or 2124 "data" URI. A user agent MUST NOT send a Referer header field in an 2125 unsecured HTTP request if the referring page was received with a 2126 secure protocol. See Section 9.4 for additional security 2127 considerations. 2129 Some intermediaries have been known to indiscriminately remove 2130 Referer header fields from outgoing requests. This has the 2131 unfortunate side effect of interfering with protection against CSRF 2132 attacks, which can be far more harmful to their users. 2133 Intermediaries and user agent extensions that wish to limit 2134 information disclosure in Referer ought to restrict their changes to 2135 specific edits, such as replacing internal domain names with 2136 pseudonyms or truncating the query and/or path components. An 2137 intermediary SHOULD NOT modify or delete the Referer header field 2138 when the field value shares the same scheme and host as the request 2139 target. 2141 5.5.3. User-Agent 2143 The "User-Agent" header field contains information about the user 2144 agent originating the request, which is often used by servers to help 2145 identify the scope of reported interoperability problems, to work 2146 around or tailor responses to avoid particular user agent 2147 limitations, and for analytics regarding browser or operating system 2148 use. A user agent SHOULD send a User-Agent field in each request 2149 unless specifically configured not to do so. 2151 User-Agent = product *( RWS ( product / comment ) ) 2153 The User-Agent field-value consists of one or more product 2154 identifiers, each followed by zero or more comments (Section 3.2 of 2155 [MESSGNG]), which together identify the user agent software and its 2156 significant subproducts. By convention, the product identifiers are 2157 listed in decreasing order of their significance for identifying the 2158 user agent software. Each product identifier consists of a name and 2159 optional version. 2161 product = token ["/" product-version] 2162 product-version = token 2164 A sender SHOULD limit generated product identifiers to what is 2165 necessary to identify the product; a sender MUST NOT generate 2166 advertising or other nonessential information within the product 2167 identifier. A sender SHOULD NOT generate information in product- 2168 version that is not a version identifier (i.e., successive versions 2169 of the same product name ought to differ only in the product-version 2170 portion of the product identifier). 2172 Example: 2174 User-Agent: CERN-LineMode/2.15 libwww/2.17b3 2176 A user agent SHOULD NOT generate a User-Agent field containing 2177 needlessly fine-grained detail and SHOULD limit the addition of 2178 subproducts by third parties. Overly long and detailed User-Agent 2179 field values increase request latency and the risk of a user being 2180 identified against their wishes ("fingerprinting"). 2182 Likewise, implementations are encouraged not to use the product 2183 tokens of other implementations in order to declare compatibility 2184 with them, as this circumvents the purpose of the field. If a user 2185 agent masquerades as a different user agent, recipients can assume 2186 that the user intentionally desires to see responses tailored for 2187 that identified user agent, even if they might not work as well for 2188 the actual user agent being used. 2190 6. Response Status Codes 2192 The status-code element is a three-digit integer code giving the 2193 result of the attempt to understand and satisfy the request. 2195 HTTP status codes are extensible. HTTP clients are not required to 2196 understand the meaning of all registered status codes, though such 2197 understanding is obviously desirable. However, a client MUST 2198 understand the class of any status code, as indicated by the first 2199 digit, and treat an unrecognized status code as being equivalent to 2200 the x00 status code of that class, with the exception that a 2201 recipient MUST NOT cache a response with an unrecognized status code. 2203 For example, if an unrecognized status code of 471 is received by a 2204 client, the client can assume that there was something wrong with its 2205 request and treat the response as if it had received a 400 (Bad 2206 Request) status code. The response message will usually contain a 2207 representation that explains the status. 2209 The first digit of the status-code defines the class of response. 2210 The last two digits do not have any categorization role. There are 2211 five values for the first digit: 2213 o 1xx (Informational): The request was received, continuing process 2215 o 2xx (Successful): The request was successfully received, 2216 understood, and accepted 2218 o 3xx (Redirection): Further action needs to be taken in order to 2219 complete the request 2221 o 4xx (Client Error): The request contains bad syntax or cannot be 2222 fulfilled 2224 o 5xx (Server Error): The server failed to fulfill an apparently 2225 valid request 2227 6.1. Overview of Status Codes 2229 The status codes listed below are defined in this specification, 2230 Section 4 of [CONDTNL], Section 4 of [RANGERQ], and Section 3 of 2231 [AUTHFRM]. The reason phrases listed here are only recommendations 2232 -- they can be replaced by local equivalents without affecting the 2233 protocol. 2235 Responses with status codes that are defined as cacheable by default 2236 (e.g., 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, and 501 in 2237 this specification) can be reused by a cache with heuristic 2238 expiration unless otherwise indicated by the method definition or 2239 explicit cache controls [CACHING]; all other status codes are not 2240 cacheable by default. 2242 +------+-------------------------------+--------------------------+ 2243 | Code | Reason-Phrase | Defined in... | 2244 +------+-------------------------------+--------------------------+ 2245 | 100 | Continue | Section 6.2.1 | 2246 | 101 | Switching Protocols | Section 6.2.2 | 2247 | 200 | OK | Section 6.3.1 | 2248 | 201 | Created | Section 6.3.2 | 2249 | 202 | Accepted | Section 6.3.3 | 2250 | 203 | Non-Authoritative Information | Section 6.3.4 | 2251 | 204 | No Content | Section 6.3.5 | 2252 | 205 | Reset Content | Section 6.3.6 | 2253 | 206 | Partial Content | Section 4.1 of [RANGERQ] | 2254 | 300 | Multiple Choices | Section 6.4.1 | 2255 | 301 | Moved Permanently | Section 6.4.2 | 2256 | 302 | Found | Section 6.4.3 | 2257 | 303 | See Other | Section 6.4.4 | 2258 | 304 | Not Modified | Section 4.1 of [CONDTNL] | 2259 | 305 | Use Proxy | Section 6.4.5 | 2260 | 307 | Temporary Redirect | Section 6.4.7 | 2261 | 400 | Bad Request | Section 6.5.1 | 2262 | 401 | Unauthorized | Section 3.1 of [AUTHFRM] | 2263 | 402 | Payment Required | Section 6.5.2 | 2264 | 403 | Forbidden | Section 6.5.3 | 2265 | 404 | Not Found | Section 6.5.4 | 2266 | 405 | Method Not Allowed | Section 6.5.5 | 2267 | 406 | Not Acceptable | Section 6.5.6 | 2268 | 407 | Proxy Authentication Required | Section 3.2 of [AUTHFRM] | 2269 | 408 | Request Timeout | Section 6.5.7 | 2270 | 409 | Conflict | Section 6.5.8 | 2271 | 410 | Gone | Section 6.5.9 | 2272 | 411 | Length Required | Section 6.5.10 | 2273 | 412 | Precondition Failed | Section 4.2 of [CONDTNL] | 2274 | 413 | Payload Too Large | Section 6.5.11 | 2275 | 414 | URI Too Long | Section 6.5.12 | 2276 | 415 | Unsupported Media Type | Section 6.5.13 | 2277 | 416 | Range Not Satisfiable | Section 4.4 of [RANGERQ] | 2278 | 417 | Expectation Failed | Section 6.5.14 | 2279 | 426 | Upgrade Required | Section 6.5.15 | 2280 | 500 | Internal Server Error | Section 6.6.1 | 2281 | 501 | Not Implemented | Section 6.6.2 | 2282 | 502 | Bad Gateway | Section 6.6.3 | 2283 | 503 | Service Unavailable | Section 6.6.4 | 2284 | 504 | Gateway Timeout | Section 6.6.5 | 2285 | 505 | HTTP Version Not Supported | Section 6.6.6 | 2286 +------+-------------------------------+--------------------------+ 2288 Note that this list is not exhaustive -- it does not include 2289 extension status codes defined in other specifications. The complete 2290 list of status codes is maintained by IANA. See Section 8.2 for 2291 details. 2293 6.2. Informational 1xx 2295 The 1xx (Informational) class of status code indicates an interim 2296 response for communicating connection status or request progress 2297 prior to completing the requested action and sending a final 2298 response. 1xx responses are terminated by the first empty line after 2299 the status-line (the empty line signaling the end of the header 2300 section). Since HTTP/1.0 did not define any 1xx status codes, a 2301 server MUST NOT send a 1xx response to an HTTP/1.0 client. 2303 A client MUST be able to parse one or more 1xx responses received 2304 prior to a final response, even if the client does not expect one. A 2305 user agent MAY ignore unexpected 1xx responses. 2307 A proxy MUST forward 1xx responses unless the proxy itself requested 2308 the generation of the 1xx response. For example, if a proxy adds an 2309 "Expect: 100-continue" field when it forwards a request, then it need 2310 not forward the corresponding 100 (Continue) response(s). 2312 6.2.1. 100 Continue 2314 The 100 (Continue) status code indicates that the initial part of a 2315 request has been received and has not yet been rejected by the 2316 server. The server intends to send a final response after the 2317 request has been fully received and acted upon. 2319 When the request contains an Expect header field that includes a 2320 100-continue expectation, the 100 response indicates that the server 2321 wishes to receive the request payload body, as described in 2322 Section 5.1.1. The client ought to continue sending the request and 2323 discard the 100 response. 2325 If the request did not contain an Expect header field containing the 2326 100-continue expectation, the client can simply discard this interim 2327 response. 2329 6.2.2. 101 Switching Protocols 2331 The 101 (Switching Protocols) status code indicates that the server 2332 understands and is willing to comply with the client's request, via 2333 the Upgrade header field (Section 6.7 of [MESSGNG]), for a change in 2334 the application protocol being used on this connection. The server 2335 MUST generate an Upgrade header field in the response that indicates 2336 which protocol(s) will be switched to immediately after the empty 2337 line that terminates the 101 response. 2339 It is assumed that the server will only agree to switch protocols 2340 when it is advantageous to do so. For example, switching to a newer 2341 version of HTTP might be advantageous over older versions, and 2342 switching to a real-time, synchronous protocol might be advantageous 2343 when delivering resources that use such features. 2345 6.3. Successful 2xx 2347 The 2xx (Successful) class of status code indicates that the client's 2348 request was successfully received, understood, and accepted. 2350 6.3.1. 200 OK 2352 The 200 (OK) status code indicates that the request has succeeded. 2353 The payload sent in a 200 response depends on the request method. 2354 For the methods defined by this specification, the intended meaning 2355 of the payload can be summarized as: 2357 GET a representation of the target resource; 2359 HEAD the same representation as GET, but without the representation 2360 data; 2362 POST a representation of the status of, or results obtained from, 2363 the action; 2365 PUT, DELETE a representation of the status of the action; 2367 OPTIONS a representation of the communications options; 2369 TRACE a representation of the request message as received by the end 2370 server. 2372 Aside from responses to CONNECT, a 200 response always has a payload, 2373 though an origin server MAY generate a payload body of zero length. 2374 If no payload is desired, an origin server ought to send 204 (No 2375 Content) instead. For CONNECT, no payload is allowed because the 2376 successful result is a tunnel, which begins immediately after the 200 2377 response header section. 2379 A 200 response is cacheable by default; i.e., unless otherwise 2380 indicated by the method definition or explicit cache controls (see 2381 Section 4.2.2 of [CACHING]). 2383 6.3.2. 201 Created 2385 The 201 (Created) status code indicates that the request has been 2386 fulfilled and has resulted in one or more new resources being 2387 created. The primary resource created by the request is identified 2388 by either a Location header field in the response or, if no Location 2389 field is received, by the effective request URI. 2391 The 201 response payload typically describes and links to the 2392 resource(s) created. See Section 7.2 for a discussion of the meaning 2393 and purpose of validator header fields, such as ETag and Last- 2394 Modified, in a 201 response. 2396 6.3.3. 202 Accepted 2398 The 202 (Accepted) status code indicates that the request has been 2399 accepted for processing, but the processing has not been completed. 2400 The request might or might not eventually be acted upon, as it might 2401 be disallowed when processing actually takes place. There is no 2402 facility in HTTP for re-sending a status code from an asynchronous 2403 operation. 2405 The 202 response is intentionally noncommittal. Its purpose is to 2406 allow a server to accept a request for some other process (perhaps a 2407 batch-oriented process that is only run once per day) without 2408 requiring that the user agent's connection to the server persist 2409 until the process is completed. The representation sent with this 2410 response ought to describe the request's current status and point to 2411 (or embed) a status monitor that can provide the user with an 2412 estimate of when the request will be fulfilled. 2414 6.3.4. 203 Non-Authoritative Information 2416 The 203 (Non-Authoritative Information) status code indicates that 2417 the request was successful but the enclosed payload has been modified 2418 from that of the origin server's 200 (OK) response by a transforming 2419 proxy (Section 5.7.2 of [MESSGNG]). This status code allows the 2420 proxy to notify recipients when a transformation has been applied, 2421 since that knowledge might impact later decisions regarding the 2422 content. For example, future cache validation requests for the 2423 content might only be applicable along the same request path (through 2424 the same proxies). 2426 The 203 response is similar to the Warning code of 214 Transformation 2427 Applied (Section 5.5 of [CACHING]), which has the advantage of being 2428 applicable to responses with any status code. 2430 A 203 response is cacheable by default; i.e., unless otherwise 2431 indicated by the method definition or explicit cache controls (see 2432 Section 4.2.2 of [CACHING]). 2434 6.3.5. 204 No Content 2436 The 204 (No Content) status code indicates that the server has 2437 successfully fulfilled the request and that there is no additional 2438 content to send in the response payload body. Metadata in the 2439 response header fields refer to the target resource and its selected 2440 representation after the requested action was applied. 2442 For example, if a 204 status code is received in response to a PUT 2443 request and the response contains an ETag header field, then the PUT 2444 was successful and the ETag field-value contains the entity-tag for 2445 the new representation of that target resource. 2447 The 204 response allows a server to indicate that the action has been 2448 successfully applied to the target resource, while implying that the 2449 user agent does not need to traverse away from its current "document 2450 view" (if any). The server assumes that the user agent will provide 2451 some indication of the success to its user, in accord with its own 2452 interface, and apply any new or updated metadata in the response to 2453 its active representation. 2455 For example, a 204 status code is commonly used with document editing 2456 interfaces corresponding to a "save" action, such that the document 2457 being saved remains available to the user for editing. It is also 2458 frequently used with interfaces that expect automated data transfers 2459 to be prevalent, such as within distributed version control systems. 2461 A 204 response is terminated by the first empty line after the header 2462 fields because it cannot contain a message body. 2464 A 204 response is cacheable by default; i.e., unless otherwise 2465 indicated by the method definition or explicit cache controls (see 2466 Section 4.2.2 of [CACHING]). 2468 6.3.6. 205 Reset Content 2470 The 205 (Reset Content) status code indicates that the server has 2471 fulfilled the request and desires that the user agent reset the 2472 "document view", which caused the request to be sent, to its original 2473 state as received from the origin server. 2475 This response is intended to support a common data entry use case 2476 where the user receives content that supports data entry (a form, 2477 notepad, canvas, etc.), enters or manipulates data in that space, 2478 causes the entered data to be submitted in a request, and then the 2479 data entry mechanism is reset for the next entry so that the user can 2480 easily initiate another input action. 2482 Since the 205 status code implies that no additional content will be 2483 provided, a server MUST NOT generate a payload in a 205 response. In 2484 other words, a server MUST do one of the following for a 205 2485 response: a) indicate a zero-length body for the response by 2486 including a Content-Length header field with a value of 0; b) 2487 indicate a zero-length payload for the response by including a 2488 Transfer-Encoding header field with a value of chunked and a message 2489 body consisting of a single chunk of zero-length; or, c) close the 2490 connection immediately after sending the blank line terminating the 2491 header section. 2493 6.4. Redirection 3xx 2495 The 3xx (Redirection) class of status code indicates that further 2496 action needs to be taken by the user agent in order to fulfill the 2497 request. If a Location header field (Section 7.1.2) is provided, the 2498 user agent MAY automatically redirect its request to the URI 2499 referenced by the Location field value, even if the specific status 2500 code is not understood. Automatic redirection needs to done with 2501 care for methods not known to be safe, as defined in Section 4.2.1, 2502 since the user might not wish to redirect an unsafe request. 2504 There are several types of redirects: 2506 1. Redirects that indicate the resource might be available at a 2507 different URI, as provided by the Location field, as in the 2508 status codes 301 (Moved Permanently), 302 (Found), and 307 2509 (Temporary Redirect). 2511 2. Redirection that offers a choice of matching resources, each 2512 capable of representing the original request target, as in the 2513 300 (Multiple Choices) status code. 2515 3. Redirection to a different resource, identified by the Location 2516 field, that can represent an indirect response to the request, as 2517 in the 303 (See Other) status code. 2519 4. Redirection to a previously cached result, as in the 304 (Not 2520 Modified) status code. 2522 Note: In HTTP/1.0, the status codes 301 (Moved Permanently) and 2523 302 (Found) were defined for the first type of redirect 2524 ([RFC1945], Section 9.3). Early user agents split on whether the 2525 method applied to the redirect target would be the same as the 2526 original request or would be rewritten as GET. Although HTTP 2527 originally defined the former semantics for 301 and 302 (to match 2528 its original implementation at CERN), and defined 303 (See Other) 2529 to match the latter semantics, prevailing practice gradually 2530 converged on the latter semantics for 301 and 302 as well. The 2531 first revision of HTTP/1.1 added 307 (Temporary Redirect) to 2532 indicate the former semantics without being impacted by divergent 2533 practice. Over 10 years later, most user agents still do method 2534 rewriting for 301 and 302; therefore, this specification makes 2535 that behavior conformant when the original request is POST. 2537 A client SHOULD detect and intervene in cyclical redirections (i.e., 2538 "infinite" redirection loops). 2540 Note: An earlier version of this specification recommended a 2541 maximum of five redirections ([RFC2068], Section 10.3). Content 2542 developers need to be aware that some clients might implement such 2543 a fixed limitation. 2545 6.4.1. 300 Multiple Choices 2547 The 300 (Multiple Choices) status code indicates that the target 2548 resource has more than one representation, each with its own more 2549 specific identifier, and information about the alternatives is being 2550 provided so that the user (or user agent) can select a preferred 2551 representation by redirecting its request to one or more of those 2552 identifiers. In other words, the server desires that the user agent 2553 engage in reactive negotiation to select the most appropriate 2554 representation(s) for its needs (Section 3.4). 2556 If the server has a preferred choice, the server SHOULD generate a 2557 Location header field containing a preferred choice's URI reference. 2558 The user agent MAY use the Location field value for automatic 2559 redirection. 2561 For request methods other than HEAD, the server SHOULD generate a 2562 payload in the 300 response containing a list of representation 2563 metadata and URI reference(s) from which the user or user agent can 2564 choose the one most preferred. The user agent MAY make a selection 2565 from that list automatically if it understands the provided media 2566 type. A specific format for automatic selection is not defined by 2567 this specification because HTTP tries to remain orthogonal to the 2568 definition of its payloads. In practice, the representation is 2569 provided in some easily parsed format believed to be acceptable to 2570 the user agent, as determined by shared design or content 2571 negotiation, or in some commonly accepted hypertext format. 2573 A 300 response is cacheable by default; i.e., unless otherwise 2574 indicated by the method definition or explicit cache controls (see 2575 Section 4.2.2 of [CACHING]). 2577 Note: The original proposal for the 300 status code defined the 2578 URI header field as providing a list of alternative 2579 representations, such that it would be usable for 200, 300, and 2580 406 responses and be transferred in responses to the HEAD method. 2581 However, lack of deployment and disagreement over syntax led to 2582 both URI and Alternates (a subsequent proposal) being dropped from 2583 this specification. It is possible to communicate the list using 2584 a set of Link header fields [RFC5988], each with a relationship of 2585 "alternate", though deployment is a chicken-and-egg problem. 2587 6.4.2. 301 Moved Permanently 2589 The 301 (Moved Permanently) status code indicates that the target 2590 resource has been assigned a new permanent URI and any future 2591 references to this resource ought to use one of the enclosed URIs. 2592 Clients with link-editing capabilities ought to automatically re-link 2593 references to the effective request URI to one or more of the new 2594 references sent by the server, where possible. 2596 The server SHOULD generate a Location header field in the response 2597 containing a preferred URI reference for the new permanent URI. The 2598 user agent MAY use the Location field value for automatic 2599 redirection. The server's response payload usually contains a short 2600 hypertext note with a hyperlink to the new URI(s). 2602 Note: For historical reasons, a user agent MAY change the request 2603 method from POST to GET for the subsequent request. If this 2604 behavior is undesired, the 307 (Temporary Redirect) status code 2605 can be used instead. 2607 A 301 response is cacheable by default; i.e., unless otherwise 2608 indicated by the method definition or explicit cache controls (see 2609 Section 4.2.2 of [CACHING]). 2611 6.4.3. 302 Found 2613 The 302 (Found) status code indicates that the target resource 2614 resides temporarily under a different URI. Since the redirection 2615 might be altered on occasion, the client ought to continue to use the 2616 effective request URI for future requests. 2618 The server SHOULD generate a Location header field in the response 2619 containing a URI reference for the different URI. The user agent MAY 2620 use the Location field value for automatic redirection. The server's 2621 response payload usually contains a short hypertext note with a 2622 hyperlink to the different URI(s). 2624 Note: For historical reasons, a user agent MAY change the request 2625 method from POST to GET for the subsequent request. If this 2626 behavior is undesired, the 307 (Temporary Redirect) status code 2627 can be used instead. 2629 6.4.4. 303 See Other 2631 The 303 (See Other) status code indicates that the server is 2632 redirecting the user agent to a different resource, as indicated by a 2633 URI in the Location header field, which is intended to provide an 2634 indirect response to the original request. A user agent can perform 2635 a retrieval request targeting that URI (a GET or HEAD request if 2636 using HTTP), which might also be redirected, and present the eventual 2637 result as an answer to the original request. Note that the new URI 2638 in the Location header field is not considered equivalent to the 2639 effective request URI. 2641 This status code is applicable to any HTTP method. It is primarily 2642 used to allow the output of a POST action to redirect the user agent 2643 to a selected resource, since doing so provides the information 2644 corresponding to the POST response in a form that can be separately 2645 identified, bookmarked, and cached, independent of the original 2646 request. 2648 A 303 response to a GET request indicates that the origin server does 2649 not have a representation of the target resource that can be 2650 transferred by the server over HTTP. However, the Location field 2651 value refers to a resource that is descriptive of the target 2652 resource, such that making a retrieval request on that other resource 2653 might result in a representation that is useful to recipients without 2654 implying that it represents the original target resource. Note that 2655 answers to the questions of what can be represented, what 2656 representations are adequate, and what might be a useful description 2657 are outside the scope of HTTP. 2659 Except for responses to a HEAD request, the representation of a 303 2660 response ought to contain a short hypertext note with a hyperlink to 2661 the same URI reference provided in the Location header field. 2663 6.4.5. 305 Use Proxy 2665 The 305 (Use Proxy) status code was defined in a previous version of 2666 this specification and is now deprecated (Appendix B of [RFC7231]). 2668 6.4.6. 306 (Unused) 2670 The 306 status code was defined in a previous version of this 2671 specification, is no longer used, and the code is reserved. 2673 6.4.7. 307 Temporary Redirect 2675 The 307 (Temporary Redirect) status code indicates that the target 2676 resource resides temporarily under a different URI and the user agent 2677 MUST NOT change the request method if it performs an automatic 2678 redirection to that URI. Since the redirection can change over time, 2679 the client ought to continue using the original effective request URI 2680 for future requests. 2682 The server SHOULD generate a Location header field in the response 2683 containing a URI reference for the different URI. The user agent MAY 2684 use the Location field value for automatic redirection. The server's 2685 response payload usually contains a short hypertext note with a 2686 hyperlink to the different URI(s). 2688 Note: This status code is similar to 302 (Found), except that it 2689 does not allow changing the request method from POST to GET. This 2690 specification defines no equivalent counterpart for 301 (Moved 2691 Permanently) ([RFC7238], however, defines the status code 308 2692 (Permanent Redirect) for this purpose). 2694 6.5. Client Error 4xx 2696 The 4xx (Client Error) class of status code indicates that the client 2697 seems to have erred. Except when responding to a HEAD request, the 2698 server SHOULD send a representation containing an explanation of the 2699 error situation, and whether it is a temporary or permanent 2700 condition. These status codes are applicable to any request method. 2701 User agents SHOULD display any included representation to the user. 2703 6.5.1. 400 Bad Request 2705 The 400 (Bad Request) status code indicates that the server cannot or 2706 will not process the request due to something that is perceived to be 2707 a client error (e.g., malformed request syntax, invalid request 2708 message framing, or deceptive request routing). 2710 6.5.2. 402 Payment Required 2712 The 402 (Payment Required) status code is reserved for future use. 2714 6.5.3. 403 Forbidden 2716 The 403 (Forbidden) status code indicates that the server understood 2717 the request but refuses to authorize it. A server that wishes to 2718 make public why the request has been forbidden can describe that 2719 reason in the response payload (if any). 2721 If authentication credentials were provided in the request, the 2722 server considers them insufficient to grant access. The client 2723 SHOULD NOT automatically repeat the request with the same 2724 credentials. The client MAY repeat the request with new or different 2725 credentials. However, a request might be forbidden for reasons 2726 unrelated to the credentials. 2728 An origin server that wishes to "hide" the current existence of a 2729 forbidden target resource MAY instead respond with a status code of 2730 404 (Not Found). 2732 6.5.4. 404 Not Found 2734 The 404 (Not Found) status code indicates that the origin server did 2735 not find a current representation for the target resource or is not 2736 willing to disclose that one exists. A 404 status code does not 2737 indicate whether this lack of representation is temporary or 2738 permanent; the 410 (Gone) status code is preferred over 404 if the 2739 origin server knows, presumably through some configurable means, that 2740 the condition is likely to be permanent. 2742 A 404 response is cacheable by default; i.e., unless otherwise 2743 indicated by the method definition or explicit cache controls (see 2744 Section 4.2.2 of [CACHING]). 2746 6.5.5. 405 Method Not Allowed 2748 The 405 (Method Not Allowed) status code indicates that the method 2749 received in the request-line is known by the origin server but not 2750 supported by the target resource. The origin server MUST generate an 2751 Allow header field in a 405 response containing a list of the target 2752 resource's currently supported methods. 2754 A 405 response is cacheable by default; i.e., unless otherwise 2755 indicated by the method definition or explicit cache controls (see 2756 Section 4.2.2 of [CACHING]). 2758 6.5.6. 406 Not Acceptable 2760 The 406 (Not Acceptable) status code indicates that the target 2761 resource does not have a current representation that would be 2762 acceptable to the user agent, according to the proactive negotiation 2763 header fields received in the request (Section 5.3), and the server 2764 is unwilling to supply a default representation. 2766 The server SHOULD generate a payload containing a list of available 2767 representation characteristics and corresponding resource identifiers 2768 from which the user or user agent can choose the one most 2769 appropriate. A user agent MAY automatically select the most 2770 appropriate choice from that list. However, this specification does 2771 not define any standard for such automatic selection, as described in 2772 Section 6.4.1. 2774 6.5.7. 408 Request Timeout 2776 The 408 (Request Timeout) status code indicates that the server did 2777 not receive a complete request message within the time that it was 2778 prepared to wait. A server SHOULD send the "close" connection option 2779 (Section 6.1 of [MESSGNG]) in the response, since 408 implies that 2780 the server has decided to close the connection rather than continue 2781 waiting. If the client has an outstanding request in transit, the 2782 client MAY repeat that request on a new connection. 2784 6.5.8. 409 Conflict 2786 The 409 (Conflict) status code indicates that the request could not 2787 be completed due to a conflict with the current state of the target 2788 resource. This code is used in situations where the user might be 2789 able to resolve the conflict and resubmit the request. The server 2790 SHOULD generate a payload that includes enough information for a user 2791 to recognize the source of the conflict. 2793 Conflicts are most likely to occur in response to a PUT request. For 2794 example, if versioning were being used and the representation being 2795 PUT included changes to a resource that conflict with those made by 2796 an earlier (third-party) request, the origin server might use a 409 2797 response to indicate that it can't complete the request. In this 2798 case, the response representation would likely contain information 2799 useful for merging the differences based on the revision history. 2801 6.5.9. 410 Gone 2803 The 410 (Gone) status code indicates that access to the target 2804 resource is no longer available at the origin server and that this 2805 condition is likely to be permanent. If the origin server does not 2806 know, or has no facility to determine, whether or not the condition 2807 is permanent, the status code 404 (Not Found) ought to be used 2808 instead. 2810 The 410 response is primarily intended to assist the task of web 2811 maintenance by notifying the recipient that the resource is 2812 intentionally unavailable and that the server owners desire that 2813 remote links to that resource be removed. Such an event is common 2814 for limited-time, promotional services and for resources belonging to 2815 individuals no longer associated with the origin server's site. It 2816 is not necessary to mark all permanently unavailable resources as 2817 "gone" or to keep the mark for any length of time -- that is left to 2818 the discretion of the server owner. 2820 A 410 response is cacheable by default; i.e., unless otherwise 2821 indicated by the method definition or explicit cache controls (see 2822 Section 4.2.2 of [CACHING]). 2824 6.5.10. 411 Length Required 2826 The 411 (Length Required) status code indicates that the server 2827 refuses to accept the request without a defined Content-Length 2828 (Section 3.3.2 of [MESSGNG]). The client MAY repeat the request if 2829 it adds a valid Content-Length header field containing the length of 2830 the message body in the request message. 2832 6.5.11. 413 Payload Too Large 2834 The 413 (Payload Too Large) status code indicates that the server is 2835 refusing to process a request because the request payload is larger 2836 than the server is willing or able to process. The server MAY close 2837 the connection to prevent the client from continuing the request. 2839 If the condition is temporary, the server SHOULD generate a Retry- 2840 After header field to indicate that it is temporary and after what 2841 time the client MAY try again. 2843 6.5.12. 414 URI Too Long 2845 The 414 (URI Too Long) status code indicates that the server is 2846 refusing to service the request because the request-target 2847 (Section 5.3 of [MESSGNG]) is longer than the server is willing to 2848 interpret. This rare condition is only likely to occur when a client 2849 has improperly converted a POST request to a GET request with long 2850 query information, when the client has descended into a "black hole" 2851 of redirection (e.g., a redirected URI prefix that points to a suffix 2852 of itself) or when the server is under attack by a client attempting 2853 to exploit potential security holes. 2855 A 414 response is cacheable by default; i.e., unless otherwise 2856 indicated by the method definition or explicit cache controls (see 2857 Section 4.2.2 of [CACHING]). 2859 6.5.13. 415 Unsupported Media Type 2861 The 415 (Unsupported Media Type) status code indicates that the 2862 origin server is refusing to service the request because the payload 2863 is in a format not supported by this method on the target resource. 2864 The format problem might be due to the request's indicated Content- 2865 Type or Content-Encoding, or as a result of inspecting the data 2866 directly. 2868 6.5.14. 417 Expectation Failed 2870 The 417 (Expectation Failed) status code indicates that the 2871 expectation given in the request's Expect header field 2872 (Section 5.1.1) could not be met by at least one of the inbound 2873 servers. 2875 6.5.15. 426 Upgrade Required 2877 The 426 (Upgrade Required) status code indicates that the server 2878 refuses to perform the request using the current protocol but might 2879 be willing to do so after the client upgrades to a different 2880 protocol. The server MUST send an Upgrade header field in a 426 2881 response to indicate the required protocol(s) (Section 6.7 of 2882 [MESSGNG]). 2884 Example: 2886 HTTP/1.1 426 Upgrade Required 2887 Upgrade: HTTP/3.0 2888 Connection: Upgrade 2889 Content-Length: 53 2890 Content-Type: text/plain 2892 This service requires use of the HTTP/3.0 protocol. 2894 6.6. Server Error 5xx 2896 The 5xx (Server Error) class of status code indicates that the server 2897 is aware that it has erred or is incapable of performing the 2898 requested method. Except when responding to a HEAD request, the 2899 server SHOULD send a representation containing an explanation of the 2900 error situation, and whether it is a temporary or permanent 2901 condition. A user agent SHOULD display any included representation 2902 to the user. These response codes are applicable to any request 2903 method. 2905 6.6.1. 500 Internal Server Error 2907 The 500 (Internal Server Error) status code indicates that the server 2908 encountered an unexpected condition that prevented it from fulfilling 2909 the request. 2911 6.6.2. 501 Not Implemented 2913 The 501 (Not Implemented) status code indicates that the server does 2914 not support the functionality required to fulfill the request. This 2915 is the appropriate response when the server does not recognize the 2916 request method and is not capable of supporting it for any resource. 2918 A 501 response is cacheable by default; i.e., unless otherwise 2919 indicated by the method definition or explicit cache controls (see 2920 Section 4.2.2 of [CACHING]). 2922 6.6.3. 502 Bad Gateway 2924 The 502 (Bad Gateway) status code indicates that the server, while 2925 acting as a gateway or proxy, received an invalid response from an 2926 inbound server it accessed while attempting to fulfill the request. 2928 6.6.4. 503 Service Unavailable 2930 The 503 (Service Unavailable) status code indicates that the server 2931 is currently unable to handle the request due to a temporary overload 2932 or scheduled maintenance, which will likely be alleviated after some 2933 delay. The server MAY send a Retry-After header field 2934 (Section 7.1.3) to suggest an appropriate amount of time for the 2935 client to wait before retrying the request. 2937 Note: The existence of the 503 status code does not imply that a 2938 server has to use it when becoming overloaded. Some servers might 2939 simply refuse the connection. 2941 6.6.5. 504 Gateway Timeout 2943 The 504 (Gateway Timeout) status code indicates that the server, 2944 while acting as a gateway or proxy, did not receive a timely response 2945 from an upstream server it needed to access in order to complete the 2946 request. 2948 6.6.6. 505 HTTP Version Not Supported 2950 The 505 (HTTP Version Not Supported) status code indicates that the 2951 server does not support, or refuses to support, the major version of 2952 HTTP that was used in the request message. The server is indicating 2953 that it is unable or unwilling to complete the request using the same 2954 major version as the client, as described in Section 2.6 of 2955 [MESSGNG], other than with this error message. The server SHOULD 2956 generate a representation for the 505 response that describes why 2957 that version is not supported and what other protocols are supported 2958 by that server. 2960 7. Response Header Fields 2962 The response header fields allow the server to pass additional 2963 information about the response beyond what is placed in the status- 2964 line. These header fields give information about the server, about 2965 further access to the target resource, or about related resources. 2967 Although each response header field has a defined meaning, in 2968 general, the precise semantics might be further refined by the 2969 semantics of the request method and/or response status code. 2971 7.1. Control Data 2973 Response header fields can supply control data that supplements the 2974 status code, directs caching, or instructs the client where to go 2975 next. 2977 +-------------------+--------------------------+ 2978 | Header Field Name | Defined in... | 2979 +-------------------+--------------------------+ 2980 | Age | Section 5.1 of [CACHING] | 2981 | Cache-Control | Section 5.2 of [CACHING] | 2982 | Expires | Section 5.3 of [CACHING] | 2983 | Date | Section 7.1.1.2 | 2984 | Location | Section 7.1.2 | 2985 | Retry-After | Section 7.1.3 | 2986 | Vary | Section 7.1.4 | 2987 | Warning | Section 5.5 of [CACHING] | 2988 +-------------------+--------------------------+ 2990 7.1.1. Origination Date 2991 7.1.1.1. Date/Time Formats 2993 Prior to 1995, there were three different formats commonly used by 2994 servers to communicate timestamps. For compatibility with old 2995 implementations, all three are defined here. The preferred format is 2996 a fixed-length and single-zone subset of the date and time 2997 specification used by the Internet Message Format [RFC5322]. 2999 HTTP-date = IMF-fixdate / obs-date 3001 An example of the preferred format is 3003 Sun, 06 Nov 1994 08:49:37 GMT ; IMF-fixdate 3005 Examples of the two obsolete formats are 3007 Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format 3008 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format 3010 A recipient that parses a timestamp value in an HTTP header field 3011 MUST accept all three HTTP-date formats. When a sender generates a 3012 header field that contains one or more timestamps defined as HTTP- 3013 date, the sender MUST generate those timestamps in the IMF-fixdate 3014 format. 3016 An HTTP-date value represents time as an instance of Coordinated 3017 Universal Time (UTC). The first two formats indicate UTC by the 3018 three-letter abbreviation for Greenwich Mean Time, "GMT", a 3019 predecessor of the UTC name; values in the asctime format are assumed 3020 to be in UTC. A sender that generates HTTP-date values from a local 3021 clock ought to use NTP ([RFC5905]) or some similar protocol to 3022 synchronize its clock to UTC. 3024 Preferred format: 3026 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 3027 ; fixed length/zone/capitalization subset of the format 3028 ; see Section 3.3 of [RFC5322] 3030 day-name = %x4D.6F.6E ; "Mon", case-sensitive 3031 / %x54.75.65 ; "Tue", case-sensitive 3032 / %x57.65.64 ; "Wed", case-sensitive 3033 / %x54.68.75 ; "Thu", case-sensitive 3034 / %x46.72.69 ; "Fri", case-sensitive 3035 / %x53.61.74 ; "Sat", case-sensitive 3036 / %x53.75.6E ; "Sun", case-sensitive 3038 date1 = day SP month SP year 3039 ; e.g., 02 Jun 1982 3041 day = 2DIGIT 3042 month = %x4A.61.6E ; "Jan", case-sensitive 3043 / %x46.65.62 ; "Feb", case-sensitive 3044 / %x4D.61.72 ; "Mar", case-sensitive 3045 / %x41.70.72 ; "Apr", case-sensitive 3046 / %x4D.61.79 ; "May", case-sensitive 3047 / %x4A.75.6E ; "Jun", case-sensitive 3048 / %x4A.75.6C ; "Jul", case-sensitive 3049 / %x41.75.67 ; "Aug", case-sensitive 3050 / %x53.65.70 ; "Sep", case-sensitive 3051 / %x4F.63.74 ; "Oct", case-sensitive 3052 / %x4E.6F.76 ; "Nov", case-sensitive 3053 / %x44.65.63 ; "Dec", case-sensitive 3054 year = 4DIGIT 3056 GMT = %x47.4D.54 ; "GMT", case-sensitive 3058 time-of-day = hour ":" minute ":" second 3059 ; 00:00:00 - 23:59:60 (leap second) 3061 hour = 2DIGIT 3062 minute = 2DIGIT 3063 second = 2DIGIT 3065 Obsolete formats: 3067 obs-date = rfc850-date / asctime-date 3068 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 3069 date2 = day "-" month "-" 2DIGIT 3070 ; e.g., 02-Jun-82 3072 day-name-l = %x4D.6F.6E.64.61.79 ; "Monday", case-sensitive 3073 / %x54.75.65.73.64.61.79 ; "Tuesday", case-sensitive 3074 / %x57.65.64.6E.65.73.64.61.79 ; "Wednesday", case-sensitive 3075 / %x54.68.75.72.73.64.61.79 ; "Thursday", case-sensitive 3076 / %x46.72.69.64.61.79 ; "Friday", case-sensitive 3077 / %x53.61.74.75.72.64.61.79 ; "Saturday", case-sensitive 3078 / %x53.75.6E.64.61.79 ; "Sunday", case-sensitive 3080 asctime-date = day-name SP date3 SP time-of-day SP year 3081 date3 = month SP ( 2DIGIT / ( SP 1DIGIT )) 3082 ; e.g., Jun 2 3084 HTTP-date is case sensitive. A sender MUST NOT generate additional 3085 whitespace in an HTTP-date beyond that specifically included as SP in 3086 the grammar. The semantics of day-name, day, month, year, and time- 3087 of-day are the same as those defined for the Internet Message Format 3088 constructs with the corresponding name ([RFC5322], Section 3.3). 3090 Recipients of a timestamp value in rfc850-date format, which uses a 3091 two-digit year, MUST interpret a timestamp that appears to be more 3092 than 50 years in the future as representing the most recent year in 3093 the past that had the same last two digits. 3095 Recipients of timestamp values are encouraged to be robust in parsing 3096 timestamps unless otherwise restricted by the field definition. For 3097 example, messages are occasionally forwarded over HTTP from a non- 3098 HTTP source that might generate any of the date and time 3099 specifications defined by the Internet Message Format. 3101 Note: HTTP requirements for the date/time stamp format apply only 3102 to their usage within the protocol stream. Implementations are 3103 not required to use these formats for user presentation, request 3104 logging, etc. 3106 7.1.1.2. Date 3108 The "Date" header field represents the date and time at which the 3109 message was originated, having the same semantics as the Origination 3110 Date Field (orig-date) defined in Section 3.6.1 of [RFC5322]. The 3111 field value is an HTTP-date, as defined in Section 7.1.1.1. 3113 Date = HTTP-date 3115 An example is 3116 Date: Tue, 15 Nov 1994 08:12:31 GMT 3118 When a Date header field is generated, the sender SHOULD generate its 3119 field value as the best available approximation of the date and time 3120 of message generation. In theory, the date ought to represent the 3121 moment just before the payload is generated. In practice, the date 3122 can be generated at any time during message origination. 3124 An origin server MUST NOT send a Date header field if it does not 3125 have a clock capable of providing a reasonable approximation of the 3126 current instance in Coordinated Universal Time. An origin server MAY 3127 send a Date header field if the response is in the 1xx 3128 (Informational) or 5xx (Server Error) class of status codes. An 3129 origin server MUST send a Date header field in all other cases. 3131 A recipient with a clock that receives a response message without a 3132 Date header field MUST record the time it was received and append a 3133 corresponding Date header field to the message's header section if it 3134 is cached or forwarded downstream. 3136 A user agent MAY send a Date header field in a request, though 3137 generally will not do so unless it is believed to convey useful 3138 information to the server. For example, custom applications of HTTP 3139 might convey a Date if the server is expected to adjust its 3140 interpretation of the user's request based on differences between the 3141 user agent and server clocks. 3143 7.1.2. Location 3145 The "Location" header field is used in some responses to refer to a 3146 specific resource in relation to the response. The type of 3147 relationship is defined by the combination of request method and 3148 status code semantics. 3150 Location = URI-reference 3152 The field value consists of a single URI-reference. When it has the 3153 form of a relative reference ([RFC3986], Section 4.2), the final 3154 value is computed by resolving it against the effective request URI 3155 ([RFC3986], Section 5). 3157 For 201 (Created) responses, the Location value refers to the primary 3158 resource created by the request. For 3xx (Redirection) responses, 3159 the Location value refers to the preferred target resource for 3160 automatically redirecting the request. 3162 If the Location value provided in a 3xx (Redirection) response does 3163 not have a fragment component, a user agent MUST process the 3164 redirection as if the value inherits the fragment component of the 3165 URI reference used to generate the request target (i.e., the 3166 redirection inherits the original reference's fragment, if any). 3168 For example, a GET request generated for the URI reference 3169 "http://www.example.org/~tim" might result in a 303 (See Other) 3170 response containing the header field: 3172 Location: /People.html#tim 3174 which suggests that the user agent redirect to 3175 "http://www.example.org/People.html#tim" 3177 Likewise, a GET request generated for the URI reference 3178 "http://www.example.org/index.html#larry" might result in a 301 3179 (Moved Permanently) response containing the header field: 3181 Location: http://www.example.net/index.html 3183 which suggests that the user agent redirect to 3184 "http://www.example.net/index.html#larry", preserving the original 3185 fragment identifier. 3187 There are circumstances in which a fragment identifier in a Location 3188 value would not be appropriate. For example, the Location header 3189 field in a 201 (Created) response is supposed to provide a URI that 3190 is specific to the created resource. 3192 Note: Some recipients attempt to recover from Location fields that 3193 are not valid URI references. This specification does not mandate 3194 or define such processing, but does allow it for the sake of 3195 robustness. 3197 Note: The Content-Location header field (Section 3.1.4.2) differs 3198 from Location in that the Content-Location refers to the most 3199 specific resource corresponding to the enclosed representation. 3200 It is therefore possible for a response to contain both the 3201 Location and Content-Location header fields. 3203 7.1.3. Retry-After 3205 Servers send the "Retry-After" header field to indicate how long the 3206 user agent ought to wait before making a follow-up request. When 3207 sent with a 503 (Service Unavailable) response, Retry-After indicates 3208 how long the service is expected to be unavailable to the client. 3209 When sent with any 3xx (Redirection) response, Retry-After indicates 3210 the minimum time that the user agent is asked to wait before issuing 3211 the redirected request. 3213 The value of this field can be either an HTTP-date or a number of 3214 seconds to delay after the response is received. 3216 Retry-After = HTTP-date / delay-seconds 3218 A delay-seconds value is a non-negative decimal integer, representing 3219 time in seconds. 3221 delay-seconds = 1*DIGIT 3223 Two examples of its use are 3225 Retry-After: Fri, 31 Dec 1999 23:59:59 GMT 3226 Retry-After: 120 3228 In the latter example, the delay is 2 minutes. 3230 7.1.4. Vary 3232 The "Vary" header field in a response describes what parts of a 3233 request message, aside from the method, Host header field, and 3234 request target, might influence the origin server's process for 3235 selecting and representing this response. The value consists of 3236 either a single asterisk ("*") or a list of header field names (case- 3237 insensitive). 3239 Vary = "*" / 1#field-name 3241 A Vary field value of "*" signals that anything about the request 3242 might play a role in selecting the response representation, possibly 3243 including elements outside the message syntax (e.g., the client's 3244 network address). A recipient will not be able to determine whether 3245 this response is appropriate for a later request without forwarding 3246 the request to the origin server. A proxy MUST NOT generate a Vary 3247 field with a "*" value. 3249 A Vary field value consisting of a comma-separated list of names 3250 indicates that the named request header fields, known as the 3251 selecting header fields, might have a role in selecting the 3252 representation. The potential selecting header fields are not 3253 limited to those defined by this specification. 3255 For example, a response that contains 3257 Vary: accept-encoding, accept-language 3259 indicates that the origin server might have used the request's 3260 Accept-Encoding and Accept-Language fields (or lack thereof) as 3261 determining factors while choosing the content for this response. 3263 An origin server might send Vary with a list of fields for two 3264 purposes: 3266 1. To inform cache recipients that they MUST NOT use this response 3267 to satisfy a later request unless the later request has the same 3268 values for the listed fields as the original request (Section 4.1 3269 of [CACHING]). In other words, Vary expands the cache key 3270 required to match a new request to the stored cache entry. 3272 2. To inform user agent recipients that this response is subject to 3273 content negotiation (Section 5.3) and that a different 3274 representation might be sent in a subsequent request if 3275 additional parameters are provided in the listed header fields 3276 (proactive negotiation). 3278 An origin server SHOULD send a Vary header field when its algorithm 3279 for selecting a representation varies based on aspects of the request 3280 message other than the method and request target, unless the variance 3281 cannot be crossed or the origin server has been deliberately 3282 configured to prevent cache transparency. For example, there is no 3283 need to send the Authorization field name in Vary because reuse 3284 across users is constrained by the field definition (Section 4.2 of 3285 [AUTHFRM]). Likewise, an origin server might use Cache-Control 3286 directives (Section 5.2 of [CACHING]) to supplant Vary if it 3287 considers the variance less significant than the performance cost of 3288 Vary's impact on caching. 3290 7.2. Validator Header Fields 3292 Validator header fields convey metadata about the selected 3293 representation (Section 3). In responses to safe requests, validator 3294 fields describe the selected representation chosen by the origin 3295 server while handling the response. Note that, depending on the 3296 status code semantics, the selected representation for a given 3297 response is not necessarily the same as the representation enclosed 3298 as response payload. 3300 In a successful response to a state-changing request, validator 3301 fields describe the new representation that has replaced the prior 3302 selected representation as a result of processing the request. 3304 For example, an ETag header field in a 201 (Created) response 3305 communicates the entity-tag of the newly created resource's 3306 representation, so that it can be used in later conditional requests 3307 to prevent the "lost update" problem [CONDTNL]. 3309 +-------------------+--------------------------+ 3310 | Header Field Name | Defined in... | 3311 +-------------------+--------------------------+ 3312 | ETag | Section 2.3 of [CONDTNL] | 3313 | Last-Modified | Section 2.2 of [CONDTNL] | 3314 +-------------------+--------------------------+ 3316 7.3. Authentication Challenges 3318 Authentication challenges indicate what mechanisms are available for 3319 the client to provide authentication credentials in future requests. 3321 +--------------------+--------------------------+ 3322 | Header Field Name | Defined in... | 3323 +--------------------+--------------------------+ 3324 | WWW-Authenticate | Section 4.1 of [AUTHFRM] | 3325 | Proxy-Authenticate | Section 4.3 of [AUTHFRM] | 3326 +--------------------+--------------------------+ 3328 7.4. Response Context 3330 The remaining response header fields provide more information about 3331 the target resource for potential use in later requests. 3333 +-------------------+--------------------------+ 3334 | Header Field Name | Defined in... | 3335 +-------------------+--------------------------+ 3336 | Accept-Ranges | Section 2.3 of [RANGERQ] | 3337 | Allow | Section 7.4.1 | 3338 | Server | Section 7.4.2 | 3339 +-------------------+--------------------------+ 3341 7.4.1. Allow 3343 The "Allow" header field lists the set of methods advertised as 3344 supported by the target resource. The purpose of this field is 3345 strictly to inform the recipient of valid request methods associated 3346 with the resource. 3348 Allow = #method 3350 Example of use: 3352 Allow: GET, HEAD, PUT 3354 The actual set of allowed methods is defined by the origin server at 3355 the time of each request. An origin server MUST generate an Allow 3356 field in a 405 (Method Not Allowed) response and MAY do so in any 3357 other response. An empty Allow field value indicates that the 3358 resource allows no methods, which might occur in a 405 response if 3359 the resource has been temporarily disabled by configuration. 3361 A proxy MUST NOT modify the Allow header field -- it does not need to 3362 understand all of the indicated methods in order to handle them 3363 according to the generic message handling rules. 3365 7.4.2. Server 3367 The "Server" header field contains information about the software 3368 used by the origin server to handle the request, which is often used 3369 by clients to help identify the scope of reported interoperability 3370 problems, to work around or tailor requests to avoid particular 3371 server limitations, and for analytics regarding server or operating 3372 system use. An origin server MAY generate a Server field in its 3373 responses. 3375 Server = product *( RWS ( product / comment ) ) 3377 The Server field-value consists of one or more product identifiers, 3378 each followed by zero or more comments (Section 3.2 of [MESSGNG]), 3379 which together identify the origin server software and its 3380 significant subproducts. By convention, the product identifiers are 3381 listed in decreasing order of their significance for identifying the 3382 origin server software. Each product identifier consists of a name 3383 and optional version, as defined in Section 5.5.3. 3385 Example: 3387 Server: CERN/3.0 libwww/2.17 3389 An origin server SHOULD NOT generate a Server field containing 3390 needlessly fine-grained detail and SHOULD limit the addition of 3391 subproducts by third parties. Overly long and detailed Server field 3392 values increase response latency and potentially reveal internal 3393 implementation details that might make it (slightly) easier for 3394 attackers to find and exploit known security holes. 3396 8. IANA Considerations 3398 8.1. Method Registry 3400 The "Hypertext Transfer Protocol (HTTP) Method Registry" defines the 3401 namespace for the request method token (Section 4). The method 3402 registry has been created and is now maintained at 3403 . 3405 8.1.1. Procedure 3407 HTTP method registrations MUST include the following fields: 3409 o Method Name (see Section 4) 3411 o Safe ("yes" or "no", see Section 4.2.1) 3413 o Idempotent ("yes" or "no", see Section 4.2.2) 3415 o Pointer to specification text 3417 Values to be added to this namespace require IETF Review (see 3418 [RFC5226], Section 4.1). 3420 8.1.2. Considerations for New Methods 3422 Standardized methods are generic; that is, they are potentially 3423 applicable to any resource, not just one particular media type, kind 3424 of resource, or application. As such, it is preferred that new 3425 methods be registered in a document that isn't specific to a single 3426 application or data format, since orthogonal technologies deserve 3427 orthogonal specification. 3429 Since message parsing (Section 3.3 of [MESSGNG]) needs to be 3430 independent of method semantics (aside from responses to HEAD), 3431 definitions of new methods cannot change the parsing algorithm or 3432 prohibit the presence of a message body on either the request or the 3433 response message. Definitions of new methods can specify that only a 3434 zero-length message body is allowed by requiring a Content-Length 3435 header field with a value of "0". 3437 A new method definition needs to indicate whether it is safe 3438 (Section 4.2.1), idempotent (Section 4.2.2), cacheable 3439 (Section 4.2.3), what semantics are to be associated with the payload 3440 body if any is present in the request and what refinements the method 3441 makes to header field or status code semantics. If the new method is 3442 cacheable, its definition ought to describe how, and under what 3443 conditions, a cache can store a response and use it to satisfy a 3444 subsequent request. The new method ought to describe whether it can 3445 be made conditional (Section 5.2) and, if so, how a server responds 3446 when the condition is false. Likewise, if the new method might have 3447 some use for partial response semantics ([RANGERQ]), it ought to 3448 document this, too. 3450 Note: Avoid defining a method name that starts with "M-", since 3451 that prefix might be misinterpreted as having the semantics 3452 assigned to it by [RFC2774]. 3454 8.1.3. Registrations 3456 The "Hypertext Transfer Protocol (HTTP) Method Registry" has been 3457 populated with the registrations below: 3459 +---------+------+------------+----------------+ 3460 | Method | Safe | Idempotent | Reference | 3461 +---------+------+------------+----------------+ 3462 | CONNECT | no | no | Section 4.3.6 | 3463 | DELETE | no | yes | Section 4.3.5 | 3464 | GET | yes | yes | Section 4.3.1 | 3465 | HEAD | yes | yes | Section 4.3.2 | 3466 | OPTIONS | yes | yes | Section 4.3.7 | 3467 | POST | no | no | Section 4.3.3 | 3468 | PUT | no | yes | Section 4.3.4 | 3469 | TRACE | yes | yes | Section 4.3.8 | 3470 +---------+------+------------+----------------+ 3472 8.2. Status Code Registry 3474 The "Hypertext Transfer Protocol (HTTP) Status Code Registry" defines 3475 the namespace for the response status-code token (Section 6). The 3476 status code registry is maintained at 3477 . 3479 This section replaces the registration procedure for HTTP Status 3480 Codes previously defined in Section 7.1 of [RFC2817]. 3482 8.2.1. Procedure 3484 A registration MUST include the following fields: 3486 o Status Code (3 digits) 3488 o Short Description 3490 o Pointer to specification text 3491 Values to be added to the HTTP status code namespace require IETF 3492 Review (see [RFC5226], Section 4.1). 3494 8.2.2. Considerations for New Status Codes 3496 When it is necessary to express semantics for a response that are not 3497 defined by current status codes, a new status code can be registered. 3498 Status codes are generic; they are potentially applicable to any 3499 resource, not just one particular media type, kind of resource, or 3500 application of HTTP. As such, it is preferred that new status codes 3501 be registered in a document that isn't specific to a single 3502 application. 3504 New status codes are required to fall under one of the categories 3505 defined in Section 6. To allow existing parsers to process the 3506 response message, new status codes cannot disallow a payload, 3507 although they can mandate a zero-length payload body. 3509 Proposals for new status codes that are not yet widely deployed ought 3510 to avoid allocating a specific number for the code until there is 3511 clear consensus that it will be registered; instead, early drafts can 3512 use a notation such as "4NN", or "3N0" .. "3N9", to indicate the 3513 class of the proposed status code(s) without consuming a number 3514 prematurely. 3516 The definition of a new status code ought to explain the request 3517 conditions that would cause a response containing that status code 3518 (e.g., combinations of request header fields and/or method(s)) along 3519 with any dependencies on response header fields (e.g., what fields 3520 are required, what fields can modify the semantics, and what header 3521 field semantics are further refined when used with the new status 3522 code). 3524 The definition of a new status code ought to specify whether or not 3525 it is cacheable. Note that all status codes can be cached if the 3526 response they occur in has explicit freshness information; however, 3527 status codes that are defined as being cacheable are allowed to be 3528 cached without explicit freshness information. Likewise, the 3529 definition of a status code can place constraints upon cache 3530 behavior. See [CACHING] for more information. 3532 Finally, the definition of a new status code ought to indicate 3533 whether the payload has any implied association with an identified 3534 resource (Section 3.1.4.1). 3536 8.2.3. Registrations 3538 The status code registry has been updated with the registrations 3539 below: 3541 +-------+-------------------------------+-----------------+ 3542 | Value | Description | Reference | 3543 +-------+-------------------------------+-----------------+ 3544 | 100 | Continue | Section 6.2.1 | 3545 | 101 | Switching Protocols | Section 6.2.2 | 3546 | 200 | OK | Section 6.3.1 | 3547 | 201 | Created | Section 6.3.2 | 3548 | 202 | Accepted | Section 6.3.3 | 3549 | 203 | Non-Authoritative Information | Section 6.3.4 | 3550 | 204 | No Content | Section 6.3.5 | 3551 | 205 | Reset Content | Section 6.3.6 | 3552 | 300 | Multiple Choices | Section 6.4.1 | 3553 | 301 | Moved Permanently | Section 6.4.2 | 3554 | 302 | Found | Section 6.4.3 | 3555 | 303 | See Other | Section 6.4.4 | 3556 | 305 | Use Proxy | Section 6.4.5 | 3557 | 306 | (Unused) | Section 6.4.6 | 3558 | 307 | Temporary Redirect | Section 6.4.7 | 3559 | 400 | Bad Request | Section 6.5.1 | 3560 | 402 | Payment Required | Section 6.5.2 | 3561 | 403 | Forbidden | Section 6.5.3 | 3562 | 404 | Not Found | Section 6.5.4 | 3563 | 405 | Method Not Allowed | Section 6.5.5 | 3564 | 406 | Not Acceptable | Section 6.5.6 | 3565 | 408 | Request Timeout | Section 6.5.7 | 3566 | 409 | Conflict | Section 6.5.8 | 3567 | 410 | Gone | Section 6.5.9 | 3568 | 411 | Length Required | Section 6.5.10 | 3569 | 413 | Payload Too Large | Section 6.5.11 | 3570 | 414 | URI Too Long | Section 6.5.12 | 3571 | 415 | Unsupported Media Type | Section 6.5.13 | 3572 | 417 | Expectation Failed | Section 6.5.14 | 3573 | 426 | Upgrade Required | Section 6.5.15 | 3574 | 500 | Internal Server Error | Section 6.6.1 | 3575 | 501 | Not Implemented | Section 6.6.2 | 3576 | 502 | Bad Gateway | Section 6.6.3 | 3577 | 503 | Service Unavailable | Section 6.6.4 | 3578 | 504 | Gateway Timeout | Section 6.6.5 | 3579 | 505 | HTTP Version Not Supported | Section 6.6.6 | 3580 +-------+-------------------------------+-----------------+ 3582 8.3. Header Field Registry 3584 HTTP header fields are registered within the "Message Headers" 3585 registry located at , as defined by [BCP90]. 3588 8.3.1. Considerations for New Header Fields 3590 Header fields are key:value pairs that can be used to communicate 3591 data about the message, its payload, the target resource, or the 3592 connection (i.e., control data). See Section 3.2 of [MESSGNG] for a 3593 general definition of header field syntax in HTTP messages. 3595 The requirements for header field names are defined in [BCP90]. 3597 Authors of specifications defining new fields are advised to keep the 3598 name as short as practical and not to prefix the name with "X-" 3599 unless the header field will never be used on the Internet. (The 3600 "X-" prefix idiom has been extensively misused in practice; it was 3601 intended to only be used as a mechanism for avoiding name collisions 3602 inside proprietary software or intranet processing, since the prefix 3603 would ensure that private names never collide with a newly registered 3604 Internet name; see [BCP178] for further information). 3606 New header field values typically have their syntax defined using 3607 ABNF ([RFC5234]), using the extension defined in Section 7 of 3608 [MESSGNG] as necessary, and are usually constrained to the range of 3609 US-ASCII characters. Header fields needing a greater range of 3610 characters can use an encoding such as the one defined in [RFC5987]. 3612 Leading and trailing whitespace in raw field values is removed upon 3613 field parsing (Section 3.2.4 of [MESSGNG]). Field definitions where 3614 leading or trailing whitespace in values is significant will have to 3615 use a container syntax such as quoted-string (Section 3.2.6 of 3616 [MESSGNG]). 3618 Because commas (",") are used as a generic delimiter between field- 3619 values, they need to be treated with care if they are allowed in the 3620 field-value. Typically, components that might contain a comma are 3621 protected with double-quotes using the quoted-string ABNF production. 3623 For example, a textual date and a URI (either of which might contain 3624 a comma) could be safely carried in field-values like these: 3626 Example-URI-Field: "http://example.com/a.html,foo", 3627 "http://without-a-comma.example.com/" 3628 Example-Date-Field: "Sat, 04 May 1996", "Wed, 14 Sep 2005" 3630 Note that double-quote delimiters almost always are used with the 3631 quoted-string production; using a different syntax inside double- 3632 quotes will likely cause unnecessary confusion. 3634 Many header fields use a format including (case-insensitively) named 3635 parameters (for instance, Content-Type, defined in Section 3.1.1.5). 3636 Allowing both unquoted (token) and quoted (quoted-string) syntax for 3637 the parameter value enables recipients to use existing parser 3638 components. When allowing both forms, the meaning of a parameter 3639 value ought to be independent of the syntax used for it (for an 3640 example, see the notes on parameter handling for media types in 3641 Section 3.1.1.1). 3643 Authors of specifications defining new header fields are advised to 3644 consider documenting: 3646 o Whether the field is a single value or whether it can be a list 3647 (delimited by commas; see Section 3.2 of [MESSGNG]). 3649 If it does not use the list syntax, document how to treat messages 3650 where the field occurs multiple times (a sensible default would be 3651 to ignore the field, but this might not always be the right 3652 choice). 3654 Note that intermediaries and software libraries might combine 3655 multiple header field instances into a single one, despite the 3656 field's definition not allowing the list syntax. A robust format 3657 enables recipients to discover these situations (good example: 3658 "Content-Type", as the comma can only appear inside quoted 3659 strings; bad example: "Location", as a comma can occur inside a 3660 URI). 3662 o Under what conditions the header field can be used; e.g., only in 3663 responses or requests, in all messages, only on responses to a 3664 particular request method, etc. 3666 o Whether the field should be stored by origin servers that 3667 understand it upon a PUT request. 3669 o Whether the field semantics are further refined by the context, 3670 such as by existing request methods or status codes. 3672 o Whether it is appropriate to list the field-name in the Connection 3673 header field (i.e., if the header field is to be hop-by-hop; see 3674 Section 6.1 of [MESSGNG]). 3676 o Under what conditions intermediaries are allowed to insert, 3677 delete, or modify the field's value. 3679 o Whether it is appropriate to list the field-name in a Vary 3680 response header field (e.g., when the request header field is used 3681 by an origin server's content selection algorithm; see 3682 Section 7.1.4). 3684 o Whether the header field is useful or allowable in trailers (see 3685 Section 4.1 of [MESSGNG]). 3687 o Whether the header field ought to be preserved across redirects. 3689 o Whether it introduces any additional security considerations, such 3690 as disclosure of privacy-related data. 3692 8.3.2. Registrations 3694 The "Message Headers" registry has been updated with the following 3695 permanent registrations: 3697 +-------------------+----------+----------+------------------+ 3698 | Header Field Name | Protocol | Status | Reference | 3699 +-------------------+----------+----------+------------------+ 3700 | Accept | http | standard | Section 5.3.2 | 3701 | Accept-Charset | http | standard | Section 5.3.3 | 3702 | Accept-Encoding | http | standard | Section 5.3.4 | 3703 | Accept-Language | http | standard | Section 5.3.5 | 3704 | Allow | http | standard | Section 7.4.1 | 3705 | Content-Encoding | http | standard | Section 3.1.2.2 | 3706 | Content-Language | http | standard | Section 3.1.3.2 | 3707 | Content-Location | http | standard | Section 3.1.4.2 | 3708 | Content-Type | http | standard | Section 3.1.1.5 | 3709 | Date | http | standard | Section 7.1.1.2 | 3710 | Expect | http | standard | Section 5.1.1 | 3711 | From | http | standard | Section 5.5.1 | 3712 | Location | http | standard | Section 7.1.2 | 3713 | Max-Forwards | http | standard | Section 5.1.2 | 3714 | MIME-Version | http | standard | Appendix A.1 | 3715 | Referer | http | standard | Section 5.5.2 | 3716 | Retry-After | http | standard | Section 7.1.3 | 3717 | Server | http | standard | Section 7.4.2 | 3718 | User-Agent | http | standard | Section 5.5.3 | 3719 | Vary | http | standard | Section 7.1.4 | 3720 +-------------------+----------+----------+------------------+ 3722 The change controller for the above registrations is: "IETF 3723 (iesg@ietf.org) - Internet Engineering Task Force". 3725 8.4. Content Coding Registry 3727 The "HTTP Content Coding Registry" defines the namespace for content 3728 coding names (Section 4.2 of [MESSGNG]). The content coding registry 3729 is maintained at . 3731 8.4.1. Procedure 3733 Content coding registrations MUST include the following fields: 3735 o Name 3737 o Description 3739 o Pointer to specification text 3741 Names of content codings MUST NOT overlap with names of transfer 3742 codings (Section 4 of [MESSGNG]), unless the encoding transformation 3743 is identical (as is the case for the compression codings defined in 3744 Section 4.2 of [MESSGNG]). 3746 Values to be added to this namespace require IETF Review (see 3747 Section 4.1 of [RFC5226]) and MUST conform to the purpose of content 3748 coding defined in this section. 3750 8.4.2. Registrations 3752 The "HTTP Content Coding Registry" has been updated with the 3753 registrations below: 3755 +----------+------------------------------------------+-------------+ 3756 | Name | Description | Reference | 3757 +----------+------------------------------------------+-------------+ 3758 | identity | Reserved (synonym for "no encoding" in | Section 5.3 | 3759 | | Accept-Encoding) | .4 | 3760 +----------+------------------------------------------+-------------+ 3762 9. Security Considerations 3764 This section is meant to inform developers, information providers, 3765 and users of known security concerns relevant to HTTP semantics and 3766 its use for transferring information over the Internet. 3767 Considerations related to message syntax, parsing, and routing are 3768 discussed in Section 9 of [MESSGNG]. 3770 The list of considerations below is not exhaustive. Most security 3771 concerns related to HTTP semantics are about securing server-side 3772 applications (code behind the HTTP interface), securing user agent 3773 processing of payloads received via HTTP, or secure use of the 3774 Internet in general, rather than security of the protocol. Various 3775 organizations maintain topical information and links to current 3776 research on Web application security (e.g., [OWASP]). 3778 9.1. Attacks Based on File and Path Names 3780 Origin servers frequently make use of their local file system to 3781 manage the mapping from effective request URI to resource 3782 representations. Most file systems are not designed to protect 3783 against malicious file or path names. Therefore, an origin server 3784 needs to avoid accessing names that have a special significance to 3785 the system when mapping the request target to files, folders, or 3786 directories. 3788 For example, UNIX, Microsoft Windows, and other operating systems use 3789 ".." as a path component to indicate a directory level above the 3790 current one, and they use specially named paths or file names to send 3791 data to system devices. Similar naming conventions might exist 3792 within other types of storage systems. Likewise, local storage 3793 systems have an annoying tendency to prefer user-friendliness over 3794 security when handling invalid or unexpected characters, 3795 recomposition of decomposed characters, and case-normalization of 3796 case-insensitive names. 3798 Attacks based on such special names tend to focus on either denial- 3799 of-service (e.g., telling the server to read from a COM port) or 3800 disclosure of configuration and source files that are not meant to be 3801 served. 3803 9.2. Attacks Based on Command, Code, or Query Injection 3805 Origin servers often use parameters within the URI as a means of 3806 identifying system services, selecting database entries, or choosing 3807 a data source. However, data received in a request cannot be 3808 trusted. An attacker could construct any of the request data 3809 elements (method, request-target, header fields, or body) to contain 3810 data that might be misinterpreted as a command, code, or query when 3811 passed through a command invocation, language interpreter, or 3812 database interface. 3814 For example, SQL injection is a common attack wherein additional 3815 query language is inserted within some part of the request-target or 3816 header fields (e.g., Host, Referer, etc.). If the received data is 3817 used directly within a SELECT statement, the query language might be 3818 interpreted as a database command instead of a simple string value. 3819 This type of implementation vulnerability is extremely common, in 3820 spite of being easy to prevent. 3822 In general, resource implementations ought to avoid use of request 3823 data in contexts that are processed or interpreted as instructions. 3824 Parameters ought to be compared to fixed strings and acted upon as a 3825 result of that comparison, rather than passed through an interface 3826 that is not prepared for untrusted data. Received data that isn't 3827 based on fixed parameters ought to be carefully filtered or encoded 3828 to avoid being misinterpreted. 3830 Similar considerations apply to request data when it is stored and 3831 later processed, such as within log files, monitoring tools, or when 3832 included within a data format that allows embedded scripts. 3834 9.3. Disclosure of Personal Information 3836 Clients are often privy to large amounts of personal information, 3837 including both information provided by the user to interact with 3838 resources (e.g., the user's name, location, mail address, passwords, 3839 encryption keys, etc.) and information about the user's browsing 3840 activity over time (e.g., history, bookmarks, etc.). Implementations 3841 need to prevent unintentional disclosure of personal information. 3843 9.4. Disclosure of Sensitive Information in URIs 3845 URIs are intended to be shared, not secured, even when they identify 3846 secure resources. URIs are often shown on displays, added to 3847 templates when a page is printed, and stored in a variety of 3848 unprotected bookmark lists. It is therefore unwise to include 3849 information within a URI that is sensitive, personally identifiable, 3850 or a risk to disclose. 3852 Authors of services ought to avoid GET-based forms for the submission 3853 of sensitive data because that data will be placed in the request- 3854 target. Many existing servers, proxies, and user agents log or 3855 display the request-target in places where it might be visible to 3856 third parties. Such services ought to use POST-based form submission 3857 instead. 3859 Since the Referer header field tells a target site about the context 3860 that resulted in a request, it has the potential to reveal 3861 information about the user's immediate browsing history and any 3862 personal information that might be found in the referring resource's 3863 URI. Limitations on the Referer header field are described in 3864 Section 5.5.2 to address some of its security considerations. 3866 9.5. Disclosure of Fragment after Redirects 3868 Although fragment identifiers used within URI references are not sent 3869 in requests, implementers ought to be aware that they will be visible 3870 to the user agent and any extensions or scripts running as a result 3871 of the response. In particular, when a redirect occurs and the 3872 original request's fragment identifier is inherited by the new 3873 reference in Location (Section 7.1.2), this might have the effect of 3874 disclosing one site's fragment to another site. If the first site 3875 uses personal information in fragments, it ought to ensure that 3876 redirects to other sites include a (possibly empty) fragment 3877 component in order to block that inheritance. 3879 9.6. Disclosure of Product Information 3881 The User-Agent (Section 5.5.3), Via (Section 5.7.1 of [MESSGNG]), and 3882 Server (Section 7.4.2) header fields often reveal information about 3883 the respective sender's software systems. In theory, this can make 3884 it easier for an attacker to exploit known security holes; in 3885 practice, attackers tend to try all potential holes regardless of the 3886 apparent software versions being used. 3888 Proxies that serve as a portal through a network firewall ought to 3889 take special precautions regarding the transfer of header information 3890 that might identify hosts behind the firewall. The Via header field 3891 allows intermediaries to replace sensitive machine names with 3892 pseudonyms. 3894 9.7. Browser Fingerprinting 3896 Browser fingerprinting is a set of techniques for identifying a 3897 specific user agent over time through its unique set of 3898 characteristics. These characteristics might include information 3899 related to its TCP behavior, feature capabilities, and scripting 3900 environment, though of particular interest here is the set of unique 3901 characteristics that might be communicated via HTTP. Fingerprinting 3902 is considered a privacy concern because it enables tracking of a user 3903 agent's behavior over time without the corresponding controls that 3904 the user might have over other forms of data collection (e.g., 3905 cookies). Many general-purpose user agents (i.e., Web browsers) have 3906 taken steps to reduce their fingerprints. 3908 There are a number of request header fields that might reveal 3909 information to servers that is sufficiently unique to enable 3910 fingerprinting. The From header field is the most obvious, though it 3911 is expected that From will only be sent when self-identification is 3912 desired by the user. Likewise, Cookie header fields are deliberately 3913 designed to enable re-identification, so fingerprinting concerns only 3914 apply to situations where cookies are disabled or restricted by the 3915 user agent's configuration. 3917 The User-Agent header field might contain enough information to 3918 uniquely identify a specific device, usually when combined with other 3919 characteristics, particularly if the user agent sends excessive 3920 details about the user's system or extensions. However, the source 3921 of unique information that is least expected by users is proactive 3922 negotiation (Section 5.3), including the Accept, Accept-Charset, 3923 Accept-Encoding, and Accept-Language header fields. 3925 In addition to the fingerprinting concern, detailed use of the 3926 Accept-Language header field can reveal information the user might 3927 consider to be of a private nature. For example, understanding a 3928 given language set might be strongly correlated to membership in a 3929 particular ethnic group. An approach that limits such loss of 3930 privacy would be for a user agent to omit the sending of Accept- 3931 Language except for sites that have been whitelisted, perhaps via 3932 interaction after detecting a Vary header field that indicates 3933 language negotiation might be useful. 3935 In environments where proxies are used to enhance privacy, user 3936 agents ought to be conservative in sending proactive negotiation 3937 header fields. General-purpose user agents that provide a high 3938 degree of header field configurability ought to inform users about 3939 the loss of privacy that might result if too much detail is provided. 3940 As an extreme privacy measure, proxies could filter the proactive 3941 negotiation header fields in relayed requests. 3943 10. References 3945 10.1. Normative References 3947 [AUTHFRM] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 3948 Protocol (HTTP): Authentication", draft-fielding-httpbis- 3949 http-auth-00 (work in progress), March 2018. 3951 [CACHING] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 3952 Ed., "Hypertext Transfer Protocol (HTTP): Caching", draft- 3953 fielding-httpbis-http-cache-00 (work in progress), March 3954 2018. 3956 [CONDTNL] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 3957 Protocol (HTTP): Conditional Requests", draft-fielding- 3958 httpbis-http-conditional-00 (work in progress), March 3959 2018. 3961 [MESSGNG] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 3962 Protocol (HTTP/1.1): Message Syntax and Routing", draft- 3963 fielding-httpbis-http-messaging-00 (work in progress), 3964 March 2018. 3966 [RANGERQ] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., 3967 "Hypertext Transfer Protocol (HTTP): Range Requests", 3968 draft-fielding-httpbis-http-range-00 (work in progress), 3969 March 2018. 3971 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 3972 Extensions (MIME) Part One: Format of Internet Message 3973 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 3974 . 3976 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 3977 Extensions (MIME) Part Two: Media Types", RFC 2046, 3978 DOI 10.17487/RFC2046, November 1996, 3979 . 3981 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3982 Requirement Levels", BCP 14, RFC 2119, 3983 DOI 10.17487/RFC2119, March 1997, 3984 . 3986 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 3987 Resource Identifier (URI): Generic Syntax", STD 66, 3988 RFC 3986, DOI 10.17487/RFC3986, January 2005, 3989 . 3991 [RFC4647] Phillips, A., Ed. and M. Davis, Ed., "Matching of Language 3992 Tags", BCP 47, RFC 4647, DOI 10.17487/RFC4647, September 3993 2006, . 3995 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 3996 Specifications: ABNF", STD 68, RFC 5234, 3997 DOI 10.17487/RFC5234, January 2008, 3998 . 4000 [RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for Identifying 4001 Languages", BCP 47, RFC 5646, DOI 10.17487/RFC5646, 4002 September 2009, . 4004 [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in 4005 Internationalization in the IETF", BCP 166, RFC 6365, 4006 DOI 10.17487/RFC6365, September 2011, 4007 . 4009 10.2. Informative References 4011 [BCP13] Freed, N., Klensin, J., and T. Hansen, "Media Type 4012 Specifications and Registration Procedures", BCP 13, 4013 RFC 6838, January 2013, 4014 . 4016 [BCP178] Saint-Andre, P., Crocker, D., and M. Nottingham, 4017 "Deprecating the "X-" Prefix and Similar Constructs in 4018 Application Protocols", BCP 178, RFC 6648, June 2012, 4019 . 4021 [BCP90] Klyne, G., Nottingham, M., and J. Mogul, "Registration 4022 Procedures for Message Header Fields", BCP 90, RFC 3864, 4023 September 2004, . 4025 [OWASP] van der Stock, A., Ed., "A Guide to Building Secure Web 4026 Applications and Web Services", The Open Web Application 4027 Security Project (OWASP) 2.0.1, July 2005, 4028 . 4030 [REST] Fielding, R., "Architectural Styles and the Design of 4031 Network-based Software Architectures", 4032 Doctoral Dissertation, University of California, Irvine, 4033 September 2000, 4034 . 4036 [RFC1945] Berners-Lee, T., Fielding, R., and H. Nielsen, "Hypertext 4037 Transfer Protocol -- HTTP/1.0", RFC 1945, 4038 DOI 10.17487/RFC1945, May 1996, 4039 . 4041 [RFC2049] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 4042 Extensions (MIME) Part Five: Conformance Criteria and 4043 Examples", RFC 2049, DOI 10.17487/RFC2049, November 1996, 4044 . 4046 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. 4047 Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", 4048 RFC 2068, DOI 10.17487/RFC2068, January 1997, 4049 . 4051 [RFC2295] Holtman, K. and A. Mutz, "Transparent Content Negotiation 4052 in HTTP", RFC 2295, DOI 10.17487/RFC2295, March 1998, 4053 . 4055 [RFC2388] Masinter, L., "Returning Values from Forms: multipart/ 4056 form-data", RFC 2388, DOI 10.17487/RFC2388, August 1998, 4057 . 4059 [RFC2557] Palme, F., Hopmann, A., Shelness, N., and E. Stefferud, 4060 "MIME Encapsulation of Aggregate Documents, such as HTML 4061 (MHTML)", RFC 2557, DOI 10.17487/RFC2557, March 1999, 4062 . 4064 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 4065 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 4066 Transfer Protocol -- HTTP/1.1", RFC 2616, 4067 DOI 10.17487/RFC2616, June 1999, 4068 . 4070 [RFC2774] Frystyk, H., Leach, P., and S. Lawrence, "An HTTP 4071 Extension Framework", RFC 2774, DOI 10.17487/RFC2774, 4072 February 2000, . 4074 [RFC2817] Khare, R. and S. Lawrence, "Upgrading to TLS Within 4075 HTTP/1.1", RFC 2817, DOI 10.17487/RFC2817, May 2000, 4076 . 4078 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 4079 Procedures", BCP 19, RFC 2978, DOI 10.17487/RFC2978, 4080 October 2000, . 4082 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 4083 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 4084 DOI 10.17487/RFC5226, May 2008, 4085 . 4087 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 4088 (TLS) Protocol Version 1.2", RFC 5246, 4089 DOI 10.17487/RFC5246, August 2008, 4090 . 4092 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 4093 DOI 10.17487/RFC5322, October 2008, 4094 . 4096 [RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP", 4097 RFC 5789, DOI 10.17487/RFC5789, March 2010, 4098 . 4100 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 4101 "Network Time Protocol Version 4: Protocol and Algorithms 4102 Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010, 4103 . 4105 [RFC5987] Reschke, J., "Character Set and Language Encoding for 4106 Hypertext Transfer Protocol (HTTP) Header Field 4107 Parameters", RFC 5987, DOI 10.17487/RFC5987, August 2010, 4108 . 4110 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, 4111 DOI 10.17487/RFC5988, October 2010, 4112 . 4114 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 4115 DOI 10.17487/RFC6265, April 2011, 4116 . 4118 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 4119 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 4120 DOI 10.17487/RFC7231, June 2014, 4121 . 4123 [RFC7238] Reschke, J., "The Hypertext Transfer Protocol (HTTP) 4124 Status Code 308 (Permanent Redirect)", draft-reschke-http- 4125 status-308-07 (work in progress), March 2012. 4127 Appendix A. Differences between HTTP and MIME 4129 HTTP/1.1 uses many of the constructs defined for the Internet Message 4130 Format [RFC5322] and the Multipurpose Internet Mail Extensions (MIME) 4131 [RFC2045] to allow a message body to be transmitted in an open 4132 variety of representations and with extensible header fields. 4133 However, RFC 2045 is focused only on email; applications of HTTP have 4134 many characteristics that differ from email; hence, HTTP has features 4135 that differ from MIME. These differences were carefully chosen to 4136 optimize performance over binary connections, to allow greater 4137 freedom in the use of new media types, to make date comparisons 4138 easier, and to acknowledge the practice of some early HTTP servers 4139 and clients. 4141 This appendix describes specific areas where HTTP differs from MIME. 4142 Proxies and gateways to and from strict MIME environments need to be 4143 aware of these differences and provide the appropriate conversions 4144 where necessary. 4146 A.1. MIME-Version 4148 HTTP is not a MIME-compliant protocol. However, messages can include 4149 a single MIME-Version header field to indicate what version of the 4150 MIME protocol was used to construct the message. Use of the MIME- 4151 Version header field indicates that the message is in full 4152 conformance with the MIME protocol (as defined in [RFC2045]). 4153 Senders are responsible for ensuring full conformance (where 4154 possible) when exporting HTTP messages to strict MIME environments. 4156 A.2. Conversion to Canonical Form 4158 MIME requires that an Internet mail body part be converted to 4159 canonical form prior to being transferred, as described in Section 4 4160 of [RFC2049]. Section 3.1.1.3 of this document describes the forms 4161 allowed for subtypes of the "text" media type when transmitted over 4162 HTTP. [RFC2046] requires that content with a type of "text" 4163 represent line breaks as CRLF and forbids the use of CR or LF outside 4164 of line break sequences. HTTP allows CRLF, bare CR, and bare LF to 4165 indicate a line break within text content. 4167 A proxy or gateway from HTTP to a strict MIME environment ought to 4168 translate all line breaks within the text media types described in 4169 Section 3.1.1.3 of this document to the RFC 2049 canonical form of 4170 CRLF. Note, however, this might be complicated by the presence of a 4171 Content-Encoding and by the fact that HTTP allows the use of some 4172 charsets that do not use octets 13 and 10 to represent CR and LF, 4173 respectively. 4175 Conversion will break any cryptographic checksums applied to the 4176 original content unless the original content is already in canonical 4177 form. Therefore, the canonical form is recommended for any content 4178 that uses such checksums in HTTP. 4180 A.3. Conversion of Date Formats 4182 HTTP/1.1 uses a restricted set of date formats (Section 7.1.1.1) to 4183 simplify the process of date comparison. Proxies and gateways from 4184 other protocols ought to ensure that any Date header field present in 4185 a message conforms to one of the HTTP/1.1 formats and rewrite the 4186 date if necessary. 4188 A.4. Conversion of Content-Encoding 4190 MIME does not include any concept equivalent to HTTP/1.1's Content- 4191 Encoding header field. Since this acts as a modifier on the media 4192 type, proxies and gateways from HTTP to MIME-compliant protocols 4193 ought to either change the value of the Content-Type header field or 4194 decode the representation before forwarding the message. (Some 4195 experimental applications of Content-Type for Internet mail have used 4196 a media-type parameter of ";conversions=" to perform 4197 a function equivalent to Content-Encoding. However, this parameter 4198 is not part of the MIME standards). 4200 A.5. Conversion of Content-Transfer-Encoding 4202 HTTP does not use the Content-Transfer-Encoding field of MIME. 4203 Proxies and gateways from MIME-compliant protocols to HTTP need to 4204 remove any Content-Transfer-Encoding prior to delivering the response 4205 message to an HTTP client. 4207 Proxies and gateways from HTTP to MIME-compliant protocols are 4208 responsible for ensuring that the message is in the correct format 4209 and encoding for safe transport on that protocol, where "safe 4210 transport" is defined by the limitations of the protocol being used. 4211 Such a proxy or gateway ought to transform and label the data with an 4212 appropriate Content-Transfer-Encoding if doing so will improve the 4213 likelihood of safe transport over the destination protocol. 4215 A.6. MHTML and Line Length Limitations 4217 HTTP implementations that share code with MHTML [RFC2557] 4218 implementations need to be aware of MIME line length limitations. 4219 Since HTTP does not have this limitation, HTTP does not fold long 4220 lines. MHTML messages being transported by HTTP follow all 4221 conventions of MHTML, including line length limitations and folding, 4222 canonicalization, etc., since HTTP transfers message-bodies as 4223 payload and, aside from the "multipart/byteranges" type (Appendix A 4224 of [RANGERQ]), does not interpret the content or any MIME header 4225 lines that might be contained therein. 4227 Appendix B. Changes from RFC 7231 4229 None yet. 4231 Appendix C. Imported ABNF 4233 The following core rules are included by reference, as defined in 4234 Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return), 4235 CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double 4236 quote), HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF 4237 (line feed), OCTET (any 8-bit sequence of data), SP (space), and 4238 VCHAR (any visible US-ASCII character). 4240 The rules below are defined in [MESSGNG]: 4242 BWS = 4243 OWS = 4244 RWS = 4245 URI-reference = 4246 absolute-URI = 4247 comment = 4248 field-name = 4249 partial-URI = 4250 quoted-string = 4251 token = 4253 Appendix D. Collected ABNF 4255 In the collected ABNF below, list rules are expanded as per 4256 Section 1.2 of [MESSGNG]. 4258 Accept = [ ( "," / ( media-range [ accept-params ] ) ) *( OWS "," [ 4259 OWS ( media-range [ accept-params ] ) ] ) ] 4260 Accept-Charset = *( "," OWS ) ( ( charset / "*" ) [ weight ] ) *( OWS 4261 "," [ OWS ( ( charset / "*" ) [ weight ] ) ] ) 4262 Accept-Encoding = [ ( "," / ( codings [ weight ] ) ) *( OWS "," [ OWS 4263 ( codings [ weight ] ) ] ) ] 4264 Accept-Language = *( "," OWS ) ( language-range [ weight ] ) *( OWS 4265 "," [ OWS ( language-range [ weight ] ) ] ) 4266 Allow = [ ( "," / method ) *( OWS "," [ OWS method ] ) ] 4268 BWS = 4270 Content-Encoding = *( "," OWS ) content-coding *( OWS "," [ OWS 4271 content-coding ] ) 4272 Content-Language = *( "," OWS ) language-tag *( OWS "," [ OWS 4273 language-tag ] ) 4274 Content-Location = absolute-URI / partial-URI 4275 Content-Type = media-type 4277 Date = HTTP-date 4279 Expect = "100-continue" 4281 From = mailbox 4283 GMT = %x47.4D.54 ; GMT 4285 HTTP-date = IMF-fixdate / obs-date 4287 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 4289 Location = URI-reference 4291 Max-Forwards = 1*DIGIT 4293 OWS = 4295 RWS = 4296 Referer = absolute-URI / partial-URI 4297 Retry-After = HTTP-date / delay-seconds 4299 Server = product *( RWS ( product / comment ) ) 4301 URI-reference = 4302 User-Agent = product *( RWS ( product / comment ) ) 4304 Vary = "*" / ( *( "," OWS ) field-name *( OWS "," [ OWS field-name ] 4305 ) ) 4307 absolute-URI = 4308 accept-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ] 4309 accept-params = weight *accept-ext 4310 asctime-date = day-name SP date3 SP time-of-day SP year 4312 charset = token 4313 codings = content-coding / "identity" / "*" 4314 comment = 4315 content-coding = token 4317 date1 = day SP month SP year 4318 date2 = day "-" month "-" 2DIGIT 4319 date3 = month SP ( 2DIGIT / ( SP DIGIT ) ) 4320 day = 2DIGIT 4321 day-name = %x4D.6F.6E ; Mon 4322 / %x54.75.65 ; Tue 4323 / %x57.65.64 ; Wed 4324 / %x54.68.75 ; Thu 4325 / %x46.72.69 ; Fri 4326 / %x53.61.74 ; Sat 4327 / %x53.75.6E ; Sun 4328 day-name-l = %x4D.6F.6E.64.61.79 ; Monday 4329 / %x54.75.65.73.64.61.79 ; Tuesday 4330 / %x57.65.64.6E.65.73.64.61.79 ; Wednesday 4331 / %x54.68.75.72.73.64.61.79 ; Thursday 4332 / %x46.72.69.64.61.79 ; Friday 4333 / %x53.61.74.75.72.64.61.79 ; Saturday 4334 / %x53.75.6E.64.61.79 ; Sunday 4335 delay-seconds = 1*DIGIT 4337 field-name = 4339 hour = 2DIGIT 4341 language-range = 4342 language-tag = 4344 mailbox = 4345 media-range = ( "*/*" / ( type "/*" ) / ( type "/" subtype ) ) *( OWS 4346 ";" OWS parameter ) 4347 media-type = type "/" subtype *( OWS ";" OWS parameter ) 4348 method = token 4349 minute = 2DIGIT 4350 month = %x4A.61.6E ; Jan 4351 / %x46.65.62 ; Feb 4352 / %x4D.61.72 ; Mar 4353 / %x41.70.72 ; Apr 4354 / %x4D.61.79 ; May 4355 / %x4A.75.6E ; Jun 4356 / %x4A.75.6C ; Jul 4357 / %x41.75.67 ; Aug 4358 / %x53.65.70 ; Sep 4359 / %x4F.63.74 ; Oct 4360 / %x4E.6F.76 ; Nov 4361 / %x44.65.63 ; Dec 4363 obs-date = rfc850-date / asctime-date 4365 parameter = token "=" ( token / quoted-string ) 4366 partial-URI = 4367 product = token [ "/" product-version ] 4368 product-version = token 4370 quoted-string = 4371 qvalue = ( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] ) 4373 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 4375 second = 2DIGIT 4376 subtype = token 4378 time-of-day = hour ":" minute ":" second 4379 token = 4380 type = token 4382 weight = OWS ";" OWS "q=" qvalue 4384 year = 4DIGIT 4386 Appendix E. Change Log 4388 This section is to be removed before publishing as an RFC. 4390 E.1. Since RFC 7231 4392 The changes in this draft are purely editorial: 4394 o Change boilerplate and abstract to indicate the "draft" status, 4395 and update references to ancestor specifications. 4397 o Remove version "1.1" from document title, indicating that this 4398 specification applies to all HTTP versions. 4400 o Adjust historical notes. 4402 o Update links to sibling specifications. 4404 o Replace sections listing changes from RFC 2616 by new empty 4405 sections referring to RFC 723x. 4407 o Remove acknowledgements specific to RFC 723x. 4409 o Move "Acknowledgements" to the very end and make them unnumbered. 4411 Index 4413 1 4414 100 Continue (status code) 50 4415 100-continue (expect value) 34 4416 101 Switching Protocols (status code) 50 4417 1xx Informational (status code class) 50 4419 2 4420 200 OK (status code) 51 4421 201 Created (status code) 52 4422 202 Accepted (status code) 52 4423 203 Non-Authoritative Information (status code) 52 4424 204 No Content (status code) 53 4425 205 Reset Content (status code) 53 4426 2xx Successful (status code class) 51 4428 3 4429 300 Multiple Choices (status code) 55 4430 301 Moved Permanently (status code) 56 4431 302 Found (status code) 56 4432 303 See Other (status code) 57 4433 305 Use Proxy (status code) 57 4434 306 (Unused) (status code) 58 4435 307 Temporary Redirect (status code) 58 4436 3xx Redirection (status code class) 54 4438 4 4439 400 Bad Request (status code) 58 4440 402 Payment Required (status code) 58 4441 403 Forbidden (status code) 59 4442 404 Not Found (status code) 59 4443 405 Method Not Allowed (status code) 59 4444 406 Not Acceptable (status code) 60 4445 408 Request Timeout (status code) 60 4446 409 Conflict (status code) 60 4447 410 Gone (status code) 60 4448 411 Length Required (status code) 61 4449 413 Payload Too Large (status code) 61 4450 414 URI Too Long (status code) 61 4451 415 Unsupported Media Type (status code) 62 4452 417 Expectation Failed (status code) 62 4453 426 Upgrade Required (status code) 62 4454 4xx Client Error (status code class) 58 4456 5 4457 500 Internal Server Error (status code) 63 4458 501 Not Implemented (status code) 63 4459 502 Bad Gateway (status code) 63 4460 503 Service Unavailable (status code) 63 4461 504 Gateway Timeout (status code) 63 4462 505 HTTP Version Not Supported (status code) 64 4463 5xx Server Error (status code class) 62 4465 A 4466 Accept header field 38 4467 Accept-Charset header field 40 4468 Accept-Encoding header field 41 4469 Accept-Language header field 43 4470 Allow header field 72 4472 C 4473 CONNECT method 30 4474 Content-Encoding header field 11 4475 Content-Language header field 13 4476 Content-Location header field 15 4477 Content-Transfer-Encoding header field 91 4478 Content-Type header field 10 4479 cacheable 24 4480 compress (content coding) 11 4481 conditional request 37 4482 content coding 11 4483 content negotiation 6 4485 D 4486 DELETE method 29 4487 Date header field 67 4488 deflate (content coding) 11 4490 E 4491 Expect header field 34 4493 F 4494 From header field 44 4496 G 4497 GET method 24 4498 Grammar 4499 Accept 38 4500 Accept-Charset 41 4501 Accept-Encoding 41 4502 accept-ext 38 4503 Accept-Language 43 4504 accept-params 38 4505 Allow 72 4506 asctime-date 67 4507 charset 9 4508 codings 41 4509 content-coding 11 4510 Content-Encoding 12 4511 Content-Language 13 4512 Content-Location 15 4513 Content-Type 10 4514 Date 67 4515 date1 66 4516 day 66 4517 day-name 66 4518 day-name-l 66 4519 delay-seconds 70 4520 Expect 34 4521 From 45 4522 GMT 66 4523 hour 66 4524 HTTP-date 65 4525 IMF-fixdate 66 4526 language-range 43 4527 language-tag 13 4528 Location 68 4529 Max-Forwards 36 4530 media-range 38 4531 media-type 8 4532 method 21 4533 minute 66 4534 month 66 4535 obs-date 66 4536 parameter 8 4537 product 47 4538 product-version 47 4539 qvalue 38 4540 Referer 45 4541 Retry-After 70 4542 rfc850-date 67 4543 second 66 4544 Server 73 4545 subtype 8 4546 time-of-day 66 4547 type 8 4548 User-Agent 46 4549 Vary 70 4550 weight 38 4551 year 66 4552 gzip (content coding) 11 4554 H 4555 HEAD method 25 4557 I 4558 idempotent 23 4560 L 4561 Location header field 68 4563 M 4564 MIME-Version header field 90 4565 Max-Forwards header field 36 4567 O 4568 OPTIONS method 31 4570 P 4571 POST method 25 4572 PUT method 26 4573 payload 17 4575 R 4576 Referer header field 45 4577 Retry-After header field 69 4578 representation 7 4580 S 4581 Server header field 73 4582 Status Codes Classes 4583 1xx Informational 50 4584 2xx Successful 51 4585 3xx Redirection 54 4586 4xx Client Error 58 4587 5xx Server Error 62 4588 safe 22 4589 selected representation 7, 71 4591 T 4592 TRACE method 32 4594 U 4595 User-Agent header field 46 4597 V 4598 Vary header field 70 4600 X 4601 x-compress (content coding) 11 4602 x-gzip (content coding) 11 4604 Acknowledgments 4606 See Appendix "Acknowledgments" of [MESSGNG]. 4608 Authors' Addresses 4610 Roy T. Fielding (editor) 4611 Adobe Systems Incorporated 4612 345 Park Ave 4613 San Jose, CA 95110 4614 USA 4616 EMail: fielding@gbiv.com 4617 URI: http://roy.gbiv.com/ 4619 Julian F. Reschke (editor) 4620 greenbytes GmbH 4621 Hafenweg 16 4622 Muenster, NW 48155 4623 Germany 4625 EMail: julian.reschke@greenbytes.de 4626 URI: http://greenbytes.de/tech/webdav/