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