idnits 2.17.1 draft-ietf-httpbis-semantics-07.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The abstract seems to indicate that this document obsoletes RFC7615, but the header doesn't have an 'Obsoletes:' line to match this. -- The abstract seems to indicate that this document obsoletes RFC7538, but the header doesn't have an 'Obsoletes:' line to match this. -- The abstract seems to indicate that this document obsoletes RFC7231, but the header doesn't have an 'Obsoletes:' line to match this. -- The abstract seems to indicate that this document obsoletes RFC7232, but the header doesn't have an 'Obsoletes:' line to match this. -- The abstract seems to indicate that this document obsoletes RFC7233, but the header doesn't have an 'Obsoletes:' line to match this. -- The abstract seems to indicate that this document obsoletes RFC7235, but the header doesn't have an 'Obsoletes:' line to match this. -- The abstract seems to indicate that this document obsoletes RFC2818, but the header doesn't have an 'Obsoletes:' line to match this. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (March 7, 2020) is 1504 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) == Unused Reference: 'RFC2145' is defined on line 8269, but no explicit reference was found in the text == Unused Reference: 'RFC2818' is defined on line 8303, but no explicit reference was found in the text == Unused Reference: 'RFC7232' is defined on line 8373, but no explicit reference was found in the text == Unused Reference: 'RFC7233' is defined on line 8378, but no explicit reference was found in the text == Unused Reference: 'RFC7235' is defined on line 8383, but no explicit reference was found in the text == Unused Reference: 'RFC7615' is defined on line 8396, but no explicit reference was found in the text == Unused Reference: 'RFC7617' is defined on line 8406, but no explicit reference was found in the text == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-cache-07 -- Possible downref: Normative reference to a draft: ref. 'Caching' == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-messaging-07 -- Possible downref: Normative reference to a draft: ref. 'Messaging' ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Downref: Normative reference to an Informational RFC: RFC 1950 ** Downref: Normative reference to an Informational RFC: RFC 1951 ** Downref: Normative reference to an Informational RFC: RFC 1952 -- Possible downref: Non-RFC (?) normative reference: ref. 'USASCII' -- Possible downref: Non-RFC (?) normative reference: ref. 'Welch' -- Duplicate reference: RFC2978, mentioned in 'Err5433', was also mentioned in 'Err1912'. -- Obsolete informational reference (is this intentional?): RFC 2068 (Obsoleted by RFC 2616) -- Obsolete informational reference (is this intentional?): RFC 2145 (Obsoleted by RFC 7230) -- 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 2617 (Obsoleted by RFC 7235, RFC 7615, RFC 7616, RFC 7617) -- Obsolete informational reference (is this intentional?): RFC 2818 (Obsoleted by RFC 9110) -- Duplicate reference: RFC2978, mentioned in 'RFC2978', was also mentioned in 'Err5433'. -- Obsolete informational reference (is this intentional?): RFC 6125 (Obsoleted by RFC 9525) -- Obsolete informational reference (is this intentional?): RFC 7230 (Obsoleted by RFC 9110, RFC 9112) -- Obsolete informational reference (is this intentional?): RFC 7231 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7232 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7233 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7235 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7538 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7615 (Obsoleted by RFC 9110) Summary: 4 errors (**), 0 flaws (~~), 11 warnings (==), 28 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: M. Nottingham, Ed. 5 2818,7230,7231,7232,7233,7235 Fastly 6 ,7538,7615 (if approved) J. Reschke, Ed. 7 Intended status: Standards Track greenbytes 8 Expires: September 8, 2020 March 7, 2020 10 HTTP Semantics 11 draft-ietf-httpbis-semantics-07 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: its 18 architecture, terminology, the "http" and "https" Uniform Resource 19 Identifier (URI) schemes, core request methods, request header 20 fields, response status codes, response header fields, and content 21 negotiation. 23 This document obsoletes RFC 2818, RFC 7231, RFC 7232, RFC 7233, RFC 24 7235, RFC 7538, RFC 7615, and portions of RFC 7230. 26 Editorial Note 28 This note is to be removed before publishing as an RFC. 30 Discussion of this draft takes place on the HTTP working group 31 mailing list (ietf-http-wg@w3.org), which is archived at 32 . 34 Working Group information can be found at ; 35 source code and issues list for this draft can be found at 36 . 38 The changes in this draft are summarized in Appendix C.8. 40 Status of This Memo 42 This Internet-Draft is submitted in full conformance with the 43 provisions of BCP 78 and BCP 79. 45 Internet-Drafts are working documents of the Internet Engineering 46 Task Force (IETF). Note that other groups may also distribute 47 working documents as Internet-Drafts. The list of current Internet- 48 Drafts is at https://datatracker.ietf.org/drafts/current/. 50 Internet-Drafts are draft documents valid for a maximum of six months 51 and may be updated, replaced, or obsoleted by other documents at any 52 time. It is inappropriate to use Internet-Drafts as reference 53 material or to cite them other than as "work in progress." 55 This Internet-Draft will expire on September 8, 2020. 57 Copyright Notice 59 Copyright (c) 2020 IETF Trust and the persons identified as the 60 document authors. All rights reserved. 62 This document is subject to BCP 78 and the IETF Trust's Legal 63 Provisions Relating to IETF Documents 64 (https://trustee.ietf.org/license-info) in effect on the date of 65 publication of this document. Please review these documents 66 carefully, as they describe your rights and restrictions with respect 67 to this document. Code Components extracted from this document must 68 include Simplified BSD License text as described in Section 4.e of 69 the Trust Legal Provisions and are provided without warranty as 70 described in the Simplified BSD License. 72 This document may contain material from IETF Documents or IETF 73 Contributions published or made publicly available before November 74 10, 2008. The person(s) controlling the copyright in some of this 75 material may not have granted the IETF Trust the right to allow 76 modifications of such material outside the IETF Standards Process. 77 Without obtaining an adequate license from the person(s) controlling 78 the copyright in such materials, this document may not be modified 79 outside the IETF Standards Process, and derivative works of it may 80 not be created outside the IETF Standards Process, except to format 81 it for publication as an RFC or to translate it into languages other 82 than English. 84 Table of Contents 86 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 87 1.1. Requirements Notation . . . . . . . . . . . . . . . . . . 9 88 1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 10 89 1.2.1. Whitespace . . . . . . . . . . . . . . . . . . . . . 10 90 2. Architecture . . . . . . . . . . . . . . . . . . . . . . . . 11 91 2.1. Client/Server Messaging . . . . . . . . . . . . . . . . . 11 92 2.2. Intermediaries . . . . . . . . . . . . . . . . . . . . . 13 93 2.3. Caches . . . . . . . . . . . . . . . . . . . . . . . . . 15 94 2.4. Uniform Resource Identifiers . . . . . . . . . . . . . . 16 95 2.5. Resources . . . . . . . . . . . . . . . . . . . . . . . . 17 96 2.5.1. http URI Scheme . . . . . . . . . . . . . . . . . . . 17 97 2.5.2. https URI Scheme . . . . . . . . . . . . . . . . . . 18 98 2.5.3. http and https URI Normalization and Comparison . . . 19 99 2.5.4. Deprecated userinfo . . . . . . . . . . . . . . . . . 19 100 2.5.5. Fragment Identifiers on http(s) URI References . . . 20 101 3. Conformance . . . . . . . . . . . . . . . . . . . . . . . . . 20 102 3.1. Implementation Diversity . . . . . . . . . . . . . . . . 20 103 3.2. Role-based Requirements . . . . . . . . . . . . . . . . . 21 104 3.3. Parsing Elements . . . . . . . . . . . . . . . . . . . . 21 105 3.4. Error Handling . . . . . . . . . . . . . . . . . . . . . 22 106 3.5. Protocol Versioning . . . . . . . . . . . . . . . . . . . 22 107 4. Header and Trailer Fields . . . . . . . . . . . . . . . . . . 24 108 4.1. Field Ordering and Combination . . . . . . . . . . . . . 25 109 4.2. Field Limits . . . . . . . . . . . . . . . . . . . . . . 26 110 4.3. Field Names . . . . . . . . . . . . . . . . . . . . . . . 26 111 4.3.1. Field Extensibility . . . . . . . . . . . . . . . . . 27 112 4.3.2. Field Name Registry . . . . . . . . . . . . . . . . . 27 113 4.4. Field Values . . . . . . . . . . . . . . . . . . . . . . 28 114 4.4.1. Common Field Value Components . . . . . . . . . . . . 30 115 4.5. ABNF List Extension: #rule . . . . . . . . . . . . . . . 31 116 4.5.1. Sender Requirements . . . . . . . . . . . . . . . . . 31 117 4.5.2. Recipient Requirements . . . . . . . . . . . . . . . 32 118 4.6. Trailer Fields . . . . . . . . . . . . . . . . . . . . . 32 119 4.6.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . 33 120 4.6.2. Limitations . . . . . . . . . . . . . . . . . . . . . 33 121 4.6.3. Trailer . . . . . . . . . . . . . . . . . . . . . . . 34 122 4.7. Considerations for New HTTP Fields . . . . . . . . . . . 34 123 4.8. Fields Defined In This Document . . . . . . . . . . . . . 35 124 5. Message Routing . . . . . . . . . . . . . . . . . . . . . . . 37 125 5.1. Identifying a Target Resource . . . . . . . . . . . . . . 37 126 5.2. Determining Origin . . . . . . . . . . . . . . . . . . . 37 127 5.3. Routing Inbound . . . . . . . . . . . . . . . . . . . . . 38 128 5.4. Direct Authoritative Access . . . . . . . . . . . . . . . 38 129 5.4.1. http origins . . . . . . . . . . . . . . . . . . . . 38 130 5.4.2. https origins . . . . . . . . . . . . . . . . . . . . 39 131 5.4.3. Initiating HTTP Over TLS . . . . . . . . . . . . . . 41 132 5.5. Effective Request URI . . . . . . . . . . . . . . . . . . 43 133 5.6. Host . . . . . . . . . . . . . . . . . . . . . . . . . . 43 134 5.7. Message Forwarding . . . . . . . . . . . . . . . . . . . 44 135 5.7.1. Via . . . . . . . . . . . . . . . . . . . . . . . . . 45 136 5.7.2. Transformations . . . . . . . . . . . . . . . . . . . 47 137 6. Representations . . . . . . . . . . . . . . . . . . . . . . . 48 138 6.1. Representation Data . . . . . . . . . . . . . . . . . . . 48 139 6.1.1. Media Type . . . . . . . . . . . . . . . . . . . . . 49 140 6.1.2. Content Codings . . . . . . . . . . . . . . . . . . . 51 141 6.1.3. Language Tags . . . . . . . . . . . . . . . . . . . . 53 142 6.1.4. Range Units . . . . . . . . . . . . . . . . . . . . . 54 143 6.2. Representation Metadata . . . . . . . . . . . . . . . . . 58 144 6.2.1. Content-Type . . . . . . . . . . . . . . . . . . . . 58 145 6.2.2. Content-Encoding . . . . . . . . . . . . . . . . . . 59 146 6.2.3. Content-Language . . . . . . . . . . . . . . . . . . 60 147 6.2.4. Content-Length . . . . . . . . . . . . . . . . . . . 61 148 6.2.5. Content-Location . . . . . . . . . . . . . . . . . . 62 149 6.3. Payload . . . . . . . . . . . . . . . . . . . . . . . . . 64 150 6.3.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . 64 151 6.3.2. Identification . . . . . . . . . . . . . . . . . . . 65 152 6.3.3. Payload Body . . . . . . . . . . . . . . . . . . . . 66 153 6.3.4. Content-Range . . . . . . . . . . . . . . . . . . . . 66 154 6.3.5. Media Type multipart/byteranges . . . . . . . . . . . 68 155 6.4. Content Negotiation . . . . . . . . . . . . . . . . . . . 70 156 6.4.1. Proactive Negotiation . . . . . . . . . . . . . . . . 71 157 6.4.2. Reactive Negotiation . . . . . . . . . . . . . . . . 72 158 7. Request Methods . . . . . . . . . . . . . . . . . . . . . . . 73 159 7.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 73 160 7.2. Common Method Properties . . . . . . . . . . . . . . . . 74 161 7.2.1. Safe Methods . . . . . . . . . . . . . . . . . . . . 75 162 7.2.2. Idempotent Methods . . . . . . . . . . . . . . . . . 76 163 7.2.3. Methods and Caching . . . . . . . . . . . . . . . . . 77 164 7.3. Method Definitions . . . . . . . . . . . . . . . . . . . 77 165 7.3.1. GET . . . . . . . . . . . . . . . . . . . . . . . . . 77 166 7.3.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . 78 167 7.3.3. POST . . . . . . . . . . . . . . . . . . . . . . . . 79 168 7.3.4. PUT . . . . . . . . . . . . . . . . . . . . . . . . . 80 169 7.3.5. DELETE . . . . . . . . . . . . . . . . . . . . . . . 82 170 7.3.6. CONNECT . . . . . . . . . . . . . . . . . . . . . . . 83 171 7.3.7. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . 85 172 7.3.8. TRACE . . . . . . . . . . . . . . . . . . . . . . . . 86 173 7.4. Method Extensibility . . . . . . . . . . . . . . . . . . 86 174 7.4.1. Method Registry . . . . . . . . . . . . . . . . . . . 86 175 7.4.2. Considerations for New Methods . . . . . . . . . . . 87 176 8. Request Header Fields . . . . . . . . . . . . . . . . . . . . 87 177 8.1. Controls . . . . . . . . . . . . . . . . . . . . . . . . 88 178 8.1.1. Expect . . . . . . . . . . . . . . . . . . . . . . . 88 179 8.1.2. Max-Forwards . . . . . . . . . . . . . . . . . . . . 90 180 8.2. Preconditions . . . . . . . . . . . . . . . . . . . . . . 91 181 8.2.1. Evaluation . . . . . . . . . . . . . . . . . . . . . 92 182 8.2.2. Precedence . . . . . . . . . . . . . . . . . . . . . 93 183 8.2.3. If-Match . . . . . . . . . . . . . . . . . . . . . . 95 184 8.2.4. If-None-Match . . . . . . . . . . . . . . . . . . . . 96 185 8.2.5. If-Modified-Since . . . . . . . . . . . . . . . . . . 97 186 8.2.6. If-Unmodified-Since . . . . . . . . . . . . . . . . . 98 187 8.2.7. If-Range . . . . . . . . . . . . . . . . . . . . . . 100 188 8.3. Range . . . . . . . . . . . . . . . . . . . . . . . . . . 101 189 8.4. Content Negotiation . . . . . . . . . . . . . . . . . . . 102 190 8.4.1. Quality Values . . . . . . . . . . . . . . . . . . . 103 191 8.4.2. Accept . . . . . . . . . . . . . . . . . . . . . . . 104 192 8.4.3. Accept-Charset . . . . . . . . . . . . . . . . . . . 106 193 8.4.4. Accept-Encoding . . . . . . . . . . . . . . . . . . . 107 194 8.4.5. Accept-Language . . . . . . . . . . . . . . . . . . . 108 195 8.5. Authentication Credentials . . . . . . . . . . . . . . . 109 196 8.5.1. Challenge and Response . . . . . . . . . . . . . . . 109 197 8.5.2. Protection Space (Realm) . . . . . . . . . . . . . . 111 198 8.5.3. Authorization . . . . . . . . . . . . . . . . . . . . 112 199 8.5.4. Proxy-Authorization . . . . . . . . . . . . . . . . . 112 200 8.5.5. Authentication Scheme Extensibility . . . . . . . . . 113 201 8.6. Request Context . . . . . . . . . . . . . . . . . . . . . 115 202 8.6.1. From . . . . . . . . . . . . . . . . . . . . . . . . 115 203 8.6.2. Referer . . . . . . . . . . . . . . . . . . . . . . . 116 204 8.6.3. User-Agent . . . . . . . . . . . . . . . . . . . . . 117 205 9. Response Status Codes . . . . . . . . . . . . . . . . . . . . 118 206 9.1. Overview of Status Codes . . . . . . . . . . . . . . . . 119 207 9.2. Informational 1xx . . . . . . . . . . . . . . . . . . . . 120 208 9.2.1. 100 Continue . . . . . . . . . . . . . . . . . . . . 121 209 9.2.2. 101 Switching Protocols . . . . . . . . . . . . . . . 121 210 9.3. Successful 2xx . . . . . . . . . . . . . . . . . . . . . 121 211 9.3.1. 200 OK . . . . . . . . . . . . . . . . . . . . . . . 121 212 9.3.2. 201 Created . . . . . . . . . . . . . . . . . . . . . 122 213 9.3.3. 202 Accepted . . . . . . . . . . . . . . . . . . . . 122 214 9.3.4. 203 Non-Authoritative Information . . . . . . . . . . 123 215 9.3.5. 204 No Content . . . . . . . . . . . . . . . . . . . 123 216 9.3.6. 205 Reset Content . . . . . . . . . . . . . . . . . . 124 217 9.3.7. 206 Partial Content . . . . . . . . . . . . . . . . . 124 218 9.4. Redirection 3xx . . . . . . . . . . . . . . . . . . . . . 127 219 9.4.1. 300 Multiple Choices . . . . . . . . . . . . . . . . 129 220 9.4.2. 301 Moved Permanently . . . . . . . . . . . . . . . . 130 221 9.4.3. 302 Found . . . . . . . . . . . . . . . . . . . . . . 130 222 9.4.4. 303 See Other . . . . . . . . . . . . . . . . . . . . 131 223 9.4.5. 304 Not Modified . . . . . . . . . . . . . . . . . . 131 224 9.4.6. 305 Use Proxy . . . . . . . . . . . . . . . . . . . . 132 225 9.4.7. 306 (Unused) . . . . . . . . . . . . . . . . . . . . 132 226 9.4.8. 307 Temporary Redirect . . . . . . . . . . . . . . . 132 227 9.4.9. 308 Permanent Redirect . . . . . . . . . . . . . . . 133 228 9.5. Client Error 4xx . . . . . . . . . . . . . . . . . . . . 133 229 9.5.1. 400 Bad Request . . . . . . . . . . . . . . . . . . . 133 230 9.5.2. 401 Unauthorized . . . . . . . . . . . . . . . . . . 133 231 9.5.3. 402 Payment Required . . . . . . . . . . . . . . . . 134 232 9.5.4. 403 Forbidden . . . . . . . . . . . . . . . . . . . . 134 233 9.5.5. 404 Not Found . . . . . . . . . . . . . . . . . . . . 134 234 9.5.6. 405 Method Not Allowed . . . . . . . . . . . . . . . 135 235 9.5.7. 406 Not Acceptable . . . . . . . . . . . . . . . . . 135 236 9.5.8. 407 Proxy Authentication Required . . . . . . . . . . 135 237 9.5.9. 408 Request Timeout . . . . . . . . . . . . . . . . . 135 238 9.5.10. 409 Conflict . . . . . . . . . . . . . . . . . . . . 136 239 9.5.11. 410 Gone . . . . . . . . . . . . . . . . . . . . . . 136 240 9.5.12. 411 Length Required . . . . . . . . . . . . . . . . . 136 241 9.5.13. 412 Precondition Failed . . . . . . . . . . . . . . . 137 242 9.5.14. 413 Payload Too Large . . . . . . . . . . . . . . . . 137 243 9.5.15. 414 URI Too Long . . . . . . . . . . . . . . . . . . 137 244 9.5.16. 415 Unsupported Media Type . . . . . . . . . . . . . 137 245 9.5.17. 416 Range Not Satisfiable . . . . . . . . . . . . . . 138 246 9.5.18. 417 Expectation Failed . . . . . . . . . . . . . . . 138 247 9.5.19. 418 (Unused) . . . . . . . . . . . . . . . . . . . . 138 248 9.5.20. 422 Unprocessable Payload . . . . . . . . . . . . . . 139 249 9.5.21. 426 Upgrade Required . . . . . . . . . . . . . . . . 139 250 9.6. Server Error 5xx . . . . . . . . . . . . . . . . . . . . 139 251 9.6.1. 500 Internal Server Error . . . . . . . . . . . . . . 140 252 9.6.2. 501 Not Implemented . . . . . . . . . . . . . . . . . 140 253 9.6.3. 502 Bad Gateway . . . . . . . . . . . . . . . . . . . 140 254 9.6.4. 503 Service Unavailable . . . . . . . . . . . . . . . 140 255 9.6.5. 504 Gateway Timeout . . . . . . . . . . . . . . . . . 140 256 9.6.6. 505 HTTP Version Not Supported . . . . . . . . . . . 140 257 9.7. Status Code Extensibility . . . . . . . . . . . . . . . . 141 258 9.7.1. Status Code Registry . . . . . . . . . . . . . . . . 141 259 9.7.2. Considerations for New Status Codes . . . . . . . . . 141 260 10. Response Header Fields . . . . . . . . . . . . . . . . . . . 142 261 10.1. Control Data . . . . . . . . . . . . . . . . . . . . . . 142 262 10.1.1. Origination Date . . . . . . . . . . . . . . . . . . 143 263 10.1.2. Location . . . . . . . . . . . . . . . . . . . . . . 146 264 10.1.3. Retry-After . . . . . . . . . . . . . . . . . . . . 147 265 10.1.4. Vary . . . . . . . . . . . . . . . . . . . . . . . . 147 266 10.2. Validators . . . . . . . . . . . . . . . . . . . . . . . 149 267 10.2.1. Weak versus Strong . . . . . . . . . . . . . . . . . 150 268 10.2.2. Last-Modified . . . . . . . . . . . . . . . . . . . 151 269 10.2.3. ETag . . . . . . . . . . . . . . . . . . . . . . . . 153 270 10.2.4. When to Use Entity-Tags and Last-Modified Dates . . 157 271 10.3. Authentication Challenges . . . . . . . . . . . . . . . 157 272 10.3.1. WWW-Authenticate . . . . . . . . . . . . . . . . . . 158 273 10.3.2. Proxy-Authenticate . . . . . . . . . . . . . . . . . 159 274 10.3.3. Authentication-Info . . . . . . . . . . . . . . . . 159 275 10.3.4. Proxy-Authentication-Info . . . . . . . . . . . . . 160 276 10.4. Response Context . . . . . . . . . . . . . . . . . . . . 161 277 10.4.1. Accept-Ranges . . . . . . . . . . . . . . . . . . . 161 278 10.4.2. Allow . . . . . . . . . . . . . . . . . . . . . . . 161 279 10.4.3. Server . . . . . . . . . . . . . . . . . . . . . . . 162 280 11. Security Considerations . . . . . . . . . . . . . . . . . . . 163 281 11.1. Establishing Authority . . . . . . . . . . . . . . . . . 163 282 11.2. Risks of Intermediaries . . . . . . . . . . . . . . . . 164 283 11.3. Attacks Based on File and Path Names . . . . . . . . . . 165 284 11.4. Attacks Based on Command, Code, or Query Injection . . . 165 285 11.5. Attacks via Protocol Element Length . . . . . . . . . . 166 286 11.6. Disclosure of Personal Information . . . . . . . . . . . 166 287 11.7. Privacy of Server Log Information . . . . . . . . . . . 166 288 11.8. Disclosure of Sensitive Information in URIs . . . . . . 167 289 11.9. Disclosure of Fragment after Redirects . . . . . . . . . 167 290 11.10. Disclosure of Product Information . . . . . . . . . . . 168 291 11.11. Browser Fingerprinting . . . . . . . . . . . . . . . . . 168 292 11.12. Validator Retention . . . . . . . . . . . . . . . . . . 169 293 11.13. Denial-of-Service Attacks Using Range . . . . . . . . . 170 294 11.14. Authentication Considerations . . . . . . . . . . . . . 170 295 11.14.1. Confidentiality of Credentials . . . . . . . . . . 170 296 11.14.2. Credentials and Idle Clients . . . . . . . . . . . 171 297 11.14.3. Protection Spaces . . . . . . . . . . . . . . . . . 171 298 11.14.4. Additional Response Fields . . . . . . . . . . . . 172 299 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 172 300 12.1. URI Scheme Registration . . . . . . . . . . . . . . . . 172 301 12.2. Method Registration . . . . . . . . . . . . . . . . . . 172 302 12.3. Status Code Registration . . . . . . . . . . . . . . . . 172 303 12.4. HTTP Field Name Registration . . . . . . . . . . . . . . 173 304 12.5. Authentication Scheme Registration . . . . . . . . . . . 173 305 12.6. Content Coding Registration . . . . . . . . . . . . . . 173 306 12.7. Range Unit Registration . . . . . . . . . . . . . . . . 174 307 12.8. Media Type Registration . . . . . . . . . . . . . . . . 174 308 12.9. Port Registration . . . . . . . . . . . . . . . . . . . 174 309 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 174 310 13.1. Normative References . . . . . . . . . . . . . . . . . . 174 311 13.2. Informative References . . . . . . . . . . . . . . . . . 176 312 Appendix A. Collected ABNF . . . . . . . . . . . . . . . . . . . 182 313 Appendix B. Changes from previous RFCs . . . . . . . . . . . . . 186 314 B.1. Changes from RFC 2818 . . . . . . . . . . . . . . . . . . 186 315 B.2. Changes from RFC 7230 . . . . . . . . . . . . . . . . . . 186 316 B.3. Changes from RFC 7231 . . . . . . . . . . . . . . . . . . 187 317 B.4. Changes from RFC 7232 . . . . . . . . . . . . . . . . . . 188 318 B.5. Changes from RFC 7233 . . . . . . . . . . . . . . . . . . 188 319 B.6. Changes from RFC 7235 . . . . . . . . . . . . . . . . . . 188 320 B.7. Changes from RFC 7538 . . . . . . . . . . . . . . . . . . 188 321 B.8. Changes from RFC 7615 . . . . . . . . . . . . . . . . . . 188 322 Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 188 323 C.1. Between RFC723x and draft 00 . . . . . . . . . . . . . . 188 324 C.2. Since draft-ietf-httpbis-semantics-00 . . . . . . . . . . 189 325 C.3. Since draft-ietf-httpbis-semantics-01 . . . . . . . . . . 189 326 C.4. Since draft-ietf-httpbis-semantics-02 . . . . . . . . . . 191 327 C.5. Since draft-ietf-httpbis-semantics-03 . . . . . . . . . . 192 328 C.6. Since draft-ietf-httpbis-semantics-04 . . . . . . . . . . 192 329 C.7. Since draft-ietf-httpbis-semantics-05 . . . . . . . . . . 193 330 C.8. Since draft-ietf-httpbis-semantics-06 . . . . . . . . . . 194 331 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 332 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 205 333 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 206 335 1. Introduction 337 The Hypertext Transfer Protocol (HTTP) is a stateless application- 338 level request/response protocol that uses extensible semantics and 339 self-descriptive messages for flexible interaction with network-based 340 hypertext information systems. HTTP is defined by a series of 341 documents that collectively form the HTTP/1.1 specification: 343 o "HTTP Semantics" (this document) 345 o "HTTP Caching" [Caching] 347 o "HTTP/1.1 Messaging" [Messaging] 349 HTTP is a generic interface protocol for information systems. It is 350 designed to hide the details of how a service is implemented by 351 presenting a uniform interface to clients that is independent of the 352 types of resources provided. Likewise, servers do not need to be 353 aware of each client's purpose: an HTTP request can be considered in 354 isolation rather than being associated with a specific type of client 355 or a predetermined sequence of application steps. The result is a 356 protocol that can be used effectively in many different contexts and 357 for which implementations can evolve independently over time. 359 HTTP is also designed for use as an intermediation protocol for 360 translating communication to and from non-HTTP information systems. 361 HTTP proxies and gateways can provide access to alternative 362 information services by translating their diverse protocols into a 363 hypertext format that can be viewed and manipulated by clients in the 364 same way as HTTP services. 366 One consequence of this flexibility is that the protocol cannot be 367 defined in terms of what occurs behind the interface. Instead, we 368 are limited to defining the syntax of communication, the intent of 369 received communication, and the expected behavior of recipients. If 370 the communication is considered in isolation, then successful actions 371 ought to be reflected in corresponding changes to the observable 372 interface provided by servers. However, since multiple clients might 373 act in parallel and perhaps at cross-purposes, we cannot require that 374 such changes be observable beyond the scope of a single response. 376 Each HTTP message is either a request or a response. A server 377 listens on a connection for a request, parses each message received, 378 interprets the message semantics in relation to the identified 379 request target, and responds to that request with one or more 380 response messages. A client constructs request messages to 381 communicate specific intentions, examines received responses to see 382 if the intentions were carried out, and determines how to interpret 383 the results. 385 HTTP provides a uniform interface for interacting with a resource 386 (Section 2.5), regardless of its type, nature, or implementation, via 387 the manipulation and transfer of representations (Section 6). 389 This document defines semantics that are common to all versions of 390 HTTP. HTTP semantics include the intentions defined by each request 391 method (Section 7), extensions to those semantics that might be 392 described in request header fields (Section 8), the meaning of status 393 codes to indicate a machine-readable response (Section 9), and the 394 meaning of other control data and resource metadata that might be 395 given in response header fields (Section 10). 397 This document also defines representation metadata that describe how 398 a payload is intended to be interpreted by a recipient, the request 399 header fields that might influence content selection, and the various 400 selection algorithms that are collectively referred to as "content 401 negotiation" (Section 6.4). 403 This document defines HTTP range requests, partial responses, and the 404 multipart/byteranges media type. 406 This document obsoletes the portions of RFC 7230 that are independent 407 of the HTTP/1.1 messaging syntax and connection management, with the 408 changes being summarized in Appendix B.2. The other parts of RFC 409 7230 are obsoleted by "HTTP/1.1 Messaging" [Messaging]. This 410 document also obsoletes RFC 2818 (see Appendix B.1), RFC 7231 (see 411 Appendix B.3), RFC 7232 (see Appendix B.4), RFC 7233 (see 412 Appendix B.5), RFC 7235 (see Appendix B.6), RFC 7538 (see 413 Appendix B.7), and RFC 7615 (see Appendix B.8). 415 1.1. Requirements Notation 417 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 418 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 419 "OPTIONAL" in this document are to be interpreted as described in BCP 420 14 [RFC2119] [RFC8174] when, and only when, they appear in all 421 capitals, as shown here. 423 Conformance criteria and considerations regarding error handling are 424 defined in Section 3. 426 1.2. Syntax Notation 428 This specification uses the Augmented Backus-Naur Form (ABNF) 429 notation of [RFC5234], extended with the notation for case- 430 sensitivity in strings defined in [RFC7405]. 432 It also uses a list extension, defined in Section 4.5, that allows 433 for compact definition of comma-separated lists using a '#' operator 434 (similar to how the '*' operator indicates repetition). Appendix A 435 shows the collected grammar with all list operators expanded to 436 standard ABNF notation. 438 As a convention, ABNF rule names prefixed with "obs-" denote 439 "obsolete" grammar rules that appear for historical reasons. 441 The following core rules are included by reference, as defined in 442 Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return), 443 CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double 444 quote), HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF 445 (line feed), OCTET (any 8-bit sequence of data), SP (space), and 446 VCHAR (any visible US-ASCII character). 448 Section 4.4.1 defines some generic syntactic components for field 449 values. 451 The rules below are defined in [Messaging]: 453 obs-fold = 454 protocol-name = 455 protocol-version = 456 request-target = 458 This specification uses the terms "character", "character encoding 459 scheme", "charset", and "protocol element" as they are defined in 460 [RFC6365]. 462 1.2.1. Whitespace 464 This specification uses three rules to denote the use of linear 465 whitespace: OWS (optional whitespace), RWS (required whitespace), and 466 BWS ("bad" whitespace). 468 The OWS rule is used where zero or more linear whitespace octets 469 might appear. For protocol elements where optional whitespace is 470 preferred to improve readability, a sender SHOULD generate the 471 optional whitespace as a single SP; otherwise, a sender SHOULD NOT 472 generate optional whitespace except as needed to white out invalid or 473 unwanted protocol elements during in-place message filtering. 475 The RWS rule is used when at least one linear whitespace octet is 476 required to separate field tokens. A sender SHOULD generate RWS as a 477 single SP. 479 OWS and RWS have the same semantics as a single SP. Any content 480 known to be defined as OWS or RWS MAY be replaced with a single SP 481 before interpreting it or forwarding the message downstream. 483 The BWS rule is used where the grammar allows optional whitespace 484 only for historical reasons. A sender MUST NOT generate BWS in 485 messages. A recipient MUST parse for such bad whitespace and remove 486 it before interpreting the protocol element. 488 BWS has no semantics. Any content known to be defined as BWS MAY be 489 removed before interpreting it or forwarding the message downstream. 491 OWS = *( SP / HTAB ) 492 ; optional whitespace 493 RWS = 1*( SP / HTAB ) 494 ; required whitespace 495 BWS = OWS 496 ; "bad" whitespace 498 2. Architecture 500 HTTP was created for the World Wide Web (WWW) architecture and has 501 evolved over time to support the scalability needs of a worldwide 502 hypertext system. Much of that architecture is reflected in the 503 terminology and syntax productions used to define HTTP. 505 2.1. Client/Server Messaging 507 HTTP is a stateless request/response protocol that operates by 508 exchanging messages (Section 2 of [Messaging]) across a reliable 509 transport- or session-layer "connection" (Section 9 of [Messaging]). 510 An HTTP "client" is a program that establishes a connection to a 511 server for the purpose of sending one or more HTTP requests. An HTTP 512 "server" is a program that accepts connections in order to service 513 HTTP requests by sending HTTP responses. 515 The terms "client" and "server" refer only to the roles that these 516 programs perform for a particular connection. The same program might 517 act as a client on some connections and a server on others. The term 518 "user agent" refers to any of the various client programs that 519 initiate a request, including (but not limited to) browsers, spiders 520 (web-based robots), command-line tools, custom applications, and 521 mobile apps. The term "origin server" refers to the program that can 522 originate authoritative responses for a given target resource. The 523 terms "sender" and "recipient" refer to any implementation that sends 524 or receives a given message, respectively. 526 HTTP relies upon the Uniform Resource Identifier (URI) standard 527 [RFC3986] to indicate the target resource (Section 5.1) and 528 relationships between resources. 530 Most HTTP communication consists of a retrieval request (GET) for a 531 representation of some resource identified by a URI. In the simplest 532 case, this might be accomplished via a single bidirectional 533 connection (===) between the user agent (UA) and the origin server 534 (O). 536 request > 537 UA ======================================= O 538 < response 540 Each major version of HTTP defines its own syntax for the inclusion 541 of information in messages. Nevertheless, a common abstraction is 542 that a message includes some form of envelope/framing, a potential 543 set of named fields up front (a header section), a potential body, 544 and a potential following set of named fields (a trailer section). 546 A client sends an HTTP request to a server in the form of a request 547 message, beginning with a method (Section 7) and URI, followed by 548 header fields containing request modifiers, client information, and 549 representation metadata (Section 4), and finally a payload body (if 550 any, Section 6.3.3). 552 A server responds to a client's request by sending one or more HTTP 553 response messages, each beginning with a success or error code 554 (Section 9), possibly followed by header fields containing server 555 information, resource metadata, and representation metadata 556 (Section 4), and finally a payload body (if any, Section 6.3.3). 558 A connection might be used for multiple request/response exchanges. 559 The mechanism used to correlate between request and response messages 560 is version dependent; some versions of HTTP use implicit ordering of 561 messages, while others use an explicit identifier. 563 Responses (both final and interim) can be sent at any time after a 564 request is received, even if it is not yet complete. However, 565 clients (including intermediaries) might abandon a request if the 566 response is not forthcoming within a reasonable period of time. 568 The following example illustrates a typical message exchange for a 569 GET request (Section 7.3.1) on the URI "http://www.example.com/ 570 hello.txt": 572 Client request: 574 GET /hello.txt HTTP/1.1 575 User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 576 Host: www.example.com 577 Accept-Language: en, mi 579 Server response: 581 HTTP/1.1 200 OK 582 Date: Mon, 27 Jul 2009 12:28:53 GMT 583 Server: Apache 584 Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT 585 ETag: "34aa387-d-1568eb00" 586 Accept-Ranges: bytes 587 Content-Length: 51 588 Vary: Accept-Encoding 589 Content-Type: text/plain 591 Hello World! My payload includes a trailing CRLF. 593 2.2. Intermediaries 595 HTTP enables the use of intermediaries to satisfy requests through a 596 chain of connections. There are three common forms of HTTP 597 intermediary: proxy, gateway, and tunnel. In some cases, a single 598 intermediary might act as an origin server, proxy, gateway, or 599 tunnel, switching behavior based on the nature of each request. 601 > > > > 602 UA =========== A =========== B =========== C =========== O 603 < < < < 605 The figure above shows three intermediaries (A, B, and C) between the 606 user agent and origin server. A request or response message that 607 travels the whole chain will pass through four separate connections. 608 Some HTTP communication options might apply only to the connection 609 with the nearest, non-tunnel neighbor, only to the endpoints of the 610 chain, or to all connections along the chain. Although the diagram 611 is linear, each participant might be engaged in multiple, 612 simultaneous communications. For example, B might be receiving 613 requests from many clients other than A, and/or forwarding requests 614 to servers other than C, at the same time that it is handling A's 615 request. Likewise, later requests might be sent through a different 616 path of connections, often based on dynamic configuration for load 617 balancing. 619 The terms "upstream" and "downstream" are used to describe 620 directional requirements in relation to the message flow: all 621 messages flow from upstream to downstream. The terms "inbound" and 622 "outbound" are used to describe directional requirements in relation 623 to the request route: "inbound" means toward the origin server and 624 "outbound" means toward the user agent. 626 A "proxy" is a message-forwarding agent that is selected by the 627 client, usually via local configuration rules, to receive requests 628 for some type(s) of absolute URI and attempt to satisfy those 629 requests via translation through the HTTP interface. Some 630 translations are minimal, such as for proxy requests for "http" URIs, 631 whereas other requests might require translation to and from entirely 632 different application-level protocols. Proxies are often used to 633 group an organization's HTTP requests through a common intermediary 634 for the sake of security, annotation services, or shared caching. 635 Some proxies are designed to apply transformations to selected 636 messages or payloads while they are being forwarded, as described in 637 Section 5.7.2. 639 A "gateway" (a.k.a. "reverse proxy") is an intermediary that acts as 640 an origin server for the outbound connection but translates received 641 requests and forwards them inbound to another server or servers. 642 Gateways are often used to encapsulate legacy or untrusted 643 information services, to improve server performance through 644 "accelerator" caching, and to enable partitioning or load balancing 645 of HTTP services across multiple machines. 647 All HTTP requirements applicable to an origin server also apply to 648 the outbound communication of a gateway. A gateway communicates with 649 inbound servers using any protocol that it desires, including private 650 extensions to HTTP that are outside the scope of this specification. 651 However, an HTTP-to-HTTP gateway that wishes to interoperate with 652 third-party HTTP servers ought to conform to user agent requirements 653 on the gateway's inbound connection. 655 A "tunnel" acts as a blind relay between two connections without 656 changing the messages. Once active, a tunnel is not considered a 657 party to the HTTP communication, though the tunnel might have been 658 initiated by an HTTP request. A tunnel ceases to exist when both 659 ends of the relayed connection are closed. Tunnels are used to 660 extend a virtual connection through an intermediary, such as when 661 Transport Layer Security (TLS, [RFC8446]) is used to establish 662 confidential communication through a shared firewall proxy. 664 The above categories for intermediary only consider those acting as 665 participants in the HTTP communication. There are also 666 intermediaries that can act on lower layers of the network protocol 667 stack, filtering or redirecting HTTP traffic without the knowledge or 668 permission of message senders. Network intermediaries are 669 indistinguishable (at a protocol level) from a man-in-the-middle 670 attack, often introducing security flaws or interoperability problems 671 due to mistakenly violating HTTP semantics. 673 For example, an "interception proxy" [RFC3040] (also commonly known 674 as a "transparent proxy" [RFC1919] or "captive portal") differs from 675 an HTTP proxy because it is not selected by the client. Instead, an 676 interception proxy filters or redirects outgoing TCP port 80 packets 677 (and occasionally other common port traffic). Interception proxies 678 are commonly found on public network access points, as a means of 679 enforcing account subscription prior to allowing use of non-local 680 Internet services, and within corporate firewalls to enforce network 681 usage policies. 683 HTTP is defined as a stateless protocol, meaning that each request 684 message can be understood in isolation. Many implementations depend 685 on HTTP's stateless design in order to reuse proxied connections or 686 dynamically load balance requests across multiple servers. Hence, a 687 server MUST NOT assume that two requests on the same connection are 688 from the same user agent unless the connection is secured and 689 specific to that agent. Some non-standard HTTP extensions (e.g., 690 [RFC4559]) have been known to violate this requirement, resulting in 691 security and interoperability problems. 693 2.3. Caches 695 A "cache" is a local store of previous response messages and the 696 subsystem that controls its message storage, retrieval, and deletion. 697 A cache stores cacheable responses in order to reduce the response 698 time and network bandwidth consumption on future, equivalent 699 requests. Any client or server MAY employ a cache, though a cache 700 cannot be used by a server while it is acting as a tunnel. 702 The effect of a cache is that the request/response chain is shortened 703 if one of the participants along the chain has a cached response 704 applicable to that request. The following illustrates the resulting 705 chain if B has a cached copy of an earlier response from O (via C) 706 for a request that has not been cached by UA or A. 708 > > 709 UA =========== A =========== B - - - - - - C - - - - - - O 710 < < 712 A response is "cacheable" if a cache is allowed to store a copy of 713 the response message for use in answering subsequent requests. Even 714 when a response is cacheable, there might be additional constraints 715 placed by the client or by the origin server on when that cached 716 response can be used for a particular request. HTTP requirements for 717 cache behavior and cacheable responses are defined in Section 2 of 718 [Caching]. 720 There is a wide variety of architectures and configurations of caches 721 deployed across the World Wide Web and inside large organizations. 722 These include national hierarchies of proxy caches to save 723 transoceanic bandwidth, collaborative systems that broadcast or 724 multicast cache entries, archives of pre-fetched cache entries for 725 use in off-line or high-latency environments, and so on. 727 2.4. Uniform Resource Identifiers 729 Uniform Resource Identifiers (URIs) [RFC3986] are used throughout 730 HTTP as the means for identifying resources (Section 2.5). URI 731 references are used to target requests, indicate redirects, and 732 define relationships. 734 The definitions of "URI-reference", "absolute-URI", "relative-part", 735 "authority", "port", "host", "path-abempty", "segment", and "query" 736 are adopted from the URI generic syntax. An "absolute-path" rule is 737 defined for protocol elements that can contain a non-empty path 738 component. (This rule differs slightly from the path-abempty rule of 739 RFC 3986, which allows for an empty path to be used in references, 740 and path-absolute rule, which does not allow paths that begin with 741 "//".) A "partial-URI" rule is defined for protocol elements that 742 can contain a relative URI but not a fragment component. 744 URI-reference = 745 absolute-URI = 746 relative-part = 747 authority = 748 uri-host = 749 port = 750 path-abempty = 751 segment = 752 query = 754 absolute-path = 1*( "/" segment ) 755 partial-URI = relative-part [ "?" query ] 757 Each protocol element in HTTP that allows a URI reference will 758 indicate in its ABNF production whether the element allows any form 759 of reference (URI-reference), only a URI in absolute form (absolute- 760 URI), only the path and optional query components, or some 761 combination of the above. Unless otherwise indicated, URI references 762 are parsed relative to the effective request URI (Section 5.5). 764 It is RECOMMENDED that all senders and recipients support, at a 765 minimum, URIs with lengths of 8000 octets in protocol elements. Note 766 that this implies some structures and on-wire representations (for 767 example, the request line in HTTP/1.1) will necessarily be larger in 768 some cases. 770 2.5. Resources 772 The target of an HTTP request is called a "resource". HTTP does not 773 limit the nature of a resource; it merely defines an interface that 774 might be used to interact with resources. Each resource is 775 identified by a Uniform Resource Identifier (URI), as described in 776 Section 2.4. 778 One design goal of HTTP is to separate resource identification from 779 request semantics, which is made possible by vesting the request 780 semantics in the request method (Section 7) and a few request- 781 modifying header fields (Section 8). If there is a conflict between 782 the method semantics and any semantic implied by the URI itself, as 783 described in Section 7.2.1, the method semantics take precedence. 785 IANA maintains the registry of URI Schemes [BCP35] at 786 . Although requests 787 might target any URI scheme, the following schemes are inherent to 788 HTTP servers: 790 +------------+------------------------------------+---------------+ 791 | URI Scheme | Description | Reference | 792 +------------+------------------------------------+---------------+ 793 | http | Hypertext Transfer Protocol | Section 2.5.1 | 794 | https | Hypertext Transfer Protocol Secure | Section 2.5.2 | 795 +------------+------------------------------------+---------------+ 797 Note that the presence of an "http" or "https" URI does not imply 798 that there is always an HTTP server at the identified origin 799 listening for connections. Anyone can mint a URI, whether or not a 800 server exists and whether or not that server currently maps that 801 identifier to a resource. The delegated nature of registered names 802 and IP addresses creates a federated namespace whether or not an HTTP 803 server is present. 805 2.5.1. http URI Scheme 807 The "http" URI scheme is hereby defined for minting identifiers 808 within the hierarchical namespace governed by a potential HTTP origin 809 server listening for TCP ([RFC0793]) connections on a given port. 811 http-URI = "http" "://" authority path-abempty [ "?" query ] 813 The origin server for an "http" URI is identified by the authority 814 component, which includes a host identifier and optional port number 815 ([RFC3986], Section 3.2.2). If the port subcomponent is empty or not 816 given, TCP port 80 (the reserved port for WWW services) is the 817 default. The origin determines who has the right to respond 818 authoritatively to requests that target the identified resource, as 819 defined in Section 5.4.1. 821 A sender MUST NOT generate an "http" URI with an empty host 822 identifier. A recipient that processes such a URI reference MUST 823 reject it as invalid. 825 The hierarchical path component and optional query component identify 826 the target resource within that origin server's name space. 828 2.5.2. https URI Scheme 830 The "https" URI scheme is hereby defined for minting identifiers 831 within the hierarchical namespace governed by a potential origin 832 server listening for TCP connections on a given port and capable of 833 establishing a TLS ([RFC8446]) connection that has been secured for 834 HTTP communication. In this context, "secured" specifically means 835 that the server has been authenticated as acting on behalf of the 836 identified authority and all HTTP communication with that server has 837 been protected for confidentiality and integrity through the use of 838 strong encryption. 840 https-URI = "https" "://" authority path-abempty [ "?" query ] 842 The origin server for an "https" URI is identified by the authority 843 component, which includes a host identifier and optional port number 844 ([RFC3986], Section 3.2.2). If the port subcomponent is empty or not 845 given, TCP port 443 (the reserved port for HTTP over TLS) is the 846 default. The origin determines who has the right to respond 847 authoritatively to requests that target the identified resource, as 848 defined in Section 5.4.2. 850 A sender MUST NOT generate an "https" URI with an empty host 851 identifier. A recipient that processes such a URI reference MUST 852 reject it as invalid. 854 The hierarchical path component and optional query component identify 855 the target resource within that origin server's name space. 857 A client MUST ensure that its HTTP requests for an "https" resource 858 are secured, prior to being communicated, and that it only accepts 859 secured responses to those requests. 861 Resources made available via the "https" scheme have no shared 862 identity with the "http" scheme. They are distinct origins with 863 separate namespaces. However, an extension to HTTP that is defined 864 to apply to all origins with the same host, such as the Cookie 865 protocol [RFC6265], can allow information set by one service to 866 impact communication with other services within a matching group of 867 host domains. 869 2.5.3. http and https URI Normalization and Comparison 871 Since the "http" and "https" schemes conform to the URI generic 872 syntax, such URIs are normalized and compared according to the 873 algorithm defined in Section 6 of [RFC3986], using the defaults 874 described above for each scheme. 876 If the port is equal to the default port for a scheme, the normal 877 form is to omit the port subcomponent. When not being used in 878 absolute form as the request target of an OPTIONS request, an empty 879 path component is equivalent to an absolute path of "/", so the 880 normal form is to provide a path of "/" instead. The scheme and host 881 are case-insensitive and normally provided in lowercase; all other 882 components are compared in a case-sensitive manner. Characters other 883 than those in the "reserved" set are equivalent to their percent- 884 encoded octets: the normal form is to not encode them (see Sections 885 2.1 and 2.2 of [RFC3986]). 887 For example, the following three URIs are equivalent: 889 http://example.com:80/~smith/home.html 890 http://EXAMPLE.com/%7Esmith/home.html 891 http://EXAMPLE.com:/%7esmith/home.html 893 2.5.4. Deprecated userinfo 895 The URI generic syntax for authority also includes a userinfo 896 subcomponent ([RFC3986], Section 3.2.1) for including user 897 authentication information in the URI. In that subcomponent, the use 898 of the format "user:password" is deprecated. 900 Some implementations make use of the userinfo component for internal 901 configuration of authentication information, such as within command 902 invocation options, configuration files, or bookmark lists, even 903 though such usage might expose a user identifier or password. 905 A sender MUST NOT generate the userinfo subcomponent (and its "@" 906 delimiter) when an "http" or "https" URI reference is generated 907 within a message as a request target or field value. 909 Before making use of an "http" or "https" URI reference received from 910 an untrusted source, a recipient SHOULD parse for userinfo and treat 911 its presence as an error; it is likely being used to obscure the 912 authority for the sake of phishing attacks. 914 2.5.5. Fragment Identifiers on http(s) URI References 916 Fragment identifiers allow for indirect identification of a secondary 917 resource, independent of the URI scheme, as defined in Section 3.5 of 918 [RFC3986]. Some protocol elements that refer to a URI allow 919 inclusion of a fragment, while others do not. They are distinguished 920 by use of the ABNF rule for elements where fragment is allowed; 921 otherwise, a specific rule that excludes fragments is used (see 922 Section 5.1). 924 Note: the fragment identifier component is not part of the actual 925 scheme definition for a URI scheme (see Section 4.3 of [RFC3986]), 926 thus does not appear in the ABNF definitions for the "http" and 927 "https" URI schemes above. 929 3. Conformance 931 3.1. Implementation Diversity 933 When considering the design of HTTP, it is easy to fall into a trap 934 of thinking that all user agents are general-purpose browsers and all 935 origin servers are large public websites. That is not the case in 936 practice. Common HTTP user agents include household appliances, 937 stereos, scales, firmware update scripts, command-line programs, 938 mobile apps, and communication devices in a multitude of shapes and 939 sizes. Likewise, common HTTP origin servers include home automation 940 units, configurable networking components, office machines, 941 autonomous robots, news feeds, traffic cameras, ad selectors, and 942 video-delivery platforms. 944 The term "user agent" does not imply that there is a human user 945 directly interacting with the software agent at the time of a 946 request. In many cases, a user agent is installed or configured to 947 run in the background and save its results for later inspection (or 948 save only a subset of those results that might be interesting or 949 erroneous). Spiders, for example, are typically given a start URI 950 and configured to follow certain behavior while crawling the Web as a 951 hypertext graph. 953 The implementation diversity of HTTP means that not all user agents 954 can make interactive suggestions to their user or provide adequate 955 warning for security or privacy concerns. In the few cases where 956 this specification requires reporting of errors to the user, it is 957 acceptable for such reporting to only be observable in an error 958 console or log file. Likewise, requirements that an automated action 959 be confirmed by the user before proceeding might be met via advance 960 configuration choices, run-time options, or simple avoidance of the 961 unsafe action; confirmation does not imply any specific user 962 interface or interruption of normal processing if the user has 963 already made that choice. 965 3.2. Role-based Requirements 967 This specification targets conformance criteria according to the role 968 of a participant in HTTP communication. Hence, HTTP requirements are 969 placed on senders, recipients, clients, servers, user agents, 970 intermediaries, origin servers, proxies, gateways, or caches, 971 depending on what behavior is being constrained by the requirement. 972 Additional (social) requirements are placed on implementations, 973 resource owners, and protocol element registrations when they apply 974 beyond the scope of a single communication. 976 The verb "generate" is used instead of "send" where a requirement 977 differentiates between creating a protocol element and merely 978 forwarding a received element downstream. 980 An implementation is considered conformant if it complies with all of 981 the requirements associated with the roles it partakes in HTTP. 983 Conformance includes both the syntax and semantics of protocol 984 elements. A sender MUST NOT generate protocol elements that convey a 985 meaning that is known by that sender to be false. A sender MUST NOT 986 generate protocol elements that do not match the grammar defined by 987 the corresponding ABNF rules. Within a given message, a sender MUST 988 NOT generate protocol elements or syntax alternatives that are only 989 allowed to be generated by participants in other roles (i.e., a role 990 that the sender does not have for that message). 992 3.3. Parsing Elements 994 When a received protocol element is parsed, the recipient MUST be 995 able to parse any value of reasonable length that is applicable to 996 the recipient's role and that matches the grammar defined by the 997 corresponding ABNF rules. Note, however, that some received protocol 998 elements might not be parsed. For example, an intermediary 999 forwarding a message might parse a field into generic field name and 1000 field value components, but then forward the field without further 1001 parsing inside the field value. 1003 HTTP does not have specific length limitations for many of its 1004 protocol elements because the lengths that might be appropriate will 1005 vary widely, depending on the deployment context and purpose of the 1006 implementation. Hence, interoperability between senders and 1007 recipients depends on shared expectations regarding what is a 1008 reasonable length for each protocol element. Furthermore, what is 1009 commonly understood to be a reasonable length for some protocol 1010 elements has changed over the course of the past two decades of HTTP 1011 use and is expected to continue changing in the future. 1013 At a minimum, a recipient MUST be able to parse and process protocol 1014 element lengths that are at least as long as the values that it 1015 generates for those same protocol elements in other messages. For 1016 example, an origin server that publishes very long URI references to 1017 its own resources needs to be able to parse and process those same 1018 references when received as a request target. 1020 3.4. Error Handling 1022 A recipient MUST interpret a received protocol element according to 1023 the semantics defined for it by this specification, including 1024 extensions to this specification, unless the recipient has determined 1025 (through experience or configuration) that the sender incorrectly 1026 implements what is implied by those semantics. For example, an 1027 origin server might disregard the contents of a received Accept- 1028 Encoding header field if inspection of the User-Agent header field 1029 indicates a specific implementation version that is known to fail on 1030 receipt of certain content codings. 1032 Unless noted otherwise, a recipient MAY attempt to recover a usable 1033 protocol element from an invalid construct. HTTP does not define 1034 specific error handling mechanisms except when they have a direct 1035 impact on security, since different applications of the protocol 1036 require different error handling strategies. For example, a Web 1037 browser might wish to transparently recover from a response where the 1038 Location header field doesn't parse according to the ABNF, whereas a 1039 systems control client might consider any form of error recovery to 1040 be dangerous. 1042 Some requests can be automatically retried by a client in the event 1043 of an underlying connection failure, as described in Section 7.2.2. 1045 3.5. Protocol Versioning 1047 The HTTP version number consists of two decimal digits separated by a 1048 "." (period or decimal point). The first digit ("major version") 1049 indicates the HTTP messaging syntax, whereas the second digit ("minor 1050 version") indicates the highest minor version within that major 1051 version to which the sender is conformant and able to understand for 1052 future communication. 1054 The protocol version as a whole indicates the sender's conformance 1055 with the set of requirements laid out in that version's corresponding 1056 specification of HTTP. For example, the version "HTTP/1.1" is 1057 defined by the combined specifications of this document, "HTTP 1058 Caching" [Caching], and "HTTP/1.1 Messaging" [Messaging]. 1060 The minor version advertises the sender's communication capabilities 1061 even when the sender is only using a backwards-compatible subset of 1062 the protocol, thereby letting the recipient know that more advanced 1063 features can be used in response (by servers) or in future requests 1064 (by clients). 1066 A client SHOULD send a request version equal to the highest version 1067 to which the client is conformant and whose major version is no 1068 higher than the highest version supported by the server, if this is 1069 known. A client MUST NOT send a version to which it is not 1070 conformant. 1072 A client MAY send a lower request version if it is known that the 1073 server incorrectly implements the HTTP specification, but only after 1074 the client has attempted at least one normal request and determined 1075 from the response status code or header fields (e.g., Server) that 1076 the server improperly handles higher request versions. 1078 A server SHOULD send a response version equal to the highest version 1079 to which the server is conformant that has a major version less than 1080 or equal to the one received in the request. A server MUST NOT send 1081 a version to which it is not conformant. A server can send a 505 1082 (HTTP Version Not Supported) response if it wishes, for any reason, 1083 to refuse service of the client's major protocol version. 1085 HTTP's major version number is incremented when an incompatible 1086 message syntax is introduced. The minor number is incremented when 1087 changes made to the protocol have the effect of adding to the message 1088 semantics or implying additional capabilities of the sender. 1090 When an HTTP message is received with a major version number that the 1091 recipient implements, but a higher minor version number than what the 1092 recipient implements, the recipient SHOULD process the message as if 1093 it were in the highest minor version within that major version to 1094 which the recipient is conformant. A recipient can assume that a 1095 message with a higher minor version, when sent to a recipient that 1096 has not yet indicated support for that higher version, is 1097 sufficiently backwards-compatible to be safely processed by any 1098 implementation of the same major version. 1100 When a major version of HTTP does not define any minor versions, the 1101 minor version "0" is implied and is used when referring to that 1102 protocol within a protocol element that requires sending a minor 1103 version. 1105 4. Header and Trailer Fields 1107 HTTP messages use key/value pairs to convey data about the message, 1108 its payload, the target resource, or the connection (i.e., control 1109 data). They are called "HTTP fields" or just "fields". 1111 Every message can have two separate areas that such fields can occur 1112 within; the "header field section" (or just "header section") 1113 preceding the message body and containing "header fields" (or just 1114 "headers", colloquially) and the "trailer field section" (or just 1115 "trailer section") after the message body containing "trailer fields" 1116 (or just "trailers" colloquially). Header fields are more common; 1117 see Section 4.6 for discussion of the applicability and limitations 1118 of trailer fields. 1120 Both sections are composed of any number of "field lines", each with 1121 a "field name" (see Section 4.3) identifying the field, and a "field 1122 line value" that conveys data for the field. 1124 Each field name present in a section has a corresponding "field 1125 value" for that section, composed from all field line values with 1126 that given field name in that section, concatenated together and 1127 separated with commas. See Section 4.1 for further discussion of the 1128 semantics of field ordering and combination in messages, and 1129 Section 4.4 for more discussion of field values. 1131 For example, this section: 1133 Example-Field: Foo, Bar 1134 Example-Field: Baz 1136 contains two field lines, both with the field name "Example-Field". 1137 The first field line has a field line value of "Foo, Bar", while the 1138 second field line value is "Baz". The field value for "Example- 1139 Field" is a list with three members: "Foo", "Bar", and "Baz". 1141 The interpretation of a field does not change between minor versions 1142 of the same major HTTP version, though the default behavior of a 1143 recipient in the absence of such a field can change. Unless 1144 specified otherwise, fields are defined for all versions of HTTP. In 1145 particular, the Host and Connection fields ought to be implemented by 1146 all HTTP/1.x implementations whether or not they advertise 1147 conformance with HTTP/1.1. 1149 New fields can be introduced without changing the protocol version if 1150 their defined semantics allow them to be safely ignored by recipients 1151 that do not recognize them; see Section 4.3.1. 1153 4.1. Field Ordering and Combination 1155 The order in which field lines with differing names are received in a 1156 message is not significant. However, it is good practice to send 1157 header fields that contain control data first, such as Host on 1158 requests and Date on responses, so that implementations can decide 1159 when not to handle a message as early as possible. A server MUST NOT 1160 apply a request to the target resource until the entire request 1161 header section is received, since later header field lines might 1162 include conditionals, authentication credentials, or deliberately 1163 misleading duplicate header fields that would impact request 1164 processing. 1166 A recipient MAY combine multiple field lines with the same field name 1167 into one field line, without changing the semantics of the message, 1168 by appending each subsequent field line value to the initial field 1169 line value in order, separated by a comma and optional whitespace. 1170 For consistency, use comma SP. 1172 The order in which field lines with the same name are received is 1173 therefore significant to the interpretation of the field value; a 1174 proxy MUST NOT change the order of these field line values when 1175 forwarding a message. 1177 This means that, aside from the well-known exception noted below, a 1178 sender MUST NOT generate multiple field lines with the same name in a 1179 message (whether in the headers or trailers), or append a field line 1180 when a field line of the same name already exists in the message, 1181 unless that field's definition allows multiple field line values to 1182 be recombined as a comma-separated list [i.e., at least one 1183 alternative of the field's definition allows a comma-separated list, 1184 such as an ABNF rule of #(values) defined in Section 4.5]. 1186 Note: In practice, the "Set-Cookie" header field ([RFC6265]) often 1187 appears in a response message across multiple field and does not 1188 use the list syntax, violating the above requirements on multiple 1189 field lines with the same field name. Since it cannot be combined 1190 into a single field value, recipients ought to handle "Set-Cookie" 1191 as a special case while processing fields. (See Appendix A.2.3 of 1192 [Kri2001] for details.) 1194 4.2. Field Limits 1196 HTTP does not place a predefined limit on the length of each field 1197 line, field value, or on the length of the header or trailer section 1198 as a whole, as described in Section 3. Various ad hoc limitations on 1199 individual lengths are found in practice, often depending on the 1200 specific field's semantics. 1202 A server that receives a request header field line, field value, or 1203 set of fields larger than it wishes to process MUST respond with an 1204 appropriate 4xx (Client Error) status code. Ignoring such header 1205 fields would increase the server's vulnerability to request smuggling 1206 attacks (Section 11.2 of [Messaging]). 1208 A client MAY discard or truncate received field lines that are larger 1209 than the client wishes to process if the field semantics are such 1210 that the dropped value(s) can be safely ignored without changing the 1211 message framing or response semantics. 1213 4.3. Field Names 1215 The field-name token labels the corresponding field value as having 1216 the semantics defined by that field. For example, the Date header 1217 field is defined in Section 10.1.1.2 as containing the origination 1218 timestamp for the message in which it appears. 1220 field-name = token 1222 Field names are case-insensitive and ought to be registered within 1223 the "Hypertext Transfer Protocol (HTTP) Field Name Registry"; see 1224 Section 4.3.2. 1226 Authors of specifications defining new fields are advised to choose a 1227 short but descriptive field name. Short names avoid needless data 1228 transmission; descriptive names avoid confusion and "squatting" on 1229 names that might have broader uses. 1231 To that end, limited-use fields (such as a header confined to a 1232 single application or use case) are encouraged to use a name that 1233 includes its name (or an abbreviation) as a prefix; for example, if 1234 the Foo Application needs a Description field, it might use "Foo- 1235 Desc"; "Description" is too generic, and "Foo-Description" is 1236 needlessly long. 1238 While the field-name syntax is defined to allow any token character, 1239 in practice some implementations place limits on the characters they 1240 accept in field-names. To be interoperable, new field names SHOULD 1241 constrain themselves to alphanumeric characters, "-", and ".", and 1242 SHOULD begin with an alphanumeric character. 1244 Field names ought not be prefixed with "X-"; see [BCP178] for further 1245 information. 1247 Other prefixes are sometimes used in HTTP field names; for example, 1248 "Accept-" is used in many content negotiation headers. These 1249 prefixes are only an aid to recognizing the purpose of a field, and 1250 do not trigger automatic processing. 1252 4.3.1. Field Extensibility 1254 There is no limit on the introduction of new field names, each 1255 presumably defining new semantics. 1257 New fields can be defined such that, when they are understood by a 1258 recipient, they might override or enhance the interpretation of 1259 previously defined fields, define preconditions on request 1260 evaluation, or refine the meaning of responses. 1262 A proxy MUST forward unrecognized header fields unless the field name 1263 is listed in the Connection header field (Section 9.1 of [Messaging]) 1264 or the proxy is specifically configured to block, or otherwise 1265 transform, such fields. Other recipients SHOULD ignore unrecognized 1266 header and trailer fields. These requirements allow HTTP's 1267 functionality to be enhanced without requiring prior update of 1268 deployed intermediaries. 1270 4.3.2. Field Name Registry 1272 The "Hypertext Transfer Protocol (HTTP) Field Name Registry" defines 1273 the namespace for HTTP field names. 1275 Any party can request registration of a HTTP field. See Section 4.7 1276 for considerations to take into account when creating a new HTTP 1277 field. 1279 The "Hypertext Transfer Protocol (HTTP) Field Name Registry" is 1280 located at "https://www.iana.org/assignments/http-fields/". 1281 Registration requests can be made by following the instructions 1282 located there or by sending an email to the "ietf-http-wg@ietf.org" 1283 mailing list. 1285 Field names are registered on the advice of a Designated Expert 1286 (appointed by the IESG or their delegate). Fields with the status 1287 'permanent' are Specification Required (using terminology from 1288 [RFC8126]). 1290 Registration requests consist of at least the following information: 1292 o Field name: The requested field name. It MUST conform to the 1293 field-name syntax defined in Section 4.3, and SHOULD be restricted 1294 to just letters, digits, hyphen ('-') and underscore ('_') 1295 characters, with the first character being a letter. 1297 o Status: "permanent" or "provisional" 1299 o Specification document(s): Reference to the document that 1300 specifies the field, preferably including a URI that can be used 1301 to retrieve a copy of the document. An indication of the relevant 1302 section(s) can also be included, but is not required. 1304 The Expert(s) can define additional fields to be collected in the 1305 registry, in consultation with the community. 1307 Standards-defined names have a status of "permanent". Other names 1308 can also be registered as permanent, if the Expert(s) find that they 1309 are in use, in consultation with the community. Other names should 1310 be registered as "provisional". 1312 Provisional entries can be removed by the Expert(s) if -- in 1313 consultation with the community -- the Expert(s) find that they are 1314 not in use. The Experts can change a provisional entry's status to 1315 permanent at any time. 1317 Note that names can be registered by third parties (including the 1318 Expert(s)), if the Expert(s) determines that an unregistered name is 1319 widely deployed and not likely to be registered in a timely manner 1320 otherwise. 1322 4.4. Field Values 1324 HTTP field values typically have their syntax defined using ABNF 1325 ([RFC5234]), using the extension defined in Section 4.5 as necessary, 1326 and are usually constrained to the range of US-ASCII characters. 1327 Fields needing a greater range of characters can use an encoding such 1328 as the one defined in [RFC8187]. 1330 field-value = *( field-content / obs-fold ) 1331 field-content = field-vchar 1332 [ 1*( SP / HTAB / field-vchar ) field-vchar ] 1333 field-vchar = VCHAR / obs-text 1335 Historically, HTTP allowed field content with text in the ISO-8859-1 1336 charset [ISO-8859-1], supporting other charsets only through use of 1337 [RFC2047] encoding. In practice, most HTTP field values use only a 1338 subset of the US-ASCII charset [USASCII]. Newly defined fields 1339 SHOULD limit their values to US-ASCII octets. A recipient SHOULD 1340 treat other octets in field content (obs-text) as opaque data. 1342 Leading and trailing whitespace in raw field values is removed upon 1343 field parsing (Section 5.1 of [Messaging]). Field definitions where 1344 leading or trailing whitespace in values is significant will have to 1345 use a container syntax such as quoted-string (Section 4.4.1.2). 1347 Because commas (",") are used as a generic delimiter between members 1348 of a list-based field value, they need to be treated with care if 1349 they are allowed as data within those members. Typically, list 1350 members that might contain a comma are enclosed in a quoted-string. 1352 For example, a textual date and a URI (either of which might contain 1353 a comma) could be safely carried in list-based field values like 1354 these: 1356 Example-URI-Field: "http://example.com/a.html,foo", 1357 "http://without-a-comma.example.com/" 1358 Example-Date-Field: "Sat, 04 May 1996", "Wed, 14 Sep 2005" 1360 Note that double-quote delimiters almost always are used with the 1361 quoted-string production; using a different syntax inside double- 1362 quotes will likely cause unnecessary confusion. 1364 Many fields (such as Content-Type, defined in Section 6.2.1) use a 1365 common syntax for parameters that allows both unquoted (token) and 1366 quoted (quoted-string) syntax for a parameter value 1367 (Section 4.4.1.4). Use of common syntax allows recipients to reuse 1368 existing parser components. When allowing both forms, the meaning of 1369 a parameter value ought to be the same whether it was received as a 1370 token or a quoted string. 1372 Historically, HTTP field values could be extended over multiple lines 1373 by preceding each extra line with at least one space or horizontal 1374 tab (obs-fold). [[CREF1: This document assumes that any such obs- 1375 fold has been replaced with one or more SP octets prior to 1376 interpreting the field value, as described in Section 5.2 of 1377 [Messaging].]] 1379 This specification does not use ABNF rules to define each "Field 1380 Name: Field Value" pair, as was done in earlier editions. 1381 Instead, this specification uses ABNF rules that are named 1382 according to each registered field name, wherein the rule defines 1383 the valid grammar for that field's corresponding field values 1384 (i.e., after the field value has been extracted by a generic field 1385 parser). 1387 4.4.1. Common Field Value Components 1389 Many HTTP field values are defined using common syntax components, 1390 separated by whitespace or specific delimiting characters. 1391 Delimiters are chosen from the set of US-ASCII visual characters not 1392 allowed in a token (DQUOTE and "(),/:;<=>?@[\]{}"). 1394 4.4.1.1. Tokens 1396 Tokens are short textual identifiers that do not include whitespace 1397 or delimiters. 1399 token = 1*tchar 1401 tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" 1402 / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" 1403 / DIGIT / ALPHA 1404 ; any VCHAR, except delimiters 1406 4.4.1.2. Quoted Strings 1408 A string of text is parsed as a single value if it is quoted using 1409 double-quote marks. 1411 quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE 1412 qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text 1413 obs-text = %x80-FF 1415 The backslash octet ("\") can be used as a single-octet quoting 1416 mechanism within quoted-string and comment constructs. Recipients 1417 that process the value of a quoted-string MUST handle a quoted-pair 1418 as if it were replaced by the octet following the backslash. 1420 quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) 1422 A sender SHOULD NOT generate a quoted-pair in a quoted-string except 1423 where necessary to quote DQUOTE and backslash octets occurring within 1424 that string. A sender SHOULD NOT generate a quoted-pair in a comment 1425 except where necessary to quote parentheses ["(" and ")"] and 1426 backslash octets occurring within that comment. 1428 4.4.1.3. Comments 1430 Comments can be included in some HTTP fields by surrounding the 1431 comment text with parentheses. Comments are only allowed in fields 1432 containing "comment" as part of their field value definition. 1434 comment = "(" *( ctext / quoted-pair / comment ) ")" 1435 ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text 1437 4.4.1.4. Parameters 1439 A parameter is a name=value pair that is often defined within field 1440 values as a common syntax for appending auxiliary information to an 1441 item. Each parameter is usually delimited by an immediately 1442 preceding semicolon. 1444 parameter = parameter-name "=" parameter-value 1445 parameter-name = token 1446 parameter-value = ( token / quoted-string ) 1448 Parameter names are case-insensitive. Parameter values might or 1449 might not be case-sensitive, depending on the semantics of the 1450 parameter name. Examples of parameters and some equivalent forms can 1451 be seen in media types (Section 6.1.1) and the Accept header field 1452 (Section 8.4.2). 1454 A parameter value that matches the token production can be 1455 transmitted either as a token or within a quoted-string. The quoted 1456 and unquoted values are equivalent. 1458 Note: Parameters do not allow whitespace (not even "bad" 1459 whitespace) around the "=" character. 1461 4.5. ABNF List Extension: #rule 1463 A #rule extension to the ABNF rules of [RFC5234] is used to improve 1464 readability in the definitions of some list-based field values. 1466 A construct "#" is defined, similar to "*", for defining comma- 1467 delimited lists of elements. The full form is "#element" 1468 indicating at least and at most elements, each separated by a 1469 single comma (",") and optional whitespace (OWS). 1471 4.5.1. Sender Requirements 1473 In any production that uses the list construct, a sender MUST NOT 1474 generate empty list elements. In other words, a sender MUST generate 1475 lists that satisfy the following syntax: 1477 1#element => element *( OWS "," OWS element ) 1479 and: 1481 #element => [ 1#element ] 1483 and for n >= 1 and m > 1: 1485 #element => element *( OWS "," OWS element ) 1487 4.5.2. Recipient Requirements 1489 Empty elements do not contribute to the count of elements present. A 1490 recipient MUST parse and ignore a reasonable number of empty list 1491 elements: enough to handle common mistakes by senders that merge 1492 values, but not so much that they could be used as a denial-of- 1493 service mechanism. In other words, a recipient MUST accept lists 1494 that satisfy the following syntax: 1496 #element => [ element ] *( OWS "," OWS [ element ] ) 1498 Note that because of the potential presence of empty list elements, 1499 the RFC 5234 ABNF cannot enforce the cardinality of list elements, 1500 and consequently all cases are mapped is if there was no cardinality 1501 specified. 1503 For example, given these ABNF productions: 1505 example-list = 1#example-list-elmt 1506 example-list-elmt = token ; see Section 4.4.1.1 1508 Then the following are valid values for example-list (not including 1509 the double quotes, which are present for delimitation only): 1511 "foo,bar" 1512 "foo ,bar," 1513 "foo , ,bar,charlie" 1515 In contrast, the following values would be invalid, since at least 1516 one non-empty element is required by the example-list production: 1518 "" 1519 "," 1520 ", ," 1522 Appendix A shows the collected ABNF for recipients after the list 1523 constructs have been expanded. 1525 4.6. Trailer Fields 1526 4.6.1. Purpose 1528 In some HTTP versions, additional metadata can be sent after the 1529 initial header section has been completed (during or after 1530 transmission of the payload body), such as a message integrity check, 1531 digital signature, or post-processing status. For example, the 1532 chunked coding in HTTP/1.1 allows a trailer section after the payload 1533 body (Section 7.1.2 of [Messaging]) which can contain trailer fields: 1534 field names and values that share the same syntax and namespace as 1535 header fields but that are received after the header section. 1537 Trailer fields ought to be processed and stored separately from the 1538 fields in the header section to avoid contradicting message semantics 1539 known at the time the header section was complete. The presence or 1540 absence of certain header fields might impact choices made for the 1541 routing or processing of the message as a whole before the trailers 1542 are received; those choices cannot be unmade by the later discovery 1543 of trailer fields. 1545 4.6.2. Limitations 1547 Many fields cannot be processed outside the header section because 1548 their evaluation is necessary prior to receiving the message body, 1549 such as those that describe message framing, routing, authentication, 1550 request modifiers, response controls, or payload format. A sender 1551 MUST NOT generate a trailer field unless the sender knows the 1552 corresponding header field name's definition permits the field to be 1553 sent in trailers. 1555 Trailer fields can be difficult to process by intermediaries that 1556 forward messages from one protocol version to another. If the entire 1557 message can be buffered in transit, some intermediaries could merge 1558 trailer fields into the header section (as appropriate) before it is 1559 forwarded. However, in most cases, the trailers are simply 1560 discarded. A recipient MUST NOT merge a trailer field into a header 1561 section unless the recipient understands the corresponding header 1562 field definition and that definition explicitly permits and defines 1563 how trailer field values can be safely merged. 1565 A client can send a TE header field indicating "trailers" is 1566 acceptable, as described in Section 7.4 of [Messaging], to inform the 1567 server that it will not discard trailer fields. 1569 Because of the potential for trailer fields to be discarded in 1570 transit, a server SHOULD NOT generate trailer fields that it believes 1571 are necessary for the user agent to receive. 1573 4.6.3. Trailer 1575 The "Trailer" header field provides a list of field names that the 1576 sender anticipates sending as trailer fields within that message. 1577 This allows a recipient to prepare for receipt of the indicated 1578 metadata before it starts processing the body. 1580 Trailer = 1#field-name 1582 For example, a sender might indicate that a message integrity check 1583 will be computed as the payload is being streamed and provide the 1584 final signature as a trailer field. This allows a recipient to 1585 perform the same check on the fly as the payload data is received. 1587 A sender that intends to generate one or more trailer fields in a 1588 message SHOULD generate a Trailer header field in the header section 1589 of that message to indicate which fields might be present in the 1590 trailers. 1592 4.7. Considerations for New HTTP Fields 1594 See Section 4.3 for a general requirements for field names, and 1595 Section 4.4 for a discussion of field values. 1597 Authors of specifications defining new fields are advised to consider 1598 documenting: 1600 o Whether the field is a single value or whether it can be a list 1601 (delimited by commas; see Section 4.4). 1603 If it is not a list, document how to treat messages where the 1604 field occurs multiple times (a sensible default would be to ignore 1605 the field, but this might not always be the right choice). 1607 Note that intermediaries and software libraries might combine 1608 multiple field instances into a single one, despite the field's 1609 definition not allowing the list syntax. A robust format enables 1610 recipients to discover these situations (good example: "Content- 1611 Type", as the comma can only appear inside quoted strings; bad 1612 example: "Location", as a comma can occur inside a URI). 1614 o Under what conditions the field can be used; e.g., only in 1615 responses or requests, in all messages, only on responses to a 1616 particular request method, etc. 1618 o Whether the field should be stored by origin servers that 1619 understand it upon a PUT request. 1621 o Whether the field semantics are further refined by the context, 1622 such as by existing request methods or status codes. 1624 o Whether it is appropriate to list the field name in the Connection 1625 header field (i.e., if the field is to be hop-by-hop; see 1626 Section 9.1 of [Messaging]). 1628 o Under what conditions intermediaries are allowed to insert, 1629 delete, or modify the field's value. 1631 o Whether it is appropriate to list the field name in a Vary 1632 response header field (e.g., when the request header field is used 1633 by an origin server's content selection algorithm; see 1634 Section 10.1.4). 1636 o Whether the field is allowable in trailers (see Section 4.6). 1638 o Whether the field ought to be preserved across redirects. 1640 o Whether it introduces any additional security considerations, such 1641 as disclosure of privacy-related data. 1643 4.8. Fields Defined In This Document 1645 The following fields are defined by this document: 1647 +---------------------------+------------+-------------------+ 1648 | Field Name | Status | Reference | 1649 +---------------------------+------------+-------------------+ 1650 | Accept | standard | Section 8.4.2 | 1651 | Accept-Charset | deprecated | Section 8.4.3 | 1652 | Accept-Encoding | standard | Section 8.4.4 | 1653 | Accept-Language | standard | Section 8.4.5 | 1654 | Accept-Ranges | standard | Section 10.4.1 | 1655 | Allow | standard | Section 10.4.2 | 1656 | Authentication-Info | standard | Section 10.3.3 | 1657 | Authorization | standard | Section 8.5.3 | 1658 | Content-Encoding | standard | Section 6.2.2 | 1659 | Content-Language | standard | Section 6.2.3 | 1660 | Content-Length | standard | Section 6.2.4 | 1661 | Content-Location | standard | Section 6.2.5 | 1662 | Content-Range | standard | Section 6.3.4 | 1663 | Content-Type | standard | Section 6.2.1 | 1664 | Date | standard | Section 10.1.1.2 | 1665 | ETag | standard | Section 10.2.3 | 1666 | Expect | standard | Section 8.1.1 | 1667 | From | standard | Section 8.6.1 | 1668 | Host | standard | Section 5.6 | 1669 | If-Match | standard | Section 8.2.3 | 1670 | If-Modified-Since | standard | Section 8.2.5 | 1671 | If-None-Match | standard | Section 8.2.4 | 1672 | If-Range | standard | Section 8.2.7 | 1673 | If-Unmodified-Since | standard | Section 8.2.6 | 1674 | Last-Modified | standard | Section 10.2.2 | 1675 | Location | standard | Section 10.1.2 | 1676 | Max-Forwards | standard | Section 8.1.2 | 1677 | Proxy-Authenticate | standard | Section 10.3.2 | 1678 | Proxy-Authentication-Info | standard | Section 10.3.4 | 1679 | Proxy-Authorization | standard | Section 8.5.4 | 1680 | Range | standard | Section 8.3 | 1681 | Referer | standard | Section 8.6.2 | 1682 | Retry-After | standard | Section 10.1.3 | 1683 | Server | standard | Section 10.4.3 | 1684 | Trailer | standard | Section 4.6.3 | 1685 | User-Agent | standard | Section 8.6.3 | 1686 | Vary | standard | Section 10.1.4 | 1687 | Via | standard | Section 5.7.1 | 1688 | WWW-Authenticate | standard | Section 10.3.1 | 1689 +---------------------------+------------+-------------------+ 1691 Table 1 1693 5. Message Routing 1695 HTTP request message routing is determined by each client based on 1696 the target resource, the client's proxy configuration, and 1697 establishment or reuse of an inbound connection. The corresponding 1698 response routing follows the same connection chain back to the 1699 client. 1701 5.1. Identifying a Target Resource 1703 HTTP is used in a wide variety of applications, ranging from general- 1704 purpose computers to home appliances. In some cases, communication 1705 options are hard-coded in a client's configuration. However, most 1706 HTTP clients rely on the same resource identification mechanism and 1707 configuration techniques as general-purpose Web browsers. 1709 HTTP communication is initiated by a user agent for some purpose. 1710 The purpose is a combination of request semantics and a target 1711 resource upon which to apply those semantics. A URI reference 1712 (Section 2.4) is typically used as an identifier for the "target 1713 resource", which a user agent would resolve to its absolute form in 1714 order to obtain the "target URI". The target URI excludes the 1715 reference's fragment component, if any, since fragment identifiers 1716 are reserved for client-side processing ([RFC3986], Section 3.5). 1718 5.2. Determining Origin 1720 The "origin" for a given URI is the triple of scheme, host, and port 1721 after normalizing the scheme and host to lowercase and normalizing 1722 the port to remove any leading zeros. If port is elided from the 1723 URI, the default port for that scheme is used. For example, the URI 1725 https://Example.Com/happy.js 1727 would have the origin 1729 { "https", "example.com", "443" } 1731 which can also be described as the normalized URI prefix with port 1732 always present: 1734 https://example.com:443 1736 Each origin defines its own namespace and controls how identifiers 1737 within that namespace are mapped to resources. In turn, how the 1738 origin responds to valid requests, consistently over time, determines 1739 the semantics that users will associate with a URI, and the 1740 usefulness of those semantics is what ultimately transforms these 1741 mechanisms into a "resource" for users to reference and access in the 1742 future. 1744 Two origins are distinct if they differ in scheme, host, or port. 1745 Even when it can be verified that the same entity controls two 1746 distinct origins, the two namespaces under those origins are distinct 1747 unless explicitly aliased by a server authoritative for that origin. 1749 Origin is also used within HTML and related Web protocols, beyond the 1750 scope of this document, as described in [RFC6454]. 1752 5.3. Routing Inbound 1754 Once the target URI and its origin are determined, a client decides 1755 whether a network request is necessary to accomplish the desired 1756 semantics and, if so, where that request is to be directed. 1758 If the client has a cache [Caching] and the request can be satisfied 1759 by it, then the request is usually directed there first. 1761 If the request is not satisfied by a cache, then a typical client 1762 will check its configuration to determine whether a proxy is to be 1763 used to satisfy the request. Proxy configuration is implementation- 1764 dependent, but is often based on URI prefix matching, selective 1765 authority matching, or both, and the proxy itself is usually 1766 identified by an "http" or "https" URI. If a proxy is applicable, 1767 the client connects inbound by establishing (or reusing) a connection 1768 to that proxy. 1770 If no proxy is applicable, a typical client will invoke a handler 1771 routine, usually specific to the target URI's scheme, to connect 1772 directly to an origin for the target resource. How that is 1773 accomplished is dependent on the target URI scheme and defined by its 1774 associated specification, similar to how this specification defines 1775 origin server access for resolution of the "http" (Section 2.5.1) and 1776 "https" (Section 2.5.2) schemes. 1778 HTTP requirements regarding connection management are defined in 1779 Section 9 of [Messaging]. 1781 5.4. Direct Authoritative Access 1783 5.4.1. http origins 1785 Although HTTP is independent of the transport protocol, the "http" 1786 scheme is specific to associating authority with whomever controls 1787 the origin server listening for TCP connections on the indicated port 1788 of whatever host is identified within the authority component. This 1789 is a very weak sense of authority because it depends on both client- 1790 specific name resolution mechanisms and communication that might not 1791 be secured from man-in-the-middle attacks. Nevertheless, it is a 1792 sufficient minimum for binding "http" identifiers to an origin server 1793 for consistent resolution within a trusted environment. 1795 If the host identifier is provided as an IP address, the origin 1796 server is the listener (if any) on the indicated TCP port at that IP 1797 address. If host is a registered name, the registered name is an 1798 indirect identifier for use with a name resolution service, such as 1799 DNS, to find an address for an appropriate origin server. 1801 When an "http" URI is used within a context that calls for access to 1802 the indicated resource, a client MAY attempt access by resolving the 1803 host identifier to an IP address, establishing a TCP connection to 1804 that address on the indicated port, and sending an HTTP request 1805 message to the server containing the URI's identifying data 1806 (Section 2 of [Messaging]). 1808 If the server responds to such a request with a non-interim HTTP 1809 response message, as described in Section 9, then that response is 1810 considered an authoritative answer to the client's request. 1812 Note, however, that the above is not the only means for obtaining an 1813 authoritative response, nor does it imply that an authoritative 1814 response is always necessary (see [Caching]). For example, the Alt- 1815 Svc header field [RFC7838] allows an origin server to identify other 1816 services that are also authoritative for that origin. Access to 1817 "http" identified resources might also be provided by protocols 1818 outside the scope of this document. 1820 See Section 11.1 for security considerations related to establishing 1821 authority. 1823 5.4.2. https origins 1825 The "https" scheme associates authority based on the ability of a 1826 server to use a private key associated with a certificate that the 1827 client considers to be trustworthy for the identified host. If a 1828 server presents a certificate that verifiably applies to the host, 1829 along with proof that it controls the corresponding private key, then 1830 a client will accept a secured connection to that server as being 1831 authoritative for all origins with the same scheme and host. 1833 A client is therefore relying upon a chain of trust, conveyed from 1834 some trust anchor (which is usually prearranged or configured), 1835 through a chain of certificates (e.g., [RFC5280]) to a final 1836 certificate that binds a private key to the host name of the origin. 1838 The handshake and certificate validation in Section 5.4.3 describe 1839 how that final certificate can be used to initiate a secured 1840 connection. 1842 Note that the "https" scheme does not rely on TCP and the connected 1843 port number for associating authority, since both are outside the 1844 secured communication and thus cannot be trusted as definitive. 1845 Hence, the HTTP communication might take place over any channel that 1846 has been secured, as defined in Section 2.5.2, including protocols 1847 that don't use TCP. It is the origin's responsibility to ensure that 1848 any services provided with control over its certificate's private key 1849 are equally responsible for managing the corresponding "https" 1850 namespaces, or at least prepared to reject requests that appear to 1851 have been misdirected. Regardless, the origin's host and port value 1852 are passed within each HTTP request, identifying the target resource 1853 and distinguishing it from other namespaces that might be controlled 1854 by the same server. 1856 In HTTP/1.1 and earlier, the only URIs for which a client will 1857 attribute authority to a server are those for which a TLS connection 1858 was specifically established toward the origin's host. Only the 1859 characteristics of the connection establishment and certificate are 1860 used. For a host that is a domain name, the client MUST include that 1861 name in the TLS server_name extension (if used) and MUST verify that 1862 the name also appears as either the CN field of the certificate 1863 subject or as a dNSName in the subjectAltName field of the 1864 certificate (see [RFC6125]). For a host that is an IP address, the 1865 client MUST verify that the address appears in the subjectAltName of 1866 the certificate. 1868 In HTTP/2, a client will associate authority to all names that are 1869 present in the certificate. However, a client will only do that if 1870 it concludes that it could open a connection to the origin for that 1871 URI. In practice, a client will make a DNS query and see that it 1872 contains the same server IP address. A server sending the ORIGIN 1873 frame removes this restriction [RFC8336]. 1875 In addition to the client's verification, an origin server is 1876 responsible for verifying that requests it receives over a connection 1877 correspond to resources for which it actually wants to be the origin. 1878 If a network attacker causes connections for port N to be received at 1879 port Q, checking the effective request URI is necessary to ensure 1880 that the attacker can't cause "https://example.com:N/foo" to be 1881 replaced by "https://example.com:Q/foo" without consent. Likewise, a 1882 server might be unwilling to serve as the origin for some hosts even 1883 when they have the authority to do so. 1885 When an "https" URI is used within a context that calls for access to 1886 the indicated resource, a client MAY attempt access by resolving the 1887 host identifier to an IP address, establishing a TCP connection to 1888 that address on the indicated port, securing the connection end-to- 1889 end by successfully initiating TLS over TCP with confidentiality and 1890 integrity protection, and sending an HTTP request message to the 1891 server over that secured connection containing the URI's identifying 1892 data (Section 2 of [Messaging]). 1894 If the server responds to such a request with a non-interim HTTP 1895 response message, as described in Section 9, then that response is 1896 considered an authoritative answer to the client's request. 1898 Note, however, that the above is not the only means for obtaining an 1899 authoritative response, nor does it imply that an authoritative 1900 response is always necessary (see [Caching]). 1902 5.4.3. Initiating HTTP Over TLS 1904 Conceptually, HTTP/TLS is very simple. Simply use HTTP over TLS 1905 precisely as you would use HTTP over TCP. 1907 The agent acting as the HTTP client should also act as the TLS 1908 client. It should initiate a connection to the server on the 1909 appropriate port and then send the TLS ClientHello to begin the TLS 1910 handshake. When the TLS handshake has finished. The client may then 1911 initiate the first HTTP request. All HTTP data MUST be sent as TLS 1912 "application data". Normal HTTP behavior, including retained 1913 connections should be followed. 1915 5.4.3.1. Identifying HTTPS Servers 1917 In general, HTTP/TLS requests are generated by dereferencing a URI. 1918 As a consequence, the hostname for the server is known to the client. 1919 If the hostname is available, the client MUST check it against the 1920 server's identity as presented in the server's Certificate message, 1921 in order to prevent man-in-the-middle attacks. 1923 If the client has external information as to the expected identity of 1924 the server, the hostname check MAY be omitted. (For instance, a 1925 client may be connecting to a machine whose address and hostname are 1926 dynamic but the client knows the certificate that the server will 1927 present.) In such cases, it is important to narrow the scope of 1928 acceptable certificates as much as possible in order to prevent man 1929 in the middle attacks. In special cases, it may be appropriate for 1930 the client to simply ignore the server's identity, but it must be 1931 understood that this leaves the connection open to active attack. 1933 If a subjectAltName extension of type dNSName is present, that MUST 1934 be used as the identity. Otherwise, the (most specific) Common Name 1935 field in the Subject field of the certificate MUST be used. Although 1936 the use of the Common Name is existing practice, it is deprecated and 1937 Certification Authorities are encouraged to use the dNSName instead. 1939 Matching is performed using the matching rules specified by 1940 [RFC5280]. If more than one identity of a given type is present in 1941 the certificate (e.g., more than one dNSName name, a match in any one 1942 of the set is considered acceptable.) Names may contain the wildcard 1943 character * which is considered to match any single domain name 1944 component or component fragment. E.g., *.a.com matches foo.a.com but 1945 not bar.foo.a.com. f*.com matches foo.com but not bar.com. 1947 In some cases, the URI is specified as an IP address rather than a 1948 hostname. In this case, the iPAddress subjectAltName must be present 1949 in the certificate and must exactly match the IP in the URI. 1951 If the hostname does not match the identity in the certificate, user 1952 oriented clients MUST either notify the user (clients MAY give the 1953 user the opportunity to continue with the connection in any case) or 1954 terminate the connection with a bad certificate error. Automated 1955 clients MUST log the error to an appropriate audit log (if available) 1956 and SHOULD terminate the connection (with a bad certificate error). 1957 Automated clients MAY provide a configuration setting that disables 1958 this check, but MUST provide a setting which enables it. 1960 Note that in many cases the URI itself comes from an untrusted 1961 source. The above-described check provides no protection against 1962 attacks where this source is compromised. For example, if the URI 1963 was obtained by clicking on an HTML page which was itself obtained 1964 without using HTTP/TLS, a man in the middle could have replaced the 1965 URI. In order to prevent this form of attack, users should carefully 1966 examine the certificate presented by the server to determine if it 1967 meets their expectations. 1969 5.4.3.2. Identifying HTTPS Clients 1971 Typically, the server has no external knowledge of what the client's 1972 identity ought to be and so checks (other than that the client has a 1973 certificate chain rooted in an appropriate CA) are not possible. If 1974 a server has such knowledge (typically from some source external to 1975 HTTP or TLS) it SHOULD check the identity as described above. 1977 5.5. Effective Request URI 1979 Once an inbound connection is obtained, the client sends an HTTP 1980 request message (Section 2 of [Messaging]). 1982 Depending on the nature of the request, the client's target URI might 1983 be split into components and transmitted (or implied) within various 1984 parts of a request message. These parts are recombined by each 1985 recipient, in accordance with their local configuration and incoming 1986 connection context, to form an "effective request URI" for 1987 identifying the intended target resource with respect to that server. 1988 Section 3.3 of [Messaging] defines how a server determines the 1989 effective request URI for an HTTP/1.1 request. 1991 For a user agent, the effective request URI is the target URI. 1993 Once the effective request URI has been constructed, an origin server 1994 needs to decide whether or not to provide service for that URI via 1995 the connection in which the request was received. For example, the 1996 request might have been misdirected, deliberately or accidentally, 1997 such that the information within a received request-target or Host 1998 header field differs from the host or port upon which the connection 1999 has been made. If the connection is from a trusted gateway, that 2000 inconsistency might be expected; otherwise, it might indicate an 2001 attempt to bypass security filters, trick the server into delivering 2002 non-public content, or poison a cache. See Section 11 for security 2003 considerations regarding message routing. 2005 5.6. Host 2007 The "Host" header field in a request provides the host and port 2008 information from the target URI, enabling the origin server to 2009 distinguish among resources while servicing requests for multiple 2010 host names on a single IP address. 2012 Host = uri-host [ ":" port ] ; Section 2.4 2014 A client MUST send a Host header field in all HTTP/1.1 request 2015 messages. If the target URI includes an authority component, then a 2016 client MUST send a field value for Host that is identical to that 2017 authority component, excluding any userinfo subcomponent and its "@" 2018 delimiter (Section 2.5.1). If the authority component is missing or 2019 undefined for the target URI, then a client MUST send a Host header 2020 field with an empty field value. 2022 Since the Host field value is critical information for handling a 2023 request, a user agent SHOULD generate Host as the first header field 2024 following the request-line. 2026 For example, a GET request to the origin server for 2027 would begin with: 2029 GET /pub/WWW/ HTTP/1.1 2030 Host: www.example.org 2032 A client MUST send a Host header field in an HTTP/1.1 request even if 2033 the request-target is in the absolute-form, since this allows the 2034 Host information to be forwarded through ancient HTTP/1.0 proxies 2035 that might not have implemented Host. 2037 When a proxy receives a request with an absolute-form of request- 2038 target, the proxy MUST ignore the received Host header field (if any) 2039 and instead replace it with the host information of the request- 2040 target. A proxy that forwards such a request MUST generate a new 2041 Host field value based on the received request-target rather than 2042 forward the received Host field value. 2044 When an origin server receives a request with an absolute-form of 2045 request-target, the origin server MUST ignore the received Host 2046 header field (if any) and instead use the host information of the 2047 request-target. Note that if the request-target does not have an 2048 authority component, an empty Host header field will be sent in this 2049 case. 2051 Since the Host header field acts as an application-level routing 2052 mechanism, it is a frequent target for malware seeking to poison a 2053 shared cache or redirect a request to an unintended server. An 2054 interception proxy is particularly vulnerable if it relies on the 2055 Host field value for redirecting requests to internal servers, or for 2056 use as a cache key in a shared cache, without first verifying that 2057 the intercepted connection is targeting a valid IP address for that 2058 host. 2060 A server MUST respond with a 400 (Bad Request) status code to any 2061 HTTP/1.1 request message that lacks a Host header field and to any 2062 request message that contains more than one Host header field or a 2063 Host header field with an invalid field value. 2065 5.7. Message Forwarding 2067 As described in Section 2.2, intermediaries can serve a variety of 2068 roles in the processing of HTTP requests and responses. Some 2069 intermediaries are used to improve performance or availability. 2070 Others are used for access control or to filter content. Since an 2071 HTTP stream has characteristics similar to a pipe-and-filter 2072 architecture, there are no inherent limits to the extent an 2073 intermediary can enhance (or interfere) with either direction of the 2074 stream. 2076 An intermediary not acting as a tunnel MUST implement the Connection 2077 header field, as specified in Section 9.1 of [Messaging], and exclude 2078 fields from being forwarded that are only intended for the incoming 2079 connection. 2081 An intermediary MUST NOT forward a message to itself unless it is 2082 protected from an infinite request loop. In general, an intermediary 2083 ought to recognize its own server names, including any aliases, local 2084 variations, or literal IP addresses, and respond to such requests 2085 directly. 2087 An HTTP message can be parsed as a stream for incremental processing 2088 or forwarding downstream. However, recipients cannot rely on 2089 incremental delivery of partial messages, since some implementations 2090 will buffer or delay message forwarding for the sake of network 2091 efficiency, security checks, or payload transformations. 2093 5.7.1. Via 2095 The "Via" header field indicates the presence of intermediate 2096 protocols and recipients between the user agent and the server (on 2097 requests) or between the origin server and the client (on responses), 2098 similar to the "Received" header field in email (Section 3.6.7 of 2099 [RFC5322]). Via can be used for tracking message forwards, avoiding 2100 request loops, and identifying the protocol capabilities of senders 2101 along the request/response chain. 2103 Via = 1#( received-protocol RWS received-by [ RWS comment ] ) 2105 received-protocol = [ protocol-name "/" ] protocol-version 2106 ; see [Messaging], Section 9.9 2107 received-by = pseudonym [ ":" port ] 2108 pseudonym = token 2110 Each member of the Via field value represents a proxy or gateway that 2111 has forwarded the message. Each intermediary appends its own 2112 information about how the message was received, such that the end 2113 result is ordered according to the sequence of forwarding recipients. 2115 A proxy MUST send an appropriate Via header field, as described 2116 below, in each message that it forwards. An HTTP-to-HTTP gateway 2117 MUST send an appropriate Via header field in each inbound request 2118 message and MAY send a Via header field in forwarded response 2119 messages. 2121 For each intermediary, the received-protocol indicates the protocol 2122 and protocol version used by the upstream sender of the message. 2123 Hence, the Via field value records the advertised protocol 2124 capabilities of the request/response chain such that they remain 2125 visible to downstream recipients; this can be useful for determining 2126 what backwards-incompatible features might be safe to use in 2127 response, or within a later request, as described in Section 3.5. 2128 For brevity, the protocol-name is omitted when the received protocol 2129 is HTTP. 2131 The received-by portion is normally the host and optional port number 2132 of a recipient server or client that subsequently forwarded the 2133 message. However, if the real host is considered to be sensitive 2134 information, a sender MAY replace it with a pseudonym. If a port is 2135 not provided, a recipient MAY interpret that as meaning it was 2136 received on the default TCP port, if any, for the received-protocol. 2138 A sender MAY generate comments to identify the software of each 2139 recipient, analogous to the User-Agent and Server header fields. 2140 However, comments in Via are optional, and a recipient MAY remove 2141 them prior to forwarding the message. 2143 For example, a request message could be sent from an HTTP/1.0 user 2144 agent to an internal proxy code-named "fred", which uses HTTP/1.1 to 2145 forward the request to a public proxy at p.example.net, which 2146 completes the request by forwarding it to the origin server at 2147 www.example.com. The request received by www.example.com would then 2148 have the following Via header field: 2150 Via: 1.0 fred, 1.1 p.example.net 2152 An intermediary used as a portal through a network firewall SHOULD 2153 NOT forward the names and ports of hosts within the firewall region 2154 unless it is explicitly enabled to do so. If not enabled, such an 2155 intermediary SHOULD replace each received-by host of any host behind 2156 the firewall by an appropriate pseudonym for that host. 2158 An intermediary MAY combine an ordered subsequence of Via header 2159 field list members into a single member if the entries have identical 2160 received-protocol values. For example, 2162 Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy 2164 could be collapsed to 2166 Via: 1.0 ricky, 1.1 mertz, 1.0 lucy 2168 A sender SHOULD NOT combine multiple list members unless they are all 2169 under the same organizational control and the hosts have already been 2170 replaced by pseudonyms. A sender MUST NOT combine members that have 2171 different received-protocol values. 2173 5.7.2. Transformations 2175 Some intermediaries include features for transforming messages and 2176 their payloads. A proxy might, for example, convert between image 2177 formats in order to save cache space or to reduce the amount of 2178 traffic on a slow link. However, operational problems might occur 2179 when these transformations are applied to payloads intended for 2180 critical applications, such as medical imaging or scientific data 2181 analysis, particularly when integrity checks or digital signatures 2182 are used to ensure that the payload received is identical to the 2183 original. 2185 An HTTP-to-HTTP proxy is called a "transforming proxy" if it is 2186 designed or configured to modify messages in a semantically 2187 meaningful way (i.e., modifications, beyond those required by normal 2188 HTTP processing, that change the message in a way that would be 2189 significant to the original sender or potentially significant to 2190 downstream recipients). For example, a transforming proxy might be 2191 acting as a shared annotation server (modifying responses to include 2192 references to a local annotation database), a malware filter, a 2193 format transcoder, or a privacy filter. Such transformations are 2194 presumed to be desired by whichever client (or client organization) 2195 selected the proxy. 2197 If a proxy receives a request-target with a host name that is not a 2198 fully qualified domain name, it MAY add its own domain to the host 2199 name it received when forwarding the request. A proxy MUST NOT 2200 change the host name if the request-target contains a fully qualified 2201 domain name. 2203 A proxy MUST NOT modify the "absolute-path" and "query" parts of the 2204 received request-target when forwarding it to the next inbound 2205 server, except as noted above to replace an empty path with "/" or 2206 "*". 2208 A proxy MAY modify the message body through application or removal of 2209 a transfer coding (Section 7 of [Messaging]). 2211 A proxy MUST NOT transform the payload (Section 6.3) of a message 2212 that contains a no-transform cache-control response directive 2213 (Section 5.2 of [Caching]). 2215 A proxy MAY transform the payload of a message that does not contain 2216 a no-transform cache-control directive. A proxy that transforms the 2217 payload of a 200 (OK) response can inform downstream recipients that 2218 a transformation has been applied by changing the response status 2219 code to 203 (Non-Authoritative Information) (Section 9.3.4). 2221 A proxy SHOULD NOT modify header fields that provide information 2222 about the endpoints of the communication chain, the resource state, 2223 or the selected representation (other than the payload) unless the 2224 field's definition specifically allows such modification or the 2225 modification is deemed necessary for privacy or security. 2227 6. Representations 2229 Considering that a resource could be anything, and that the uniform 2230 interface provided by HTTP is similar to a window through which one 2231 can observe and act upon such a thing only through the communication 2232 of messages to some independent actor on the other side, an 2233 abstraction is needed to represent ("take the place of") the current 2234 or desired state of that thing in our communications. That 2235 abstraction is called a representation [REST]. 2237 For the purposes of HTTP, a "representation" is information that is 2238 intended to reflect a past, current, or desired state of a given 2239 resource, in a format that can be readily communicated via the 2240 protocol, and that consists of a set of representation metadata and a 2241 potentially unbounded stream of representation data. 2243 An origin server might be provided with, or be capable of generating, 2244 multiple representations that are each intended to reflect the 2245 current state of a target resource. In such cases, some algorithm is 2246 used by the origin server to select one of those representations as 2247 most applicable to a given request, usually based on content 2248 negotiation. This "selected representation" is used to provide the 2249 data and metadata for evaluating conditional requests (Section 8.2) 2250 and constructing the payload for 200 (OK) and 304 (Not Modified) 2251 responses to GET (Section 7.3.1). 2253 6.1. Representation Data 2255 The representation data associated with an HTTP message is either 2256 provided as the payload body of the message or referred to by the 2257 message semantics and the effective request URI. The representation 2258 data is in a format and encoding defined by the representation 2259 metadata header fields. 2261 The data type of the representation data is determined via the header 2262 fields Content-Type and Content-Encoding. These define a two-layer, 2263 ordered encoding model: 2265 representation-data := Content-Encoding( Content-Type( bits ) ) 2267 6.1.1. Media Type 2269 HTTP uses media types [RFC2046] in the Content-Type (Section 6.2.1) 2270 and Accept (Section 8.4.2) header fields in order to provide open and 2271 extensible data typing and type negotiation. Media types define both 2272 a data format and various processing models: how to process that data 2273 in accordance with each context in which it is received. 2275 media-type = type "/" subtype *( OWS ";" OWS parameter ) 2276 type = token 2277 subtype = token 2279 The type and subtype tokens are case-insensitive. 2281 The type/subtype MAY be followed by semicolon-delimited parameters 2282 (Section 4.4.1.4) in the form of name=value pairs. The presence or 2283 absence of a parameter might be significant to the processing of a 2284 media type, depending on its definition within the media type 2285 registry. Parameter values might or might not be case-sensitive, 2286 depending on the semantics of the parameter name. 2288 For example, the following media types are equivalent in describing 2289 HTML text data encoded in the UTF-8 character encoding scheme, but 2290 the first is preferred for consistency (the "charset" parameter value 2291 is defined as being case-insensitive in [RFC2046], Section 4.1.2): 2293 text/html;charset=utf-8 2294 Text/HTML;Charset="utf-8" 2295 text/html; charset="utf-8" 2296 text/html;charset=UTF-8 2298 Media types ought to be registered with IANA according to the 2299 procedures defined in [BCP13]. 2301 6.1.1.1. Charset 2303 HTTP uses charset names to indicate or negotiate the character 2304 encoding scheme of a textual representation [RFC6365]. A charset is 2305 identified by a case-insensitive token. 2307 charset = token 2309 Charset names ought to be registered in the IANA "Character Sets" 2310 registry () 2311 according to the procedures defined in Section 2 of [RFC2978]. 2313 Note: In theory, charset names are defined by the "mime-charset" 2314 ABNF rule defined in Section 2.3 of [RFC2978] (as corrected in 2315 [Err1912]). That rule allows two characters that are not included 2316 in "token" ("{" and "}"), but no charset name registered at the 2317 time of this writing includes braces (see [Err5433]). 2319 6.1.1.2. Canonicalization and Text Defaults 2321 Media types are registered with a canonical form in order to be 2322 interoperable among systems with varying native encoding formats. 2323 Representations selected or transferred via HTTP ought to be in 2324 canonical form, for many of the same reasons described by the 2325 Multipurpose Internet Mail Extensions (MIME) [RFC2045]. However, the 2326 performance characteristics of email deployments (i.e., store and 2327 forward messages to peers) are significantly different from those 2328 common to HTTP and the Web (server-based information services). 2329 Furthermore, MIME's constraints for the sake of compatibility with 2330 older mail transfer protocols do not apply to HTTP (see Appendix B of 2331 [Messaging]). 2333 MIME's canonical form requires that media subtypes of the "text" type 2334 use CRLF as the text line break. HTTP allows the transfer of text 2335 media with plain CR or LF alone representing a line break, when such 2336 line breaks are consistent for an entire representation. An HTTP 2337 sender MAY generate, and a recipient MUST be able to parse, line 2338 breaks in text media that consist of CRLF, bare CR, or bare LF. In 2339 addition, text media in HTTP is not limited to charsets that use 2340 octets 13 and 10 for CR and LF, respectively. This flexibility 2341 regarding line breaks applies only to text within a representation 2342 that has been assigned a "text" media type; it does not apply to 2343 "multipart" types or HTTP elements outside the payload body (e.g., 2344 header fields). 2346 If a representation is encoded with a content-coding, the underlying 2347 data ought to be in a form defined above prior to being encoded. 2349 6.1.1.3. Multipart Types 2351 MIME provides for a number of "multipart" types -- encapsulations of 2352 one or more representations within a single message body. All 2353 multipart types share a common syntax, as defined in Section 5.1.1 of 2354 [RFC2046], and include a boundary parameter as part of the media type 2355 value. The message body is itself a protocol element; a sender MUST 2356 generate only CRLF to represent line breaks between body parts. 2358 HTTP message framing does not use the multipart boundary as an 2359 indicator of message body length, though it might be used by 2360 implementations that generate or process the payload. For example, 2361 the "multipart/form-data" type is often used for carrying form data 2362 in a request, as described in [RFC7578], and the "multipart/ 2363 byteranges" type is defined by this specification for use in some 206 2364 (Partial Content) responses (see Section 9.3.7). 2366 6.1.2. Content Codings 2368 Content coding values indicate an encoding transformation that has 2369 been or can be applied to a representation. Content codings are 2370 primarily used to allow a representation to be compressed or 2371 otherwise usefully transformed without losing the identity of its 2372 underlying media type and without loss of information. Frequently, 2373 the representation is stored in coded form, transmitted directly, and 2374 only decoded by the final recipient. 2376 content-coding = token 2378 All content codings are case-insensitive and ought to be registered 2379 within the "HTTP Content Coding Registry", as defined in 2380 Section 6.1.2.4 2382 Content-coding values are used in the Accept-Encoding (Section 8.4.4) 2383 and Content-Encoding (Section 6.2.2) header fields. 2385 The following content-coding values are defined by this 2386 specification: 2388 +------------+------------------------------------------+-----------+ 2389 | Name | Description | Reference | 2390 +------------+------------------------------------------+-----------+ 2391 | compress | UNIX "compress" data format [Welch] | Section 6 | 2392 | | | .1.2.1 | 2393 | deflate | "deflate" compressed data ([RFC1951]) | Section 6 | 2394 | | inside the "zlib" data format | .1.2.2 | 2395 | | ([RFC1950]) | | 2396 | gzip | GZIP file format [RFC1952] | Section 6 | 2397 | | | .1.2.3 | 2398 | identity | Reserved (synonym for "no encoding" in | Section 8 | 2399 | | Accept-Encoding) | .4.4 | 2400 | x-compress | Deprecated (alias for compress) | Section 6 | 2401 | | | .1.2.1 | 2402 | x-gzip | Deprecated (alias for gzip) | Section 6 | 2403 | | | .1.2.3 | 2404 +------------+------------------------------------------+-----------+ 2406 Table 2 2408 6.1.2.1. Compress Coding 2410 The "compress" coding is an adaptive Lempel-Ziv-Welch (LZW) coding 2411 [Welch] that is commonly produced by the UNIX file compression 2412 program "compress". A recipient SHOULD consider "x-compress" to be 2413 equivalent to "compress". 2415 6.1.2.2. Deflate Coding 2417 The "deflate" coding is a "zlib" data format [RFC1950] containing a 2418 "deflate" compressed data stream [RFC1951] that uses a combination of 2419 the Lempel-Ziv (LZ77) compression algorithm and Huffman coding. 2421 Note: Some non-conformant implementations send the "deflate" 2422 compressed data without the zlib wrapper. 2424 6.1.2.3. Gzip Coding 2426 The "gzip" coding is an LZ77 coding with a 32-bit Cyclic Redundancy 2427 Check (CRC) that is commonly produced by the gzip file compression 2428 program [RFC1952]. A recipient SHOULD consider "x-gzip" to be 2429 equivalent to "gzip". 2431 6.1.2.4. Content Coding Registry 2433 The "HTTP Content Coding Registry", maintained by IANA at 2434 , registers 2435 content-coding names. 2437 Content coding registrations MUST include the following fields: 2439 o Name 2441 o Description 2443 o Pointer to specification text 2445 Names of content codings MUST NOT overlap with names of transfer 2446 codings (Section 7 of [Messaging]), unless the encoding 2447 transformation is identical (as is the case for the compression 2448 codings defined in Section 6.1.2). 2450 Values to be added to this namespace require IETF Review (see 2451 Section 4.8 of [RFC8126]) and MUST conform to the purpose of content 2452 coding defined in Section 6.1.2. 2454 6.1.3. Language Tags 2456 A language tag, as defined in [RFC5646], identifies a natural 2457 language spoken, written, or otherwise conveyed by human beings for 2458 communication of information to other human beings. Computer 2459 languages are explicitly excluded. 2461 HTTP uses language tags within the Accept-Language and Content- 2462 Language header fields. Accept-Language uses the broader language- 2463 range production defined in Section 8.4.5, whereas Content-Language 2464 uses the language-tag production defined below. 2466 language-tag = 2468 A language tag is a sequence of one or more case-insensitive subtags, 2469 each separated by a hyphen character ("-", %x2D). In most cases, a 2470 language tag consists of a primary language subtag that identifies a 2471 broad family of related languages (e.g., "en" = English), which is 2472 optionally followed by a series of subtags that refine or narrow that 2473 language's range (e.g., "en-CA" = the variety of English as 2474 communicated in Canada). Whitespace is not allowed within a language 2475 tag. Example tags include: 2477 fr, en-US, es-419, az-Arab, x-pig-latin, man-Nkoo-GN 2479 See [RFC5646] for further information. 2481 6.1.4. Range Units 2483 Representation data can be partitioned into subranges when there are 2484 addressable structural units inherent to that data's content coding 2485 or media type. For example, octet (a.k.a., byte) boundaries are a 2486 structural unit common to all representation data, allowing 2487 partitions of the data to be identified as a range of bytes at some 2488 offset from the start or end of that data. 2490 This general notion of a "range unit" is used in the Accept-Ranges 2491 (Section 10.4.1) response header field to advertise support for range 2492 requests, the Range (Section 8.3) request header field to delineate 2493 the parts of a representation that are requested, and the Content- 2494 Range (Section 6.3.4) payload header field to describe which part of 2495 a representation is being transferred. 2497 range-unit = token 2499 All range unit names are case-insensitive and ought to be registered 2500 within the "HTTP Range Unit Registry", as defined in Section 6.1.4.4 2502 The following range unit names are defined by this document: 2504 +------------+-----------------------------------------+------------+ 2505 | Range Unit | Description | Reference | 2506 | Name | | | 2507 +------------+-----------------------------------------+------------+ 2508 | bytes | a range of octets | Section 6. | 2509 | | | 1.4.2 | 2510 | none | reserved as keyword to indicate range | Section 10 | 2511 | | requests are not supported | .4.1 | 2512 +------------+-----------------------------------------+------------+ 2514 Table 3 2516 6.1.4.1. Range Specifiers 2518 Ranges are expressed in terms of a range unit paired with a set of 2519 range specifiers. The range unit name determines what kinds of 2520 range-spec are applicable to its own specifiers. Hence, the 2521 following gramar is generic: each range unit is expected to specify 2522 requirements on when int-range, suffix-range, and other-range are 2523 allowed. 2525 A range request can specify a single range or a set of ranges within 2526 a single representation. 2528 ranges-specifier = range-unit "=" range-set 2529 range-set = 1#range-spec 2530 range-spec = int-range 2531 / suffix-range 2532 / other-range 2534 An int-range is a range expressed as two non-negative integers or as 2535 one non-negative integer through to the end of the representation 2536 data. The range unit specifies what the integers mean (e.g., they 2537 might indicate unit offsets from the beginning, inclusive numbered 2538 parts, etc.). 2540 int-range = first-pos "-" [ last-pos ] 2541 first-pos = 1*DIGIT 2542 last-pos = 1*DIGIT 2544 An int-range is invalid if the last-pos value is present and less 2545 than the first-pos. 2547 A suffix-range is a range expressed as a suffix of the representation 2548 data with the provided non-negative integer maximum length (in range 2549 units). In other words, the last N units of the representation data. 2551 suffix-range = "-" suffix-length 2552 suffix-length = 1*DIGIT 2554 To provide for extensibility, the other-range rule is a mostly 2555 unconstrained grammar that allows application-specific or future 2556 range units to define additional range specifiers. 2558 other-range = 1*( %x21-2B / %x2D-7E ) 2559 ; 1*(VCHAR excluding comma) 2561 6.1.4.2. Byte Ranges 2563 The "bytes" range unit is used to express subranges of a 2564 representation data's octet sequence. Each byte range is expressed 2565 as an integer range at some offset, relative to either the beginning 2566 (int-range) or end (suffix-range) of the representation data. Byte 2567 ranges do not use the other-range specifier. 2569 The first-pos value in a bytes int-range gives the offset of the 2570 first byte in a range. The last-pos value gives the offset of the 2571 last byte in the range; that is, the byte positions specified are 2572 inclusive. Byte offsets start at zero. 2574 If the representation data has a content coding applied, each byte 2575 range is calculated with respect to the encoded sequence of bytes, 2576 not the sequence of underlying bytes that would be obtained after 2577 decoding. 2579 Examples of bytes range specifiers: 2581 o The first 500 bytes (byte offsets 0-499, inclusive): 2583 bytes=0-499 2585 o The second 500 bytes (byte offsets 500-999, inclusive): 2587 bytes=500-999 2589 A client can limit the number of bytes requested without knowing the 2590 size of the selected representation. If the last-pos value is 2591 absent, or if the value is greater than or equal to the current 2592 length of the representation data, the byte range is interpreted as 2593 the remainder of the representation (i.e., the server replaces the 2594 value of last-pos with a value that is one less than the current 2595 length of the selected representation). 2597 A client can request the last N bytes of the selected representation 2598 using a suffix-range. If the selected representation is shorter than 2599 the specified suffix-length, the entire representation is used. 2601 Additional examples, assuming a representation of length 10000: 2603 o The final 500 bytes (byte offsets 9500-9999, inclusive): 2605 bytes=-500 2607 Or: 2609 bytes=9500- 2611 o The first and last bytes only (bytes 0 and 9999): 2613 bytes=0-0,-1 2615 o The first, middle, and last 1000 bytes: 2617 bytes= 0-999, 4500-5499, -1000 2619 o Other valid (but not canonical) specifications of the second 500 2620 bytes (byte offsets 500-999, inclusive): 2622 bytes=500-600,601-999 2623 bytes=500-700,601-999 2625 If a valid bytes range-set includes at least one range-spec with a 2626 first-pos that is less than the current length of the representation, 2627 or at least one suffix-range with a non-zero suffix-length, then the 2628 bytes range-set is satisfiable. Otherwise, the bytes range-set is 2629 unsatisfiable. 2631 In the byte-range syntax, first-pos, last-pos, and suffix-length are 2632 expressed as decimal number of octets. Since there is no predefined 2633 limit to the length of a payload, recipients MUST anticipate 2634 potentially large decimal numerals and prevent parsing errors due to 2635 integer conversion overflows. 2637 6.1.4.3. Other Range Units 2639 Other range units, such as format-specific boundaries like pages, 2640 sections, records, rows, or time, are potentially usable in HTTP for 2641 application-specific purposes, but are not commonly used in practice. 2642 Implementors of alternative range units ought to consider how they 2643 would work with content codings and general-purpose intermediaries. 2645 Range units are intended to be extensible. New range units ought to 2646 be registered with IANA, as defined in Section 6.1.4.4. 2648 6.1.4.4. Range Unit Registry 2650 The "HTTP Range Unit Registry" defines the namespace for the range 2651 unit names and refers to their corresponding specifications. It is 2652 maintained at . 2654 Registration of an HTTP Range Unit MUST include the following fields: 2656 o Name 2658 o Description 2659 o Pointer to specification text 2661 Values to be added to this namespace require IETF Review (see 2662 [RFC8126], Section 4.8). 2664 6.2. Representation Metadata 2666 Representation header fields provide metadata about the 2667 representation. When a message includes a payload body, the 2668 representation header fields describe how to interpret the 2669 representation data enclosed in the payload body. In a response to a 2670 HEAD request, the representation header fields describe the 2671 representation data that would have been enclosed in the payload body 2672 if the same request had been a GET. 2674 The following header fields convey representation metadata: 2676 +------------------+---------------+ 2677 | Field Name | Defined in... | 2678 +------------------+---------------+ 2679 | Content-Type | Section 6.2.1 | 2680 | Content-Encoding | Section 6.2.2 | 2681 | Content-Language | Section 6.2.3 | 2682 | Content-Length | Section 6.2.4 | 2683 | Content-Location | Section 6.2.5 | 2684 +------------------+---------------+ 2686 6.2.1. Content-Type 2688 The "Content-Type" header field indicates the media type of the 2689 associated representation: either the representation enclosed in the 2690 message payload or the selected representation, as determined by the 2691 message semantics. The indicated media type defines both the data 2692 format and how that data is intended to be processed by a recipient, 2693 within the scope of the received message semantics, after any content 2694 codings indicated by Content-Encoding are decoded. 2696 Content-Type = media-type 2698 Media types are defined in Section 6.1.1. An example of the field is 2700 Content-Type: text/html; charset=ISO-8859-4 2702 A sender that generates a message containing a payload body SHOULD 2703 generate a Content-Type header field in that message unless the 2704 intended media type of the enclosed representation is unknown to the 2705 sender. If a Content-Type header field is not present, the recipient 2706 MAY either assume a media type of "application/octet-stream" 2707 ([RFC2046], Section 4.5.1) or examine the data to determine its type. 2709 In practice, resource owners do not always properly configure their 2710 origin server to provide the correct Content-Type for a given 2711 representation. Some user agents examine a payload's content and, in 2712 certain cases, override the received type (for example, see 2713 [Sniffing]). This "MIME sniffing" risks drawing incorrect 2714 conclusions about the data, which might expose the user to additional 2715 security risks (e.g., "privilege escalation"). Furthermore, it is 2716 impossible to determine the sender's intended processing model by 2717 examining the data format: many data formats match multiple media 2718 types that differ only in processing semantics. Implementers are 2719 encouraged to provide a means to disable such sniffing. 2721 6.2.2. Content-Encoding 2723 The "Content-Encoding" header field indicates what content codings 2724 have been applied to the representation, beyond those inherent in the 2725 media type, and thus what decoding mechanisms have to be applied in 2726 order to obtain data in the media type referenced by the Content-Type 2727 header field. Content-Encoding is primarily used to allow a 2728 representation's data to be compressed without losing the identity of 2729 its underlying media type. 2731 Content-Encoding = 1#content-coding 2733 An example of its use is 2735 Content-Encoding: gzip 2737 If one or more encodings have been applied to a representation, the 2738 sender that applied the encodings MUST generate a Content-Encoding 2739 header field that lists the content codings in the order in which 2740 they were applied. Additional information about the encoding 2741 parameters can be provided by other header fields not defined by this 2742 specification. 2744 Unlike Transfer-Encoding (Section 6.1 of [Messaging]), the codings 2745 listed in Content-Encoding are a characteristic of the 2746 representation; the representation is defined in terms of the coded 2747 form, and all other metadata about the representation is about the 2748 coded form unless otherwise noted in the metadata definition. 2749 Typically, the representation is only decoded just prior to rendering 2750 or analogous usage. 2752 If the media type includes an inherent encoding, such as a data 2753 format that is always compressed, then that encoding would not be 2754 restated in Content-Encoding even if it happens to be the same 2755 algorithm as one of the content codings. Such a content coding would 2756 only be listed if, for some bizarre reason, it is applied a second 2757 time to form the representation. Likewise, an origin server might 2758 choose to publish the same data as multiple representations that 2759 differ only in whether the coding is defined as part of Content-Type 2760 or Content-Encoding, since some user agents will behave differently 2761 in their handling of each response (e.g., open a "Save as ..." dialog 2762 instead of automatic decompression and rendering of content). 2764 An origin server MAY respond with a status code of 415 (Unsupported 2765 Media Type) if a representation in the request message has a content 2766 coding that is not acceptable. 2768 6.2.3. Content-Language 2770 The "Content-Language" header field describes the natural language(s) 2771 of the intended audience for the representation. Note that this 2772 might not be equivalent to all the languages used within the 2773 representation. 2775 Content-Language = 1#language-tag 2777 Language tags are defined in Section 6.1.3. The primary purpose of 2778 Content-Language is to allow a user to identify and differentiate 2779 representations according to the users' own preferred language. 2780 Thus, if the content is intended only for a Danish-literate audience, 2781 the appropriate field is 2783 Content-Language: da 2785 If no Content-Language is specified, the default is that the content 2786 is intended for all language audiences. This might mean that the 2787 sender does not consider it to be specific to any natural language, 2788 or that the sender does not know for which language it is intended. 2790 Multiple languages MAY be listed for content that is intended for 2791 multiple audiences. For example, a rendition of the "Treaty of 2792 Waitangi", presented simultaneously in the original Maori and English 2793 versions, would call for 2795 Content-Language: mi, en 2797 However, just because multiple languages are present within a 2798 representation does not mean that it is intended for multiple 2799 linguistic audiences. An example would be a beginner's language 2800 primer, such as "A First Lesson in Latin", which is clearly intended 2801 to be used by an English-literate audience. In this case, the 2802 Content-Language would properly only include "en". 2804 Content-Language MAY be applied to any media type -- it is not 2805 limited to textual documents. 2807 6.2.4. Content-Length 2809 [[CREF2: The "Content-Length" header field indicates the number of 2810 data octets (body length) for the representation. In some cases, 2811 Content-Length is used to define or estimate message framing. ]] 2813 Content-Length = 1*DIGIT 2815 An example is 2817 Content-Length: 3495 2819 A sender MUST NOT send a Content-Length header field in any message 2820 that contains a Transfer-Encoding header field. 2822 A user agent SHOULD send a Content-Length in a request message when 2823 no Transfer-Encoding is sent and the request method defines a meaning 2824 for an enclosed payload body. For example, a Content-Length header 2825 field is normally sent in a POST request even when the value is 0 2826 (indicating an empty payload body). A user agent SHOULD NOT send a 2827 Content-Length header field when the request message does not contain 2828 a payload body and the method semantics do not anticipate such a 2829 body. 2831 A server MAY send a Content-Length header field in a response to a 2832 HEAD request (Section 7.3.2); a server MUST NOT send Content-Length 2833 in such a response unless its field value equals the decimal number 2834 of octets that would have been sent in the payload body of a response 2835 if the same request had used the GET method. 2837 A server MAY send a Content-Length header field in a 304 (Not 2838 Modified) response to a conditional GET request (Section 9.4.5); a 2839 server MUST NOT send Content-Length in such a response unless its 2840 field value equals the decimal number of octets that would have been 2841 sent in the payload body of a 200 (OK) response to the same request. 2843 A server MUST NOT send a Content-Length header field in any response 2844 with a status code of 1xx (Informational) or 204 (No Content). A 2845 server MUST NOT send a Content-Length header field in any 2xx 2846 (Successful) response to a CONNECT request (Section 7.3.6). 2848 Aside from the cases defined above, in the absence of Transfer- 2849 Encoding, an origin server SHOULD send a Content-Length header field 2850 when the payload body size is known prior to sending the complete 2851 header section. This will allow downstream recipients to measure 2852 transfer progress, know when a received message is complete, and 2853 potentially reuse the connection for additional requests. 2855 Any Content-Length field value greater than or equal to zero is 2856 valid. Since there is no predefined limit to the length of a 2857 payload, a recipient MUST anticipate potentially large decimal 2858 numerals and prevent parsing errors due to integer conversion 2859 overflows (Section 11.5). 2861 If a message is received that has multiple Content-Length header 2862 fields with field values consisting of the same decimal value, or a 2863 single Content-Length header field with a field value containing a 2864 list of identical decimal values (e.g., "Content-Length: 42, 42"), 2865 indicating that duplicate Content-Length header fields have been 2866 generated or combined by an upstream message processor, then the 2867 recipient MUST either reject the message as invalid or replace the 2868 duplicated field values with a single valid Content-Length field 2869 containing that decimal value prior to determining the message body 2870 length or forwarding the message. 2872 6.2.5. Content-Location 2874 The "Content-Location" header field references a URI that can be used 2875 as an identifier for a specific resource corresponding to the 2876 representation in this message's payload. In other words, if one 2877 were to perform a GET request on this URI at the time of this 2878 message's generation, then a 200 (OK) response would contain the same 2879 representation that is enclosed as payload in this message. 2881 Content-Location = absolute-URI / partial-URI 2883 The Content-Location value is not a replacement for the effective 2884 Request URI (Section 5.5). It is representation metadata. It has 2885 the same syntax and semantics as the header field of the same name 2886 defined for MIME body parts in Section 4 of [RFC2557]. However, its 2887 appearance in an HTTP message has some special implications for HTTP 2888 recipients. 2890 If Content-Location is included in a 2xx (Successful) response 2891 message and its value refers (after conversion to absolute form) to a 2892 URI that is the same as the effective request URI, then the recipient 2893 MAY consider the payload to be a current representation of that 2894 resource at the time indicated by the message origination date. For 2895 a GET (Section 7.3.1) or HEAD (Section 7.3.2) request, this is the 2896 same as the default semantics when no Content-Location is provided by 2897 the server. For a state-changing request like PUT (Section 7.3.4) or 2898 POST (Section 7.3.3), it implies that the server's response contains 2899 the new representation of that resource, thereby distinguishing it 2900 from representations that might only report about the action (e.g., 2901 "It worked!"). This allows authoring applications to update their 2902 local copies without the need for a subsequent GET request. 2904 If Content-Location is included in a 2xx (Successful) response 2905 message and its field value refers to a URI that differs from the 2906 effective request URI, then the origin server claims that the URI is 2907 an identifier for a different resource corresponding to the enclosed 2908 representation. Such a claim can only be trusted if both identifiers 2909 share the same resource owner, which cannot be programmatically 2910 determined via HTTP. 2912 o For a response to a GET or HEAD request, this is an indication 2913 that the effective request URI refers to a resource that is 2914 subject to content negotiation and the Content-Location field 2915 value is a more specific identifier for the selected 2916 representation. 2918 o For a 201 (Created) response to a state-changing method, a 2919 Content-Location field value that is identical to the Location 2920 field value indicates that this payload is a current 2921 representation of the newly created resource. 2923 o Otherwise, such a Content-Location indicates that this payload is 2924 a representation reporting on the requested action's status and 2925 that the same report is available (for future access with GET) at 2926 the given URI. For example, a purchase transaction made via a 2927 POST request might include a receipt document as the payload of 2928 the 200 (OK) response; the Content-Location field value provides 2929 an identifier for retrieving a copy of that same receipt in the 2930 future. 2932 A user agent that sends Content-Location in a request message is 2933 stating that its value refers to where the user agent originally 2934 obtained the content of the enclosed representation (prior to any 2935 modifications made by that user agent). In other words, the user 2936 agent is providing a back link to the source of the original 2937 representation. 2939 An origin server that receives a Content-Location field in a request 2940 message MUST treat the information as transitory request context 2941 rather than as metadata to be saved verbatim as part of the 2942 representation. An origin server MAY use that context to guide in 2943 processing the request or to save it for other uses, such as within 2944 source links or versioning metadata. However, an origin server MUST 2945 NOT use such context information to alter the request semantics. 2947 For example, if a client makes a PUT request on a negotiated resource 2948 and the origin server accepts that PUT (without redirection), then 2949 the new state of that resource is expected to be consistent with the 2950 one representation supplied in that PUT; the Content-Location cannot 2951 be used as a form of reverse content selection identifier to update 2952 only one of the negotiated representations. If the user agent had 2953 wanted the latter semantics, it would have applied the PUT directly 2954 to the Content-Location URI. 2956 6.3. Payload 2958 Some HTTP messages transfer a complete or partial representation as 2959 the message "payload". In some cases, a payload might contain only 2960 the associated representation's header fields (e.g., responses to 2961 HEAD) or only some part(s) of the representation data (e.g., the 206 2962 (Partial Content) status code). 2964 Header fields that specifically describe the payload, rather than the 2965 associated representation, are referred to as "payload header 2966 fields". Payload header fields are defined in other parts of this 2967 specification, due to their impact on message parsing. 2969 +-------------------+----------------------------+ 2970 | Field Name | Defined in... | 2971 +-------------------+----------------------------+ 2972 | Content-Range | Section 6.3.4 | 2973 | Trailer | Section 4.6.3 | 2974 | Transfer-Encoding | Section 6.1 of [Messaging] | 2975 +-------------------+----------------------------+ 2977 6.3.1. Purpose 2979 The purpose of a payload in a request is defined by the method 2980 semantics. For example, a representation in the payload of a PUT 2981 request (Section 7.3.4) represents the desired state of the target 2982 resource if the request is successfully applied, whereas a 2983 representation in the payload of a POST request (Section 7.3.3) 2984 represents information to be processed by the target resource. 2986 In a response, the payload's purpose is defined by both the request 2987 method and the response status code. For example, the payload of a 2988 200 (OK) response to GET (Section 7.3.1) represents the current state 2989 of the target resource, as observed at the time of the message 2990 origination date (Section 10.1.1.2), whereas the payload of the same 2991 status code in a response to POST might represent either the 2992 processing result or the new state of the target resource after 2993 applying the processing. Response messages with an error status code 2994 usually contain a payload that represents the error condition, such 2995 that it describes the error state and what next steps are suggested 2996 for resolving it. 2998 6.3.2. Identification 3000 When a complete or partial representation is transferred in a message 3001 payload, it is often desirable for the sender to supply, or the 3002 recipient to determine, an identifier for a resource corresponding to 3003 that representation. 3005 For a request message: 3007 o If the request has a Content-Location header field, then the 3008 sender asserts that the payload is a representation of the 3009 resource identified by the Content-Location field value. However, 3010 such an assertion cannot be trusted unless it can be verified by 3011 other means (not defined by this specification). The information 3012 might still be useful for revision history links. 3014 o Otherwise, the payload is unidentified. 3016 For a response message, the following rules are applied in order 3017 until a match is found: 3019 1. If the request method is GET or HEAD and the response status code 3020 is 200 (OK), 204 (No Content), 206 (Partial Content), or 304 (Not 3021 Modified), the payload is a representation of the resource 3022 identified by the effective request URI (Section 5.5). 3024 2. If the request method is GET or HEAD and the response status code 3025 is 203 (Non-Authoritative Information), the payload is a 3026 potentially modified or enhanced representation of the target 3027 resource as provided by an intermediary. 3029 3. If the response has a Content-Location header field and its field 3030 value is a reference to the same URI as the effective request 3031 URI, the payload is a representation of the resource identified 3032 by the effective request URI. 3034 4. If the response has a Content-Location header field and its field 3035 value is a reference to a URI different from the effective 3036 request URI, then the sender asserts that the payload is a 3037 representation of the resource identified by the Content-Location 3038 field value. However, such an assertion cannot be trusted unless 3039 it can be verified by other means (not defined by this 3040 specification). 3042 5. Otherwise, the payload is unidentified. 3044 6.3.3. Payload Body 3046 The payload body contains the data of a request or response. This is 3047 distinct from the message body (e.g., Section 6 of [Messaging]), 3048 which is how the payload body is transferred "on the wire", and might 3049 be encoded, depending on the HTTP version in use. 3051 It is also distinct from a request or response's representation data 3052 (Section 6.1), which can be inferred from protocol operation, rather 3053 than necessarily appearing "on the wire." 3055 The presence of a payload body in a request depends on whether the 3056 request method used defines semantics for it. 3058 The presence of a payload body in a response depends on both the 3059 request method to which it is responding and the response status code 3060 (Section 9). 3062 Responses to the HEAD request method (Section 7.3.2) never include a 3063 payload body because the associated response header fields indicate 3064 only what their values would have been if the request method had been 3065 GET (Section 7.3.1). 3067 2xx (Successful) responses to a CONNECT request method 3068 (Section 7.3.6) switch the connection to tunnel mode instead of 3069 having a payload body. 3071 All 1xx (Informational), 204 (No Content), and 304 (Not Modified) 3072 responses do not include a payload body. 3074 All other responses do include a payload body, although that body 3075 might be of zero length. 3077 6.3.4. Content-Range 3079 The "Content-Range" header field is sent in a single part 206 3080 (Partial Content) response to indicate the partial range of the 3081 selected representation enclosed as the message payload, sent in each 3082 part of a multipart 206 response to indicate the range enclosed 3083 within each body part, and sent in 416 (Range Not Satisfiable) 3084 responses to provide information about the selected representation. 3086 Content-Range = range-unit SP 3087 ( range-resp / unsatisfied-range ) 3089 range-resp = incl-range "/" ( complete-length / "*" ) 3090 incl-range = first-pos "-" last-pos 3091 unsatisfied-range = "*/" complete-length 3093 complete-length = 1*DIGIT 3095 If a 206 (Partial Content) response contains a Content-Range header 3096 field with a range unit (Section 6.1.4) that the recipient does not 3097 understand, the recipient MUST NOT attempt to recombine it with a 3098 stored representation. A proxy that receives such a message SHOULD 3099 forward it downstream. 3101 For byte ranges, a sender SHOULD indicate the complete length of the 3102 representation from which the range has been extracted, unless the 3103 complete length is unknown or difficult to determine. An asterisk 3104 character ("*") in place of the complete-length indicates that the 3105 representation length was unknown when the header field was 3106 generated. 3108 The following example illustrates when the complete length of the 3109 selected representation is known by the sender to be 1234 bytes: 3111 Content-Range: bytes 42-1233/1234 3113 and this second example illustrates when the complete length is 3114 unknown: 3116 Content-Range: bytes 42-1233/* 3118 A Content-Range field value is invalid if it contains a range-resp 3119 that has a last-pos value less than its first-pos value, or a 3120 complete-length value less than or equal to its last-pos value. The 3121 recipient of an invalid Content-Range MUST NOT attempt to recombine 3122 the received content with a stored representation. 3124 A server generating a 416 (Range Not Satisfiable) response to a byte- 3125 range request SHOULD send a Content-Range header field with an 3126 unsatisfied-range value, as in the following example: 3128 Content-Range: bytes */1234 3130 The complete-length in a 416 response indicates the current length of 3131 the selected representation. 3133 The Content-Range header field has no meaning for status codes that 3134 do not explicitly describe its semantic. For this specification, 3135 only the 206 (Partial Content) and 416 (Range Not Satisfiable) status 3136 codes describe a meaning for Content-Range. 3138 The following are examples of Content-Range values in which the 3139 selected representation contains a total of 1234 bytes: 3141 o The first 500 bytes: 3143 Content-Range: bytes 0-499/1234 3145 o The second 500 bytes: 3147 Content-Range: bytes 500-999/1234 3149 o All except for the first 500 bytes: 3151 Content-Range: bytes 500-1233/1234 3153 o The last 500 bytes: 3155 Content-Range: bytes 734-1233/1234 3157 6.3.5. Media Type multipart/byteranges 3159 When a 206 (Partial Content) response message includes the content of 3160 multiple ranges, they are transmitted as body parts in a multipart 3161 message body ([RFC2046], Section 5.1) with the media type of 3162 "multipart/byteranges". 3164 The multipart/byteranges media type includes one or more body parts, 3165 each with its own Content-Type and Content-Range fields. The 3166 required boundary parameter specifies the boundary string used to 3167 separate each body part. 3169 Implementation Notes: 3171 1. Additional CRLFs might precede the first boundary string in the 3172 body. 3174 2. Although [RFC2046] permits the boundary string to be quoted, some 3175 existing implementations handle a quoted boundary string 3176 incorrectly. 3178 3. A number of clients and servers were coded to an early draft of 3179 the byteranges specification that used a media type of multipart/ 3180 x-byteranges, which is almost (but not quite) compatible with 3181 this type. 3183 Despite the name, the "multipart/byteranges" media type is not 3184 limited to byte ranges. The following example uses an "exampleunit" 3185 range unit: 3187 HTTP/1.1 206 Partial Content 3188 Date: Tue, 14 Nov 1995 06:25:24 GMT 3189 Last-Modified: Tue, 14 July 04:58:08 GMT 3190 Content-Length: 2331785 3191 Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES 3193 --THIS_STRING_SEPARATES 3194 Content-Type: video/example 3195 Content-Range: exampleunit 1.2-4.3/25 3197 ...the first range... 3198 --THIS_STRING_SEPARATES 3199 Content-Type: video/example 3200 Content-Range: exampleunit 11.2-14.3/25 3202 ...the second range 3203 --THIS_STRING_SEPARATES-- 3205 The following information serves as the registration form for the 3206 multipart/byteranges media type. 3208 Type name: multipart 3210 Subtype name: byteranges 3212 Required parameters: boundary 3214 Optional parameters: N/A 3216 Encoding considerations: only "7bit", "8bit", or "binary" are 3217 permitted 3219 Security considerations: see Section 11 3221 Interoperability considerations: N/A 3222 Published specification: This specification (see Section 6.3.5). 3224 Applications that use this media type: HTTP components supporting 3225 multiple ranges in a single request. 3227 Fragment identifier considerations: N/A 3229 Additional information: 3231 Deprecated alias names for this type: N/A 3233 Magic number(s): N/A 3235 File extension(s): N/A 3237 Macintosh file type code(s): N/A 3239 Person and email address to contact for further information: See Aut 3240 hors' Addresses section. 3242 Intended usage: COMMON 3244 Restrictions on usage: N/A 3246 Author: See Authors' Addresses section. 3248 Change controller: IESG 3250 6.4. Content Negotiation 3252 When responses convey payload information, whether indicating a 3253 success or an error, the origin server often has different ways of 3254 representing that information; for example, in different formats, 3255 languages, or encodings. Likewise, different users or user agents 3256 might have differing capabilities, characteristics, or preferences 3257 that could influence which representation, among those available, 3258 would be best to deliver. For this reason, HTTP provides mechanisms 3259 for content negotiation. 3261 This specification defines two patterns of content negotiation that 3262 can be made visible within the protocol: "proactive", where the 3263 server selects the representation based upon the user agent's stated 3264 preferences, and "reactive" negotiation, where the server provides a 3265 list of representations for the user agent to choose from. Other 3266 patterns of content negotiation include "conditional content", where 3267 the representation consists of multiple parts that are selectively 3268 rendered based on user agent parameters, "active content", where the 3269 representation contains a script that makes additional (more 3270 specific) requests based on the user agent characteristics, and 3271 "Transparent Content Negotiation" ([RFC2295]), where content 3272 selection is performed by an intermediary. These patterns are not 3273 mutually exclusive, and each has trade-offs in applicability and 3274 practicality. 3276 Note that, in all cases, HTTP is not aware of the resource semantics. 3277 The consistency with which an origin server responds to requests, 3278 over time and over the varying dimensions of content negotiation, and 3279 thus the "sameness" of a resource's observed representations over 3280 time, is determined entirely by whatever entity or algorithm selects 3281 or generates those responses. HTTP pays no attention to the man 3282 behind the curtain. 3284 6.4.1. Proactive Negotiation 3286 When content negotiation preferences are sent by the user agent in a 3287 request to encourage an algorithm located at the server to select the 3288 preferred representation, it is called proactive negotiation (a.k.a., 3289 server-driven negotiation). Selection is based on the available 3290 representations for a response (the dimensions over which it might 3291 vary, such as language, content-coding, etc.) compared to various 3292 information supplied in the request, including both the explicit 3293 negotiation fields of Section 8.4 and implicit characteristics, such 3294 as the client's network address or parts of the User-Agent field. 3296 Proactive negotiation is advantageous when the algorithm for 3297 selecting from among the available representations is difficult to 3298 describe to a user agent, or when the server desires to send its 3299 "best guess" to the user agent along with the first response (hoping 3300 to avoid the round trip delay of a subsequent request if the "best 3301 guess" is good enough for the user). In order to improve the 3302 server's guess, a user agent MAY send request header fields that 3303 describe its preferences. 3305 Proactive negotiation has serious disadvantages: 3307 o It is impossible for the server to accurately determine what might 3308 be "best" for any given user, since that would require complete 3309 knowledge of both the capabilities of the user agent and the 3310 intended use for the response (e.g., does the user want to view it 3311 on screen or print it on paper?); 3313 o Having the user agent describe its capabilities in every request 3314 can be both very inefficient (given that only a small percentage 3315 of responses have multiple representations) and a potential risk 3316 to the user's privacy; 3318 o It complicates the implementation of an origin server and the 3319 algorithms for generating responses to a request; and, 3321 o It limits the reusability of responses for shared caching. 3323 A user agent cannot rely on proactive negotiation preferences being 3324 consistently honored, since the origin server might not implement 3325 proactive negotiation for the requested resource or might decide that 3326 sending a response that doesn't conform to the user agent's 3327 preferences is better than sending a 406 (Not Acceptable) response. 3329 A Vary header field (Section 10.1.4) is often sent in a response 3330 subject to proactive negotiation to indicate what parts of the 3331 request information were used in the selection algorithm. 3333 6.4.2. Reactive Negotiation 3335 With reactive negotiation (a.k.a., agent-driven negotiation), 3336 selection of the best response representation (regardless of the 3337 status code) is performed by the user agent after receiving an 3338 initial response from the origin server that contains a list of 3339 resources for alternative representations. If the user agent is not 3340 satisfied by the initial response representation, it can perform a 3341 GET request on one or more of the alternative resources, selected 3342 based on metadata included in the list, to obtain a different form of 3343 representation for that response. Selection of alternatives might be 3344 performed automatically by the user agent or manually by the user 3345 selecting from a generated (possibly hypertext) menu. 3347 Note that the above refers to representations of the response, in 3348 general, not representations of the resource. The alternative 3349 representations are only considered representations of the target 3350 resource if the response in which those alternatives are provided has 3351 the semantics of being a representation of the target resource (e.g., 3352 a 200 (OK) response to a GET request) or has the semantics of 3353 providing links to alternative representations for the target 3354 resource (e.g., a 300 (Multiple Choices) response to a GET request). 3356 A server might choose not to send an initial representation, other 3357 than the list of alternatives, and thereby indicate that reactive 3358 negotiation by the user agent is preferred. For example, the 3359 alternatives listed in responses with the 300 (Multiple Choices) and 3360 406 (Not Acceptable) status codes include information about the 3361 available representations so that the user or user agent can react by 3362 making a selection. 3364 Reactive negotiation is advantageous when the response would vary 3365 over commonly used dimensions (such as type, language, or encoding), 3366 when the origin server is unable to determine a user agent's 3367 capabilities from examining the request, and generally when public 3368 caches are used to distribute server load and reduce network usage. 3370 Reactive negotiation suffers from the disadvantages of transmitting a 3371 list of alternatives to the user agent, which degrades user-perceived 3372 latency if transmitted in the header section, and needing a second 3373 request to obtain an alternate representation. Furthermore, this 3374 specification does not define a mechanism for supporting automatic 3375 selection, though it does not prevent such a mechanism from being 3376 developed as an extension. 3378 7. Request Methods 3380 7.1. Overview 3382 The request method token is the primary source of request semantics; 3383 it indicates the purpose for which the client has made this request 3384 and what is expected by the client as a successful result. 3386 The request method's semantics might be further specialized by the 3387 semantics of some header fields when present in a request (Section 8) 3388 if those additional semantics do not conflict with the method. For 3389 example, a client can send conditional request header fields 3390 (Section 8.2) to make the requested action conditional on the current 3391 state of the target resource. 3393 method = token 3395 HTTP was originally designed to be usable as an interface to 3396 distributed object systems. The request method was envisioned as 3397 applying semantics to a target resource in much the same way as 3398 invoking a defined method on an identified object would apply 3399 semantics. 3401 The method token is case-sensitive because it might be used as a 3402 gateway to object-based systems with case-sensitive method names. By 3403 convention, standardized methods are defined in all-uppercase US- 3404 ASCII letters. 3406 Unlike distributed objects, the standardized request methods in HTTP 3407 are not resource-specific, since uniform interfaces provide for 3408 better visibility and reuse in network-based systems [REST]. Once 3409 defined, a standardized method ought to have the same semantics when 3410 applied to any resource, though each resource determines for itself 3411 whether those semantics are implemented or allowed. 3413 This specification defines a number of standardized methods that are 3414 commonly used in HTTP, as outlined by the following table. 3416 +---------+-------------------------------------------------+-------+ 3417 | Method | Description | Sec. | 3418 +---------+-------------------------------------------------+-------+ 3419 | GET | Transfer a current representation of the target | 7.3.1 | 3420 | | resource. | | 3421 | HEAD | Same as GET, but only transfer the status line | 7.3.2 | 3422 | | and header section. | | 3423 | POST | Perform resource-specific processing on the | 7.3.3 | 3424 | | request payload. | | 3425 | PUT | Replace all current representations of the | 7.3.4 | 3426 | | target resource with the request payload. | | 3427 | DELETE | Remove all current representations of the | 7.3.5 | 3428 | | target resource. | | 3429 | CONNECT | Establish a tunnel to the server identified by | 7.3.6 | 3430 | | the target resource. | | 3431 | OPTIONS | Describe the communication options for the | 7.3.7 | 3432 | | target resource. | | 3433 | TRACE | Perform a message loop-back test along the path | 7.3.8 | 3434 | | to the target resource. | | 3435 +---------+-------------------------------------------------+-------+ 3437 Table 4 3439 All general-purpose servers MUST support the methods GET and HEAD. 3440 All other methods are OPTIONAL. 3442 The set of methods allowed by a target resource can be listed in an 3443 Allow header field (Section 10.4.2). However, the set of allowed 3444 methods can change dynamically. When a request method is received 3445 that is unrecognized or not implemented by an origin server, the 3446 origin server SHOULD respond with the 501 (Not Implemented) status 3447 code. When a request method is received that is known by an origin 3448 server but not allowed for the target resource, the origin server 3449 SHOULD respond with the 405 (Method Not Allowed) status code. 3451 7.2. Common Method Properties 3452 +---------+------+------------+----------------+ 3453 | Method | Safe | Idempotent | Reference | 3454 +---------+------+------------+----------------+ 3455 | CONNECT | no | no | Section 7.3.6 | 3456 | DELETE | no | yes | Section 7.3.5 | 3457 | GET | yes | yes | Section 7.3.1 | 3458 | HEAD | yes | yes | Section 7.3.2 | 3459 | OPTIONS | yes | yes | Section 7.3.7 | 3460 | POST | no | no | Section 7.3.3 | 3461 | PUT | no | yes | Section 7.3.4 | 3462 | TRACE | yes | yes | Section 7.3.8 | 3463 +---------+------+------------+----------------+ 3465 Table 5 3467 7.2.1. Safe Methods 3469 Request methods are considered "safe" if their defined semantics are 3470 essentially read-only; i.e., the client does not request, and does 3471 not expect, any state change on the origin server as a result of 3472 applying a safe method to a target resource. Likewise, reasonable 3473 use of a safe method is not expected to cause any harm, loss of 3474 property, or unusual burden on the origin server. 3476 This definition of safe methods does not prevent an implementation 3477 from including behavior that is potentially harmful, that is not 3478 entirely read-only, or that causes side effects while invoking a safe 3479 method. What is important, however, is that the client did not 3480 request that additional behavior and cannot be held accountable for 3481 it. For example, most servers append request information to access 3482 log files at the completion of every response, regardless of the 3483 method, and that is considered safe even though the log storage might 3484 become full and crash the server. Likewise, a safe request initiated 3485 by selecting an advertisement on the Web will often have the side 3486 effect of charging an advertising account. 3488 Of the request methods defined by this specification, the GET, HEAD, 3489 OPTIONS, and TRACE methods are defined to be safe. 3491 The purpose of distinguishing between safe and unsafe methods is to 3492 allow automated retrieval processes (spiders) and cache performance 3493 optimization (pre-fetching) to work without fear of causing harm. In 3494 addition, it allows a user agent to apply appropriate constraints on 3495 the automated use of unsafe methods when processing potentially 3496 untrusted content. 3498 A user agent SHOULD distinguish between safe and unsafe methods when 3499 presenting potential actions to a user, such that the user can be 3500 made aware of an unsafe action before it is requested. 3502 When a resource is constructed such that parameters within the 3503 effective request URI have the effect of selecting an action, it is 3504 the resource owner's responsibility to ensure that the action is 3505 consistent with the request method semantics. For example, it is 3506 common for Web-based content editing software to use actions within 3507 query parameters, such as "page?do=delete". If the purpose of such a 3508 resource is to perform an unsafe action, then the resource owner MUST 3509 disable or disallow that action when it is accessed using a safe 3510 request method. Failure to do so will result in unfortunate side 3511 effects when automated processes perform a GET on every URI reference 3512 for the sake of link maintenance, pre-fetching, building a search 3513 index, etc. 3515 7.2.2. Idempotent Methods 3517 A request method is considered "idempotent" if the intended effect on 3518 the server of multiple identical requests with that method is the 3519 same as the effect for a single such request. Of the request methods 3520 defined by this specification, PUT, DELETE, and safe request methods 3521 are idempotent. 3523 Like the definition of safe, the idempotent property only applies to 3524 what has been requested by the user; a server is free to log each 3525 request separately, retain a revision control history, or implement 3526 other non-idempotent side effects for each idempotent request. 3528 Idempotent methods are distinguished because the request can be 3529 repeated automatically if a communication failure occurs before the 3530 client is able to read the server's response. For example, if a 3531 client sends a PUT request and the underlying connection is closed 3532 before any response is received, then the client can establish a new 3533 connection and retry the idempotent request. It knows that repeating 3534 the request will have the same intended effect, even if the original 3535 request succeeded, though the response might differ. 3537 A client SHOULD NOT automatically retry a request with a non- 3538 idempotent method unless it has some means to know that the request 3539 semantics are actually idempotent, regardless of the method, or some 3540 means to detect that the original request was never applied. 3542 For example, a user agent that knows (through design or 3543 configuration) that a POST request to a given resource is safe can 3544 repeat that request automatically. Likewise, a user agent designed 3545 specifically to operate on a version control repository might be able 3546 to recover from partial failure conditions by checking the target 3547 resource revision(s) after a failed connection, reverting or fixing 3548 any changes that were partially applied, and then automatically 3549 retrying the requests that failed. 3551 Some clients use weaker signals to initiate automatic retries. For 3552 example, when a POST request is sent, but the underlying transport 3553 connection is closed before any part of the response is received. 3554 Although this is commonly implemented, it is not recommended. 3556 A proxy MUST NOT automatically retry non-idempotent requests. A 3557 client SHOULD NOT automatically retry a failed automatic retry. 3559 7.2.3. Methods and Caching 3561 For a cache to store and use a response, the associated method needs 3562 to explicitly allow caching, and detail under what conditions a 3563 response can be used to satisfy subsequent requests; a method 3564 definition which does not do so cannot be cached. For additional 3565 requirements see [Caching]. 3567 This specification defines caching semantics for GET, HEAD, and POST, 3568 although the overwhelming majority of cache implementations only 3569 support GET and HEAD. 3571 7.3. Method Definitions 3573 7.3.1. GET 3575 The GET method requests transfer of a current selected representation 3576 for the target resource. GET is the primary mechanism of information 3577 retrieval and the focus of almost all performance optimizations. 3578 Hence, when people speak of retrieving some identifiable information 3579 via HTTP, they are generally referring to making a GET request. 3581 The GET method is specifically intended to reflect the quality of 3582 "sameness" identified by the request URI as if it were referenced as 3583 an ordinary hypertext link. 3585 It is tempting to think of resource identifiers as remote file system 3586 pathnames and of representations as being a copy of the contents of 3587 such files. In fact, that is how many resources are implemented (see 3588 Section 11.3 for related security considerations). However, there 3589 are no such limitations in practice. The HTTP interface for a 3590 resource is just as likely to be implemented as a tree of content 3591 objects, a programmatic view on various database records, or a 3592 gateway to other information systems. Even when the URI mapping 3593 mechanism is tied to a file system, an origin server might be 3594 configured to execute the files with the request as input and send 3595 the output as the representation rather than transfer the files 3596 directly. Regardless, only the origin server needs to know how each 3597 of its resource identifiers corresponds to an implementation and how 3598 each implementation manages to select and send a current 3599 representation of the target resource in a response to GET. 3601 A client can alter the semantics of GET to be a "range request", 3602 requesting transfer of only some part(s) of the selected 3603 representation, by sending a Range header field in the request 3604 (Section 8.3). 3606 A client SHOULD NOT generate a body in a GET request. A payload 3607 received in a GET request has no defined semantics, cannot alter the 3608 meaning or target of the request, and might lead some implementations 3609 to reject the request and close the connection because of its 3610 potential as a request smuggling attack (Section 11.2 of 3611 [Messaging]). 3613 The response to a GET request is cacheable; a cache MAY use it to 3614 satisfy subsequent GET and HEAD requests unless otherwise indicated 3615 by the Cache-Control header field (Section 5.2 of [Caching]). A 3616 cache that receives a payload in a GET request is likely to ignore 3617 that payload and cache regardless of the payload contents. 3619 7.3.2. HEAD 3621 The HEAD method is identical to GET except that the server MUST NOT 3622 send a message body in the response (i.e., the response terminates at 3623 the end of the header section). The server SHOULD send the same 3624 header fields in response to a HEAD request as it would have sent if 3625 the request had been a GET, except that the payload header fields 3626 (Section 6.3) MAY be omitted. This method can be used for obtaining 3627 metadata about the selected representation without transferring the 3628 representation data and is often used for testing hypertext links for 3629 validity, accessibility, and recent modification. 3631 A payload within a HEAD request message has no defined semantics; 3632 sending a payload body on a HEAD request might cause some existing 3633 implementations to reject the request. 3635 The response to a HEAD request is cacheable; a cache MAY use it to 3636 satisfy subsequent HEAD requests unless otherwise indicated by the 3637 Cache-Control header field (Section 5.2 of [Caching]). A HEAD 3638 response might also have an effect on previously cached responses to 3639 GET; see Section 4.3.5 of [Caching]. 3641 7.3.3. POST 3643 The POST method requests that the target resource process the 3644 representation enclosed in the request according to the resource's 3645 own specific semantics. For example, POST is used for the following 3646 functions (among others): 3648 o Providing a block of data, such as the fields entered into an HTML 3649 form, to a data-handling process; 3651 o Posting a message to a bulletin board, newsgroup, mailing list, 3652 blog, or similar group of articles; 3654 o Creating a new resource that has yet to be identified by the 3655 origin server; and 3657 o Appending data to a resource's existing representation(s). 3659 An origin server indicates response semantics by choosing an 3660 appropriate status code depending on the result of processing the 3661 POST request; almost all of the status codes defined by this 3662 specification might be received in a response to POST (the exceptions 3663 being 206 (Partial Content), 304 (Not Modified), and 416 (Range Not 3664 Satisfiable)). 3666 If one or more resources has been created on the origin server as a 3667 result of successfully processing a POST request, the origin server 3668 SHOULD send a 201 (Created) response containing a Location header 3669 field that provides an identifier for the primary resource created 3670 (Section 10.1.2) and a representation that describes the status of 3671 the request while referring to the new resource(s). 3673 Responses to POST requests are only cacheable when they include 3674 explicit freshness information (see Section 4.2.1 of [Caching]) and a 3675 Content-Location header field that has the same value as the POST's 3676 effective request URI (Section 6.2.5). A cached POST response can be 3677 reused to satisfy a later GET or HEAD request, but not a POST 3678 request, since POST is required to be written through to the origin 3679 server, because it is unsafe; see Section 4 of [Caching]. 3681 If the result of processing a POST would be equivalent to a 3682 representation of an existing resource, an origin server MAY redirect 3683 the user agent to that resource by sending a 303 (See Other) response 3684 with the existing resource's identifier in the Location field. This 3685 has the benefits of providing the user agent a resource identifier 3686 and transferring the representation via a method more amenable to 3687 shared caching, though at the cost of an extra request if the user 3688 agent does not already have the representation cached. 3690 7.3.4. PUT 3692 The PUT method requests that the state of the target resource be 3693 created or replaced with the state defined by the representation 3694 enclosed in the request message payload. A successful PUT of a given 3695 representation would suggest that a subsequent GET on that same 3696 target resource will result in an equivalent representation being 3697 sent in a 200 (OK) response. However, there is no guarantee that 3698 such a state change will be observable, since the target resource 3699 might be acted upon by other user agents in parallel, or might be 3700 subject to dynamic processing by the origin server, before any 3701 subsequent GET is received. A successful response only implies that 3702 the user agent's intent was achieved at the time of its processing by 3703 the origin server. 3705 If the target resource does not have a current representation and the 3706 PUT successfully creates one, then the origin server MUST inform the 3707 user agent by sending a 201 (Created) response. If the target 3708 resource does have a current representation and that representation 3709 is successfully modified in accordance with the state of the enclosed 3710 representation, then the origin server MUST send either a 200 (OK) or 3711 a 204 (No Content) response to indicate successful completion of the 3712 request. 3714 An origin server SHOULD ignore unrecognized header and trailer fields 3715 received in a PUT request (i.e., do not save them as part of the 3716 resource state). 3718 An origin server SHOULD verify that the PUT representation is 3719 consistent with any constraints the server has for the target 3720 resource that cannot or will not be changed by the PUT. This is 3721 particularly important when the origin server uses internal 3722 configuration information related to the URI in order to set the 3723 values for representation metadata on GET responses. When a PUT 3724 representation is inconsistent with the target resource, the origin 3725 server SHOULD either make them consistent, by transforming the 3726 representation or changing the resource configuration, or respond 3727 with an appropriate error message containing sufficient information 3728 to explain why the representation is unsuitable. The 409 (Conflict) 3729 or 415 (Unsupported Media Type) status codes are suggested, with the 3730 latter being specific to constraints on Content-Type values. 3732 For example, if the target resource is configured to always have a 3733 Content-Type of "text/html" and the representation being PUT has a 3734 Content-Type of "image/jpeg", the origin server ought to do one of: 3736 a. reconfigure the target resource to reflect the new media type; 3737 b. transform the PUT representation to a format consistent with that 3738 of the resource before saving it as the new resource state; or, 3740 c. reject the request with a 415 (Unsupported Media Type) response 3741 indicating that the target resource is limited to "text/html", 3742 perhaps including a link to a different resource that would be a 3743 suitable target for the new representation. 3745 HTTP does not define exactly how a PUT method affects the state of an 3746 origin server beyond what can be expressed by the intent of the user 3747 agent request and the semantics of the origin server response. It 3748 does not define what a resource might be, in any sense of that word, 3749 beyond the interface provided via HTTP. It does not define how 3750 resource state is "stored", nor how such storage might change as a 3751 result of a change in resource state, nor how the origin server 3752 translates resource state into representations. Generally speaking, 3753 all implementation details behind the resource interface are 3754 intentionally hidden by the server. 3756 An origin server MUST NOT send a validator header field 3757 (Section 10.2), such as an ETag or Last-Modified field, in a 3758 successful response to PUT unless the request's representation data 3759 was saved without any transformation applied to the body (i.e., the 3760 resource's new representation data is identical to the representation 3761 data received in the PUT request) and the validator field value 3762 reflects the new representation. This requirement allows a user 3763 agent to know when the representation body it has in memory remains 3764 current as a result of the PUT, thus not in need of being retrieved 3765 again from the origin server, and that the new validator(s) received 3766 in the response can be used for future conditional requests in order 3767 to prevent accidental overwrites (Section 8.2). 3769 The fundamental difference between the POST and PUT methods is 3770 highlighted by the different intent for the enclosed representation. 3771 The target resource in a POST request is intended to handle the 3772 enclosed representation according to the resource's own semantics, 3773 whereas the enclosed representation in a PUT request is defined as 3774 replacing the state of the target resource. Hence, the intent of PUT 3775 is idempotent and visible to intermediaries, even though the exact 3776 effect is only known by the origin server. 3778 Proper interpretation of a PUT request presumes that the user agent 3779 knows which target resource is desired. A service that selects a 3780 proper URI on behalf of the client, after receiving a state-changing 3781 request, SHOULD be implemented using the POST method rather than PUT. 3782 If the origin server will not make the requested PUT state change to 3783 the target resource and instead wishes to have it applied to a 3784 different resource, such as when the resource has been moved to a 3785 different URI, then the origin server MUST send an appropriate 3xx 3786 (Redirection) response; the user agent MAY then make its own decision 3787 regarding whether or not to redirect the request. 3789 A PUT request applied to the target resource can have side effects on 3790 other resources. For example, an article might have a URI for 3791 identifying "the current version" (a resource) that is separate from 3792 the URIs identifying each particular version (different resources 3793 that at one point shared the same state as the current version 3794 resource). A successful PUT request on "the current version" URI 3795 might therefore create a new version resource in addition to changing 3796 the state of the target resource, and might also cause links to be 3797 added between the related resources. 3799 An origin server that allows PUT on a given target resource MUST send 3800 a 400 (Bad Request) response to a PUT request that contains a 3801 Content-Range header field (Section 6.3.4), since the payload is 3802 likely to be partial content that has been mistakenly PUT as a full 3803 representation. Partial content updates are possible by targeting a 3804 separately identified resource with state that overlaps a portion of 3805 the larger resource, or by using a different method that has been 3806 specifically defined for partial updates (for example, the PATCH 3807 method defined in [RFC5789]). 3809 Responses to the PUT method are not cacheable. If a successful PUT 3810 request passes through a cache that has one or more stored responses 3811 for the effective request URI, those stored responses will be 3812 invalidated (see Section 4.4 of [Caching]). 3814 7.3.5. DELETE 3816 The DELETE method requests that the origin server remove the 3817 association between the target resource and its current 3818 functionality. In effect, this method is similar to the rm command 3819 in UNIX: it expresses a deletion operation on the URI mapping of the 3820 origin server rather than an expectation that the previously 3821 associated information be deleted. 3823 If the target resource has one or more current representations, they 3824 might or might not be destroyed by the origin server, and the 3825 associated storage might or might not be reclaimed, depending 3826 entirely on the nature of the resource and its implementation by the 3827 origin server (which are beyond the scope of this specification). 3828 Likewise, other implementation aspects of a resource might need to be 3829 deactivated or archived as a result of a DELETE, such as database or 3830 gateway connections. In general, it is assumed that the origin 3831 server will only allow DELETE on resources for which it has a 3832 prescribed mechanism for accomplishing the deletion. 3834 Relatively few resources allow the DELETE method -- its primary use 3835 is for remote authoring environments, where the user has some 3836 direction regarding its effect. For example, a resource that was 3837 previously created using a PUT request, or identified via the 3838 Location header field after a 201 (Created) response to a POST 3839 request, might allow a corresponding DELETE request to undo those 3840 actions. Similarly, custom user agent implementations that implement 3841 an authoring function, such as revision control clients using HTTP 3842 for remote operations, might use DELETE based on an assumption that 3843 the server's URI space has been crafted to correspond to a version 3844 repository. 3846 If a DELETE method is successfully applied, the origin server SHOULD 3847 send 3849 o a 202 (Accepted) status code if the action will likely succeed but 3850 has not yet been enacted, 3852 o a 204 (No Content) status code if the action has been enacted and 3853 no further information is to be supplied, or 3855 o a 200 (OK) status code if the action has been enacted and the 3856 response message includes a representation describing the status. 3858 A client SHOULD NOT generate a body in a DELETE request. A payload 3859 received in a DELETE request has no defined semantics, cannot alter 3860 the meaning or target of the request, and might lead some 3861 implementations to reject the request. 3863 Responses to the DELETE method are not cacheable. If a successful 3864 DELETE request passes through a cache that has one or more stored 3865 responses for the effective request URI, those stored responses will 3866 be invalidated (see Section 4.4 of [Caching]). 3868 7.3.6. CONNECT 3870 The CONNECT method requests that the recipient establish a tunnel to 3871 the destination origin server identified by the request-target and, 3872 if successful, thereafter restrict its behavior to blind forwarding 3873 of packets, in both directions, until the tunnel is closed. Tunnels 3874 are commonly used to create an end-to-end virtual connection, through 3875 one or more proxies, which can then be secured using TLS (Transport 3876 Layer Security, [RFC8446]). 3878 CONNECT is intended only for use in requests to a proxy. An origin 3879 server that receives a CONNECT request for itself MAY respond with a 3880 2xx (Successful) status code to indicate that a connection is 3881 established. However, most origin servers do not implement CONNECT. 3883 A client sending a CONNECT request MUST send the authority form of 3884 request-target (Section 3.2 of [Messaging]); i.e., the request-target 3885 consists of only the host name and port number of the tunnel 3886 destination, separated by a colon. For example, 3888 CONNECT server.example.com:80 HTTP/1.1 3889 Host: server.example.com:80 3891 The recipient proxy can establish a tunnel either by directly 3892 connecting to the request-target or, if configured to use another 3893 proxy, by forwarding the CONNECT request to the next inbound proxy. 3894 Any 2xx (Successful) response indicates that the sender (and all 3895 inbound proxies) will switch to tunnel mode immediately after the 3896 blank line that concludes the successful response's header section; 3897 data received after that blank line is from the server identified by 3898 the request-target. Any response other than a successful response 3899 indicates that the tunnel has not yet been formed and that the 3900 connection remains governed by HTTP. 3902 A tunnel is closed when a tunnel intermediary detects that either 3903 side has closed its connection: the intermediary MUST attempt to send 3904 any outstanding data that came from the closed side to the other 3905 side, close both connections, and then discard any remaining data 3906 left undelivered. 3908 Proxy authentication might be used to establish the authority to 3909 create a tunnel. For example, 3911 CONNECT server.example.com:80 HTTP/1.1 3912 Host: server.example.com:80 3913 Proxy-Authorization: basic aGVsbG86d29ybGQ= 3915 There are significant risks in establishing a tunnel to arbitrary 3916 servers, particularly when the destination is a well-known or 3917 reserved TCP port that is not intended for Web traffic. For example, 3918 a CONNECT to a request-target of "example.com:25" would suggest that 3919 the proxy connect to the reserved port for SMTP traffic; if allowed, 3920 that could trick the proxy into relaying spam email. Proxies that 3921 support CONNECT SHOULD restrict its use to a limited set of known 3922 ports or a configurable whitelist of safe request targets. 3924 A server MUST NOT send any Transfer-Encoding or Content-Length header 3925 fields in a 2xx (Successful) response to CONNECT. A client MUST 3926 ignore any Content-Length or Transfer-Encoding header fields received 3927 in a successful response to CONNECT. 3929 A payload within a CONNECT request message has no defined semantics; 3930 sending a payload body on a CONNECT request might cause some existing 3931 implementations to reject the request. 3933 Responses to the CONNECT method are not cacheable. 3935 7.3.7. OPTIONS 3937 The OPTIONS method requests information about the communication 3938 options available for the target resource, at either the origin 3939 server or an intervening intermediary. This method allows a client 3940 to determine the options and/or requirements associated with a 3941 resource, or the capabilities of a server, without implying a 3942 resource action. 3944 An OPTIONS request with an asterisk ("*") as the request-target 3945 (Section 3.2 of [Messaging]) applies to the server in general rather 3946 than to a specific resource. Since a server's communication options 3947 typically depend on the resource, the "*" request is only useful as a 3948 "ping" or "no-op" type of method; it does nothing beyond allowing the 3949 client to test the capabilities of the server. For example, this can 3950 be used to test a proxy for HTTP/1.1 conformance (or lack thereof). 3952 If the request-target is not an asterisk, the OPTIONS request applies 3953 to the options that are available when communicating with the target 3954 resource. 3956 A server generating a successful response to OPTIONS SHOULD send any 3957 header that might indicate optional features implemented by the 3958 server and applicable to the target resource (e.g., Allow), including 3959 potential extensions not defined by this specification. The response 3960 payload, if any, might also describe the communication options in a 3961 machine or human-readable representation. A standard format for such 3962 a representation is not defined by this specification, but might be 3963 defined by future extensions to HTTP. 3965 A client MAY send a Max-Forwards header field in an OPTIONS request 3966 to target a specific recipient in the request chain (see 3967 Section 8.1.2). A proxy MUST NOT generate a Max-Forwards header 3968 field while forwarding a request unless that request was received 3969 with a Max-Forwards field. 3971 A client that generates an OPTIONS request containing a payload body 3972 MUST send a valid Content-Type header field describing the 3973 representation media type. Note that this specification does not 3974 define any use for such a payload. 3976 Responses to the OPTIONS method are not cacheable. 3978 7.3.8. TRACE 3980 The TRACE method requests a remote, application-level loop-back of 3981 the request message. The final recipient of the request SHOULD 3982 reflect the message received, excluding some fields described below, 3983 back to the client as the message body of a 200 (OK) response with a 3984 Content-Type of "message/http" (Section 10.1 of [Messaging]). The 3985 final recipient is either the origin server or the first server to 3986 receive a Max-Forwards value of zero (0) in the request 3987 (Section 8.1.2). 3989 A client MUST NOT generate fields in a TRACE request containing 3990 sensitive data that might be disclosed by the response. For example, 3991 it would be foolish for a user agent to send stored user credentials 3992 Section 8.5 or cookies [RFC6265] in a TRACE request. The final 3993 recipient of the request SHOULD exclude any request fields that are 3994 likely to contain sensitive data when that recipient generates the 3995 response body. 3997 TRACE allows the client to see what is being received at the other 3998 end of the request chain and use that data for testing or diagnostic 3999 information. The value of the Via header field (Section 5.7.1) is of 4000 particular interest, since it acts as a trace of the request chain. 4001 Use of the Max-Forwards header field allows the client to limit the 4002 length of the request chain, which is useful for testing a chain of 4003 proxies forwarding messages in an infinite loop. 4005 A client MUST NOT send a message body in a TRACE request. 4007 Responses to the TRACE method are not cacheable. 4009 7.4. Method Extensibility 4011 Additional methods, outside the scope of this specification, have 4012 been specified for use in HTTP. All such methods ought to be 4013 registered within the "Hypertext Transfer Protocol (HTTP) Method 4014 Registry". 4016 7.4.1. Method Registry 4018 The "Hypertext Transfer Protocol (HTTP) Method Registry", maintained 4019 by IANA at , registers 4020 method names. 4022 HTTP method registrations MUST include the following fields: 4024 o Method Name (see Section 7) 4025 o Safe ("yes" or "no", see Section 7.2.1) 4027 o Idempotent ("yes" or "no", see Section 7.2.2) 4029 o Pointer to specification text 4031 Values to be added to this namespace require IETF Review (see 4032 [RFC8126], Section 4.8). 4034 7.4.2. Considerations for New Methods 4036 Standardized methods are generic; that is, they are potentially 4037 applicable to any resource, not just one particular media type, kind 4038 of resource, or application. As such, it is preferred that new 4039 methods be registered in a document that isn't specific to a single 4040 application or data format, since orthogonal technologies deserve 4041 orthogonal specification. 4043 Since message parsing (Section 6 of [Messaging]) needs to be 4044 independent of method semantics (aside from responses to HEAD), 4045 definitions of new methods cannot change the parsing algorithm or 4046 prohibit the presence of a message body on either the request or the 4047 response message. Definitions of new methods can specify that only a 4048 zero-length message body is allowed by requiring a Content-Length 4049 header field with a value of "0". 4051 A new method definition needs to indicate whether it is safe 4052 (Section 7.2.1), idempotent (Section 7.2.2), cacheable 4053 (Section 7.2.3), what semantics are to be associated with the payload 4054 body if any is present in the request and what refinements the method 4055 makes to header field or status code semantics. If the new method is 4056 cacheable, its definition ought to describe how, and under what 4057 conditions, a cache can store a response and use it to satisfy a 4058 subsequent request. The new method ought to describe whether it can 4059 be made conditional (Section 8.2) and, if so, how a server responds 4060 when the condition is false. Likewise, if the new method might have 4061 some use for partial response semantics (Section 8.3), it ought to 4062 document this, too. 4064 Note: Avoid defining a method name that starts with "M-", since 4065 that prefix might be misinterpreted as having the semantics 4066 assigned to it by [RFC2774]. 4068 8. Request Header Fields 4070 A client sends request header fields to provide more information 4071 about the request context, make the request conditional based on the 4072 target resource state, suggest preferred formats for the response, 4073 supply authentication credentials, or modify the expected request 4074 processing. These fields act as request modifiers, similar to the 4075 parameters on a programming language method invocation. 4077 8.1. Controls 4079 Controls are request header fields that direct specific handling of 4080 the request. 4082 +---------------+----------------------------+ 4083 | Field Name | Defined in... | 4084 +---------------+----------------------------+ 4085 | Cache-Control | Section 5.2 of [Caching] | 4086 | Expect | Section 8.1.1 | 4087 | Host | Section 5.6 | 4088 | Max-Forwards | Section 8.1.2 | 4089 | Pragma | Section 5.4 of [Caching] | 4090 | TE | Section 7.4 of [Messaging] | 4091 +---------------+----------------------------+ 4093 8.1.1. Expect 4095 The "Expect" header field in a request indicates a certain set of 4096 behaviors (expectations) that need to be supported by the server in 4097 order to properly handle this request. The only such expectation 4098 defined by this specification is 100-continue. 4100 Expect = "100-continue" 4102 The Expect field value is case-insensitive. 4104 A server that receives an Expect field value other than 100-continue 4105 MAY respond with a 417 (Expectation Failed) status code to indicate 4106 that the unexpected expectation cannot be met. 4108 A 100-continue expectation informs recipients that the client is 4109 about to send a (presumably large) message body in this request and 4110 wishes to receive a 100 (Continue) interim response if the request- 4111 line and header fields are not sufficient to cause an immediate 4112 success, redirect, or error response. This allows the client to wait 4113 for an indication that it is worthwhile to send the message body 4114 before actually doing so, which can improve efficiency when the 4115 message body is huge or when the client anticipates that an error is 4116 likely (e.g., when sending a state-changing method, for the first 4117 time, without previously verified authentication credentials). 4119 For example, a request that begins with 4120 PUT /somewhere/fun HTTP/1.1 4121 Host: origin.example.com 4122 Content-Type: video/h264 4123 Content-Length: 1234567890987 4124 Expect: 100-continue 4126 allows the origin server to immediately respond with an error 4127 message, such as 401 (Unauthorized) or 405 (Method Not Allowed), 4128 before the client starts filling the pipes with an unnecessary data 4129 transfer. 4131 Requirements for clients: 4133 o A client MUST NOT generate a 100-continue expectation in a request 4134 that does not include a message body. 4136 o A client that will wait for a 100 (Continue) response before 4137 sending the request message body MUST send an Expect header field 4138 containing a 100-continue expectation. 4140 o A client that sends a 100-continue expectation is not required to 4141 wait for any specific length of time; such a client MAY proceed to 4142 send the message body even if it has not yet received a response. 4143 Furthermore, since 100 (Continue) responses cannot be sent through 4144 an HTTP/1.0 intermediary, such a client SHOULD NOT wait for an 4145 indefinite period before sending the message body. 4147 o A client that receives a 417 (Expectation Failed) status code in 4148 response to a request containing a 100-continue expectation SHOULD 4149 repeat that request without a 100-continue expectation, since the 4150 417 response merely indicates that the response chain does not 4151 support expectations (e.g., it passes through an HTTP/1.0 server). 4153 Requirements for servers: 4155 o A server that receives a 100-continue expectation in an HTTP/1.0 4156 request MUST ignore that expectation. 4158 o A server MAY omit sending a 100 (Continue) response if it has 4159 already received some or all of the message body for the 4160 corresponding request, or if the framing indicates that there is 4161 no message body. 4163 o A server that sends a 100 (Continue) response MUST ultimately send 4164 a final status code, once the message body is received and 4165 processed, unless the connection is closed prematurely. 4167 o A server that responds with a final status code before reading the 4168 entire request payload body SHOULD indicate whether it intends to 4169 close the connection (see Section 9.7 of [Messaging]) or continue 4170 reading the payload body. 4172 An origin server MUST, upon receiving an HTTP/1.1 (or later) request- 4173 line and a complete header section that contains a 100-continue 4174 expectation and indicates a request message body will follow, either 4175 send an immediate response with a final status code, if that status 4176 can be determined by examining just the request-line and header 4177 fields, or send an immediate 100 (Continue) response to encourage the 4178 client to send the request's message body. The origin server MUST 4179 NOT wait for the message body before sending the 100 (Continue) 4180 response. 4182 A proxy MUST, upon receiving an HTTP/1.1 (or later) request-line and 4183 a complete header section that contains a 100-continue expectation 4184 and indicates a request message body will follow, either send an 4185 immediate response with a final status code, if that status can be 4186 determined by examining just the request-line and header fields, or 4187 begin forwarding the request toward the origin server by sending a 4188 corresponding request-line and header section to the next inbound 4189 server. If the proxy believes (from configuration or past 4190 interaction) that the next inbound server only supports HTTP/1.0, the 4191 proxy MAY generate an immediate 100 (Continue) response to encourage 4192 the client to begin sending the message body. 4194 Note: The Expect header field was added after the original 4195 publication of HTTP/1.1 [RFC2068] as both the means to request an 4196 interim 100 (Continue) response and the general mechanism for 4197 indicating must-understand extensions. However, the extension 4198 mechanism has not been used by clients and the must-understand 4199 requirements have not been implemented by many servers, rendering 4200 the extension mechanism useless. This specification has removed 4201 the extension mechanism in order to simplify the definition and 4202 processing of 100-continue. 4204 8.1.2. Max-Forwards 4206 The "Max-Forwards" header field provides a mechanism with the TRACE 4207 (Section 7.3.8) and OPTIONS (Section 7.3.7) request methods to limit 4208 the number of times that the request is forwarded by proxies. This 4209 can be useful when the client is attempting to trace a request that 4210 appears to be failing or looping mid-chain. 4212 Max-Forwards = 1*DIGIT 4214 The Max-Forwards value is a decimal integer indicating the remaining 4215 number of times this request message can be forwarded. 4217 Each intermediary that receives a TRACE or OPTIONS request containing 4218 a Max-Forwards header field MUST check and update its value prior to 4219 forwarding the request. If the received value is zero (0), the 4220 intermediary MUST NOT forward the request; instead, the intermediary 4221 MUST respond as the final recipient. If the received Max-Forwards 4222 value is greater than zero, the intermediary MUST generate an updated 4223 Max-Forwards field in the forwarded message with a field value that 4224 is the lesser of a) the received value decremented by one (1) or b) 4225 the recipient's maximum supported value for Max-Forwards. 4227 A recipient MAY ignore a Max-Forwards header field received with any 4228 other request methods. 4230 8.2. Preconditions 4232 A conditional request is an HTTP request with one or more request 4233 header fields that indicate a precondition to be tested before 4234 applying the request method to the target resource. Section 8.2.1 4235 defines when preconditions are applied. Section 8.2.2 defines the 4236 order of evaluation when more than one precondition is present. 4238 Conditional GET requests are the most efficient mechanism for HTTP 4239 cache updates [Caching]. Conditionals can also be applied to state- 4240 changing methods, such as PUT and DELETE, to prevent the "lost 4241 update" problem: one client accidentally overwriting the work of 4242 another client that has been acting in parallel. 4244 Conditional request preconditions are based on the state of the 4245 target resource as a whole (its current value set) or the state as 4246 observed in a previously obtained representation (one value in that 4247 set). A resource might have multiple current representations, each 4248 with its own observable state. The conditional request mechanisms 4249 assume that the mapping of requests to a "selected representation" 4250 (Section 6) will be consistent over time if the server intends to 4251 take advantage of conditionals. Regardless, if the mapping is 4252 inconsistent and the server is unable to select the appropriate 4253 representation, then no harm will result when the precondition 4254 evaluates to false. 4256 The following request header fields allow a client to place a 4257 precondition on the state of the target resource, so that the action 4258 corresponding to the method semantics will not be applied if the 4259 precondition evaluates to false. Each precondition defined by this 4260 specification consists of a comparison between a set of validators 4261 obtained from prior representations of the target resource to the 4262 current state of validators for the selected representation 4263 (Section 10.2). Hence, these preconditions evaluate whether the 4264 state of the target resource has changed since a given state known by 4265 the client. The effect of such an evaluation depends on the method 4266 semantics and choice of conditional, as defined in Section 8.2.1. 4268 +---------------------+---------------+ 4269 | Field Name | Defined in... | 4270 +---------------------+---------------+ 4271 | If-Match | Section 8.2.3 | 4272 | If-None-Match | Section 8.2.4 | 4273 | If-Modified-Since | Section 8.2.5 | 4274 | If-Unmodified-Since | Section 8.2.6 | 4275 | If-Range | Section 8.2.7 | 4276 +---------------------+---------------+ 4278 8.2.1. Evaluation 4280 Except when excluded below, a recipient cache or origin server MUST 4281 evaluate received request preconditions after it has successfully 4282 performed its normal request checks and just before it would perform 4283 the action associated with the request method. A server MUST ignore 4284 all received preconditions if its response to the same request 4285 without those conditions would have been a status code other than a 4286 2xx (Successful) or 412 (Precondition Failed). In other words, 4287 redirects and failures take precedence over the evaluation of 4288 preconditions in conditional requests. 4290 A server that is not the origin server for the target resource and 4291 cannot act as a cache for requests on the target resource MUST NOT 4292 evaluate the conditional request header fields defined by this 4293 specification, and it MUST forward them if the request is forwarded, 4294 since the generating client intends that they be evaluated by a 4295 server that can provide a current representation. Likewise, a server 4296 MUST ignore the conditional request header fields defined by this 4297 specification when received with a request method that does not 4298 involve the selection or modification of a selected representation, 4299 such as CONNECT, OPTIONS, or TRACE. 4301 Note that protocol extensions can modify the conditions under which 4302 revalidation is triggered. For example, the "immutable" cache 4303 directive (defined by [RFC8246]) instructs caches to forgo 4304 revalidation of fresh responses even when requested by the client. 4306 Conditional request header fields that are defined by extensions to 4307 HTTP might place conditions on all recipients, on the state of the 4308 target resource in general, or on a group of resources. For 4309 instance, the "If" header field in WebDAV can make a request 4310 conditional on various aspects of multiple resources, such as locks, 4311 if the recipient understands and implements that field ([RFC4918], 4312 Section 10.4). 4314 Although conditional request header fields are defined as being 4315 usable with the HEAD method (to keep HEAD's semantics consistent with 4316 those of GET), there is no point in sending a conditional HEAD 4317 because a successful response is around the same size as a 304 (Not 4318 Modified) response and more useful than a 412 (Precondition Failed) 4319 response. 4321 8.2.2. Precedence 4323 When more than one conditional request header field is present in a 4324 request, the order in which the fields are evaluated becomes 4325 important. In practice, the fields defined in this document are 4326 consistently implemented in a single, logical order, since "lost 4327 update" preconditions have more strict requirements than cache 4328 validation, a validated cache is more efficient than a partial 4329 response, and entity tags are presumed to be more accurate than date 4330 validators. 4332 A recipient cache or origin server MUST evaluate the request 4333 preconditions defined by this specification in the following order: 4335 1. When recipient is the origin server and If-Match is present, 4336 evaluate the If-Match precondition: 4338 * if true, continue to step 3 4340 * if false, respond 412 (Precondition Failed) unless it can be 4341 determined that the state-changing request has already 4342 succeeded (see Section 8.2.3) 4344 2. When recipient is the origin server, If-Match is not present, and 4345 If-Unmodified-Since is present, evaluate the If-Unmodified-Since 4346 precondition: 4348 * if true, continue to step 3 4349 * if false, respond 412 (Precondition Failed) unless it can be 4350 determined that the state-changing request has already 4351 succeeded (see Section 8.2.6) 4353 3. When If-None-Match is present, evaluate the If-None-Match 4354 precondition: 4356 * if true, continue to step 5 4358 * if false for GET/HEAD, respond 304 (Not Modified) 4360 * if false for other methods, respond 412 (Precondition Failed) 4362 4. When the method is GET or HEAD, If-None-Match is not present, and 4363 If-Modified-Since is present, evaluate the If-Modified-Since 4364 precondition: 4366 * if true, continue to step 5 4368 * if false, respond 304 (Not Modified) 4370 5. When the method is GET and both Range and If-Range are present, 4371 evaluate the If-Range precondition: 4373 * if the validator matches and the Range specification is 4374 applicable to the selected representation, respond 206 4375 (Partial Content) 4377 6. Otherwise, 4379 * all conditions are met, so perform the requested action and 4380 respond according to its success or failure. 4382 Any extension to HTTP/1.1 that defines additional conditional request 4383 header fields ought to define its own expectations regarding the 4384 order for evaluating such fields in relation to those defined in this 4385 document and other conditionals that might be found in practice. 4387 8.2.3. If-Match 4389 The "If-Match" header field makes the request method conditional on 4390 the recipient origin server either having at least one current 4391 representation of the target resource, when the field value is "*", 4392 or having a current representation of the target resource that has an 4393 entity-tag matching a member of the list of entity-tags provided in 4394 the field value. 4396 An origin server MUST use the strong comparison function when 4397 comparing entity-tags for If-Match (Section 10.2.3.2), since the 4398 client intends this precondition to prevent the method from being 4399 applied if there have been any changes to the representation data. 4401 If-Match = "*" / 1#entity-tag 4403 Examples: 4405 If-Match: "xyzzy" 4406 If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz" 4407 If-Match: * 4409 If-Match is most often used with state-changing methods (e.g., POST, 4410 PUT, DELETE) to prevent accidental overwrites when multiple user 4411 agents might be acting in parallel on the same resource (i.e., to 4412 prevent the "lost update" problem). It can also be used with safe 4413 methods to abort a request if the selected representation does not 4414 match one already stored (or partially stored) from a prior request. 4416 An origin server that receives an If-Match header field MUST evaluate 4417 the condition prior to performing the method (Section 8.2.1). If the 4418 field value is "*", the condition is false if the origin server does 4419 not have a current representation for the target resource. If the 4420 field value is a list of entity-tags, the condition is false if none 4421 of the listed tags match the entity-tag of the selected 4422 representation. 4424 An origin server MUST NOT perform the requested method if a received 4425 If-Match condition evaluates to false; instead, the origin server 4426 MUST respond with either a) the 412 (Precondition Failed) status code 4427 or b) one of the 2xx (Successful) status codes if the origin server 4428 has verified that a state change is being requested and the final 4429 state is already reflected in the current state of the target 4430 resource (i.e., the change requested by the user agent has already 4431 succeeded, but the user agent might not be aware of it, perhaps 4432 because the prior response was lost or a compatible change was made 4433 by some other user agent). In the latter case, the origin server 4434 MUST NOT send a validator header field in the response unless it can 4435 verify that the request is a duplicate of an immediately prior change 4436 made by the same user agent. 4438 The If-Match header field can be ignored by caches and intermediaries 4439 because it is not applicable to a stored response. 4441 8.2.4. If-None-Match 4443 The "If-None-Match" header field makes the request method conditional 4444 on a recipient cache or origin server either not having any current 4445 representation of the target resource, when the field value is "*", 4446 or having a selected representation with an entity-tag that does not 4447 match any of those listed in the field value. 4449 A recipient MUST use the weak comparison function when comparing 4450 entity-tags for If-None-Match (Section 10.2.3.2), since weak entity- 4451 tags can be used for cache validation even if there have been changes 4452 to the representation data. 4454 If-None-Match = "*" / 1#entity-tag 4456 Examples: 4458 If-None-Match: "xyzzy" 4459 If-None-Match: W/"xyzzy" 4460 If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz" 4461 If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz" 4462 If-None-Match: * 4464 If-None-Match is primarily used in conditional GET requests to enable 4465 efficient updates of cached information with a minimum amount of 4466 transaction overhead. When a client desires to update one or more 4467 stored responses that have entity-tags, the client SHOULD generate an 4468 If-None-Match header field containing a list of those entity-tags 4469 when making a GET request; this allows recipient servers to send a 4470 304 (Not Modified) response to indicate when one of those stored 4471 responses matches the selected representation. 4473 If-None-Match can also be used with a value of "*" to prevent an 4474 unsafe request method (e.g., PUT) from inadvertently modifying an 4475 existing representation of the target resource when the client 4476 believes that the resource does not have a current representation 4477 (Section 7.2.1). This is a variation on the "lost update" problem 4478 that might arise if more than one client attempts to create an 4479 initial representation for the target resource. 4481 An origin server that receives an If-None-Match header field MUST 4482 evaluate the condition prior to performing the method 4483 (Section 8.2.1). If the field value is "*", the condition is false 4484 if the origin server has a current representation for the target 4485 resource. If the field value is a list of entity-tags, the condition 4486 is false if one of the listed tags match the entity-tag of the 4487 selected representation. 4489 An origin server MUST NOT perform the requested method if the 4490 condition evaluates to false; instead, the origin server MUST respond 4491 with either a) the 304 (Not Modified) status code if the request 4492 method is GET or HEAD or b) the 412 (Precondition Failed) status code 4493 for all other request methods. 4495 Requirements on cache handling of a received If-None-Match header 4496 field are defined in Section 4.3.2 of [Caching]. 4498 8.2.5. If-Modified-Since 4500 The "If-Modified-Since" header field makes a GET or HEAD request 4501 method conditional on the selected representation's modification date 4502 being more recent than the date provided in the field value. 4503 Transfer of the selected representation's data is avoided if that 4504 data has not changed. 4506 If-Modified-Since = HTTP-date 4508 An example of the field is: 4510 If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT 4512 A recipient MUST ignore If-Modified-Since if the request contains an 4513 If-None-Match header field; the condition in If-None-Match is 4514 considered to be a more accurate replacement for the condition in If- 4515 Modified-Since, and the two are only combined for the sake of 4516 interoperating with older intermediaries that might not implement If- 4517 None-Match. 4519 A recipient MUST ignore the If-Modified-Since header field if the 4520 received field value is not a valid HTTP-date, or if the request 4521 method is neither GET nor HEAD. 4523 A recipient MUST interpret an If-Modified-Since field value's 4524 timestamp in terms of the origin server's clock. 4526 If-Modified-Since is typically used for two distinct purposes: 1) to 4527 allow efficient updates of a cached representation that does not have 4528 an entity-tag and 2) to limit the scope of a web traversal to 4529 resources that have recently changed. 4531 When used for cache updates, a cache will typically use the value of 4532 the cached message's Last-Modified field to generate the field value 4533 of If-Modified-Since. This behavior is most interoperable for cases 4534 where clocks are poorly synchronized or when the server has chosen to 4535 only honor exact timestamp matches (due to a problem with Last- 4536 Modified dates that appear to go "back in time" when the origin 4537 server's clock is corrected or a representation is restored from an 4538 archived backup). However, caches occasionally generate the field 4539 value based on other data, such as the Date header field of the 4540 cached message or the local clock time that the message was received, 4541 particularly when the cached message does not contain a Last-Modified 4542 field. 4544 When used for limiting the scope of retrieval to a recent time 4545 window, a user agent will generate an If-Modified-Since field value 4546 based on either its own local clock or a Date header field received 4547 from the server in a prior response. Origin servers that choose an 4548 exact timestamp match based on the selected representation's Last- 4549 Modified field will not be able to help the user agent limit its data 4550 transfers to only those changed during the specified window. 4552 An origin server that receives an If-Modified-Since header field 4553 SHOULD evaluate the condition prior to performing the method 4554 (Section 8.2.1). The origin server SHOULD NOT perform the requested 4555 method if the selected representation's last modification date is 4556 earlier than or equal to the date provided in the field value; 4557 instead, the origin server SHOULD generate a 304 (Not Modified) 4558 response, including only those metadata that are useful for 4559 identifying or updating a previously cached response. 4561 Requirements on cache handling of a received If-Modified-Since header 4562 field are defined in Section 4.3.2 of [Caching]. 4564 8.2.6. If-Unmodified-Since 4566 The "If-Unmodified-Since" header field makes the request method 4567 conditional on the selected representation's last modification date 4568 being earlier than or equal to the date provided in the field value. 4569 This field accomplishes the same purpose as If-Match for cases where 4570 the user agent does not have an entity-tag for the representation. 4572 If-Unmodified-Since = HTTP-date 4574 An example of the field is: 4576 If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT 4578 A recipient MUST ignore If-Unmodified-Since if the request contains 4579 an If-Match header field; the condition in If-Match is considered to 4580 be a more accurate replacement for the condition in If-Unmodified- 4581 Since, and the two are only combined for the sake of interoperating 4582 with older intermediaries that might not implement If-Match. 4584 A recipient MUST ignore the If-Unmodified-Since header field if the 4585 received field value is not a valid HTTP-date. 4587 A recipient MUST interpret an If-Unmodified-Since field value's 4588 timestamp in terms of the origin server's clock. 4590 If-Unmodified-Since is most often used with state-changing methods 4591 (e.g., POST, PUT, DELETE) to prevent accidental overwrites when 4592 multiple user agents might be acting in parallel on a resource that 4593 does not supply entity-tags with its representations (i.e., to 4594 prevent the "lost update" problem). It can also be used with safe 4595 methods to abort a request if the selected representation does not 4596 match one already stored (or partially stored) from a prior request. 4598 An origin server that receives an If-Unmodified-Since header field 4599 MUST evaluate the condition prior to performing the method 4600 (Section 8.2.1). The origin server MUST NOT perform the requested 4601 method if the selected representation's last modification date is 4602 more recent than the date provided in the field value; instead the 4603 origin server MUST respond with either a) the 412 (Precondition 4604 Failed) status code or b) one of the 2xx (Successful) status codes if 4605 the origin server has verified that a state change is being requested 4606 and the final state is already reflected in the current state of the 4607 target resource (i.e., the change requested by the user agent has 4608 already succeeded, but the user agent might not be aware of that 4609 because the prior response message was lost or a compatible change 4610 was made by some other user agent). In the latter case, the origin 4611 server MUST NOT send a validator header field in the response unless 4612 it can verify that the request is a duplicate of an immediately prior 4613 change made by the same user agent. 4615 The If-Unmodified-Since header field can be ignored by caches and 4616 intermediaries because it is not applicable to a stored response. 4618 8.2.7. If-Range 4620 The "If-Range" header field provides a special conditional request 4621 mechanism that is similar to the If-Match and If-Unmodified-Since 4622 header fields but that instructs the recipient to ignore the Range 4623 header field if the validator doesn't match, resulting in transfer of 4624 the new selected representation instead of a 412 (Precondition 4625 Failed) response. 4627 If a client has a partial copy of a representation and wishes to have 4628 an up-to-date copy of the entire representation, it could use the 4629 Range header field with a conditional GET (using either or both of 4630 If-Unmodified-Since and If-Match.) However, if the precondition 4631 fails because the representation has been modified, the client would 4632 then have to make a second request to obtain the entire current 4633 representation. 4635 The "If-Range" header field allows a client to "short-circuit" the 4636 second request. Informally, its meaning is as follows: if the 4637 representation is unchanged, send me the part(s) that I am requesting 4638 in Range; otherwise, send me the entire representation. 4640 If-Range = entity-tag / HTTP-date 4642 A client MUST NOT generate an If-Range header field in a request that 4643 does not contain a Range header field. A server MUST ignore an If- 4644 Range header field received in a request that does not contain a 4645 Range header field. An origin server MUST ignore an If-Range header 4646 field received in a request for a target resource that does not 4647 support Range requests. 4649 A client MUST NOT generate an If-Range header field containing an 4650 entity-tag that is marked as weak. A client MUST NOT generate an If- 4651 Range header field containing an HTTP-date unless the client has no 4652 entity-tag for the corresponding representation and the date is a 4653 strong validator in the sense defined by Section 10.2.2.2. 4655 A server that evaluates an If-Range precondition MUST use the strong 4656 comparison function when comparing entity-tags (Section 10.2.3.2) and 4657 MUST evaluate the condition as false if an HTTP-date validator is 4658 provided that is not a strong validator in the sense defined by 4659 Section 10.2.2.2. A valid entity-tag can be distinguished from a 4660 valid HTTP-date by examining the first two characters for a DQUOTE. 4662 If the validator given in the If-Range header field matches the 4663 current validator for the selected representation of the target 4664 resource, then the server SHOULD process the Range header field as 4665 requested. If the validator does not match, the server MUST ignore 4666 the Range header field. Note that this comparison by exact match, 4667 including when the validator is an HTTP-date, differs from the 4668 "earlier than or equal to" comparison used when evaluating an If- 4669 Unmodified-Since conditional. 4671 8.3. Range 4673 The "Range" header field on a GET request modifies the method 4674 semantics to request transfer of only one or more subranges of the 4675 selected representation data, rather than the entire selected 4676 representation data. 4678 Range = ranges-specifier 4680 Clients often encounter interrupted data transfers as a result of 4681 canceled requests or dropped connections. When a client has stored a 4682 partial representation, it is desirable to request the remainder of 4683 that representation in a subsequent request rather than transfer the 4684 entire representation. Likewise, devices with limited local storage 4685 might benefit from being able to request only a subset of a larger 4686 representation, such as a single page of a very large document, or 4687 the dimensions of an embedded image. 4689 Range requests are an OPTIONAL feature of HTTP, designed so that 4690 recipients not implementing this feature (or not supporting it for 4691 the target resource) can respond as if it is a normal GET request 4692 without impacting interoperability. Partial responses are indicated 4693 by a distinct status code to not be mistaken for full responses by 4694 caches that might not implement the feature. 4696 A server MAY ignore the Range header field. However, origin servers 4697 and intermediate caches ought to support byte ranges when possible, 4698 since they support efficient recovery from partially failed transfers 4699 and partial retrieval of large representations. A server MUST ignore 4700 a Range header field received with a request method other than GET. 4702 Although the range request mechanism is designed to allow for 4703 extensible range types, this specification only defines requests for 4704 byte ranges. 4706 An origin server MUST ignore a Range header field that contains a 4707 range unit it does not understand. A proxy MAY discard a Range 4708 header field that contains a range unit it does not understand. 4710 A server that supports range requests MAY ignore or reject a Range 4711 header field that consists of more than two overlapping ranges, or a 4712 set of many small ranges that are not listed in ascending order, 4713 since both are indications of either a broken client or a deliberate 4714 denial-of-service attack (Section 11.13). A client SHOULD NOT 4715 request multiple ranges that are inherently less efficient to process 4716 and transfer than a single range that encompasses the same data. 4718 A client that is requesting multiple ranges SHOULD list those ranges 4719 in ascending order (the order in which they would typically be 4720 received in a complete representation) unless there is a specific 4721 need to request a later part earlier. For example, a user agent 4722 processing a large representation with an internal catalog of parts 4723 might need to request later parts first, particularly if the 4724 representation consists of pages stored in reverse order and the user 4725 agent wishes to transfer one page at a time. 4727 The Range header field is evaluated after evaluating the precondition 4728 header fields defined in Section 8.2, and only if the result in 4729 absence of the Range header field would be a 200 (OK) response. In 4730 other words, Range is ignored when a conditional GET would result in 4731 a 304 (Not Modified) response. 4733 The If-Range header field (Section 8.2.7) can be used as a 4734 precondition to applying the Range header field. 4736 If all of the preconditions are true, the server supports the Range 4737 header field for the target resource, and the specified range(s) are 4738 valid and satisfiable (as defined in Section 6.1.4.2), the server 4739 SHOULD send a 206 (Partial Content) response with a payload 4740 containing one or more partial representations that correspond to the 4741 satisfiable ranges requested. 4743 If all of the preconditions are true, the server supports the Range 4744 header field for the target resource, and the specified range(s) are 4745 invalid or unsatisfiable, the server SHOULD send a 416 (Range Not 4746 Satisfiable) response. 4748 8.4. Content Negotiation 4750 The following request header fields are sent by a user agent to 4751 engage in proactive negotiation of the response content, as defined 4752 in Section 6.4.1. The preferences sent in these fields apply to any 4753 content in the response, including representations of the target 4754 resource, representations of error or processing status, and 4755 potentially even the miscellaneous text strings that might appear 4756 within the protocol. 4758 +-----------------+---------------+ 4759 | Field Name | Defined in... | 4760 +-----------------+---------------+ 4761 | Accept | Section 8.4.2 | 4762 | Accept-Charset | Section 8.4.3 | 4763 | Accept-Encoding | Section 8.4.4 | 4764 | Accept-Language | Section 8.4.5 | 4765 +-----------------+---------------+ 4767 For each of these header fields, a request that does not contain it 4768 implies that the user agent has no preference on that axis of 4769 negotiation. If the header field is present in a request and none of 4770 the available representations for the response can be considered 4771 acceptable according to it, the origin server can either honor the 4772 header field by sending a 406 (Not Acceptable) response or disregard 4773 the header field by treating the response as if it is not subject to 4774 content negotiation for that request header field. This does not 4775 imply, however, that the client will be able to use the 4776 representation. 4778 Note: Sending these header fields makes it easier for a server to 4779 identify an individual by virtue of the user agent's request 4780 characteristics (Section 11.11). 4782 Each of these header fields defines a wildcard value (often, "*") to 4783 select unspecified values. If no wildcard is present, all values not 4784 explicitly mentioned in the field are considered "not acceptable" to 4785 the client. 4787 Note: In practice, using wildcards in content negotiation has limited 4788 practical value, because it is seldom useful to say, for example, "I 4789 prefer image/* more or less than (some other specific value)". 4790 Clients can explicitly request a 406 (Not Acceptable) response if a 4791 more preferred format is not available by sending Accept: */*;q=0, 4792 but they still need to be able to handle a different response, since 4793 the server is allowed to ignore their preference. 4795 8.4.1. Quality Values 4797 Many of the request header fields for proactive negotiation use a 4798 common parameter, named "q" (case-insensitive), to assign a relative 4799 "weight" to the preference for that associated kind of content. This 4800 weight is referred to as a "quality value" (or "qvalue") because the 4801 same parameter name is often used within server configurations to 4802 assign a weight to the relative quality of the various 4803 representations that can be selected for a resource. 4805 The weight is normalized to a real number in the range 0 through 1, 4806 where 0.001 is the least preferred and 1 is the most preferred; a 4807 value of 0 means "not acceptable". If no "q" parameter is present, 4808 the default weight is 1. 4810 weight = OWS ";" OWS "q=" qvalue 4811 qvalue = ( "0" [ "." 0*3DIGIT ] ) 4812 / ( "1" [ "." 0*3("0") ] ) 4814 A sender of qvalue MUST NOT generate more than three digits after the 4815 decimal point. User configuration of these values ought to be 4816 limited in the same fashion. 4818 8.4.2. Accept 4820 The "Accept" header field can be used by user agents to specify their 4821 preferences regarding response media types. For example, Accept 4822 header fields can be used to indicate that the request is 4823 specifically limited to a small set of desired types, as in the case 4824 of a request for an in-line image. 4826 Accept = #( media-range [ accept-params ] ) 4828 media-range = ( "*/*" 4829 / ( type "/" "*" ) 4830 / ( type "/" subtype ) 4831 ) *( OWS ";" OWS parameter ) 4832 accept-params = weight *( accept-ext ) 4833 accept-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ] 4835 The asterisk "*" character is used to group media types into ranges, 4836 with "*/*" indicating all media types and "type/*" indicating all 4837 subtypes of that type. The media-range can include media type 4838 parameters that are applicable to that range. 4840 Each media-range might be followed by zero or more applicable media 4841 type parameters (e.g., charset), an optional "q" parameter for 4842 indicating a relative weight (Section 8.4.1), and then zero or more 4843 extension parameters. The "q" parameter is necessary if any 4844 extensions (accept-ext) are present, since it acts as a separator 4845 between the two parameter sets. 4847 Note: Use of the "q" parameter name to separate media type 4848 parameters from Accept extension parameters is due to historical 4849 practice. Although this prevents any media type parameter named 4850 "q" from being used with a media range, such an event is believed 4851 to be unlikely given the lack of any "q" parameters in the IANA 4852 media type registry and the rare usage of any media type 4853 parameters in Accept. Future media types are discouraged from 4854 registering any parameter named "q". 4856 The example 4858 Accept: audio/*; q=0.2, audio/basic 4860 is interpreted as "I prefer audio/basic, but send me any audio type 4861 if it is the best available after an 80% markdown in quality". 4863 A more elaborate example is 4865 Accept: text/plain; q=0.5, text/html, 4866 text/x-dvi; q=0.8, text/x-c 4868 Verbally, this would be interpreted as "text/html and text/x-c are 4869 the equally preferred media types, but if they do not exist, then 4870 send the text/x-dvi representation, and if that does not exist, send 4871 the text/plain representation". 4873 Media ranges can be overridden by more specific media ranges or 4874 specific media types. If more than one media range applies to a 4875 given type, the most specific reference has precedence. For example, 4877 Accept: text/*, text/plain, text/plain;format=flowed, */* 4879 have the following precedence: 4881 1. text/plain;format=flowed 4883 2. text/plain 4885 3. text/* 4887 4. */* 4889 The media type quality factor associated with a given type is 4890 determined by finding the media range with the highest precedence 4891 that matches the type. For example, 4893 Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1, 4894 text/html;level=2;q=0.4, */*;q=0.5 4896 would cause the following values to be associated: 4898 +-------------------+---------------+ 4899 | Media Type | Quality Value | 4900 +-------------------+---------------+ 4901 | text/html;level=1 | 1 | 4902 | text/html | 0.7 | 4903 | text/plain | 0.3 | 4904 | image/jpeg | 0.5 | 4905 | text/html;level=2 | 0.4 | 4906 | text/html;level=3 | 0.7 | 4907 +-------------------+---------------+ 4909 Note: A user agent might be provided with a default set of quality 4910 values for certain media ranges. However, unless the user agent is a 4911 closed system that cannot interact with other rendering agents, this 4912 default set ought to be configurable by the user. 4914 8.4.3. Accept-Charset 4916 The "Accept-Charset" header field can be sent by a user agent to 4917 indicate its preferences for charsets in textual response content. 4918 For example, this field allows user agents capable of understanding 4919 more comprehensive or special-purpose charsets to signal that 4920 capability to an origin server that is capable of representing 4921 information in those charsets. 4923 Accept-Charset = 1#( ( charset / "*" ) [ weight ] ) 4925 Charset names are defined in Section 6.1.1.1. A user agent MAY 4926 associate a quality value with each charset to indicate the user's 4927 relative preference for that charset, as defined in Section 8.4.1. 4928 An example is 4930 Accept-Charset: iso-8859-5, unicode-1-1;q=0.8 4932 The special value "*", if present in the Accept-Charset field, 4933 matches every charset that is not mentioned elsewhere in the Accept- 4934 Charset field. 4936 Note: Accept-Charset is deprecated because UTF-8 has become nearly 4937 ubiquitous and sending a detailed list of user-preferred charsets 4938 wastes bandwidth, increases latency, and makes passive fingerprinting 4939 far too easy (Section 11.11). Most general-purpose user agents do 4940 not send Accept-Charset, unless specifically configured to do so. 4942 8.4.4. Accept-Encoding 4944 The "Accept-Encoding" header field can be used by user agents to 4945 indicate their preferences regarding response content-codings 4946 (Section 6.1.2). An "identity" token is used as a synonym for "no 4947 encoding" in order to communicate when no encoding is preferred. 4949 Accept-Encoding = #( codings [ weight ] ) 4950 codings = content-coding / "identity" / "*" 4952 Each codings value MAY be given an associated quality value 4953 representing the preference for that encoding, as defined in 4954 Section 8.4.1. The asterisk "*" symbol in an Accept-Encoding field 4955 matches any available content-coding not explicitly listed in the 4956 header field. 4958 For example, 4960 Accept-Encoding: compress, gzip 4961 Accept-Encoding: 4962 Accept-Encoding: * 4963 Accept-Encoding: compress;q=0.5, gzip;q=1.0 4964 Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0 4966 A server tests whether a content-coding for a given representation is 4967 acceptable using these rules: 4969 1. If no Accept-Encoding field is in the request, any content-coding 4970 is considered acceptable by the user agent. 4972 2. If the representation has no content-coding, then it is 4973 acceptable by default unless specifically excluded by the Accept- 4974 Encoding field stating either "identity;q=0" or "*;q=0" without a 4975 more specific entry for "identity". 4977 3. If the representation's content-coding is one of the content- 4978 codings listed in the Accept-Encoding field value, then it is 4979 acceptable unless it is accompanied by a qvalue of 0. (As 4980 defined in Section 8.4.1, a qvalue of 0 means "not acceptable".) 4982 4. If multiple content-codings are acceptable, then the acceptable 4983 content-coding with the highest non-zero qvalue is preferred. 4985 An Accept-Encoding header field with a field value that is empty 4986 implies that the user agent does not want any content-coding in 4987 response. If an Accept-Encoding header field is present in a request 4988 and none of the available representations for the response have a 4989 content-coding that is listed as acceptable, the origin server SHOULD 4990 send a response without any content-coding. 4992 Note: Most HTTP/1.0 applications do not recognize or obey qvalues 4993 associated with content-codings. This means that qvalues might 4994 not work and are not permitted with x-gzip or x-compress. 4996 8.4.5. Accept-Language 4998 The "Accept-Language" header field can be used by user agents to 4999 indicate the set of natural languages that are preferred in the 5000 response. Language tags are defined in Section 6.1.3. 5002 Accept-Language = 1#( language-range [ weight ] ) 5003 language-range = 5004 5006 Each language-range can be given an associated quality value 5007 representing an estimate of the user's preference for the languages 5008 specified by that range, as defined in Section 8.4.1. For example, 5010 Accept-Language: da, en-gb;q=0.8, en;q=0.7 5012 would mean: "I prefer Danish, but will accept British English and 5013 other types of English". 5015 Note that some recipients treat the order in which language tags are 5016 listed as an indication of descending priority, particularly for tags 5017 that are assigned equal quality values (no value is the same as q=1). 5018 However, this behavior cannot be relied upon. For consistency and to 5019 maximize interoperability, many user agents assign each language tag 5020 a unique quality value while also listing them in order of decreasing 5021 quality. Additional discussion of language priority lists can be 5022 found in Section 2.3 of [RFC4647]. 5024 For matching, Section 3 of [RFC4647] defines several matching 5025 schemes. Implementations can offer the most appropriate matching 5026 scheme for their requirements. The "Basic Filtering" scheme 5027 ([RFC4647], Section 3.3.1) is identical to the matching scheme that 5028 was previously defined for HTTP in Section 14.4 of [RFC2616]. 5030 It might be contrary to the privacy expectations of the user to send 5031 an Accept-Language header field with the complete linguistic 5032 preferences of the user in every request (Section 11.11). 5034 Since intelligibility is highly dependent on the individual user, 5035 user agents need to allow user control over the linguistic preference 5036 (either through configuration of the user agent itself or by 5037 defaulting to a user controllable system setting). A user agent that 5038 does not provide such control to the user MUST NOT send an Accept- 5039 Language header field. 5041 Note: User agents ought to provide guidance to users when setting 5042 a preference, since users are rarely familiar with the details of 5043 language matching as described above. For example, users might 5044 assume that on selecting "en-gb", they will be served any kind of 5045 English document if British English is not available. A user 5046 agent might suggest, in such a case, to add "en" to the list for 5047 better matching behavior. 5049 8.5. Authentication Credentials 5051 HTTP provides a general framework for access control and 5052 authentication, via an extensible set of challenge-response 5053 authentication schemes, which can be used by a server to challenge a 5054 client request and by a client to provide authentication information. 5056 Two header fields are used for carrying authentication credentials. 5057 Note that various custom mechanisms for user authentication use the 5058 Cookie header field for this purpose, as defined in [RFC6265]. 5060 +---------------------+---------------+ 5061 | Field Name | Defined in... | 5062 +---------------------+---------------+ 5063 | Authorization | Section 8.5.3 | 5064 | Proxy-Authorization | Section 8.5.4 | 5065 +---------------------+---------------+ 5067 8.5.1. Challenge and Response 5069 HTTP provides a simple challenge-response authentication framework 5070 that can be used by a server to challenge a client request and by a 5071 client to provide authentication information. It uses a case- 5072 insensitive token as a means to identify the authentication scheme, 5073 followed by additional information necessary for achieving 5074 authentication via that scheme. The latter can be either a comma- 5075 separated list of parameters or a single sequence of characters 5076 capable of holding base64-encoded information. 5078 Authentication parameters are name=value pairs, where the name token 5079 is matched case-insensitively, and each parameter name MUST only 5080 occur once per challenge. 5082 auth-scheme = token 5084 auth-param = token BWS "=" BWS ( token / quoted-string ) 5086 token68 = 1*( ALPHA / DIGIT / 5087 "-" / "." / "_" / "~" / "+" / "/" ) *"=" 5089 The token68 syntax allows the 66 unreserved URI characters 5090 ([RFC3986]), plus a few others, so that it can hold a base64, 5091 base64url (URL and filename safe alphabet), base32, or base16 (hex) 5092 encoding, with or without padding, but excluding whitespace 5093 ([RFC4648]). 5095 A 401 (Unauthorized) response message is used by an origin server to 5096 challenge the authorization of a user agent, including a WWW- 5097 Authenticate header field containing at least one challenge 5098 applicable to the requested resource. 5100 A 407 (Proxy Authentication Required) response message is used by a 5101 proxy to challenge the authorization of a client, including a Proxy- 5102 Authenticate header field containing at least one challenge 5103 applicable to the proxy for the requested resource. 5105 challenge = auth-scheme [ 1*SP ( token68 / #auth-param ) ] 5107 Note: Many clients fail to parse a challenge that contains an 5108 unknown scheme. A workaround for this problem is to list well- 5109 supported schemes (such as "basic") first. 5111 A user agent that wishes to authenticate itself with an origin server 5112 -- usually, but not necessarily, after receiving a 401 (Unauthorized) 5113 -- can do so by including an Authorization header field with the 5114 request. 5116 A client that wishes to authenticate itself with a proxy -- usually, 5117 but not necessarily, after receiving a 407 (Proxy Authentication 5118 Required) -- can do so by including a Proxy-Authorization header 5119 field with the request. 5121 Both the Authorization field value and the Proxy-Authorization field 5122 value contain the client's credentials for the realm of the resource 5123 being requested, based upon a challenge received in a response 5124 (possibly at some point in the past). When creating their values, 5125 the user agent ought to do so by selecting the challenge with what it 5126 considers to be the most secure auth-scheme that it understands, 5127 obtaining credentials from the user as appropriate. Transmission of 5128 credentials within header field values implies significant security 5129 considerations regarding the confidentiality of the underlying 5130 connection, as described in Section 11.14.1. 5132 credentials = auth-scheme [ 1*SP ( token68 / #auth-param ) ] 5134 Upon receipt of a request for a protected resource that omits 5135 credentials, contains invalid credentials (e.g., a bad password) or 5136 partial credentials (e.g., when the authentication scheme requires 5137 more than one round trip), an origin server SHOULD send a 401 5138 (Unauthorized) response that contains a WWW-Authenticate header field 5139 with at least one (possibly new) challenge applicable to the 5140 requested resource. 5142 Likewise, upon receipt of a request that omits proxy credentials or 5143 contains invalid or partial proxy credentials, a proxy that requires 5144 authentication SHOULD generate a 407 (Proxy Authentication Required) 5145 response that contains a Proxy-Authenticate header field with at 5146 least one (possibly new) challenge applicable to the proxy. 5148 A server that receives valid credentials that are not adequate to 5149 gain access ought to respond with the 403 (Forbidden) status code 5150 (Section 9.5.4). 5152 HTTP does not restrict applications to this simple challenge-response 5153 framework for access authentication. Additional mechanisms can be 5154 used, such as authentication at the transport level or via message 5155 encapsulation, and with additional header fields specifying 5156 authentication information. However, such additional mechanisms are 5157 not defined by this specification. 5159 8.5.2. Protection Space (Realm) 5161 The "realm" authentication parameter is reserved for use by 5162 authentication schemes that wish to indicate a scope of protection. 5164 A protection space is defined by the canonical root URI (the scheme 5165 and authority components of the effective request URI; see 5166 Section 5.5) of the server being accessed, in combination with the 5167 realm value if present. These realms allow the protected resources 5168 on a server to be partitioned into a set of protection spaces, each 5169 with its own authentication scheme and/or authorization database. 5170 The realm value is a string, generally assigned by the origin server, 5171 that can have additional semantics specific to the authentication 5172 scheme. Note that a response can have multiple challenges with the 5173 same auth-scheme but with different realms. 5175 The protection space determines the domain over which credentials can 5176 be automatically applied. If a prior request has been authorized, 5177 the user agent MAY reuse the same credentials for all other requests 5178 within that protection space for a period of time determined by the 5179 authentication scheme, parameters, and/or user preferences (such as a 5180 configurable inactivity timeout). Unless specifically allowed by the 5181 authentication scheme, a single protection space cannot extend 5182 outside the scope of its server. 5184 For historical reasons, a sender MUST only generate the quoted-string 5185 syntax. Recipients might have to support both token and quoted- 5186 string syntax for maximum interoperability with existing clients that 5187 have been accepting both notations for a long time. 5189 8.5.3. Authorization 5191 The "Authorization" header field allows a user agent to authenticate 5192 itself with an origin server -- usually, but not necessarily, after 5193 receiving a 401 (Unauthorized) response. Its value consists of 5194 credentials containing the authentication information of the user 5195 agent for the realm of the resource being requested. 5197 Authorization = credentials 5199 If a request is authenticated and a realm specified, the same 5200 credentials are presumed to be valid for all other requests within 5201 this realm (assuming that the authentication scheme itself does not 5202 require otherwise, such as credentials that vary according to a 5203 challenge value or using synchronized clocks). 5205 A proxy forwarding a request MUST NOT modify any Authorization fields 5206 in that request. See Section 3.2 of [Caching] for details of and 5207 requirements pertaining to handling of the Authorization field by 5208 HTTP caches. 5210 8.5.4. Proxy-Authorization 5212 The "Proxy-Authorization" header field allows the client to identify 5213 itself (or its user) to a proxy that requires authentication. Its 5214 value consists of credentials containing the authentication 5215 information of the client for the proxy and/or realm of the resource 5216 being requested. 5218 Proxy-Authorization = credentials 5220 Unlike Authorization, the Proxy-Authorization header field applies 5221 only to the next inbound proxy that demanded authentication using the 5222 Proxy-Authenticate field. When multiple proxies are used in a chain, 5223 the Proxy-Authorization header field is consumed by the first inbound 5224 proxy that was expecting to receive credentials. A proxy MAY relay 5225 the credentials from the client request to the next proxy if that is 5226 the mechanism by which the proxies cooperatively authenticate a given 5227 request. 5229 8.5.5. Authentication Scheme Extensibility 5231 Aside from the general framework, this document does not specify any 5232 authentication schemes. New and existing authentication schemes are 5233 specified independently and ought to be registered within the 5234 "Hypertext Transfer Protocol (HTTP) Authentication Scheme Registry". 5235 For example, the "basic" and "digest" authentication schemes are 5236 defined by RFC 7617 and RFC 7616, respectively. 5238 8.5.5.1. Authentication Scheme Registry 5240 The "Hypertext Transfer Protocol (HTTP) Authentication Scheme 5241 Registry" defines the namespace for the authentication schemes in 5242 challenges and credentials. It is maintained at 5243 . 5245 Registrations MUST include the following fields: 5247 o Authentication Scheme Name 5249 o Pointer to specification text 5251 o Notes (optional) 5253 Values to be added to this namespace require IETF Review (see 5254 [RFC8126], Section 4.8). 5256 8.5.5.2. Considerations for New Authentication Schemes 5258 There are certain aspects of the HTTP Authentication framework that 5259 put constraints on how new authentication schemes can work: 5261 o HTTP authentication is presumed to be stateless: all of the 5262 information necessary to authenticate a request MUST be provided 5263 in the request, rather than be dependent on the server remembering 5264 prior requests. Authentication based on, or bound to, the 5265 underlying connection is outside the scope of this specification 5266 and inherently flawed unless steps are taken to ensure that the 5267 connection cannot be used by any party other than the 5268 authenticated user (see Section 2.2). 5270 o The authentication parameter "realm" is reserved for defining 5271 protection spaces as described in Section 8.5.2. New schemes MUST 5272 NOT use it in a way incompatible with that definition. 5274 o The "token68" notation was introduced for compatibility with 5275 existing authentication schemes and can only be used once per 5276 challenge or credential. Thus, new schemes ought to use the auth- 5277 param syntax instead, because otherwise future extensions will be 5278 impossible. 5280 o The parsing of challenges and credentials is defined by this 5281 specification and cannot be modified by new authentication 5282 schemes. When the auth-param syntax is used, all parameters ought 5283 to support both token and quoted-string syntax, and syntactical 5284 constraints ought to be defined on the field value after parsing 5285 (i.e., quoted-string processing). This is necessary so that 5286 recipients can use a generic parser that applies to all 5287 authentication schemes. 5289 Note: The fact that the value syntax for the "realm" parameter is 5290 restricted to quoted-string was a bad design choice not to be 5291 repeated for new parameters. 5293 o Definitions of new schemes ought to define the treatment of 5294 unknown extension parameters. In general, a "must-ignore" rule is 5295 preferable to a "must-understand" rule, because otherwise it will 5296 be hard to introduce new parameters in the presence of legacy 5297 recipients. Furthermore, it's good to describe the policy for 5298 defining new parameters (such as "update the specification" or 5299 "use this registry"). 5301 o Authentication schemes need to document whether they are usable in 5302 origin-server authentication (i.e., using WWW-Authenticate), and/ 5303 or proxy authentication (i.e., using Proxy-Authenticate). 5305 o The credentials carried in an Authorization header field are 5306 specific to the user agent and, therefore, have the same effect on 5307 HTTP caches as the "private" Cache-Control response directive 5308 (Section 5.2.2.7 of [Caching]), within the scope of the request in 5309 which they appear. 5311 Therefore, new authentication schemes that choose not to carry 5312 credentials in the Authorization header field (e.g., using a newly 5313 defined header field) will need to explicitly disallow caching, by 5314 mandating the use of Cache-Control response directives (e.g., 5315 "private"). 5317 o Schemes using Authentication-Info, Proxy-Authentication-Info, or 5318 any other authentication related response header field need to 5319 consider and document the related security considerations (see 5320 Section 11.14.4). 5322 8.6. Request Context 5324 The following request header fields provide additional information 5325 about the request context, including information about the user, user 5326 agent, and resource behind the request. 5328 +------------+---------------+ 5329 | Field Name | Defined in... | 5330 +------------+---------------+ 5331 | From | Section 8.6.1 | 5332 | Referer | Section 8.6.2 | 5333 | User-Agent | Section 8.6.3 | 5334 +------------+---------------+ 5336 8.6.1. From 5338 The "From" header field contains an Internet email address for a 5339 human user who controls the requesting user agent. The address ought 5340 to be machine-usable, as defined by "mailbox" in Section 3.4 of 5341 [RFC5322]: 5343 From = mailbox 5345 mailbox = 5347 An example is: 5349 From: webmaster@example.org 5351 The From header field is rarely sent by non-robotic user agents. A 5352 user agent SHOULD NOT send a From header field without explicit 5353 configuration by the user, since that might conflict with the user's 5354 privacy interests or their site's security policy. 5356 A robotic user agent SHOULD send a valid From header field so that 5357 the person responsible for running the robot can be contacted if 5358 problems occur on servers, such as if the robot is sending excessive, 5359 unwanted, or invalid requests. 5361 A server SHOULD NOT use the From header field for access control or 5362 authentication, since most recipients will assume that the field 5363 value is public information. 5365 8.6.2. Referer 5367 The "Referer" [sic] header field allows the user agent to specify a 5368 URI reference for the resource from which the target URI was obtained 5369 (i.e., the "referrer", though the field name is misspelled). A user 5370 agent MUST NOT include the fragment and userinfo components of the 5371 URI reference [RFC3986], if any, when generating the Referer field 5372 value. 5374 Referer = absolute-URI / partial-URI 5376 The Referer header field allows servers to generate back-links to 5377 other resources for simple analytics, logging, optimized caching, 5378 etc. It also allows obsolete or mistyped links to be found for 5379 maintenance. Some servers use the Referer header field as a means of 5380 denying links from other sites (so-called "deep linking") or 5381 restricting cross-site request forgery (CSRF), but not all requests 5382 contain it. 5384 Example: 5386 Referer: http://www.example.org/hypertext/Overview.html 5388 If the target URI was obtained from a source that does not have its 5389 own URI (e.g., input from the user keyboard, or an entry within the 5390 user's bookmarks/favorites), the user agent MUST either exclude the 5391 Referer field or send it with a value of "about:blank". 5393 The Referer field has the potential to reveal information about the 5394 request context or browsing history of the user, which is a privacy 5395 concern if the referring resource's identifier reveals personal 5396 information (such as an account name) or a resource that is supposed 5397 to be confidential (such as behind a firewall or internal to a 5398 secured service). Most general-purpose user agents do not send the 5399 Referer header field when the referring resource is a local "file" or 5400 "data" URI. A user agent MUST NOT send a Referer header field in an 5401 unsecured HTTP request if the referring page was received with a 5402 secure protocol. See Section 11.8 for additional security 5403 considerations. 5405 Some intermediaries have been known to indiscriminately remove 5406 Referer header fields from outgoing requests. This has the 5407 unfortunate side effect of interfering with protection against CSRF 5408 attacks, which can be far more harmful to their users. 5409 Intermediaries and user agent extensions that wish to limit 5410 information disclosure in Referer ought to restrict their changes to 5411 specific edits, such as replacing internal domain names with 5412 pseudonyms or truncating the query and/or path components. An 5413 intermediary SHOULD NOT modify or delete the Referer header field 5414 when the field value shares the same scheme and host as the request 5415 target. 5417 8.6.3. User-Agent 5419 The "User-Agent" header field contains information about the user 5420 agent originating the request, which is often used by servers to help 5421 identify the scope of reported interoperability problems, to work 5422 around or tailor responses to avoid particular user agent 5423 limitations, and for analytics regarding browser or operating system 5424 use. A user agent SHOULD send a User-Agent field in each request 5425 unless specifically configured not to do so. 5427 User-Agent = product *( RWS ( product / comment ) ) 5429 The User-Agent field value consists of one or more product 5430 identifiers, each followed by zero or more comments 5431 (Section 4.4.1.3), which together identify the user agent software 5432 and its significant subproducts. By convention, the product 5433 identifiers are listed in decreasing order of their significance for 5434 identifying the user agent software. Each product identifier 5435 consists of a name and optional version. 5437 product = token ["/" product-version] 5438 product-version = token 5440 A sender SHOULD limit generated product identifiers to what is 5441 necessary to identify the product; a sender MUST NOT generate 5442 advertising or other nonessential information within the product 5443 identifier. A sender SHOULD NOT generate information in product- 5444 version that is not a version identifier (i.e., successive versions 5445 of the same product name ought to differ only in the product-version 5446 portion of the product identifier). 5448 Example: 5450 User-Agent: CERN-LineMode/2.15 libwww/2.17b3 5452 A user agent SHOULD NOT generate a User-Agent field containing 5453 needlessly fine-grained detail and SHOULD limit the addition of 5454 subproducts by third parties. Overly long and detailed User-Agent 5455 field values increase request latency and the risk of a user being 5456 identified against their wishes ("fingerprinting"). 5458 Likewise, implementations are encouraged not to use the product 5459 tokens of other implementations in order to declare compatibility 5460 with them, as this circumvents the purpose of the field. If a user 5461 agent masquerades as a different user agent, recipients can assume 5462 that the user intentionally desires to see responses tailored for 5463 that identified user agent, even if they might not work as well for 5464 the actual user agent being used. 5466 9. Response Status Codes 5468 The (response) status code is a three-digit integer code giving the 5469 result of the attempt to understand and satisfy the request. 5471 HTTP status codes are extensible. HTTP clients are not required to 5472 understand the meaning of all registered status codes, though such 5473 understanding is obviously desirable. However, a client MUST 5474 understand the class of any status code, as indicated by the first 5475 digit, and treat an unrecognized status code as being equivalent to 5476 the x00 status code of that class. 5478 For example, if an unrecognized status code of 471 is received by a 5479 client, the client can assume that there was something wrong with its 5480 request and treat the response as if it had received a 400 (Bad 5481 Request) status code. The response message will usually contain a 5482 representation that explains the status. 5484 The first digit of the status code defines the class of response. 5485 The last two digits do not have any categorization role. There are 5486 five values for the first digit: 5488 o 1xx (Informational): The request was received, continuing process 5490 o 2xx (Successful): The request was successfully received, 5491 understood, and accepted 5493 o 3xx (Redirection): Further action needs to be taken in order to 5494 complete the request 5496 o 4xx (Client Error): The request contains bad syntax or cannot be 5497 fulfilled 5499 o 5xx (Server Error): The server failed to fulfill an apparently 5500 valid request 5502 A single request can have multiple associated responses: zero or more 5503 interim (non-final) responses with status codes in the 5504 "informational" (1xx) range, followed by exactly one final response 5505 with a status code in one of the other ranges. 5507 9.1. Overview of Status Codes 5509 The status codes listed below are defined in this specification. The 5510 reason phrases listed here are only recommendations -- they can be 5511 replaced by local equivalents without affecting the protocol. 5513 Responses with status codes that are defined as heuristically 5514 cacheable (e.g., 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 5515 and 501 in this specification) can be reused by a cache with 5516 heuristic expiration unless otherwise indicated by the method 5517 definition or explicit cache controls [Caching]; all other status 5518 codes are not heuristically cacheable. 5520 +-------+-------------------------------+-----------------+ 5521 | Value | Description | Reference | 5522 +-------+-------------------------------+-----------------+ 5523 | 100 | Continue | Section 9.2.1 | 5524 | 101 | Switching Protocols | Section 9.2.2 | 5525 | 200 | OK | Section 9.3.1 | 5526 | 201 | Created | Section 9.3.2 | 5527 | 202 | Accepted | Section 9.3.3 | 5528 | 203 | Non-Authoritative Information | Section 9.3.4 | 5529 | 204 | No Content | Section 9.3.5 | 5530 | 205 | Reset Content | Section 9.3.6 | 5531 | 206 | Partial Content | Section 9.3.7 | 5532 | 300 | Multiple Choices | Section 9.4.1 | 5533 | 301 | Moved Permanently | Section 9.4.2 | 5534 | 302 | Found | Section 9.4.3 | 5535 | 303 | See Other | Section 9.4.4 | 5536 | 304 | Not Modified | Section 9.4.5 | 5537 | 305 | Use Proxy | Section 9.4.6 | 5538 | 306 | (Unused) | Section 9.4.7 | 5539 | 307 | Temporary Redirect | Section 9.4.8 | 5540 | 308 | Permanent Redirect | Section 9.4.9 | 5541 | 400 | Bad Request | Section 9.5.1 | 5542 | 401 | Unauthorized | Section 9.5.2 | 5543 | 402 | Payment Required | Section 9.5.3 | 5544 | 403 | Forbidden | Section 9.5.4 | 5545 | 404 | Not Found | Section 9.5.5 | 5546 | 405 | Method Not Allowed | Section 9.5.6 | 5547 | 406 | Not Acceptable | Section 9.5.7 | 5548 | 407 | Proxy Authentication Required | Section 9.5.8 | 5549 | 408 | Request Timeout | Section 9.5.9 | 5550 | 409 | Conflict | Section 9.5.10 | 5551 | 410 | Gone | Section 9.5.11 | 5552 | 411 | Length Required | Section 9.5.12 | 5553 | 412 | Precondition Failed | Section 9.5.13 | 5554 | 413 | Payload Too Large | Section 9.5.14 | 5555 | 414 | URI Too Long | Section 9.5.15 | 5556 | 415 | Unsupported Media Type | Section 9.5.16 | 5557 | 416 | Range Not Satisfiable | Section 9.5.17 | 5558 | 417 | Expectation Failed | Section 9.5.18 | 5559 | 418 | (Unused) | Section 9.5.19 | 5560 | 422 | Unprocessable Payload | Section 9.5.20 | 5561 | 426 | Upgrade Required | Section 9.5.21 | 5562 | 500 | Internal Server Error | Section 9.6.1 | 5563 | 501 | Not Implemented | Section 9.6.2 | 5564 | 502 | Bad Gateway | Section 9.6.3 | 5565 | 503 | Service Unavailable | Section 9.6.4 | 5566 | 504 | Gateway Timeout | Section 9.6.5 | 5567 | 505 | HTTP Version Not Supported | Section 9.6.6 | 5568 +-------+-------------------------------+-----------------+ 5570 Table 6 5572 Note that this list is not exhaustive -- it does not include 5573 extension status codes defined in other specifications (Section 9.7). 5575 9.2. Informational 1xx 5577 The 1xx (Informational) class of status code indicates an interim 5578 response for communicating connection status or request progress 5579 prior to completing the requested action and sending a final 5580 response. 1xx responses are terminated by the first empty line after 5581 the status-line (the empty line signaling the end of the header 5582 section). Since HTTP/1.0 did not define any 1xx status codes, a 5583 server MUST NOT send a 1xx response to an HTTP/1.0 client. 5585 A client MUST be able to parse one or more 1xx responses received 5586 prior to a final response, even if the client does not expect one. A 5587 user agent MAY ignore unexpected 1xx responses. 5589 A proxy MUST forward 1xx responses unless the proxy itself requested 5590 the generation of the 1xx response. For example, if a proxy adds an 5591 "Expect: 100-continue" field when it forwards a request, then it need 5592 not forward the corresponding 100 (Continue) response(s). 5594 9.2.1. 100 Continue 5596 The 100 (Continue) status code indicates that the initial part of a 5597 request has been received and has not yet been rejected by the 5598 server. The server intends to send a final response after the 5599 request has been fully received and acted upon. 5601 When the request contains an Expect header field that includes a 5602 100-continue expectation, the 100 response indicates that the server 5603 wishes to receive the request payload body, as described in 5604 Section 8.1.1. The client ought to continue sending the request and 5605 discard the 100 response. 5607 If the request did not contain an Expect header field containing the 5608 100-continue expectation, the client can simply discard this interim 5609 response. 5611 9.2.2. 101 Switching Protocols 5613 The 101 (Switching Protocols) status code indicates that the server 5614 understands and is willing to comply with the client's request, via 5615 the Upgrade header field (Section 9.9 of [Messaging]), for a change 5616 in the application protocol being used on this connection. The 5617 server MUST generate an Upgrade header field in the response that 5618 indicates which protocol(s) will be switched to immediately after the 5619 empty line that terminates the 101 response. 5621 It is assumed that the server will only agree to switch protocols 5622 when it is advantageous to do so. For example, switching to a newer 5623 version of HTTP might be advantageous over older versions, and 5624 switching to a real-time, synchronous protocol might be advantageous 5625 when delivering resources that use such features. 5627 9.3. Successful 2xx 5629 The 2xx (Successful) class of status code indicates that the client's 5630 request was successfully received, understood, and accepted. 5632 9.3.1. 200 OK 5634 The 200 (OK) status code indicates that the request has succeeded. 5635 The payload sent in a 200 response depends on the request method. 5636 For the methods defined by this specification, the intended meaning 5637 of the payload can be summarized as: 5639 GET a representation of the target resource; 5641 HEAD the same representation as GET, but without the representation 5642 data; 5644 POST a representation of the status of, or results obtained from, 5645 the action; 5647 PUT, DELETE a representation of the status of the action; 5649 OPTIONS a representation of the communications options; 5651 TRACE a representation of the request message as received by the end 5652 server. 5654 Aside from responses to CONNECT, a 200 response always has a payload, 5655 though an origin server MAY generate a payload body of zero length. 5656 If no payload is desired, an origin server ought to send 204 (No 5657 Content) instead. For CONNECT, no payload is allowed because the 5658 successful result is a tunnel, which begins immediately after the 200 5659 response header section. 5661 A 200 response is heuristically cacheable; i.e., unless otherwise 5662 indicated by the method definition or explicit cache controls (see 5663 Section 4.2.2 of [Caching]). 5665 9.3.2. 201 Created 5667 The 201 (Created) status code indicates that the request has been 5668 fulfilled and has resulted in one or more new resources being 5669 created. The primary resource created by the request is identified 5670 by either a Location header field in the response or, if no Location 5671 field is received, by the effective request URI. 5673 The 201 response payload typically describes and links to the 5674 resource(s) created. See Section 10.2 for a discussion of the 5675 meaning and purpose of validator header fields, such as ETag and 5676 Last-Modified, in a 201 response. 5678 9.3.3. 202 Accepted 5680 The 202 (Accepted) status code indicates that the request has been 5681 accepted for processing, but the processing has not been completed. 5682 The request might or might not eventually be acted upon, as it might 5683 be disallowed when processing actually takes place. There is no 5684 facility in HTTP for re-sending a status code from an asynchronous 5685 operation. 5687 The 202 response is intentionally noncommittal. Its purpose is to 5688 allow a server to accept a request for some other process (perhaps a 5689 batch-oriented process that is only run once per day) without 5690 requiring that the user agent's connection to the server persist 5691 until the process is completed. The representation sent with this 5692 response ought to describe the request's current status and point to 5693 (or embed) a status monitor that can provide the user with an 5694 estimate of when the request will be fulfilled. 5696 9.3.4. 203 Non-Authoritative Information 5698 The 203 (Non-Authoritative Information) status code indicates that 5699 the request was successful but the enclosed payload has been modified 5700 from that of the origin server's 200 (OK) response by a transforming 5701 proxy (Section 5.7.2). This status code allows the proxy to notify 5702 recipients when a transformation has been applied, since that 5703 knowledge might impact later decisions regarding the content. For 5704 example, future cache validation requests for the content might only 5705 be applicable along the same request path (through the same proxies). 5707 The 203 response is similar to the Warning code of 214 Transformation 5708 Applied (Section 5.5 of [Caching]), which has the advantage of being 5709 applicable to responses with any status code. 5711 A 203 response is heuristically cacheable; i.e., unless otherwise 5712 indicated by the method definition or explicit cache controls (see 5713 Section 4.2.2 of [Caching]). 5715 9.3.5. 204 No Content 5717 The 204 (No Content) status code indicates that the server has 5718 successfully fulfilled the request and that there is no additional 5719 content to send in the response payload body. Metadata in the 5720 response header fields refer to the target resource and its selected 5721 representation after the requested action was applied. 5723 For example, if a 204 status code is received in response to a PUT 5724 request and the response contains an ETag field, then the PUT was 5725 successful and the ETag field value contains the entity-tag for the 5726 new representation of that target resource. 5728 The 204 response allows a server to indicate that the action has been 5729 successfully applied to the target resource, while implying that the 5730 user agent does not need to traverse away from its current "document 5731 view" (if any). The server assumes that the user agent will provide 5732 some indication of the success to its user, in accord with its own 5733 interface, and apply any new or updated metadata in the response to 5734 its active representation. 5736 For example, a 204 status code is commonly used with document editing 5737 interfaces corresponding to a "save" action, such that the document 5738 being saved remains available to the user for editing. It is also 5739 frequently used with interfaces that expect automated data transfers 5740 to be prevalent, such as within distributed version control systems. 5742 A 204 response is terminated by the first empty line after the header 5743 fields because it cannot contain a message body. 5745 A 204 response is heuristically cacheable; i.e., unless otherwise 5746 indicated by the method definition or explicit cache controls (see 5747 Section 4.2.2 of [Caching]). 5749 9.3.6. 205 Reset Content 5751 The 205 (Reset Content) status code indicates that the server has 5752 fulfilled the request and desires that the user agent reset the 5753 "document view", which caused the request to be sent, to its original 5754 state as received from the origin server. 5756 This response is intended to support a common data entry use case 5757 where the user receives content that supports data entry (a form, 5758 notepad, canvas, etc.), enters or manipulates data in that space, 5759 causes the entered data to be submitted in a request, and then the 5760 data entry mechanism is reset for the next entry so that the user can 5761 easily initiate another input action. 5763 Since the 205 status code implies that no additional content will be 5764 provided, a server MUST NOT generate a payload in a 205 response. In 5765 other words, a server MUST do one of the following for a 205 5766 response: a) indicate a zero-length body for the response by 5767 including a Content-Length header field with a value of 0; b) 5768 indicate a zero-length payload for the response by including a 5769 Transfer-Encoding header field with a value of chunked and a message 5770 body consisting of a single chunk of zero-length; or, c) close the 5771 connection immediately after sending the blank line terminating the 5772 header section. 5774 9.3.7. 206 Partial Content 5776 The 206 (Partial Content) status code indicates that the server is 5777 successfully fulfilling a range request for the target resource by 5778 transferring one or more parts of the selected representation. 5780 When a 206 response is generated, the server MUST generate the 5781 following header fields, in addition to those required in the 5782 subsections below, if the field would have been sent in a 200 (OK) 5783 response to the same request: Date, Cache-Control, ETag, Expires, 5784 Content-Location, and Vary. 5786 If a 206 is generated in response to a request with an If-Range 5787 header field, the sender SHOULD NOT generate other representation 5788 header fields beyond those required, because the client is understood 5789 to already have a prior response containing those header fields. 5790 Otherwise, the sender MUST generate all of the representation header 5791 fields that would have been sent in a 200 (OK) response to the same 5792 request. 5794 A 206 response is heuristically cacheable; i.e., unless otherwise 5795 indicated by explicit cache controls (see Section 4.2.2 of 5796 [Caching]). 5798 9.3.7.1. Single Part 5800 If a single part is being transferred, the server generating the 206 5801 response MUST generate a Content-Range header field, describing what 5802 range of the selected representation is enclosed, and a payload 5803 consisting of the range. For example: 5805 HTTP/1.1 206 Partial Content 5806 Date: Wed, 15 Nov 1995 06:25:24 GMT 5807 Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT 5808 Content-Range: bytes 21010-47021/47022 5809 Content-Length: 26012 5810 Content-Type: image/gif 5812 ... 26012 bytes of partial image data ... 5814 9.3.7.2. Multiple Parts 5816 If multiple parts are being transferred, the server generating the 5817 206 response MUST generate a "multipart/byteranges" payload, as 5818 defined in Section 6.3.5, and a Content-Type header field containing 5819 the multipart/byteranges media type and its required boundary 5820 parameter. To avoid confusion with single-part responses, a server 5821 MUST NOT generate a Content-Range header field in the HTTP header 5822 section of a multiple part response (this field will be sent in each 5823 part instead). 5825 Within the header area of each body part in the multipart payload, 5826 the server MUST generate a Content-Range header field corresponding 5827 to the range being enclosed in that body part. If the selected 5828 representation would have had a Content-Type header field in a 200 5829 (OK) response, the server SHOULD generate that same Content-Type 5830 field in the header area of each body part. For example: 5832 HTTP/1.1 206 Partial Content 5833 Date: Wed, 15 Nov 1995 06:25:24 GMT 5834 Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT 5835 Content-Length: 1741 5836 Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES 5838 --THIS_STRING_SEPARATES 5839 Content-Type: application/pdf 5840 Content-Range: bytes 500-999/8000 5842 ...the first range... 5843 --THIS_STRING_SEPARATES 5844 Content-Type: application/pdf 5845 Content-Range: bytes 7000-7999/8000 5847 ...the second range 5848 --THIS_STRING_SEPARATES-- 5850 When multiple ranges are requested, a server MAY coalesce any of the 5851 ranges that overlap, or that are separated by a gap that is smaller 5852 than the overhead of sending multiple parts, regardless of the order 5853 in which the corresponding range-spec appeared in the received Range 5854 header field. Since the typical overhead between parts of a 5855 multipart/byteranges payload is around 80 bytes, depending on the 5856 selected representation's media type and the chosen boundary 5857 parameter length, it can be less efficient to transfer many small 5858 disjoint parts than it is to transfer the entire selected 5859 representation. 5861 A server MUST NOT generate a multipart response to a request for a 5862 single range, since a client that does not request multiple parts 5863 might not support multipart responses. However, a server MAY 5864 generate a multipart/byteranges payload with only a single body part 5865 if multiple ranges were requested and only one range was found to be 5866 satisfiable or only one range remained after coalescing. A client 5867 that cannot process a multipart/byteranges response MUST NOT generate 5868 a request that asks for multiple ranges. 5870 When a multipart response payload is generated, the server SHOULD 5871 send the parts in the same order that the corresponding range-spec 5872 appeared in the received Range header field, excluding those ranges 5873 that were deemed unsatisfiable or that were coalesced into other 5874 ranges. A client that receives a multipart response MUST inspect the 5875 Content-Range header field present in each body part in order to 5876 determine which range is contained in that body part; a client cannot 5877 rely on receiving the same ranges that it requested, nor the same 5878 order that it requested. 5880 9.3.7.3. Combining Parts 5882 A response might transfer only a subrange of a representation if the 5883 connection closed prematurely or if the request used one or more 5884 Range specifications. After several such transfers, a client might 5885 have received several ranges of the same representation. These 5886 ranges can only be safely combined if they all have in common the 5887 same strong validator (Section 10.2.1). 5889 A client that has received multiple partial responses to GET requests 5890 on a target resource MAY combine those responses into a larger 5891 continuous range if they share the same strong validator. 5893 If the most recent response is an incomplete 200 (OK) response, then 5894 the header fields of that response are used for any combined response 5895 and replace those of the matching stored responses. 5897 If the most recent response is a 206 (Partial Content) response and 5898 at least one of the matching stored responses is a 200 (OK), then the 5899 combined response header fields consist of the most recent 200 5900 response's header fields. If all of the matching stored responses 5901 are 206 responses, then the stored response with the most recent 5902 header fields is used as the source of header fields for the combined 5903 response, except that the client MUST use other header fields 5904 provided in the new response, aside from Content-Range, to replace 5905 all instances of the corresponding header fields in the stored 5906 response. 5908 The combined response message body consists of the union of partial 5909 content ranges in the new response and each of the selected 5910 responses. If the union consists of the entire range of the 5911 representation, then the client MUST process the combined response as 5912 if it were a complete 200 (OK) response, including a Content-Length 5913 header field that reflects the complete length. Otherwise, the 5914 client MUST process the set of continuous ranges as one of the 5915 following: an incomplete 200 (OK) response if the combined response 5916 is a prefix of the representation, a single 206 (Partial Content) 5917 response containing a multipart/byteranges body, or multiple 206 5918 (Partial Content) responses, each with one continuous range that is 5919 indicated by a Content-Range header field. 5921 9.4. Redirection 3xx 5923 The 3xx (Redirection) class of status code indicates that further 5924 action needs to be taken by the user agent in order to fulfill the 5925 request. If a Location header field (Section 10.1.2) is provided, 5926 the user agent MAY automatically redirect its request to the URI 5927 referenced by the Location field value, even if the specific status 5928 code is not understood. Automatic redirection needs to be done with 5929 care for methods not known to be safe, as defined in Section 7.2.1, 5930 since the user might not wish to redirect an unsafe request. 5932 There are several types of redirects: 5934 1. Redirects that indicate the resource might be available at a 5935 different URI, as provided by the Location field, as in the 5936 status codes 301 (Moved Permanently), 302 (Found), 307 (Temporary 5937 Redirect), and 308 (Permanent Redirect). 5939 2. Redirection that offers a choice of matching resources, each 5940 capable of representing the original request target, as in the 5941 300 (Multiple Choices) status code. 5943 3. Redirection to a different resource, identified by the Location 5944 field, that can represent an indirect response to the request, as 5945 in the 303 (See Other) status code. 5947 4. Redirection to a previously cached result, as in the 304 (Not 5948 Modified) status code. 5950 Note: In HTTP/1.0, the status codes 301 (Moved Permanently) and 5951 302 (Found) were defined for the first type of redirect 5952 ([RFC1945], Section 9.3). Early user agents split on whether the 5953 method applied to the redirect target would be the same as the 5954 original request or would be rewritten as GET. Although HTTP 5955 originally defined the former semantics for 301 and 302 (to match 5956 its original implementation at CERN), and defined 303 (See Other) 5957 to match the latter semantics, prevailing practice gradually 5958 converged on the latter semantics for 301 and 302 as well. The 5959 first revision of HTTP/1.1 added 307 (Temporary Redirect) to 5960 indicate the former semantics of 302 without being impacted by 5961 divergent practice. For the same reason, 308 (Permanent Redirect) 5962 was later on added in [RFC7538] to match 301. Over 10 years 5963 later, most user agents still do method rewriting for 301 and 302; 5964 therefore, [RFC7231] made that behavior conformant when the 5965 original request is POST. 5967 A client SHOULD detect and intervene in cyclical redirections (i.e., 5968 "infinite" redirection loops). 5970 Note: An earlier version of this specification recommended a 5971 maximum of five redirections ([RFC2068], Section 10.3). Content 5972 developers need to be aware that some clients might implement such 5973 a fixed limitation. 5975 9.4.1. 300 Multiple Choices 5977 The 300 (Multiple Choices) status code indicates that the target 5978 resource has more than one representation, each with its own more 5979 specific identifier, and information about the alternatives is being 5980 provided so that the user (or user agent) can select a preferred 5981 representation by redirecting its request to one or more of those 5982 identifiers. In other words, the server desires that the user agent 5983 engage in reactive negotiation to select the most appropriate 5984 representation(s) for its needs (Section 6.4). 5986 If the server has a preferred choice, the server SHOULD generate a 5987 Location header field containing a preferred choice's URI reference. 5988 The user agent MAY use the Location field value for automatic 5989 redirection. 5991 For request methods other than HEAD, the server SHOULD generate a 5992 payload in the 300 response containing a list of representation 5993 metadata and URI reference(s) from which the user or user agent can 5994 choose the one most preferred. The user agent MAY make a selection 5995 from that list automatically if it understands the provided media 5996 type. A specific format for automatic selection is not defined by 5997 this specification because HTTP tries to remain orthogonal to the 5998 definition of its payloads. In practice, the representation is 5999 provided in some easily parsed format believed to be acceptable to 6000 the user agent, as determined by shared design or content 6001 negotiation, or in some commonly accepted hypertext format. 6003 A 300 response is heuristically cacheable; i.e., unless otherwise 6004 indicated by the method definition or explicit cache controls (see 6005 Section 4.2.2 of [Caching]). 6007 Note: The original proposal for the 300 status code defined the 6008 URI header field as providing a list of alternative 6009 representations, such that it would be usable for 200, 300, and 6010 406 responses and be transferred in responses to the HEAD method. 6011 However, lack of deployment and disagreement over syntax led to 6012 both URI and Alternates (a subsequent proposal) being dropped from 6013 this specification. It is possible to communicate the list as a 6014 Link header field value [RFC8288] whose members have a 6015 relationship of "alternate", though deployment is a chicken-and- 6016 egg problem. 6018 9.4.2. 301 Moved Permanently 6020 The 301 (Moved Permanently) status code indicates that the target 6021 resource has been assigned a new permanent URI and any future 6022 references to this resource ought to use one of the enclosed URIs. 6023 Clients with link-editing capabilities ought to automatically re-link 6024 references to the effective request URI to one or more of the new 6025 references sent by the server, where possible. 6027 The server SHOULD generate a Location header field in the response 6028 containing a preferred URI reference for the new permanent URI. The 6029 user agent MAY use the Location field value for automatic 6030 redirection. The server's response payload usually contains a short 6031 hypertext note with a hyperlink to the new URI(s). 6033 Note: For historical reasons, a user agent MAY change the request 6034 method from POST to GET for the subsequent request. If this 6035 behavior is undesired, the 308 (Permanent Redirect) status code 6036 can be used instead. 6038 A 301 response is heuristically cacheable; i.e., unless otherwise 6039 indicated by the method definition or explicit cache controls (see 6040 Section 4.2.2 of [Caching]). 6042 9.4.3. 302 Found 6044 The 302 (Found) status code indicates that the target resource 6045 resides temporarily under a different URI. Since the redirection 6046 might be altered on occasion, the client ought to continue to use the 6047 effective request URI for future requests. 6049 The server SHOULD generate a Location header field in the response 6050 containing a URI reference for the different URI. The user agent MAY 6051 use the Location field value for automatic redirection. The server's 6052 response payload usually contains a short hypertext note with a 6053 hyperlink to the different URI(s). 6055 Note: For historical reasons, a user agent MAY change the request 6056 method from POST to GET for the subsequent request. If this 6057 behavior is undesired, the 307 (Temporary Redirect) status code 6058 can be used instead. 6060 9.4.4. 303 See Other 6062 The 303 (See Other) status code indicates that the server is 6063 redirecting the user agent to a different resource, as indicated by a 6064 URI in the Location header field, which is intended to provide an 6065 indirect response to the original request. A user agent can perform 6066 a retrieval request targeting that URI (a GET or HEAD request if 6067 using HTTP), which might also be redirected, and present the eventual 6068 result as an answer to the original request. Note that the new URI 6069 in the Location header field is not considered equivalent to the 6070 effective request URI. 6072 This status code is applicable to any HTTP method. It is primarily 6073 used to allow the output of a POST action to redirect the user agent 6074 to a selected resource, since doing so provides the information 6075 corresponding to the POST response in a form that can be separately 6076 identified, bookmarked, and cached, independent of the original 6077 request. 6079 A 303 response to a GET request indicates that the origin server does 6080 not have a representation of the target resource that can be 6081 transferred by the server over HTTP. However, the Location field 6082 value refers to a resource that is descriptive of the target 6083 resource, such that making a retrieval request on that other resource 6084 might result in a representation that is useful to recipients without 6085 implying that it represents the original target resource. Note that 6086 answers to the questions of what can be represented, what 6087 representations are adequate, and what might be a useful description 6088 are outside the scope of HTTP. 6090 Except for responses to a HEAD request, the representation of a 303 6091 response ought to contain a short hypertext note with a hyperlink to 6092 the same URI reference provided in the Location header field. 6094 9.4.5. 304 Not Modified 6096 The 304 (Not Modified) status code indicates that a conditional GET 6097 or HEAD request has been received and would have resulted in a 200 6098 (OK) response if it were not for the fact that the condition 6099 evaluated to false. In other words, there is no need for the server 6100 to transfer a representation of the target resource because the 6101 request indicates that the client, which made the request 6102 conditional, already has a valid representation; the server is 6103 therefore redirecting the client to make use of that stored 6104 representation as if it were the payload of a 200 (OK) response. 6106 The server generating a 304 response MUST generate any of the 6107 following header fields that would have been sent in a 200 (OK) 6108 response to the same request: Cache-Control, Content-Location, Date, 6109 ETag, Expires, and Vary. 6111 Since the goal of a 304 response is to minimize information transfer 6112 when the recipient already has one or more cached representations, a 6113 sender SHOULD NOT generate representation metadata other than the 6114 above listed fields unless said metadata exists for the purpose of 6115 guiding cache updates (e.g., Last-Modified might be useful if the 6116 response does not have an ETag field). 6118 Requirements on a cache that receives a 304 response are defined in 6119 Section 4.3.4 of [Caching]. If the conditional request originated 6120 with an outbound client, such as a user agent with its own cache 6121 sending a conditional GET to a shared proxy, then the proxy SHOULD 6122 forward the 304 response to that client. 6124 A 304 response cannot contain a message-body; it is always terminated 6125 by the first empty line after the header fields. 6127 9.4.6. 305 Use Proxy 6129 The 305 (Use Proxy) status code was defined in a previous version of 6130 this specification and is now deprecated (Appendix B of [RFC7231]). 6132 9.4.7. 306 (Unused) 6134 The 306 status code was defined in a previous version of this 6135 specification, is no longer used, and the code is reserved. 6137 9.4.8. 307 Temporary Redirect 6139 The 307 (Temporary Redirect) status code indicates that the target 6140 resource resides temporarily under a different URI and the user agent 6141 MUST NOT change the request method if it performs an automatic 6142 redirection to that URI. Since the redirection can change over time, 6143 the client ought to continue using the original effective request URI 6144 for future requests. 6146 The server SHOULD generate a Location header field in the response 6147 containing a URI reference for the different URI. The user agent MAY 6148 use the Location field value for automatic redirection. The server's 6149 response payload usually contains a short hypertext note with a 6150 hyperlink to the different URI(s). 6152 9.4.9. 308 Permanent Redirect 6154 The 308 (Permanent Redirect) status code indicates that the target 6155 resource has been assigned a new permanent URI and any future 6156 references to this resource ought to use one of the enclosed URIs. 6157 Clients with link editing capabilities ought to automatically re-link 6158 references to the effective request URI to one or more of the new 6159 references sent by the server, where possible. 6161 The server SHOULD generate a Location header field in the response 6162 containing a preferred URI reference for the new permanent URI. The 6163 user agent MAY use the Location field value for automatic 6164 redirection. The server's response payload usually contains a short 6165 hypertext note with a hyperlink to the new URI(s). 6167 A 308 response is heuristically cacheable; i.e., unless otherwise 6168 indicated by the method definition or explicit cache controls (see 6169 Section 4.2.2 of [Caching]). 6171 Note: This status code is much younger (June 2014) than its 6172 sibling codes, and thus might not be recognized everywhere. See 6173 Section 4 of [RFC7538] for deployment considerations. 6175 9.5. Client Error 4xx 6177 The 4xx (Client Error) class of status code indicates that the client 6178 seems to have erred. Except when responding to a HEAD request, the 6179 server SHOULD send a representation containing an explanation of the 6180 error situation, and whether it is a temporary or permanent 6181 condition. These status codes are applicable to any request method. 6182 User agents SHOULD display any included representation to the user. 6184 9.5.1. 400 Bad Request 6186 The 400 (Bad Request) status code indicates that the server cannot or 6187 will not process the request due to something that is perceived to be 6188 a client error (e.g., malformed request syntax, invalid request 6189 message framing, or deceptive request routing). 6191 9.5.2. 401 Unauthorized 6193 The 401 (Unauthorized) status code indicates that the request has not 6194 been applied because it lacks valid authentication credentials for 6195 the target resource. The server generating a 401 response MUST send 6196 a WWW-Authenticate header field (Section 10.3.1) containing at least 6197 one challenge applicable to the target resource. 6199 If the request included authentication credentials, then the 401 6200 response indicates that authorization has been refused for those 6201 credentials. The user agent MAY repeat the request with a new or 6202 replaced Authorization header field (Section 8.5.3). If the 401 6203 response contains the same challenge as the prior response, and the 6204 user agent has already attempted authentication at least once, then 6205 the user agent SHOULD present the enclosed representation to the 6206 user, since it usually contains relevant diagnostic information. 6208 9.5.3. 402 Payment Required 6210 The 402 (Payment Required) status code is reserved for future use. 6212 9.5.4. 403 Forbidden 6214 The 403 (Forbidden) status code indicates that the server understood 6215 the request but refuses to fulfill it. A server that wishes to make 6216 public why the request has been forbidden can describe that reason in 6217 the response payload (if any). 6219 If authentication credentials were provided in the request, the 6220 server considers them insufficient to grant access. The client 6221 SHOULD NOT automatically repeat the request with the same 6222 credentials. The client MAY repeat the request with new or different 6223 credentials. However, a request might be forbidden for reasons 6224 unrelated to the credentials. 6226 An origin server that wishes to "hide" the current existence of a 6227 forbidden target resource MAY instead respond with a status code of 6228 404 (Not Found). 6230 9.5.5. 404 Not Found 6232 The 404 (Not Found) status code indicates that the origin server did 6233 not find a current representation for the target resource or is not 6234 willing to disclose that one exists. A 404 status code does not 6235 indicate whether this lack of representation is temporary or 6236 permanent; the 410 (Gone) status code is preferred over 404 if the 6237 origin server knows, presumably through some configurable means, that 6238 the condition is likely to be permanent. 6240 A 404 response is heuristically cacheable; i.e., unless otherwise 6241 indicated by the method definition or explicit cache controls (see 6242 Section 4.2.2 of [Caching]). 6244 9.5.6. 405 Method Not Allowed 6246 The 405 (Method Not Allowed) status code indicates that the method 6247 received in the request-line is known by the origin server but not 6248 supported by the target resource. The origin server MUST generate an 6249 Allow header field in a 405 response containing a list of the target 6250 resource's currently supported methods. 6252 A 405 response is heuristically cacheable; i.e., unless otherwise 6253 indicated by the method definition or explicit cache controls (see 6254 Section 4.2.2 of [Caching]). 6256 9.5.7. 406 Not Acceptable 6258 The 406 (Not Acceptable) status code indicates that the target 6259 resource does not have a current representation that would be 6260 acceptable to the user agent, according to the proactive negotiation 6261 header fields received in the request (Section 8.4), and the server 6262 is unwilling to supply a default representation. 6264 The server SHOULD generate a payload containing a list of available 6265 representation characteristics and corresponding resource identifiers 6266 from which the user or user agent can choose the one most 6267 appropriate. A user agent MAY automatically select the most 6268 appropriate choice from that list. However, this specification does 6269 not define any standard for such automatic selection, as described in 6270 Section 9.4.1. 6272 9.5.8. 407 Proxy Authentication Required 6274 The 407 (Proxy Authentication Required) status code is similar to 401 6275 (Unauthorized), but it indicates that the client needs to 6276 authenticate itself in order to use a proxy. The proxy MUST send a 6277 Proxy-Authenticate header field (Section 10.3.2) containing a 6278 challenge applicable to that proxy for the target resource. The 6279 client MAY repeat the request with a new or replaced Proxy- 6280 Authorization header field (Section 8.5.4). 6282 9.5.9. 408 Request Timeout 6284 The 408 (Request Timeout) status code indicates that the server did 6285 not receive a complete request message within the time that it was 6286 prepared to wait. A server SHOULD send the "close" connection option 6287 (Section 9.1 of [Messaging]) in the response, since 408 implies that 6288 the server has decided to close the connection rather than continue 6289 waiting. If the client has an outstanding request in transit, the 6290 client MAY repeat that request on a new connection. 6292 9.5.10. 409 Conflict 6294 The 409 (Conflict) status code indicates that the request could not 6295 be completed due to a conflict with the current state of the target 6296 resource. This code is used in situations where the user might be 6297 able to resolve the conflict and resubmit the request. The server 6298 SHOULD generate a payload that includes enough information for a user 6299 to recognize the source of the conflict. 6301 Conflicts are most likely to occur in response to a PUT request. For 6302 example, if versioning were being used and the representation being 6303 PUT included changes to a resource that conflict with those made by 6304 an earlier (third-party) request, the origin server might use a 409 6305 response to indicate that it can't complete the request. In this 6306 case, the response representation would likely contain information 6307 useful for merging the differences based on the revision history. 6309 9.5.11. 410 Gone 6311 The 410 (Gone) status code indicates that access to the target 6312 resource is no longer available at the origin server and that this 6313 condition is likely to be permanent. If the origin server does not 6314 know, or has no facility to determine, whether or not the condition 6315 is permanent, the status code 404 (Not Found) ought to be used 6316 instead. 6318 The 410 response is primarily intended to assist the task of web 6319 maintenance by notifying the recipient that the resource is 6320 intentionally unavailable and that the server owners desire that 6321 remote links to that resource be removed. Such an event is common 6322 for limited-time, promotional services and for resources belonging to 6323 individuals no longer associated with the origin server's site. It 6324 is not necessary to mark all permanently unavailable resources as 6325 "gone" or to keep the mark for any length of time -- that is left to 6326 the discretion of the server owner. 6328 A 410 response is heuristically cacheable; i.e., unless otherwise 6329 indicated by the method definition or explicit cache controls (see 6330 Section 4.2.2 of [Caching]). 6332 9.5.12. 411 Length Required 6334 The 411 (Length Required) status code indicates that the server 6335 refuses to accept the request without a defined Content-Length 6336 (Section 6.2.4). The client MAY repeat the request if it adds a 6337 valid Content-Length header field containing the length of the 6338 message body in the request message. 6340 9.5.13. 412 Precondition Failed 6342 The 412 (Precondition Failed) status code indicates that one or more 6343 conditions given in the request header fields evaluated to false when 6344 tested on the server. This response status code allows the client to 6345 place preconditions on the current resource state (its current 6346 representations and metadata) and, thus, prevent the request method 6347 from being applied if the target resource is in an unexpected state. 6349 9.5.14. 413 Payload Too Large 6351 The 413 (Payload Too Large) status code indicates that the server is 6352 refusing to process a request because the request payload is larger 6353 than the server is willing or able to process. The server MAY close 6354 the connection to prevent the client from continuing the request. 6356 If the condition is temporary, the server SHOULD generate a Retry- 6357 After header field to indicate that it is temporary and after what 6358 time the client MAY try again. 6360 9.5.15. 414 URI Too Long 6362 The 414 (URI Too Long) status code indicates that the server is 6363 refusing to service the request because the request-target 6364 (Section 3.2 of [Messaging]) is longer than the server is willing to 6365 interpret. This rare condition is only likely to occur when a client 6366 has improperly converted a POST request to a GET request with long 6367 query information, when the client has descended into a "black hole" 6368 of redirection (e.g., a redirected URI prefix that points to a suffix 6369 of itself) or when the server is under attack by a client attempting 6370 to exploit potential security holes. 6372 A 414 response is heuristically cacheable; i.e., unless otherwise 6373 indicated by the method definition or explicit cache controls (see 6374 Section 4.2.2 of [Caching]). 6376 9.5.16. 415 Unsupported Media Type 6378 The 415 (Unsupported Media Type) status code indicates that the 6379 origin server is refusing to service the request because the payload 6380 is in a format not supported by this method on the target resource. 6381 The format problem might be due to the request's indicated Content- 6382 Type or Content-Encoding, or as a result of inspecting the data 6383 directly. 6385 9.5.17. 416 Range Not Satisfiable 6387 The 416 (Range Not Satisfiable) status code indicates that none of 6388 the ranges in the request's Range header field (Section 8.3) overlap 6389 the current extent of the selected representation or that the set of 6390 ranges requested has been rejected due to invalid ranges or an 6391 excessive request of small or overlapping ranges. 6393 For byte ranges, failing to overlap the current extent means that the 6394 first-pos of all of the range-spec values were greater than or equal 6395 to the current length of the selected representation. When this 6396 status code is generated in response to a byte-range request, the 6397 sender SHOULD generate a Content-Range header field specifying the 6398 current length of the selected representation (Section 6.3.4). 6400 For example: 6402 HTTP/1.1 416 Range Not Satisfiable 6403 Date: Fri, 20 Jan 2012 15:41:54 GMT 6404 Content-Range: bytes */47022 6406 Note: Because servers are free to ignore Range, many 6407 implementations will simply respond with the entire selected 6408 representation in a 200 (OK) response. That is partly because 6409 most clients are prepared to receive a 200 (OK) to complete the 6410 task (albeit less efficiently) and partly because clients might 6411 not stop making an invalid partial request until they have 6412 received a complete representation. Thus, clients cannot depend 6413 on receiving a 416 (Range Not Satisfiable) response even when it 6414 is most appropriate. 6416 9.5.18. 417 Expectation Failed 6418 The 417 (Expectation Failed) status code indicates that the 6419 expectation given in the request's Expect header field 6420 (Section 8.1.1) could not be met by at least one of the inbound 6421 servers. 6423 9.5.19. 418 (Unused) 6425 [RFC2324] was an April 1 RFC that lampooned the various ways HTTP was 6426 abused; one such abuse was the definition of an application-specific 6427 418 status code. In the intervening years, this status code has been 6428 widely implemented as an "Easter Egg", and therefore is effectively 6429 consumed by this use. 6431 Therefore, the 418 status code is reserved in the IANA HTTP Status 6432 Code Registry. This indicates that the status code cannot be 6433 assigned to other applications currently. If future circumstances 6434 require its use (e.g., exhaustion of 4NN status codes), it can be re- 6435 assigned to another use. 6437 9.5.20. 422 Unprocessable Payload 6439 The 422 (Unprocessable Payload) status code indicates that the server 6440 understands the content type of the request payload (hence a 415 6441 (Unsupported Media Type) status code is inappropriate), and the 6442 syntax of the request payload is correct, but was unable to process 6443 the contained instructions. For example, this status code can be 6444 sent if an XML request payload contains well-formed (i.e., 6445 syntactically correct), but semantically erroneous XML instructions. 6447 9.5.21. 426 Upgrade Required 6449 The 426 (Upgrade Required) status code indicates that the server 6450 refuses to perform the request using the current protocol but might 6451 be willing to do so after the client upgrades to a different 6452 protocol. The server MUST send an Upgrade header field in a 426 6453 response to indicate the required protocol(s) (Section 9.9 of 6454 [Messaging]). 6456 Example: 6458 HTTP/1.1 426 Upgrade Required 6459 Upgrade: HTTP/3.0 6460 Connection: Upgrade 6461 Content-Length: 53 6462 Content-Type: text/plain 6464 This service requires use of the HTTP/3.0 protocol. 6466 9.6. Server Error 5xx 6468 The 5xx (Server Error) class of status code indicates that the server 6469 is aware that it has erred or is incapable of performing the 6470 requested method. Except when responding to a HEAD request, the 6471 server SHOULD send a representation containing an explanation of the 6472 error situation, and whether it is a temporary or permanent 6473 condition. A user agent SHOULD display any included representation 6474 to the user. These response codes are applicable to any request 6475 method. 6477 9.6.1. 500 Internal Server Error 6479 The 500 (Internal Server Error) status code indicates that the server 6480 encountered an unexpected condition that prevented it from fulfilling 6481 the request. 6483 9.6.2. 501 Not Implemented 6485 The 501 (Not Implemented) status code indicates that the server does 6486 not support the functionality required to fulfill the request. This 6487 is the appropriate response when the server does not recognize the 6488 request method and is not capable of supporting it for any resource. 6490 A 501 response is heuristically cacheable; i.e., unless otherwise 6491 indicated by the method definition or explicit cache controls (see 6492 Section 4.2.2 of [Caching]). 6494 9.6.3. 502 Bad Gateway 6496 The 502 (Bad Gateway) status code indicates that the server, while 6497 acting as a gateway or proxy, received an invalid response from an 6498 inbound server it accessed while attempting to fulfill the request. 6500 9.6.4. 503 Service Unavailable 6502 The 503 (Service Unavailable) status code indicates that the server 6503 is currently unable to handle the request due to a temporary overload 6504 or scheduled maintenance, which will likely be alleviated after some 6505 delay. The server MAY send a Retry-After header field 6506 (Section 10.1.3) to suggest an appropriate amount of time for the 6507 client to wait before retrying the request. 6509 Note: The existence of the 503 status code does not imply that a 6510 server has to use it when becoming overloaded. Some servers might 6511 simply refuse the connection. 6513 9.6.5. 504 Gateway Timeout 6515 The 504 (Gateway Timeout) status code indicates that the server, 6516 while acting as a gateway or proxy, did not receive a timely response 6517 from an upstream server it needed to access in order to complete the 6518 request. 6520 9.6.6. 505 HTTP Version Not Supported 6522 The 505 (HTTP Version Not Supported) status code indicates that the 6523 server does not support, or refuses to support, the major version of 6524 HTTP that was used in the request message. The server is indicating 6525 that it is unable or unwilling to complete the request using the same 6526 major version as the client, as described in Section 3.5, other than 6527 with this error message. The server SHOULD generate a representation 6528 for the 505 response that describes why that version is not supported 6529 and what other protocols are supported by that server. 6531 9.7. Status Code Extensibility 6533 Additional status codes, outside the scope of this specification, 6534 have been specified for use in HTTP. All such status codes ought to 6535 be registered within the "Hypertext Transfer Protocol (HTTP) Status 6536 Code Registry". 6538 9.7.1. Status Code Registry 6540 The "Hypertext Transfer Protocol (HTTP) Status Code Registry", 6541 maintained by IANA at , registers status code numbers. 6544 A registration MUST include the following fields: 6546 o Status Code (3 digits) 6548 o Short Description 6550 o Pointer to specification text 6552 Values to be added to the HTTP status code namespace require IETF 6553 Review (see [RFC8126], Section 4.8). 6555 9.7.2. Considerations for New Status Codes 6557 When it is necessary to express semantics for a response that are not 6558 defined by current status codes, a new status code can be registered. 6559 Status codes are generic; they are potentially applicable to any 6560 resource, not just one particular media type, kind of resource, or 6561 application of HTTP. As such, it is preferred that new status codes 6562 be registered in a document that isn't specific to a single 6563 application. 6565 New status codes are required to fall under one of the categories 6566 defined in Section 9. To allow existing parsers to process the 6567 response message, new status codes cannot disallow a payload, 6568 although they can mandate a zero-length payload body. 6570 Proposals for new status codes that are not yet widely deployed ought 6571 to avoid allocating a specific number for the code until there is 6572 clear consensus that it will be registered; instead, early drafts can 6573 use a notation such as "4NN", or "3N0" .. "3N9", to indicate the 6574 class of the proposed status code(s) without consuming a number 6575 prematurely. 6577 The definition of a new status code ought to explain the request 6578 conditions that would cause a response containing that status code 6579 (e.g., combinations of request header fields and/or method(s)) along 6580 with any dependencies on response header fields (e.g., what fields 6581 are required, what fields can modify the semantics, and what field 6582 semantics are further refined when used with the new status code). 6584 The definition of a new status code ought to specify whether or not 6585 it is cacheable. Note that all status codes can be cached if the 6586 response they occur in has explicit freshness information; however, 6587 status codes that are defined as being cacheable are allowed to be 6588 cached without explicit freshness information. Likewise, the 6589 definition of a status code can place constraints upon cache 6590 behavior. See [Caching] for more information. 6592 Finally, the definition of a new status code ought to indicate 6593 whether the payload has any implied association with an identified 6594 resource (Section 6.3.2). 6596 10. Response Header Fields 6598 The response header fields allow the server to pass additional 6599 information about the response beyond what is placed in the status- 6600 line. These header fields give information about the server, about 6601 further access to the target resource, or about related resources. 6603 Although each response header field has a defined meaning, in 6604 general, the precise semantics might be further refined by the 6605 semantics of the request method and/or response status code. 6607 10.1. Control Data 6609 Response header fields can supply control data that supplements the 6610 status code, directs caching, or instructs the client where to go 6611 next. 6613 +---------------+--------------------------+ 6614 | Field Name | Defined in... | 6615 +---------------+--------------------------+ 6616 | Age | Section 5.1 of [Caching] | 6617 | Cache-Control | Section 5.2 of [Caching] | 6618 | Expires | Section 5.3 of [Caching] | 6619 | Date | Section 10.1.1.2 | 6620 | Location | Section 10.1.2 | 6621 | Retry-After | Section 10.1.3 | 6622 | Vary | Section 10.1.4 | 6623 | Warning | Section 5.5 of [Caching] | 6624 +---------------+--------------------------+ 6626 10.1.1. Origination Date 6628 10.1.1.1. Date/Time Formats 6630 Prior to 1995, there were three different formats commonly used by 6631 servers to communicate timestamps. For compatibility with old 6632 implementations, all three are defined here. The preferred format is 6633 a fixed-length and single-zone subset of the date and time 6634 specification used by the Internet Message Format [RFC5322]. 6636 HTTP-date = IMF-fixdate / obs-date 6638 An example of the preferred format is 6640 Sun, 06 Nov 1994 08:49:37 GMT ; IMF-fixdate 6642 Examples of the two obsolete formats are 6644 Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format 6645 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format 6647 A recipient that parses a timestamp value in an HTTP field MUST 6648 accept all three HTTP-date formats. When a sender generates a field 6649 that contains one or more timestamps defined as HTTP-date, the sender 6650 MUST generate those timestamps in the IMF-fixdate format. 6652 An HTTP-date value represents time as an instance of Coordinated 6653 Universal Time (UTC). The first two formats indicate UTC by the 6654 three-letter abbreviation for Greenwich Mean Time, "GMT", a 6655 predecessor of the UTC name; values in the asctime format are assumed 6656 to be in UTC. A sender that generates HTTP-date values from a local 6657 clock ought to use NTP ([RFC5905]) or some similar protocol to 6658 synchronize its clock to UTC. 6660 Preferred format: 6662 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 6663 ; fixed length/zone/capitalization subset of the format 6664 ; see Section 3.3 of [RFC5322] 6666 day-name = %s"Mon" / %s"Tue" / %s"Wed" 6667 / %s"Thu" / %s"Fri" / %s"Sat" / %s"Sun" 6669 date1 = day SP month SP year 6670 ; e.g., 02 Jun 1982 6672 day = 2DIGIT 6673 month = %s"Jan" / %s"Feb" / %s"Mar" / %s"Apr" 6674 / %s"May" / %s"Jun" / %s"Jul" / %s"Aug" 6675 / %s"Sep" / %s"Oct" / %s"Nov" / %s"Dec" 6676 year = 4DIGIT 6678 GMT = %s"GMT" 6680 time-of-day = hour ":" minute ":" second 6681 ; 00:00:00 - 23:59:60 (leap second) 6683 hour = 2DIGIT 6684 minute = 2DIGIT 6685 second = 2DIGIT 6687 Obsolete formats: 6689 obs-date = rfc850-date / asctime-date 6691 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 6692 date2 = day "-" month "-" 2DIGIT 6693 ; e.g., 02-Jun-82 6695 day-name-l = %s"Monday" / %s"Tuesday" / %s"Wednesday" 6696 / %s"Thursday" / %s"Friday" / %s"Saturday" / %s"Sunday" 6698 asctime-date = day-name SP date3 SP time-of-day SP year 6699 date3 = month SP ( 2DIGIT / ( SP 1DIGIT )) 6700 ; e.g., Jun 2 6702 HTTP-date is case sensitive. A sender MUST NOT generate additional 6703 whitespace in an HTTP-date beyond that specifically included as SP in 6704 the grammar. The semantics of day-name, day, month, year, and time- 6705 of-day are the same as those defined for the Internet Message Format 6706 constructs with the corresponding name ([RFC5322], Section 3.3). 6708 Recipients of a timestamp value in rfc850-date format, which uses a 6709 two-digit year, MUST interpret a timestamp that appears to be more 6710 than 50 years in the future as representing the most recent year in 6711 the past that had the same last two digits. 6713 Recipients of timestamp values are encouraged to be robust in parsing 6714 timestamps unless otherwise restricted by the field definition. For 6715 example, messages are occasionally forwarded over HTTP from a non- 6716 HTTP source that might generate any of the date and time 6717 specifications defined by the Internet Message Format. 6719 Note: HTTP requirements for the date/time stamp format apply only 6720 to their usage within the protocol stream. Implementations are 6721 not required to use these formats for user presentation, request 6722 logging, etc. 6724 10.1.1.2. Date 6726 The "Date" header field represents the date and time at which the 6727 message was originated, having the same semantics as the Origination 6728 Date Field (orig-date) defined in Section 3.6.1 of [RFC5322]. The 6729 field value is an HTTP-date, as defined in Section 10.1.1.1. 6731 Date = HTTP-date 6733 An example is 6735 Date: Tue, 15 Nov 1994 08:12:31 GMT 6737 When a Date header field is generated, the sender SHOULD generate its 6738 field value as the best available approximation of the date and time 6739 of message generation. In theory, the date ought to represent the 6740 moment just before the payload is generated. In practice, the date 6741 can be generated at any time during message origination. 6743 An origin server MUST NOT send a Date header field if it does not 6744 have a clock capable of providing a reasonable approximation of the 6745 current instance in Coordinated Universal Time. An origin server MAY 6746 send a Date header field if the response is in the 1xx 6747 (Informational) or 5xx (Server Error) class of status codes. An 6748 origin server MUST send a Date header field in all other cases. 6750 A recipient with a clock that receives a response message without a 6751 Date header field MUST record the time it was received and append a 6752 corresponding Date header field to the message's header section if it 6753 is cached or forwarded downstream. 6755 A user agent MAY send a Date header field in a request, though 6756 generally will not do so unless it is believed to convey useful 6757 information to the server. For example, custom applications of HTTP 6758 might convey a Date if the server is expected to adjust its 6759 interpretation of the user's request based on differences between the 6760 user agent and server clocks. 6762 10.1.2. Location 6764 The "Location" header field is used in some responses to refer to a 6765 specific resource in relation to the response. The type of 6766 relationship is defined by the combination of request method and 6767 status code semantics. 6769 Location = URI-reference 6771 The field value consists of a single URI-reference. When it has the 6772 form of a relative reference ([RFC3986], Section 4.2), the final 6773 value is computed by resolving it against the effective request URI 6774 ([RFC3986], Section 5). 6776 For 201 (Created) responses, the Location value refers to the primary 6777 resource created by the request. For 3xx (Redirection) responses, 6778 the Location value refers to the preferred target resource for 6779 automatically redirecting the request. 6781 If the Location value provided in a 3xx (Redirection) response does 6782 not have a fragment component, a user agent MUST process the 6783 redirection as if the value inherits the fragment component of the 6784 URI reference used to generate the request target (i.e., the 6785 redirection inherits the original reference's fragment, if any). 6787 For example, a GET request generated for the URI reference 6788 "http://www.example.org/~tim" might result in a 303 (See Other) 6789 response containing the header field: 6791 Location: /People.html#tim 6793 which suggests that the user agent redirect to 6794 "http://www.example.org/People.html#tim" 6796 Likewise, a GET request generated for the URI reference 6797 "http://www.example.org/index.html#larry" might result in a 301 6798 (Moved Permanently) response containing the header field: 6800 Location: http://www.example.net/index.html 6802 which suggests that the user agent redirect to 6803 "http://www.example.net/index.html#larry", preserving the original 6804 fragment identifier. 6806 There are circumstances in which a fragment identifier in a Location 6807 value would not be appropriate. For example, the Location header 6808 field in a 201 (Created) response is supposed to provide a URI that 6809 is specific to the created resource. 6811 Note: Some recipients attempt to recover from Location fields that 6812 are not valid URI references. This specification does not mandate 6813 or define such processing, but does allow it for the sake of 6814 robustness. 6816 Note: The Content-Location header field (Section 6.2.5) differs 6817 from Location in that the Content-Location refers to the most 6818 specific resource corresponding to the enclosed representation. 6819 It is therefore possible for a response to contain both the 6820 Location and Content-Location header fields. 6822 10.1.3. Retry-After 6824 Servers send the "Retry-After" header field to indicate how long the 6825 user agent ought to wait before making a follow-up request. When 6826 sent with a 503 (Service Unavailable) response, Retry-After indicates 6827 how long the service is expected to be unavailable to the client. 6828 When sent with any 3xx (Redirection) response, Retry-After indicates 6829 the minimum time that the user agent is asked to wait before issuing 6830 the redirected request. 6832 The value of this field can be either an HTTP-date or a number of 6833 seconds to delay after the response is received. 6835 Retry-After = HTTP-date / delay-seconds 6837 A delay-seconds value is a non-negative decimal integer, representing 6838 time in seconds. 6840 delay-seconds = 1*DIGIT 6842 Two examples of its use are 6844 Retry-After: Fri, 31 Dec 1999 23:59:59 GMT 6845 Retry-After: 120 6847 In the latter example, the delay is 2 minutes. 6849 10.1.4. Vary 6851 The "Vary" header field in a response describes what parts of a 6852 request message, aside from the method, Host header field, and 6853 request target, might influence the origin server's process for 6854 selecting and representing this response. The value consists of 6855 either a single asterisk ("*") or a list of header field names (case- 6856 insensitive). 6858 Vary = "*" / 1#field-name 6860 A Vary field value of "*" signals that anything about the request 6861 might play a role in selecting the response representation, possibly 6862 including elements outside the message syntax (e.g., the client's 6863 network address). A recipient will not be able to determine whether 6864 this response is appropriate for a later request without forwarding 6865 the request to the origin server. A proxy MUST NOT generate a Vary 6866 field with a "*" value. 6868 A Vary field value consisting of a list of field names indicates that 6869 the named request header fields, known as the selecting header 6870 fields, might have a role in selecting the representation. The 6871 potential selecting header fields are not limited to those defined by 6872 this specification. 6874 For example, a response that contains 6876 Vary: accept-encoding, accept-language 6878 indicates that the origin server might have used the request's 6879 Accept-Encoding and Accept-Language fields (or lack thereof) as 6880 determining factors while choosing the content for this response. 6882 An origin server might send Vary with a list of fields for two 6883 purposes: 6885 1. To inform cache recipients that they MUST NOT use this response 6886 to satisfy a later request unless the later request has the same 6887 values for the listed fields as the original request (Section 4.1 6888 of [Caching]). In other words, Vary expands the cache key 6889 required to match a new request to the stored cache entry. 6891 2. To inform user agent recipients that this response is subject to 6892 content negotiation (Section 8.4) and that a different 6893 representation might be sent in a subsequent request if 6894 additional parameters are provided in the listed header fields 6895 (proactive negotiation). 6897 An origin server SHOULD send a Vary header field when its algorithm 6898 for selecting a representation varies based on aspects of the request 6899 message other than the method and request target, unless the variance 6900 cannot be crossed or the origin server has been deliberately 6901 configured to prevent cache transparency. For example, there is no 6902 need to send the Authorization field name in Vary because reuse 6903 across users is constrained by the field definition (Section 8.5.3). 6904 Likewise, an origin server might use Cache-Control response 6905 directives (Section 5.2 of [Caching]) to supplant Vary if it 6906 considers the variance less significant than the performance cost of 6907 Vary's impact on caching. 6909 10.2. Validators 6911 Validator header fields convey metadata about the selected 6912 representation (Section 6). In responses to safe requests, validator 6913 fields describe the selected representation chosen by the origin 6914 server while handling the response. Note that, depending on the 6915 status code semantics, the selected representation for a given 6916 response is not necessarily the same as the representation enclosed 6917 as response payload. 6919 In a successful response to a state-changing request, validator 6920 fields describe the new representation that has replaced the prior 6921 selected representation as a result of processing the request. 6923 For example, an ETag field in a 201 (Created) response communicates 6924 the entity-tag of the newly created resource's representation, so 6925 that it can be used in later conditional requests to prevent the 6926 "lost update" problem Section 8.2. 6928 +---------------+----------------+ 6929 | Field Name | Defined in... | 6930 +---------------+----------------+ 6931 | ETag | Section 10.2.3 | 6932 | Last-Modified | Section 10.2.2 | 6933 +---------------+----------------+ 6935 This specification defines two forms of metadata that are commonly 6936 used to observe resource state and test for preconditions: 6937 modification dates (Section 10.2.2) and opaque entity tags 6938 (Section 10.2.3). Additional metadata that reflects resource state 6939 has been defined by various extensions of HTTP, such as Web 6940 Distributed Authoring and Versioning (WebDAV, [RFC4918]), that are 6941 beyond the scope of this specification. A resource metadata value is 6942 referred to as a "validator" when it is used within a precondition. 6944 10.2.1. Weak versus Strong 6946 Validators come in two flavors: strong or weak. Weak validators are 6947 easy to generate but are far less useful for comparisons. Strong 6948 validators are ideal for comparisons but can be very difficult (and 6949 occasionally impossible) to generate efficiently. Rather than impose 6950 that all forms of resource adhere to the same strength of validator, 6951 HTTP exposes the type of validator in use and imposes restrictions on 6952 when weak validators can be used as preconditions. 6954 A "strong validator" is representation metadata that changes value 6955 whenever a change occurs to the representation data that would be 6956 observable in the payload body of a 200 (OK) response to GET. 6958 A strong validator might change for reasons other than a change to 6959 the representation data, such as when a semantically significant part 6960 of the representation metadata is changed (e.g., Content-Type), but 6961 it is in the best interests of the origin server to only change the 6962 value when it is necessary to invalidate the stored responses held by 6963 remote caches and authoring tools. 6965 Cache entries might persist for arbitrarily long periods, regardless 6966 of expiration times. Thus, a cache might attempt to validate an 6967 entry using a validator that it obtained in the distant past. A 6968 strong validator is unique across all versions of all representations 6969 associated with a particular resource over time. However, there is 6970 no implication of uniqueness across representations of different 6971 resources (i.e., the same strong validator might be in use for 6972 representations of multiple resources at the same time and does not 6973 imply that those representations are equivalent). 6975 There are a variety of strong validators used in practice. The best 6976 are based on strict revision control, wherein each change to a 6977 representation always results in a unique node name and revision 6978 identifier being assigned before the representation is made 6979 accessible to GET. A collision-resistant hash function applied to 6980 the representation data is also sufficient if the data is available 6981 prior to the response header fields being sent and the digest does 6982 not need to be recalculated every time a validation request is 6983 received. However, if a resource has distinct representations that 6984 differ only in their metadata, such as might occur with content 6985 negotiation over media types that happen to share the same data 6986 format, then the origin server needs to incorporate additional 6987 information in the validator to distinguish those representations. 6989 In contrast, a "weak validator" is representation metadata that might 6990 not change for every change to the representation data. This 6991 weakness might be due to limitations in how the value is calculated, 6992 such as clock resolution, an inability to ensure uniqueness for all 6993 possible representations of the resource, or a desire of the resource 6994 owner to group representations by some self-determined set of 6995 equivalency rather than unique sequences of data. An origin server 6996 SHOULD change a weak entity-tag whenever it considers prior 6997 representations to be unacceptable as a substitute for the current 6998 representation. In other words, a weak entity-tag ought to change 6999 whenever the origin server wants caches to invalidate old responses. 7001 For example, the representation of a weather report that changes in 7002 content every second, based on dynamic measurements, might be grouped 7003 into sets of equivalent representations (from the origin server's 7004 perspective) with the same weak validator in order to allow cached 7005 representations to be valid for a reasonable period of time (perhaps 7006 adjusted dynamically based on server load or weather quality). 7007 Likewise, a representation's modification time, if defined with only 7008 one-second resolution, might be a weak validator if it is possible 7009 for the representation to be modified twice during a single second 7010 and retrieved between those modifications. 7012 Likewise, a validator is weak if it is shared by two or more 7013 representations of a given resource at the same time, unless those 7014 representations have identical representation data. For example, if 7015 the origin server sends the same validator for a representation with 7016 a gzip content coding applied as it does for a representation with no 7017 content coding, then that validator is weak. However, two 7018 simultaneous representations might share the same strong validator if 7019 they differ only in the representation metadata, such as when two 7020 different media types are available for the same representation data. 7022 Strong validators are usable for all conditional requests, including 7023 cache validation, partial content ranges, and "lost update" 7024 avoidance. Weak validators are only usable when the client does not 7025 require exact equality with previously obtained representation data, 7026 such as when validating a cache entry or limiting a web traversal to 7027 recent changes. 7029 10.2.2. Last-Modified 7031 The "Last-Modified" header field in a response provides a timestamp 7032 indicating the date and time at which the origin server believes the 7033 selected representation was last modified, as determined at the 7034 conclusion of handling the request. 7036 Last-Modified = HTTP-date 7038 An example of its use is 7039 Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT 7041 10.2.2.1. Generation 7043 An origin server SHOULD send Last-Modified for any selected 7044 representation for which a last modification date can be reasonably 7045 and consistently determined, since its use in conditional requests 7046 and evaluating cache freshness ([Caching]) results in a substantial 7047 reduction of HTTP traffic on the Internet and can be a significant 7048 factor in improving service scalability and reliability. 7050 A representation is typically the sum of many parts behind the 7051 resource interface. The last-modified time would usually be the most 7052 recent time that any of those parts were changed. How that value is 7053 determined for any given resource is an implementation detail beyond 7054 the scope of this specification. What matters to HTTP is how 7055 recipients of the Last-Modified header field can use its value to 7056 make conditional requests and test the validity of locally cached 7057 responses. 7059 An origin server SHOULD obtain the Last-Modified value of the 7060 representation as close as possible to the time that it generates the 7061 Date field value for its response. This allows a recipient to make 7062 an accurate assessment of the representation's modification time, 7063 especially if the representation changes near the time that the 7064 response is generated. 7066 An origin server with a clock MUST NOT send a Last-Modified date that 7067 is later than the server's time of message origination (Date). If 7068 the last modification time is derived from implementation-specific 7069 metadata that evaluates to some time in the future, according to the 7070 origin server's clock, then the origin server MUST replace that value 7071 with the message origination date. This prevents a future 7072 modification date from having an adverse impact on cache validation. 7074 An origin server without a clock MUST NOT assign Last-Modified values 7075 to a response unless these values were associated with the resource 7076 by some other system or user with a reliable clock. 7078 10.2.2.2. Comparison 7080 A Last-Modified time, when used as a validator in a request, is 7081 implicitly weak unless it is possible to deduce that it is strong, 7082 using the following rules: 7084 o The validator is being compared by an origin server to the actual 7085 current validator for the representation and, 7087 o That origin server reliably knows that the associated 7088 representation did not change twice during the second covered by 7089 the presented validator. 7091 or 7093 o The validator is about to be used by a client in an If-Modified- 7094 Since, If-Unmodified-Since, or If-Range header field, because the 7095 client has a cache entry for the associated representation, and 7097 o That cache entry includes a Date value, which gives the time when 7098 the origin server sent the original response, and 7100 o The presented Last-Modified time is at least 60 seconds before the 7101 Date value. 7103 or 7105 o The validator is being compared by an intermediate cache to the 7106 validator stored in its cache entry for the representation, and 7108 o That cache entry includes a Date value, which gives the time when 7109 the origin server sent the original response, and 7111 o The presented Last-Modified time is at least 60 seconds before the 7112 Date value. 7114 This method relies on the fact that if two different responses were 7115 sent by the origin server during the same second, but both had the 7116 same Last-Modified time, then at least one of those responses would 7117 have a Date value equal to its Last-Modified time. The arbitrary 7118 60-second limit guards against the possibility that the Date and 7119 Last-Modified values are generated from different clocks or at 7120 somewhat different times during the preparation of the response. An 7121 implementation MAY use a value larger than 60 seconds, if it is 7122 believed that 60 seconds is too short. 7124 10.2.3. ETag 7126 The "ETag" field in a response provides the current entity-tag for 7127 the selected representation, as determined at the conclusion of 7128 handling the request. An entity-tag is an opaque validator for 7129 differentiating between multiple representations of the same 7130 resource, regardless of whether those multiple representations are 7131 due to resource state changes over time, content negotiation 7132 resulting in multiple representations being valid at the same time, 7133 or both. An entity-tag consists of an opaque quoted string, possibly 7134 prefixed by a weakness indicator. 7136 ETag = entity-tag 7138 entity-tag = [ weak ] opaque-tag 7139 weak = %s"W/" 7140 opaque-tag = DQUOTE *etagc DQUOTE 7141 etagc = %x21 / %x23-7E / obs-text 7142 ; VCHAR except double quotes, plus obs-text 7144 Note: Previously, opaque-tag was defined to be a quoted-string 7145 ([RFC2616], Section 3.11); thus, some recipients might perform 7146 backslash unescaping. Servers therefore ought to avoid backslash 7147 characters in entity tags. 7149 An entity-tag can be more reliable for validation than a modification 7150 date in situations where it is inconvenient to store modification 7151 dates, where the one-second resolution of HTTP date values is not 7152 sufficient, or where modification dates are not consistently 7153 maintained. 7155 Examples: 7157 ETag: "xyzzy" 7158 ETag: W/"xyzzy" 7159 ETag: "" 7161 An entity-tag can be either a weak or strong validator, with strong 7162 being the default. If an origin server provides an entity-tag for a 7163 representation and the generation of that entity-tag does not satisfy 7164 all of the characteristics of a strong validator (Section 10.2.1), 7165 then the origin server MUST mark the entity-tag as weak by prefixing 7166 its opaque value with "W/" (case-sensitive). 7168 A sender MAY send the Etag field in a trailer section (see 7169 Section 4.6). However, since trailers are often ignored, it is 7170 preferable to send Etag as a header field unless the entity-tag is 7171 generated while sending the message body. 7173 10.2.3.1. Generation 7175 The principle behind entity-tags is that only the service author 7176 knows the implementation of a resource well enough to select the most 7177 accurate and efficient validation mechanism for that resource, and 7178 that any such mechanism can be mapped to a simple sequence of octets 7179 for easy comparison. Since the value is opaque, there is no need for 7180 the client to be aware of how each entity-tag is constructed. 7182 For example, a resource that has implementation-specific versioning 7183 applied to all changes might use an internal revision number, perhaps 7184 combined with a variance identifier for content negotiation, to 7185 accurately differentiate between representations. Other 7186 implementations might use a collision-resistant hash of 7187 representation content, a combination of various file attributes, or 7188 a modification timestamp that has sub-second resolution. 7190 An origin server SHOULD send an ETag for any selected representation 7191 for which detection of changes can be reasonably and consistently 7192 determined, since the entity-tag's use in conditional requests and 7193 evaluating cache freshness ([Caching]) can result in a substantial 7194 reduction of HTTP network traffic and can be a significant factor in 7195 improving service scalability and reliability. 7197 10.2.3.2. Comparison 7199 There are two entity-tag comparison functions, depending on whether 7200 or not the comparison context allows the use of weak validators: 7202 o Strong comparison: two entity-tags are equivalent if both are not 7203 weak and their opaque-tags match character-by-character. 7205 o Weak comparison: two entity-tags are equivalent if their opaque- 7206 tags match character-by-character, regardless of either or both 7207 being tagged as "weak". 7209 The example below shows the results for a set of entity-tag pairs and 7210 both the weak and strong comparison function results: 7212 +--------+--------+-------------------+-----------------+ 7213 | ETag 1 | ETag 2 | Strong Comparison | Weak Comparison | 7214 +--------+--------+-------------------+-----------------+ 7215 | W/"1" | W/"1" | no match | match | 7216 | W/"1" | W/"2" | no match | no match | 7217 | W/"1" | "1" | no match | match | 7218 | "1" | "1" | match | match | 7219 +--------+--------+-------------------+-----------------+ 7221 10.2.3.3. Example: Entity-Tags Varying on Content-Negotiated Resources 7223 Consider a resource that is subject to content negotiation 7224 (Section 6.4), and where the representations sent in response to a 7225 GET request vary based on the Accept-Encoding request header field 7226 (Section 8.4.4): 7228 >> Request: 7230 GET /index HTTP/1.1 7231 Host: www.example.com 7232 Accept-Encoding: gzip 7234 In this case, the response might or might not use the gzip content 7235 coding. If it does not, the response might look like: 7237 >> Response: 7239 HTTP/1.1 200 OK 7240 Date: Fri, 26 Mar 2010 00:05:00 GMT 7241 ETag: "123-a" 7242 Content-Length: 70 7243 Vary: Accept-Encoding 7244 Content-Type: text/plain 7246 Hello World! 7247 Hello World! 7248 Hello World! 7249 Hello World! 7250 Hello World! 7252 An alternative representation that does use gzip content coding would 7253 be: 7255 >> Response: 7257 HTTP/1.1 200 OK 7258 Date: Fri, 26 Mar 2010 00:05:00 GMT 7259 ETag: "123-b" 7260 Content-Length: 43 7261 Vary: Accept-Encoding 7262 Content-Type: text/plain 7263 Content-Encoding: gzip 7265 ...binary data... 7267 Note: Content codings are a property of the representation data, 7268 so a strong entity-tag for a content-encoded representation has to 7269 be distinct from the entity tag of an unencoded representation to 7270 prevent potential conflicts during cache updates and range 7271 requests. In contrast, transfer codings (Section 7 of 7272 [Messaging]) apply only during message transfer and do not result 7273 in distinct entity-tags. 7275 10.2.4. When to Use Entity-Tags and Last-Modified Dates 7277 In 200 (OK) responses to GET or HEAD, an origin server: 7279 o SHOULD send an entity-tag validator unless it is not feasible to 7280 generate one. 7282 o MAY send a weak entity-tag instead of a strong entity-tag, if 7283 performance considerations support the use of weak entity-tags, or 7284 if it is unfeasible to send a strong entity-tag. 7286 o SHOULD send a Last-Modified value if it is feasible to send one. 7288 In other words, the preferred behavior for an origin server is to 7289 send both a strong entity-tag and a Last-Modified value in successful 7290 responses to a retrieval request. 7292 A client: 7294 o MUST send that entity-tag in any cache validation request (using 7295 If-Match or If-None-Match) if an entity-tag has been provided by 7296 the origin server. 7298 o SHOULD send the Last-Modified value in non-subrange cache 7299 validation requests (using If-Modified-Since) if only a Last- 7300 Modified value has been provided by the origin server. 7302 o MAY send the Last-Modified value in subrange cache validation 7303 requests (using If-Unmodified-Since) if only a Last-Modified value 7304 has been provided by an HTTP/1.0 origin server. The user agent 7305 SHOULD provide a way to disable this, in case of difficulty. 7307 o SHOULD send both validators in cache validation requests if both 7308 an entity-tag and a Last-Modified value have been provided by the 7309 origin server. This allows both HTTP/1.0 and HTTP/1.1 caches to 7310 respond appropriately. 7312 10.3. Authentication Challenges 7314 Authentication challenges indicate what mechanisms are available for 7315 the client to provide authentication credentials in future requests. 7317 +--------------------+----------------+ 7318 | Field Name | Defined in... | 7319 +--------------------+----------------+ 7320 | WWW-Authenticate | Section 10.3.1 | 7321 | Proxy-Authenticate | Section 10.3.2 | 7322 +--------------------+----------------+ 7323 Furthermore, the "Authentication-Info" and "Proxy-Authentication- 7324 Info" response header fields are defined for use in authentication 7325 schemes that need to return information once the client's 7326 authentication credentials have been accepted. 7328 +---------------------------+----------------+ 7329 | Field Name | Defined in... | 7330 +---------------------------+----------------+ 7331 | Authentication-Info | Section 10.3.3 | 7332 | Proxy-Authentication-Info | Section 10.3.4 | 7333 +---------------------------+----------------+ 7335 10.3.1. WWW-Authenticate 7337 The "WWW-Authenticate" header field indicates the authentication 7338 scheme(s) and parameters applicable to the target resource. 7340 WWW-Authenticate = 1#challenge 7342 A server generating a 401 (Unauthorized) response MUST send a WWW- 7343 Authenticate header field containing at least one challenge. A 7344 server MAY generate a WWW-Authenticate header field in other response 7345 messages to indicate that supplying credentials (or different 7346 credentials) might affect the response. 7348 A proxy forwarding a response MUST NOT modify any WWW-Authenticate 7349 fields in that response. 7351 User agents are advised to take special care in parsing the field 7352 value, as it might contain more than one challenge, and each 7353 challenge can contain a comma-separated list of authentication 7354 parameters. Furthermore, the header field itself can occur multiple 7355 times. 7357 For instance: 7359 WWW-Authenticate: Newauth realm="apps", type=1, 7360 title="Login to \"apps\"", Basic realm="simple" 7362 This header field contains two challenges; one for the "Newauth" 7363 scheme with a realm value of "apps", and two additional parameters 7364 "type" and "title", and another one for the "Basic" scheme with a 7365 realm value of "simple". 7367 Note: The challenge grammar production uses the list syntax as 7368 well. Therefore, a sequence of comma, whitespace, and comma can 7369 be considered either as applying to the preceding challenge, or to 7370 be an empty entry in the list of challenges. In practice, this 7371 ambiguity does not affect the semantics of the header field value 7372 and thus is harmless. 7374 10.3.2. Proxy-Authenticate 7376 The "Proxy-Authenticate" header field consists of at least one 7377 challenge that indicates the authentication scheme(s) and parameters 7378 applicable to the proxy for this effective request URI (Section 5.5). 7379 A proxy MUST send at least one Proxy-Authenticate header field in 7380 each 407 (Proxy Authentication Required) response that it generates. 7382 Proxy-Authenticate = 1#challenge 7384 Unlike WWW-Authenticate, the Proxy-Authenticate header field applies 7385 only to the next outbound client on the response chain. This is 7386 because only the client that chose a given proxy is likely to have 7387 the credentials necessary for authentication. However, when multiple 7388 proxies are used within the same administrative domain, such as 7389 office and regional caching proxies within a large corporate network, 7390 it is common for credentials to be generated by the user agent and 7391 passed through the hierarchy until consumed. Hence, in such a 7392 configuration, it will appear as if Proxy-Authenticate is being 7393 forwarded because each proxy will send the same challenge set. 7395 Note that the parsing considerations for WWW-Authenticate apply to 7396 this header field as well; see Section 10.3.1 for details. 7398 10.3.3. Authentication-Info 7400 HTTP authentication schemes can use the Authentication-Info response 7401 header field to communicate information after the client's 7402 authentication credentials have been accepted. This information can 7403 include a finalization message from the server (e.g., it can contain 7404 the server authentication). 7406 The field value is a list of parameters (name/value pairs), using the 7407 "auth-param" syntax defined in Section 8.5.1. This specification 7408 only describes the generic format; authentication schemes using 7409 Authentication-Info will define the individual parameters. The 7410 "Digest" Authentication Scheme, for instance, defines multiple 7411 parameters in Section 3.5 of [RFC7616]. 7413 Authentication-Info = #auth-param 7415 The Authentication-Info header field can be used in any HTTP 7416 response, independently of request method and status code. Its 7417 semantics are defined by the authentication scheme indicated by the 7418 Authorization header field (Section 8.5.3) of the corresponding 7419 request. 7421 A proxy forwarding a response is not allowed to modify the field 7422 value in any way. 7424 Authentication-Info can be used inside trailers (Section 7.1.2 of 7425 [Messaging]) when the authentication scheme explicitly allows this. 7427 10.3.3.1. Parameter Value Format 7429 Parameter values can be expressed either as "token" or as "quoted- 7430 string" (Section 4.4.1). 7432 Authentication scheme definitions need to allow both notations, both 7433 for senders and recipients. This allows recipients to use generic 7434 parsing components, independent of the authentication scheme in use. 7436 For backwards compatibility, authentication scheme definitions can 7437 restrict the format for senders to one of the two variants. This can 7438 be important when it is known that deployed implementations will fail 7439 when encountering one of the two formats. 7441 10.3.4. Proxy-Authentication-Info 7443 The Proxy-Authentication-Info response header field is equivalent to 7444 Authentication-Info, except that it applies to proxy authentication 7445 (Section 8.5.1) and its semantics are defined by the authentication 7446 scheme indicated by the Proxy-Authorization header field 7447 (Section 8.5.4) of the corresponding request: 7449 Proxy-Authentication-Info = #auth-param 7451 However, unlike Authentication-Info, the Proxy-Authentication-Info 7452 header field applies only to the next outbound client on the response 7453 chain. This is because only the client that chose a given proxy is 7454 likely to have the credentials necessary for authentication. 7455 However, when multiple proxies are used within the same 7456 administrative domain, such as office and regional caching proxies 7457 within a large corporate network, it is common for credentials to be 7458 generated by the user agent and passed through the hierarchy until 7459 consumed. Hence, in such a configuration, it will appear as if 7460 Proxy-Authentication-Info is being forwarded because each proxy will 7461 send the same field value. 7463 10.4. Response Context 7465 The remaining response header fields provide more information about 7466 the target resource for potential use in later requests. 7468 +---------------+----------------+ 7469 | Field Name | Defined in... | 7470 +---------------+----------------+ 7471 | Accept-Ranges | Section 10.4.1 | 7472 | Allow | Section 10.4.2 | 7473 | Server | Section 10.4.3 | 7474 +---------------+----------------+ 7476 10.4.1. Accept-Ranges 7478 The "Accept-Ranges" header field allows a server to indicate that it 7479 supports range requests for the target resource. 7481 Accept-Ranges = acceptable-ranges 7482 acceptable-ranges = 1#range-unit / "none" 7484 An origin server that supports byte-range requests for a given target 7485 resource MAY send 7487 Accept-Ranges: bytes 7489 to indicate what range units are supported. A client MAY generate 7490 range requests without having received this header field for the 7491 resource involved. Range units are defined in Section 6.1.4. 7493 A server that does not support any kind of range request for the 7494 target resource MAY send 7496 Accept-Ranges: none 7498 to advise the client not to attempt a range request. 7500 10.4.2. Allow 7502 The "Allow" header field lists the set of methods advertised as 7503 supported by the target resource. The purpose of this field is 7504 strictly to inform the recipient of valid request methods associated 7505 with the resource. 7507 Allow = #method 7509 Example of use: 7511 Allow: GET, HEAD, PUT 7513 The actual set of allowed methods is defined by the origin server at 7514 the time of each request. An origin server MUST generate an Allow 7515 field in a 405 (Method Not Allowed) response and MAY do so in any 7516 other response. An empty Allow field value indicates that the 7517 resource allows no methods, which might occur in a 405 response if 7518 the resource has been temporarily disabled by configuration. 7520 A proxy MUST NOT modify the Allow header field -- it does not need to 7521 understand all of the indicated methods in order to handle them 7522 according to the generic message handling rules. 7524 10.4.3. Server 7526 The "Server" header field contains information about the software 7527 used by the origin server to handle the request, which is often used 7528 by clients to help identify the scope of reported interoperability 7529 problems, to work around or tailor requests to avoid particular 7530 server limitations, and for analytics regarding server or operating 7531 system use. An origin server MAY generate a Server field in its 7532 responses. 7534 Server = product *( RWS ( product / comment ) ) 7536 The Server field value consists of one or more product identifiers, 7537 each followed by zero or more comments (Section 4.4.1.3), which 7538 together identify the origin server software and its significant 7539 subproducts. By convention, the product identifiers are listed in 7540 decreasing order of their significance for identifying the origin 7541 server software. Each product identifier consists of a name and 7542 optional version, as defined in Section 8.6.3. 7544 Example: 7546 Server: CERN/3.0 libwww/2.17 7548 An origin server SHOULD NOT generate a Server field containing 7549 needlessly fine-grained detail and SHOULD limit the addition of 7550 subproducts by third parties. Overly long and detailed Server field 7551 values increase response latency and potentially reveal internal 7552 implementation details that might make it (slightly) easier for 7553 attackers to find and exploit known security holes. 7555 11. Security Considerations 7557 This section is meant to inform developers, information providers, 7558 and users of known security concerns relevant to HTTP semantics and 7559 its use for transferring information over the Internet. 7560 Considerations related to message syntax, parsing, and routing are 7561 discussed in Section 11 of [Messaging]. 7563 The list of considerations below is not exhaustive. Most security 7564 concerns related to HTTP semantics are about securing server-side 7565 applications (code behind the HTTP interface), securing user agent 7566 processing of payloads received via HTTP, or secure use of the 7567 Internet in general, rather than security of the protocol. Various 7568 organizations maintain topical information and links to current 7569 research on Web application security (e.g., [OWASP]). 7571 11.1. Establishing Authority 7573 HTTP relies on the notion of an authoritative response: a response 7574 that has been determined by (or at the direction of) the origin 7575 server identified within the target URI to be the most appropriate 7576 response for that request given the state of the target resource at 7577 the time of response message origination. 7579 When a registered name is used in the authority component, the "http" 7580 URI scheme (Section 2.5.1) relies on the user's local name resolution 7581 service to determine where it can find authoritative responses. This 7582 means that any attack on a user's network host table, cached names, 7583 or name resolution libraries becomes an avenue for attack on 7584 establishing authority for "http" URIs. Likewise, the user's choice 7585 of server for Domain Name Service (DNS), and the hierarchy of servers 7586 from which it obtains resolution results, could impact the 7587 authenticity of address mappings; DNS Security Extensions (DNSSEC, 7588 [RFC4033]) are one way to improve authenticity. 7590 Furthermore, after an IP address is obtained, establishing authority 7591 for an "http" URI is vulnerable to attacks on Internet Protocol 7592 routing. 7594 The "https" scheme (Section 2.5.2) is intended to prevent (or at 7595 least reveal) many of these potential attacks on establishing 7596 authority, provided that the negotiated TLS connection is secured and 7597 the client properly verifies that the communicating server's identity 7598 matches the target URI's authority component (Section 5.4.3.1). 7599 Correctly implementing such verification can be difficult (see 7600 [Georgiev]). 7602 Authority for a given origin server can be delegated through protocol 7603 extensions; for example, [RFC7838]. Likewise, the set of servers 7604 that a connection is considered authoritative for can be changed with 7605 a protocol extension like [RFC8336]. 7607 Providing a response from a non-authoritative source, such as a 7608 shared proxy cache, is often useful to improve performance and 7609 availability, but only to the extent that the source can be trusted 7610 or the distrusted response can be safely used. 7612 Unfortunately, communicating authority to users can be difficult. 7613 For example, phishing is an attack on the user's perception of 7614 authority, where that perception can be misled by presenting similar 7615 branding in hypertext, possibly aided by userinfo obfuscating the 7616 authority component (see Section 2.5.1). User agents can reduce the 7617 impact of phishing attacks by enabling users to easily inspect a 7618 target URI prior to making an action, by prominently distinguishing 7619 (or rejecting) userinfo when present, and by not sending stored 7620 credentials and cookies when the referring document is from an 7621 unknown or untrusted source. 7623 11.2. Risks of Intermediaries 7625 By their very nature, HTTP intermediaries are men-in-the-middle and, 7626 thus, represent an opportunity for man-in-the-middle attacks. 7627 Compromise of the systems on which the intermediaries run can result 7628 in serious security and privacy problems. Intermediaries might have 7629 access to security-related information, personal information about 7630 individual users and organizations, and proprietary information 7631 belonging to users and content providers. A compromised 7632 intermediary, or an intermediary implemented or configured without 7633 regard to security and privacy considerations, might be used in the 7634 commission of a wide range of potential attacks. 7636 Intermediaries that contain a shared cache are especially vulnerable 7637 to cache poisoning attacks, as described in Section 7 of [Caching]. 7639 Implementers need to consider the privacy and security implications 7640 of their design and coding decisions, and of the configuration 7641 options they provide to operators (especially the default 7642 configuration). 7644 Users need to be aware that intermediaries are no more trustworthy 7645 than the people who run them; HTTP itself cannot solve this problem. 7647 11.3. Attacks Based on File and Path Names 7649 Origin servers frequently make use of their local file system to 7650 manage the mapping from effective request URI to resource 7651 representations. Most file systems are not designed to protect 7652 against malicious file or path names. Therefore, an origin server 7653 needs to avoid accessing names that have a special significance to 7654 the system when mapping the request target to files, folders, or 7655 directories. 7657 For example, UNIX, Microsoft Windows, and other operating systems use 7658 ".." as a path component to indicate a directory level above the 7659 current one, and they use specially named paths or file names to send 7660 data to system devices. Similar naming conventions might exist 7661 within other types of storage systems. Likewise, local storage 7662 systems have an annoying tendency to prefer user-friendliness over 7663 security when handling invalid or unexpected characters, 7664 recomposition of decomposed characters, and case-normalization of 7665 case-insensitive names. 7667 Attacks based on such special names tend to focus on either denial- 7668 of-service (e.g., telling the server to read from a COM port) or 7669 disclosure of configuration and source files that are not meant to be 7670 served. 7672 11.4. Attacks Based on Command, Code, or Query Injection 7674 Origin servers often use parameters within the URI as a means of 7675 identifying system services, selecting database entries, or choosing 7676 a data source. However, data received in a request cannot be 7677 trusted. An attacker could construct any of the request data 7678 elements (method, request-target, header fields, or body) to contain 7679 data that might be misinterpreted as a command, code, or query when 7680 passed through a command invocation, language interpreter, or 7681 database interface. 7683 For example, SQL injection is a common attack wherein additional 7684 query language is inserted within some part of the request-target or 7685 header fields (e.g., Host, Referer, etc.). If the received data is 7686 used directly within a SELECT statement, the query language might be 7687 interpreted as a database command instead of a simple string value. 7688 This type of implementation vulnerability is extremely common, in 7689 spite of being easy to prevent. 7691 In general, resource implementations ought to avoid use of request 7692 data in contexts that are processed or interpreted as instructions. 7693 Parameters ought to be compared to fixed strings and acted upon as a 7694 result of that comparison, rather than passed through an interface 7695 that is not prepared for untrusted data. Received data that isn't 7696 based on fixed parameters ought to be carefully filtered or encoded 7697 to avoid being misinterpreted. 7699 Similar considerations apply to request data when it is stored and 7700 later processed, such as within log files, monitoring tools, or when 7701 included within a data format that allows embedded scripts. 7703 11.5. Attacks via Protocol Element Length 7705 Because HTTP uses mostly textual, character-delimited fields, parsers 7706 are often vulnerable to attacks based on sending very long (or very 7707 slow) streams of data, particularly where an implementation is 7708 expecting a protocol element with no predefined length (Section 3.3). 7710 To promote interoperability, specific recommendations are made for 7711 minimum size limits on request-line (Section 3 of [Messaging]) and 7712 fields (Section 4). These are minimum recommendations, chosen to be 7713 supportable even by implementations with limited resources; it is 7714 expected that most implementations will choose substantially higher 7715 limits. 7717 A server can reject a message that has a request-target that is too 7718 long (Section 9.5.15) or a request payload that is too large 7719 (Section 9.5.14). Additional status codes related to capacity limits 7720 have been defined by extensions to HTTP [RFC6585]. 7722 Recipients ought to carefully limit the extent to which they process 7723 other protocol elements, including (but not limited to) request 7724 methods, response status phrases, field names, numeric values, and 7725 body chunks. Failure to limit such processing can result in buffer 7726 overflows, arithmetic overflows, or increased vulnerability to 7727 denial-of-service attacks. 7729 11.6. Disclosure of Personal Information 7731 Clients are often privy to large amounts of personal information, 7732 including both information provided by the user to interact with 7733 resources (e.g., the user's name, location, mail address, passwords, 7734 encryption keys, etc.) and information about the user's browsing 7735 activity over time (e.g., history, bookmarks, etc.). Implementations 7736 need to prevent unintentional disclosure of personal information. 7738 11.7. Privacy of Server Log Information 7740 A server is in the position to save personal data about a user's 7741 requests over time, which might identify their reading patterns or 7742 subjects of interest. In particular, log information gathered at an 7743 intermediary often contains a history of user agent interaction, 7744 across a multitude of sites, that can be traced to individual users. 7746 HTTP log information is confidential in nature; its handling is often 7747 constrained by laws and regulations. Log information needs to be 7748 securely stored and appropriate guidelines followed for its analysis. 7749 Anonymization of personal information within individual entries 7750 helps, but it is generally not sufficient to prevent real log traces 7751 from being re-identified based on correlation with other access 7752 characteristics. As such, access traces that are keyed to a specific 7753 client are unsafe to publish even if the key is pseudonymous. 7755 To minimize the risk of theft or accidental publication, log 7756 information ought to be purged of personally identifiable 7757 information, including user identifiers, IP addresses, and user- 7758 provided query parameters, as soon as that information is no longer 7759 necessary to support operational needs for security, auditing, or 7760 fraud control. 7762 11.8. Disclosure of Sensitive Information in URIs 7764 URIs are intended to be shared, not secured, even when they identify 7765 secure resources. URIs are often shown on displays, added to 7766 templates when a page is printed, and stored in a variety of 7767 unprotected bookmark lists. It is therefore unwise to include 7768 information within a URI that is sensitive, personally identifiable, 7769 or a risk to disclose. 7771 Authors of services ought to avoid GET-based forms for the submission 7772 of sensitive data because that data will be placed in the request- 7773 target. Many existing servers, proxies, and user agents log or 7774 display the request-target in places where it might be visible to 7775 third parties. Such services ought to use POST-based form submission 7776 instead. 7778 Since the Referer header field tells a target site about the context 7779 that resulted in a request, it has the potential to reveal 7780 information about the user's immediate browsing history and any 7781 personal information that might be found in the referring resource's 7782 URI. Limitations on the Referer header field are described in 7783 Section 8.6.2 to address some of its security considerations. 7785 11.9. Disclosure of Fragment after Redirects 7787 Although fragment identifiers used within URI references are not sent 7788 in requests, implementers ought to be aware that they will be visible 7789 to the user agent and any extensions or scripts running as a result 7790 of the response. In particular, when a redirect occurs and the 7791 original request's fragment identifier is inherited by the new 7792 reference in Location (Section 10.1.2), this might have the effect of 7793 disclosing one site's fragment to another site. If the first site 7794 uses personal information in fragments, it ought to ensure that 7795 redirects to other sites include a (possibly empty) fragment 7796 component in order to block that inheritance. 7798 11.10. Disclosure of Product Information 7800 The User-Agent (Section 8.6.3), Via (Section 5.7.1), and Server 7801 (Section 10.4.3) header fields often reveal information about the 7802 respective sender's software systems. In theory, this can make it 7803 easier for an attacker to exploit known security holes; in practice, 7804 attackers tend to try all potential holes regardless of the apparent 7805 software versions being used. 7807 Proxies that serve as a portal through a network firewall ought to 7808 take special precautions regarding the transfer of header information 7809 that might identify hosts behind the firewall. The Via header field 7810 allows intermediaries to replace sensitive machine names with 7811 pseudonyms. 7813 11.11. Browser Fingerprinting 7815 Browser fingerprinting is a set of techniques for identifying a 7816 specific user agent over time through its unique set of 7817 characteristics. These characteristics might include information 7818 related to its TCP behavior, feature capabilities, and scripting 7819 environment, though of particular interest here is the set of unique 7820 characteristics that might be communicated via HTTP. Fingerprinting 7821 is considered a privacy concern because it enables tracking of a user 7822 agent's behavior over time ([Bujlow]) without the corresponding 7823 controls that the user might have over other forms of data collection 7824 (e.g., cookies). Many general-purpose user agents (i.e., Web 7825 browsers) have taken steps to reduce their fingerprints. 7827 There are a number of request header fields that might reveal 7828 information to servers that is sufficiently unique to enable 7829 fingerprinting. The From header field is the most obvious, though it 7830 is expected that From will only be sent when self-identification is 7831 desired by the user. Likewise, Cookie header fields are deliberately 7832 designed to enable re-identification, so fingerprinting concerns only 7833 apply to situations where cookies are disabled or restricted by the 7834 user agent's configuration. 7836 The User-Agent header field might contain enough information to 7837 uniquely identify a specific device, usually when combined with other 7838 characteristics, particularly if the user agent sends excessive 7839 details about the user's system or extensions. However, the source 7840 of unique information that is least expected by users is proactive 7841 negotiation (Section 8.4), including the Accept, Accept-Charset, 7842 Accept-Encoding, and Accept-Language header fields. 7844 In addition to the fingerprinting concern, detailed use of the 7845 Accept-Language header field can reveal information the user might 7846 consider to be of a private nature. For example, understanding a 7847 given language set might be strongly correlated to membership in a 7848 particular ethnic group. An approach that limits such loss of 7849 privacy would be for a user agent to omit the sending of Accept- 7850 Language except for sites that have been whitelisted, perhaps via 7851 interaction after detecting a Vary header field that indicates 7852 language negotiation might be useful. 7854 In environments where proxies are used to enhance privacy, user 7855 agents ought to be conservative in sending proactive negotiation 7856 header fields. General-purpose user agents that provide a high 7857 degree of header field configurability ought to inform users about 7858 the loss of privacy that might result if too much detail is provided. 7859 As an extreme privacy measure, proxies could filter the proactive 7860 negotiation header fields in relayed requests. 7862 11.12. Validator Retention 7864 The validators defined by this specification are not intended to 7865 ensure the validity of a representation, guard against malicious 7866 changes, or detect man-in-the-middle attacks. At best, they enable 7867 more efficient cache updates and optimistic concurrent writes when 7868 all participants are behaving nicely. At worst, the conditions will 7869 fail and the client will receive a response that is no more harmful 7870 than an HTTP exchange without conditional requests. 7872 An entity-tag can be abused in ways that create privacy risks. For 7873 example, a site might deliberately construct a semantically invalid 7874 entity-tag that is unique to the user or user agent, send it in a 7875 cacheable response with a long freshness time, and then read that 7876 entity-tag in later conditional requests as a means of re-identifying 7877 that user or user agent. Such an identifying tag would become a 7878 persistent identifier for as long as the user agent retained the 7879 original cache entry. User agents that cache representations ought 7880 to ensure that the cache is cleared or replaced whenever the user 7881 performs privacy-maintaining actions, such as clearing stored cookies 7882 or changing to a private browsing mode. 7884 11.13. Denial-of-Service Attacks Using Range 7886 Unconstrained multiple range requests are susceptible to denial-of- 7887 service attacks because the effort required to request many 7888 overlapping ranges of the same data is tiny compared to the time, 7889 memory, and bandwidth consumed by attempting to serve the requested 7890 data in many parts. Servers ought to ignore, coalesce, or reject 7891 egregious range requests, such as requests for more than two 7892 overlapping ranges or for many small ranges in a single set, 7893 particularly when the ranges are requested out of order for no 7894 apparent reason. Multipart range requests are not designed to 7895 support random access. 7897 11.14. Authentication Considerations 7899 Everything about the topic of HTTP authentication is a security 7900 consideration, so the list of considerations below is not exhaustive. 7901 Furthermore, it is limited to security considerations regarding the 7902 authentication framework, in general, rather than discussing all of 7903 the potential considerations for specific authentication schemes 7904 (which ought to be documented in the specifications that define those 7905 schemes). Various organizations maintain topical information and 7906 links to current research on Web application security (e.g., 7907 [OWASP]), including common pitfalls for implementing and using the 7908 authentication schemes found in practice. 7910 11.14.1. Confidentiality of Credentials 7912 The HTTP authentication framework does not define a single mechanism 7913 for maintaining the confidentiality of credentials; instead, each 7914 authentication scheme defines how the credentials are encoded prior 7915 to transmission. While this provides flexibility for the development 7916 of future authentication schemes, it is inadequate for the protection 7917 of existing schemes that provide no confidentiality on their own, or 7918 that do not sufficiently protect against replay attacks. 7919 Furthermore, if the server expects credentials that are specific to 7920 each individual user, the exchange of those credentials will have the 7921 effect of identifying that user even if the content within 7922 credentials remains confidential. 7924 HTTP depends on the security properties of the underlying transport- 7925 or session-level connection to provide confidential transmission of 7926 fields. In other words, if a server limits access to authenticated 7927 users using this framework, the server needs to ensure that the 7928 connection is properly secured in accordance with the nature of the 7929 authentication scheme used. For example, services that depend on 7930 individual user authentication often require a connection to be 7931 secured with TLS ("Transport Layer Security", [RFC8446]) prior to 7932 exchanging any credentials. 7934 11.14.2. Credentials and Idle Clients 7936 Existing HTTP clients and user agents typically retain authentication 7937 information indefinitely. HTTP does not provide a mechanism for the 7938 origin server to direct clients to discard these cached credentials, 7939 since the protocol has no awareness of how credentials are obtained 7940 or managed by the user agent. The mechanisms for expiring or 7941 revoking credentials can be specified as part of an authentication 7942 scheme definition. 7944 Circumstances under which credential caching can interfere with the 7945 application's security model include but are not limited to: 7947 o Clients that have been idle for an extended period, following 7948 which the server might wish to cause the client to re-prompt the 7949 user for credentials. 7951 o Applications that include a session termination indication (such 7952 as a "logout" or "commit" button on a page) after which the server 7953 side of the application "knows" that there is no further reason 7954 for the client to retain the credentials. 7956 User agents that cache credentials are encouraged to provide a 7957 readily accessible mechanism for discarding cached credentials under 7958 user control. 7960 11.14.3. Protection Spaces 7962 Authentication schemes that solely rely on the "realm" mechanism for 7963 establishing a protection space will expose credentials to all 7964 resources on an origin server. Clients that have successfully made 7965 authenticated requests with a resource can use the same 7966 authentication credentials for other resources on the same origin 7967 server. This makes it possible for a different resource to harvest 7968 authentication credentials for other resources. 7970 This is of particular concern when an origin server hosts resources 7971 for multiple parties under the same canonical root URI 7972 (Section 8.5.2). Possible mitigation strategies include restricting 7973 direct access to authentication credentials (i.e., not making the 7974 content of the Authorization request header field available), and 7975 separating protection spaces by using a different host name (or port 7976 number) for each party. 7978 11.14.4. Additional Response Fields 7980 Adding information to responses that are sent over an unencrypted 7981 channel can affect security and privacy. The presence of the 7982 Authentication-Info and Proxy-Authentication-Info header fields alone 7983 indicates that HTTP authentication is in use. Additional information 7984 could be exposed by the contents of the authentication-scheme 7985 specific parameters; this will have to be considered in the 7986 definitions of these schemes. 7988 12. IANA Considerations 7990 The change controller for the following registrations is: "IETF 7991 (iesg@ietf.org) - Internet Engineering Task Force". 7993 12.1. URI Scheme Registration 7995 Please update the registry of URI Schemes [BCP35] at 7996 with the permanent 7997 schemes listed in the first table of Section 2.5. 7999 12.2. Method Registration 8001 Please update the "Hypertext Transfer Protocol (HTTP) Method 8002 Registry" at with the 8003 registration procedure of Section 7.4.1 and the method names 8004 summarized in the table of Section 7.2. 8006 12.3. Status Code Registration 8008 Please update the "Hypertext Transfer Protocol (HTTP) Status Code 8009 Registry" at 8010 with the registration procedure of Section 9.7.1 and the status code 8011 values summarized in the table of Section 9.1. 8013 Additionally, please update the following entry in the Hypertext 8014 Transfer Protocol (HTTP) Status Code Registry: 8016 Value: 418 8018 Description: (Unused) 8020 Reference Section 9.5.19 8022 12.4. HTTP Field Name Registration 8024 Please create a new registry as outlined in Section 4.3.2. 8026 After creating the registry, all entries in the Permanent and 8027 Provisional Message Header Registries with the protocol 'http' are to 8028 be moved to it, with the following changes applied: 8030 1. The 'Applicable Protocol' field is to be omitted. 8032 2. Entries with a status of 'standard', 'experimental', 'reserved', 8033 or 'informational' are to have a status of 'permanent'. 8035 3. Provisional entries without a status are to have a status of 8036 'provisional'. 8038 4. Permanent entries without a status (after confirmation that the 8039 registration document did not define one) will have a status of 8040 'provisional'. The Expert(s) can choose to update their status 8041 if there is evidence that another is more appropriate. 8043 Please annotate the Permanent and Provisional Message Header 8044 registries to indicate that HTTP field name registrations have moved, 8045 with an appropriate link. 8047 After that is complete, please update the new registry with the field 8048 names listed in the table of Section 4.3. 8050 Finally, please update the "Content-MD5" entry in the new registry to 8051 have a status of 'obsoleted' with references to Section 14.15 of 8052 [RFC2616] (for the definition of the header field) and Appendix B of 8053 [RFC7231] (which removed the field definition from the updated 8054 specification). 8056 12.5. Authentication Scheme Registration 8058 Please update the "Hypertext Transfer Protocol (HTTP) Authentication 8059 Scheme Registry" at with the registration procedure of Section 8.5.5.1. No 8061 authentication schemes are defined in this document. 8063 12.6. Content Coding Registration 8065 Please update the "HTTP Content Coding Registry" at 8066 with the 8067 registration procedure of Section 6.1.2.4 and the content coding 8068 names summarized in the table of Section 6.1.2. 8070 12.7. Range Unit Registration 8072 Please update the "HTTP Range Unit Registry" at 8073 with the 8074 registration procedure of Section 6.1.4.4 and the range unit names 8075 summarized in the table of Section 6.1.4. 8077 12.8. Media Type Registration 8079 Please update the "Media Types" registry at 8080 with the registration 8081 information in Section 6.3.5 for the media type "multipart/ 8082 byteranges". 8084 12.9. Port Registration 8086 Please update the "Service Name and Transport Protocol Port Number" 8087 registry at for the services on ports 80 and 443 that use UDP or TCP 8089 to: 8091 1. use this document as "Reference", and 8093 2. when currently unspecified, set "Assignee" to "IESG" and 8094 "Contact" to "IETF_Chair". 8096 13. References 8098 13.1. Normative References 8100 [Caching] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 8101 Ed., "HTTP Caching", draft-ietf-httpbis-cache-07 (work in 8102 progress), March 2020. 8104 [Messaging] 8105 Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 8106 Ed., "HTTP/1.1 Messaging", draft-ietf-httpbis-messaging-07 8107 (work in progress), March 2020. 8109 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 8110 RFC 793, DOI 10.17487/RFC0793, September 1981, 8111 . 8113 [RFC1950] Deutsch, L. and J-L. Gailly, "ZLIB Compressed Data Format 8114 Specification version 3.3", RFC 1950, 8115 DOI 10.17487/RFC1950, May 1996, 8116 . 8118 [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification 8119 version 1.3", RFC 1951, DOI 10.17487/RFC1951, May 1996, 8120 . 8122 [RFC1952] Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and G. 8123 Randers-Pehrson, "GZIP file format specification version 8124 4.3", RFC 1952, DOI 10.17487/RFC1952, May 1996, 8125 . 8127 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 8128 Extensions (MIME) Part One: Format of Internet Message 8129 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 8130 . 8132 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 8133 Extensions (MIME) Part Two: Media Types", RFC 2046, 8134 DOI 10.17487/RFC2046, November 1996, 8135 . 8137 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 8138 Requirement Levels", BCP 14, RFC 2119, 8139 DOI 10.17487/RFC2119, March 1997, 8140 . 8142 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 8143 Resource Identifier (URI): Generic Syntax", STD 66, 8144 RFC 3986, DOI 10.17487/RFC3986, January 2005, 8145 . 8147 [RFC4647] Phillips, A., Ed. and M. Davis, Ed., "Matching of Language 8148 Tags", BCP 47, RFC 4647, DOI 10.17487/RFC4647, September 8149 2006, . 8151 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 8152 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 8153 . 8155 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 8156 Specifications: ABNF", STD 68, RFC 5234, 8157 DOI 10.17487/RFC5234, January 2008, 8158 . 8160 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 8161 Housley, R., and W. Polk, "Internet X.509 Public Key 8162 Infrastructure Certificate and Certificate Revocation List 8163 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 8164 . 8166 [RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for Identifying 8167 Languages", BCP 47, RFC 5646, DOI 10.17487/RFC5646, 8168 September 2009, . 8170 [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in 8171 Internationalization in the IETF", BCP 166, RFC 6365, 8172 DOI 10.17487/RFC6365, September 2011, 8173 . 8175 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", 8176 RFC 7405, DOI 10.17487/RFC7405, December 2014, 8177 . 8179 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 8180 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 8181 May 2017, . 8183 [USASCII] American National Standards Institute, "Coded Character 8184 Set -- 7-bit American Standard Code for Information 8185 Interchange", ANSI X3.4, 1986. 8187 [Welch] Welch, T., "A Technique for High-Performance Data 8188 Compression", IEEE Computer 17(6), 8189 DOI 10.1109/MC.1984.1659158, June 1984, 8190 . 8192 13.2. Informative References 8194 [BCP13] Freed, N., Klensin, J., and T. Hansen, "Media Type 8195 Specifications and Registration Procedures", BCP 13, 8196 RFC 6838, January 2013, 8197 . 8199 [BCP178] Saint-Andre, P., Crocker, D., and M. Nottingham, 8200 "Deprecating the "X-" Prefix and Similar Constructs in 8201 Application Protocols", BCP 178, RFC 6648, June 2012, 8202 . 8204 [BCP35] Thaler, D., Ed., Hansen, T., and T. Hardie, "Guidelines 8205 and Registration Procedures for URI Schemes", BCP 35, 8206 RFC 7595, June 2015, 8207 . 8209 [Bujlow] Bujlow, T., Carela-Espanol, V., Sole-Pareta, J., and P. 8210 Barlet-Ros, "A Survey on Web Tracking: Mechanisms, 8211 Implications, and Defenses", 8212 DOI 10.1109/JPROC.2016.2637878, Proceedings of the 8213 IEEE 105(8), August 2017. 8215 [Err1912] RFC Errata, Erratum ID 1912, RFC 2978, 8216 . 8218 [Err5433] RFC Errata, Erratum ID 5433, RFC 2978, 8219 . 8221 [Georgiev] 8222 Georgiev, M., Iyengar, S., Jana, S., Anubhai, R., Boneh, 8223 D., and V. Shmatikov, "The Most Dangerous Code in the 8224 World: Validating SSL Certificates in Non-browser 8225 Software", DOI 10.1145/2382196.2382204, In Proceedings of 8226 the 2012 ACM Conference on Computer and Communications 8227 Security (CCS '12), pp. 38-49, October 2012. 8229 [ISO-8859-1] 8230 International Organization for Standardization, 8231 "Information technology -- 8-bit single-byte coded graphic 8232 character sets -- Part 1: Latin alphabet No. 1", ISO/ 8233 IEC 8859-1:1998, 1998. 8235 [Kri2001] Kristol, D., "HTTP Cookies: Standards, Privacy, and 8236 Politics", ACM Transactions on Internet Technology 1(2), 8237 November 2001, . 8239 [OWASP] van der Stock, A., Ed., "A Guide to Building Secure Web 8240 Applications and Web Services", The Open Web Application 8241 Security Project (OWASP) 2.0.1, July 2005, 8242 . 8244 [REST] Fielding, R., "Architectural Styles and the Design of 8245 Network-based Software Architectures", 8246 Doctoral Dissertation, University of California, Irvine, 8247 September 2000, 8248 . 8250 [RFC1919] Chatel, M., "Classical versus Transparent IP Proxies", 8251 RFC 1919, DOI 10.17487/RFC1919, March 1996, 8252 . 8254 [RFC1945] Berners-Lee, T., Fielding, R., and H. Nielsen, "Hypertext 8255 Transfer Protocol -- HTTP/1.0", RFC 1945, 8256 DOI 10.17487/RFC1945, May 1996, 8257 . 8259 [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 8260 Part Three: Message Header Extensions for Non-ASCII Text", 8261 RFC 2047, DOI 10.17487/RFC2047, November 1996, 8262 . 8264 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. 8265 Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", 8266 RFC 2068, DOI 10.17487/RFC2068, January 1997, 8267 . 8269 [RFC2145] Mogul, J., Fielding, R., Gettys, J., and H. Nielsen, "Use 8270 and Interpretation of HTTP Version Numbers", RFC 2145, 8271 DOI 10.17487/RFC2145, May 1997, 8272 . 8274 [RFC2295] Holtman, K. and A. Mutz, "Transparent Content Negotiation 8275 in HTTP", RFC 2295, DOI 10.17487/RFC2295, March 1998, 8276 . 8278 [RFC2324] Masinter, L., "Hyper Text Coffee Pot Control Protocol 8279 (HTCPCP/1.0)", RFC 2324, DOI 10.17487/RFC2324, April 1998, 8280 . 8282 [RFC2557] Palme, F., Hopmann, A., Shelness, N., and E. Stefferud, 8283 "MIME Encapsulation of Aggregate Documents, such as HTML 8284 (MHTML)", RFC 2557, DOI 10.17487/RFC2557, March 1999, 8285 . 8287 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 8288 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 8289 Transfer Protocol -- HTTP/1.1", RFC 2616, 8290 DOI 10.17487/RFC2616, June 1999, 8291 . 8293 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 8294 Leach, P., Luotonen, A., and L. Stewart, "HTTP 8295 Authentication: Basic and Digest Access Authentication", 8296 RFC 2617, DOI 10.17487/RFC2617, June 1999, 8297 . 8299 [RFC2774] Frystyk, H., Leach, P., and S. Lawrence, "An HTTP 8300 Extension Framework", RFC 2774, DOI 10.17487/RFC2774, 8301 February 2000, . 8303 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, 8304 DOI 10.17487/RFC2818, May 2000, 8305 . 8307 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 8308 Procedures", BCP 19, RFC 2978, DOI 10.17487/RFC2978, 8309 October 2000, . 8311 [RFC3040] Cooper, I., Melve, I., and G. Tomlinson, "Internet Web 8312 Replication and Caching Taxonomy", RFC 3040, 8313 DOI 10.17487/RFC3040, January 2001, 8314 . 8316 [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S. 8317 Rose, "DNS Security Introduction and Requirements", 8318 RFC 4033, DOI 10.17487/RFC4033, March 2005, 8319 . 8321 [RFC4559] Jaganathan, K., Zhu, L., and J. Brezak, "SPNEGO-based 8322 Kerberos and NTLM HTTP Authentication in Microsoft 8323 Windows", RFC 4559, DOI 10.17487/RFC4559, June 2006, 8324 . 8326 [RFC4918] Dusseault, L., Ed., "HTTP Extensions for Web Distributed 8327 Authoring and Versioning (WebDAV)", RFC 4918, 8328 DOI 10.17487/RFC4918, June 2007, 8329 . 8331 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 8332 DOI 10.17487/RFC5322, October 2008, 8333 . 8335 [RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP", 8336 RFC 5789, DOI 10.17487/RFC5789, March 2010, 8337 . 8339 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 8340 "Network Time Protocol Version 4: Protocol and Algorithms 8341 Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010, 8342 . 8344 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 8345 Verification of Domain-Based Application Service Identity 8346 within Internet Public Key Infrastructure Using X.509 8347 (PKIX) Certificates in the Context of Transport Layer 8348 Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March 8349 2011, . 8351 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 8352 DOI 10.17487/RFC6265, April 2011, 8353 . 8355 [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, 8356 DOI 10.17487/RFC6454, December 2011, 8357 . 8359 [RFC6585] Nottingham, M. and R. Fielding, "Additional HTTP Status 8360 Codes", RFC 6585, DOI 10.17487/RFC6585, April 2012, 8361 . 8363 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 8364 Protocol (HTTP/1.1): Message Syntax and Routing", 8365 RFC 7230, DOI 10.17487/RFC7230, June 2014, 8366 . 8368 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 8369 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 8370 DOI 10.17487/RFC7231, June 2014, 8371 . 8373 [RFC7232] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 8374 Protocol (HTTP/1.1): Conditional Requests", RFC 7232, 8375 DOI 10.17487/RFC7232, June 2014, 8376 . 8378 [RFC7233] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., 8379 "Hypertext Transfer Protocol (HTTP): Range Requests", 8380 RFC 7233, DOI 10.17487/RFC7233, June 2014, 8381 . 8383 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 8384 Protocol (HTTP/1.1): Authentication", RFC 7235, 8385 DOI 10.17487/RFC7235, June 2014, 8386 . 8388 [RFC7538] Reschke, J., "The Hypertext Transfer Protocol Status Code 8389 308 (Permanent Redirect)", RFC 7538, DOI 10.17487/RFC7538, 8390 April 2015, . 8392 [RFC7578] Masinter, L., "Returning Values from Forms: multipart/ 8393 form-data", RFC 7578, DOI 10.17487/RFC7578, July 2015, 8394 . 8396 [RFC7615] Reschke, J., "HTTP Authentication-Info and Proxy- 8397 Authentication-Info Response Header Fields", RFC 7615, 8398 DOI 10.17487/RFC7615, September 2015, 8399 . 8401 [RFC7616] Shekh-Yusef, R., Ed., Ahrens, D., and S. Bremer, "HTTP 8402 Digest Access Authentication", RFC 7616, 8403 DOI 10.17487/RFC7616, September 2015, 8404 . 8406 [RFC7617] Reschke, J., "The 'Basic' HTTP Authentication Scheme", 8407 RFC 7617, DOI 10.17487/RFC7617, September 2015, 8408 . 8410 [RFC7838] Nottingham, M., McManus, P., and J. Reschke, "HTTP 8411 Alternative Services", RFC 7838, DOI 10.17487/RFC7838, 8412 April 2016, . 8414 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 8415 Writing an IANA Considerations Section in RFCs", BCP 26, 8416 RFC 8126, DOI 10.17487/RFC8126, June 2017, 8417 . 8419 [RFC8187] Reschke, J., "Indicating Character Encoding and Language 8420 for HTTP Header Field Parameters", RFC 8187, 8421 DOI 10.17487/RFC8187, September 2017, 8422 . 8424 [RFC8246] McManus, P., "HTTP Immutable Responses", RFC 8246, 8425 DOI 10.17487/RFC8246, September 2017, 8426 . 8428 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 8429 DOI 10.17487/RFC8288, October 2017, 8430 . 8432 [RFC8336] Nottingham, M. and E. Nygren, "The ORIGIN HTTP/2 Frame", 8433 RFC 8336, DOI 10.17487/RFC8336, March 2018, 8434 . 8436 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 8437 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 8438 . 8440 [Sniffing] 8441 WHATWG, "MIME Sniffing", 8442 . 8444 Appendix A. Collected ABNF 8446 In the collected ABNF below, list rules are expanded as per 8447 Section 4.5. 8449 Accept = [ ( "," / ( media-range [ accept-params ] ) ) *( OWS "," [ 8450 OWS ( media-range [ accept-params ] ) ] ) ] 8451 Accept-Charset = *( "," OWS ) ( ( charset / "*" ) [ weight ] ) *( OWS 8452 "," [ OWS ( ( charset / "*" ) [ weight ] ) ] ) 8453 Accept-Encoding = [ ( "," / ( codings [ weight ] ) ) *( OWS "," [ OWS 8454 ( codings [ weight ] ) ] ) ] 8455 Accept-Language = *( "," OWS ) ( language-range [ weight ] ) *( OWS 8456 "," [ OWS ( language-range [ weight ] ) ] ) 8457 Accept-Ranges = acceptable-ranges 8458 Allow = [ method ] *( OWS "," OWS [ method ] ) 8459 Authentication-Info = [ auth-param ] *( OWS "," OWS [ auth-param ] ) 8460 Authorization = credentials 8462 BWS = OWS 8464 Content-Encoding = [ content-coding ] *( OWS "," OWS [ content-coding 8465 ] ) 8466 Content-Language = [ language-tag ] *( OWS "," OWS [ language-tag ] 8467 ) 8468 Content-Length = 1*DIGIT 8469 Content-Location = absolute-URI / partial-URI 8470 Content-Range = range-unit SP ( range-resp / unsatisfied-range ) 8471 Content-Type = media-type 8473 Date = HTTP-date 8475 ETag = entity-tag 8476 Expect = "100-continue" 8478 From = mailbox 8480 GMT = %x47.4D.54 ; GMT 8482 HTTP-date = IMF-fixdate / obs-date 8483 Host = uri-host [ ":" port ] 8485 IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT 8486 If-Match = "*" / ( [ entity-tag ] *( OWS "," OWS [ entity-tag ] ) ) 8487 If-Modified-Since = HTTP-date 8488 If-None-Match = "*" / ( [ entity-tag ] *( OWS "," OWS [ entity-tag ] 8489 ) ) 8490 If-Range = entity-tag / HTTP-date 8491 If-Unmodified-Since = HTTP-date 8492 Last-Modified = HTTP-date 8493 Location = URI-reference 8495 Max-Forwards = 1*DIGIT 8497 OWS = *( SP / HTAB ) 8499 Proxy-Authenticate = [ challenge ] *( OWS "," OWS [ challenge ] ) 8500 Proxy-Authentication-Info = [ auth-param ] *( OWS "," OWS [ 8501 auth-param ] ) 8502 Proxy-Authorization = credentials 8504 RWS = 1*( SP / HTAB ) 8505 Range = ranges-specifier 8506 Referer = absolute-URI / partial-URI 8507 Retry-After = HTTP-date / delay-seconds 8509 Server = product *( RWS ( product / comment ) ) 8511 Trailer = [ field-name ] *( OWS "," OWS [ field-name ] ) 8513 URI-reference = 8514 User-Agent = product *( RWS ( product / comment ) ) 8516 Vary = "*" / ( [ field-name ] *( OWS "," OWS [ field-name ] ) ) 8517 Via = *( "," OWS ) ( received-protocol RWS received-by [ RWS comment 8518 ] ) *( OWS "," [ OWS ( received-protocol RWS received-by [ RWS 8519 comment ] ) ] ) 8521 WWW-Authenticate = [ challenge ] *( OWS "," OWS [ challenge ] ) 8523 absolute-URI = 8524 absolute-path = 1*( "/" segment ) 8525 accept-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ] 8526 accept-params = weight *accept-ext 8527 acceptable-ranges = ( [ range-unit ] *( OWS "," OWS [ range-unit ] ) 8528 ) / "none" 8529 asctime-date = day-name SP date3 SP time-of-day SP year 8530 auth-param = token BWS "=" BWS ( token / quoted-string ) 8531 auth-scheme = token 8532 authority = 8534 challenge = auth-scheme [ 1*SP ( token68 / ( [ auth-param ] *( OWS 8535 "," OWS [ auth-param ] ) ) ) ] 8536 charset = token 8537 codings = content-coding / "identity" / "*" 8538 comment = "(" *( ctext / quoted-pair / comment ) ")" 8539 complete-length = 1*DIGIT 8540 content-coding = token 8541 credentials = auth-scheme [ 1*SP ( token68 / ( [ auth-param ] *( OWS 8542 "," OWS [ auth-param ] ) ) ) ] 8543 ctext = HTAB / SP / %x21-27 ; '!'-''' 8544 / %x2A-5B ; '*'-'[' 8545 / %x5D-7E ; ']'-'~' 8546 / obs-text 8548 date1 = day SP month SP year 8549 date2 = day "-" month "-" 2DIGIT 8550 date3 = month SP ( 2DIGIT / ( SP DIGIT ) ) 8551 day = 2DIGIT 8552 day-name = %x4D.6F.6E ; Mon 8553 / %x54.75.65 ; Tue 8554 / %x57.65.64 ; Wed 8555 / %x54.68.75 ; Thu 8556 / %x46.72.69 ; Fri 8557 / %x53.61.74 ; Sat 8558 / %x53.75.6E ; Sun 8559 day-name-l = %x4D.6F.6E.64.61.79 ; Monday 8560 / %x54.75.65.73.64.61.79 ; Tuesday 8561 / %x57.65.64.6E.65.73.64.61.79 ; Wednesday 8562 / %x54.68.75.72.73.64.61.79 ; Thursday 8563 / %x46.72.69.64.61.79 ; Friday 8564 / %x53.61.74.75.72.64.61.79 ; Saturday 8565 / %x53.75.6E.64.61.79 ; Sunday 8566 delay-seconds = 1*DIGIT 8568 entity-tag = [ weak ] opaque-tag 8569 etagc = "!" / %x23-7E ; '#'-'~' 8570 / obs-text 8572 field-content = field-vchar [ 1*( SP / HTAB / field-vchar ) 8573 field-vchar ] 8574 field-name = token 8575 field-value = *( field-content / obs-fold ) 8576 field-vchar = VCHAR / obs-text 8577 first-pos = 1*DIGIT 8579 hour = 2DIGIT 8580 http-URI = "http://" authority path-abempty [ "?" query ] 8581 https-URI = "https://" authority path-abempty [ "?" query ] 8583 incl-range = first-pos "-" last-pos 8584 int-range = first-pos "-" [ last-pos ] 8586 language-range = 8587 language-tag = 8588 last-pos = 1*DIGIT 8590 mailbox = 8591 media-range = ( "*/*" / ( type "/*" ) / ( type "/" subtype ) ) *( OWS 8592 ";" OWS parameter ) 8593 media-type = type "/" subtype *( OWS ";" OWS parameter ) 8594 method = token 8595 minute = 2DIGIT 8596 month = %x4A.61.6E ; Jan 8597 / %x46.65.62 ; Feb 8598 / %x4D.61.72 ; Mar 8599 / %x41.70.72 ; Apr 8600 / %x4D.61.79 ; May 8601 / %x4A.75.6E ; Jun 8602 / %x4A.75.6C ; Jul 8603 / %x41.75.67 ; Aug 8604 / %x53.65.70 ; Sep 8605 / %x4F.63.74 ; Oct 8606 / %x4E.6F.76 ; Nov 8607 / %x44.65.63 ; Dec 8609 obs-date = rfc850-date / asctime-date 8610 obs-fold = 8611 obs-text = %x80-FF 8612 opaque-tag = DQUOTE *etagc DQUOTE 8613 other-range = 1*( %x21-2B ; '!'-'+' 8614 / %x2D-7E ; '-'-'~' 8615 ) 8617 parameter = parameter-name "=" parameter-value 8618 parameter-name = token 8619 parameter-value = ( token / quoted-string ) 8620 partial-URI = relative-part [ "?" query ] 8621 path-abempty = 8622 port = 8623 product = token [ "/" product-version ] 8624 product-version = token 8625 protocol-name = 8626 protocol-version = 8627 pseudonym = token 8629 qdtext = HTAB / SP / "!" / %x23-5B ; '#'-'[' 8630 / %x5D-7E ; ']'-'~' 8631 / obs-text 8632 query = 8633 quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) 8634 quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE 8635 qvalue = ( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] ) 8636 range-resp = incl-range "/" ( complete-length / "*" ) 8637 range-set = [ range-spec ] *( OWS "," OWS [ range-spec ] ) 8638 range-spec = int-range / suffix-range / other-range 8639 range-unit = token 8640 ranges-specifier = range-unit "=" range-set 8641 received-by = pseudonym [ ":" port ] 8642 received-protocol = [ protocol-name "/" ] protocol-version 8643 relative-part = 8644 request-target = 8645 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 8647 second = 2DIGIT 8648 segment = 8649 subtype = token 8650 suffix-length = 1*DIGIT 8651 suffix-range = "-" suffix-length 8653 tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / 8654 "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA 8655 time-of-day = hour ":" minute ":" second 8656 token = 1*tchar 8657 token68 = 1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) 8658 *"=" 8659 type = token 8661 unsatisfied-range = "*/" complete-length 8662 uri-host = 8664 weak = %x57.2F ; W/ 8665 weight = OWS ";" OWS "q=" qvalue 8667 year = 4DIGIT 8669 Appendix B. Changes from previous RFCs 8671 B.1. Changes from RFC 2818 8673 None yet. 8675 B.2. Changes from RFC 7230 8677 The sections introducing HTTP's design goals, history, architecture, 8678 conformance criteria, protocol versioning, URIs, message routing, and 8679 header fields have been moved here (without substantive change). 8681 "Field value" now refers to the value after multiple instances are 8682 combined with commas -- by far the most common use. To refer to a 8683 single header line's value, use "field line value". (Section 4) 8684 Trailer field semantics now transcend the specifics of chunked 8685 encoding. Use of trailer fields has been further limited to only 8686 allow generation as a trailer field when the sender knows the field 8687 defines that usage and to only allow merging into the header section 8688 if the recipient knows the corresponding field definition permits and 8689 defines how to merge. In all other cases, implementations are 8690 encouraged to either store the trailer fields separately or discard 8691 them instead of merging. (Section 4.6.2) 8693 Made the priority of the absolute form of the request URI over the 8694 Host header by origin servers explicit, to align with proxy handling. 8695 (Section 5.6) 8697 The grammar definition for the Via field's "received-by" was expanded 8698 in 7230 due to changes in the URI grammar for host [RFC3986] that are 8699 not desirable for Via. For simplicity, we have removed uri-host from 8700 the received-by production because it can be encompassed by the 8701 existing grammar for pseudonym. In particular, this change removed 8702 comma from the allowed set of charaters for a host name in received- 8703 by. (Section 5.7.1) 8705 Added status code 308 (previously defined in [RFC7538]) so that it's 8706 defined closer to status codes 301, 302, and 307. (Section 9.4.9) 8708 Added status code 422 (previously defined in Section 11.2 of 8709 [RFC4918]) because of its general applicability. (Section 9.5.20) 8711 The description of an origin and authoritative access to origin 8712 servers has been extended for both "http" and "https" URIs to account 8713 for alternative services and secured connections that are not 8714 necessarily based on TCP. (Section 2.5.1, Section 2.5.2, 8715 Section 5.2, Section 5.4) 8717 B.3. Changes from RFC 7231 8719 Minimum URI lengths to be supported by implementations are now 8720 recommended. (Section 2.5) 8722 Range units are compared in a case insensitive fashion. 8723 (Section 6.1.4) 8725 Restrictions on client retries have been loosened, to reflect 8726 implementation behavior. (Section 7.2.2) 8728 Clarified that request bodies on GET and DELETE are not 8729 interoperable. (Section 7.3.1, Section 7.3.5) 8730 Removed a superfluous requirement about setting Content-Length from 8731 the description of the OPTIONS method. (Section 7.3.7) 8733 B.4. Changes from RFC 7232 8735 None yet. 8737 B.5. Changes from RFC 7233 8739 Refactored the range-unit and ranges-specifier grammars to simplify 8740 and reduce artificial distinctions between bytes and other 8741 (extension) range units, removing the overlapping grammar of other- 8742 range-unit by defining range units generically as a token and placing 8743 extensions within the scope of a range-spec (other-range). This 8744 disambiguates the role of list syntax (commas) in all range sets, 8745 including extension range units, for indicating a range-set of more 8746 than one range. Moving the extension grammar into range specifiers 8747 also allows protocol specific to byte ranges to be specified 8748 separately. 8750 B.6. Changes from RFC 7235 8752 None yet. 8754 B.7. Changes from RFC 7538 8756 None yet. 8758 B.8. Changes from RFC 7615 8760 None yet. 8762 Appendix C. Change Log 8764 This section is to be removed before publishing as an RFC. 8766 C.1. Between RFC723x and draft 00 8768 The changes were purely editorial: 8770 o Change boilerplate and abstract to indicate the "draft" status, 8771 and update references to ancestor specifications. 8773 o Remove version "1.1" from document title, indicating that this 8774 specification applies to all HTTP versions. 8776 o Adjust historical notes. 8778 o Update links to sibling specifications. 8780 o Replace sections listing changes from RFC 2616 by new empty 8781 sections referring to RFC 723x. 8783 o Remove acknowledgements specific to RFC 723x. 8785 o Move "Acknowledgements" to the very end and make them unnumbered. 8787 C.2. Since draft-ietf-httpbis-semantics-00 8789 The changes in this draft are editorial, with respect to HTTP as a 8790 whole, to merge core HTTP semantics into this document: 8792 o Merged introduction, architecture, conformance, and ABNF 8793 extensions from RFC 7230 (Messaging). 8795 o Rearranged architecture to extract conformance, http(s) schemes, 8796 and protocol versioning into a separate major section. 8798 o Moved discussion of MIME differences to [Messaging] since that is 8799 primarily concerned with transforming 1.1 messages. 8801 o Merged entire content of RFC 7232 (Conditional Requests). 8803 o Merged entire content of RFC 7233 (Range Requests). 8805 o Merged entire content of RFC 7235 (Auth Framework). 8807 o Moved all extensibility tips, registration procedures, and 8808 registry tables from the IANA considerations to normative 8809 sections, reducing the IANA considerations to just instructions 8810 that will be removed prior to publication as an RFC. 8812 C.3. Since draft-ietf-httpbis-semantics-01 8814 o Improve [Welch] citation () 8817 o Remove HTTP/1.1-ism about Range Requests 8818 () 8820 o Cite RFC 8126 instead of RFC 5226 () 8823 o Cite RFC 7538 instead of RFC 7238 () 8826 o Cite RFC 8288 instead of RFC 5988 () 8829 o Cite RFC 8187 instead of RFC 5987 () 8832 o Cite RFC 7578 instead of RFC 2388 () 8835 o Cite RFC 7595 instead of RFC 4395 () 8838 o improve ABNF readability for qdtext (, ) 8841 o Clarify "resource" vs "representation" in definition of status 8842 code 416 (, 8843 ) 8845 o Resolved erratum 4072, no change needed here 8846 (, 8847 ) 8849 o Clarify DELETE status code suggestions 8850 (, 8851 ) 8853 o In Section 6.3.4, fix ABNF for "other-range-resp" to use VCHAR 8854 instead of CHAR (, 8855 ) 8857 o Resolved erratum 5162, no change needed here 8858 (, 8859 ) 8861 o Replace "response code" with "response status code" and "status- 8862 code" (the ABNF production name from the HTTP/1.1 message format) 8863 by "status code" (, 8864 ) 8866 o Added a missing word in Section 9.4 (, ) 8869 o In Section 4.5, fixed an example that had trailing whitespace 8870 where it shouldn't (, ) 8873 o In Section 9.3.7, remove words that were potentially misleading 8874 with respect to the relation to the requested ranges 8875 (, 8876 ) 8878 C.4. Since draft-ietf-httpbis-semantics-02 8880 o Included (Proxy-)Auth-Info header field definition from RFC 7615 8881 () 8883 o In Section 7.3.3, clarify POST caching 8884 () 8886 o Add Section 9.5.19 to reserve the 418 status code 8887 () 8889 o In Section 2.1 and Section 8.1.1, clarified when a response can be 8890 sent () 8892 o In Section 6.1.1.1, explain the difference between the "token" 8893 production, the RFC 2978 ABNF for charset names, and the actual 8894 registration practice (, ) 8897 o In Section 2.5, removed the fragment component in the URI scheme 8898 definitions as per Section 4.3 of [RFC3986], furthermore moved 8899 fragment discussion into a separate section 8900 (, 8901 , ) 8904 o In Section 3.5, add language about minor HTTP version number 8905 defaulting () 8907 o Added Section 9.5.20 for status code 422, previously defined in 8908 Section 11.2 of [RFC4918] () 8911 o In Section 9.5.17, fixed prose about byte range comparison 8912 (, 8913 ) 8915 o In Section 2.1, explain that request/response correlation is 8916 version specific () 8919 C.5. Since draft-ietf-httpbis-semantics-03 8921 o In Section 9.4.9, include status code 308 from RFC 7538 8922 () 8924 o In Section 6.1.1, clarify that the charset parameter value is 8925 case-insensitive due to the definition in RFC 2046 8926 () 8928 o Define a separate registry for HTTP header field names 8929 () 8931 o In Section 8.4, refactor and clarify description of wildcard ("*") 8932 handling () 8934 o Deprecate Accept-Charset () 8937 o In Section 8.2.1, mention Cache-Control: immutable 8938 () 8940 o In Section 4.1, clarify when header field combination is allowed 8941 () 8943 o In Section 12.4, instruct IANA to mark Content-MD5 as obsolete 8944 () 8946 o Use RFC 7405 ABNF notation for case-sensitive string constants 8947 () 8949 o Rework Section 2.1 to be more version-independent 8950 () 8952 o In Section 7.3.5, clarify that DELETE needs to be successful to 8953 invalidate cache (, ) 8956 C.6. Since draft-ietf-httpbis-semantics-04 8958 o In Section 4.4, fix field-content ABNF 8959 (, 8960 ) 8962 o Move Section 4.4.1.4 into its own section 8963 () 8965 o In Section 6.2.1, reference MIME Sniffing 8966 () 8968 o In Section 4.5, simplify the #rule mapping for recipients 8969 (, 8970 ) 8972 o In Section 7.3.7, remove misleading text about "extension" of HTTP 8973 is needed to define method payloads () 8976 o Fix editorial issue in Section 6 () 8979 o In Section 9.5.20, rephrase language not to use "entity" anymore, 8980 and also avoid lowercase "may" () 8983 o Move discussion of retries from [Messaging] into Section 7.2.2 8984 () 8986 C.7. Since draft-ietf-httpbis-semantics-05 8988 o Moved transport-independent part of the description of trailers 8989 into Section 4.6 () 8991 o Loosen requirements on retries based upon implementation behavior 8992 () 8994 o In Section 12.9, update IANA port registry for TCP/UDP on ports 80 8995 and 443 () 8997 o In Section 4.7, revise guidelines for new header field names 8998 () 9000 o In Section 7.2.3, remove concept of "cacheable methods" in favor 9001 of prose (, 9002 ) 9004 o In Section 11.1, mention that the concept of authority can be 9005 modified by protocol extensions () 9008 o Create new subsection on payload body in Section 6.3.3, taken from 9009 portions of message body () 9012 o Moved definition of "Whitespace" into new container "Generic 9013 Syntax" () 9015 o In Section 2.5, recommend minimum URI size support for 9016 implementations () 9018 o In Section 6.1.4, refactored the range-unit and ranges-specifier 9019 grammars (, 9020 ) 9022 o In Section 7.3.1, caution against a request body more strongly 9023 () 9025 o Reorganized text in Section 4.7 () 9028 o In Section 9.5.4, replace "authorize" with "fulfill" 9029 () 9031 o In Section 7.3.7, removed a misleading statement about Content- 9032 Length (, 9033 ) 9035 o In Section 11.1, add text from RFC 2818 9036 () 9038 o Changed "cacheable by default" to "heuristically cacheable" 9039 throughout () 9041 C.8. Since draft-ietf-httpbis-semantics-06 9043 o In Section 5.7.1, simplify received-by grammar (and disallow comma 9044 character) () 9046 o In Section 4.3, give guidance on interoperable field names 9047 () 9049 o In Section 1.2.1, define the semantics and possible replacement of 9050 whitespace when it is known to occur () 9053 o In Section 4, introduce field terminology and distinguish between 9054 field line values and field values; use terminology consistently 9055 throughout () 9057 o Moved #rule definition into Section 4.4 and whitespace into 9058 Section 1.2 () 9060 o In Section 6.1.4, explicitly call out range unit names as case- 9061 insensitive, and encourage registration 9062 () 9064 o In Section 6.1.2, explicitly call out content codings as case- 9065 insensitive, and encourage registration 9066 () 9068 o In Section 4.3, explicitly call out field names as case- 9069 insensitive () 9071 o In Section 11.11, cite [Bujlow] () 9074 o In Section 9, formally define "final" and "interim" status codes 9075 () 9077 o In Section 7.3.5, caution against a request body more strongly 9078 () 9080 o In Section 10.2.3, note that Etag can be used in trailers 9081 () 9083 o In Section 12.4, consider reserved fields as well 9084 () 9086 o In Section 2.5.4, be more correct about what was deprecated by RFC 9087 3986 (, 9088 ) 9090 o In Section 4.1, recommend comma SP when combining field lines 9091 () 9093 o In Section 5.6, make explicit requirements on origin server to use 9094 authority from absolute-form when available 9095 () 9097 o In Section 2.5.1, Section 2.5.2, Section 5.2, and Section 5.4, 9098 refactored schemes to define origin and authoritative access to an 9099 origin server for both "http" and "https" URIs to account for 9100 alternative services and secured connections that are not 9101 necessarily based on TCP () 9104 o In Section 1.1, reference RFC 8174 as well 9105 () 9107 Index 9109 1 9110 100 Continue (status code) 121 9111 100-continue (expect value) 88 9112 101 Switching Protocols (status code) 121 9113 1xx Informational (status code class) 120 9115 2 9116 200 OK (status code) 121 9117 201 Created (status code) 122 9118 202 Accepted (status code) 122 9119 203 Non-Authoritative Information (status code) 123 9120 204 No Content (status code) 123 9121 205 Reset Content (status code) 124 9122 206 Partial Content (status code) 124 9123 2xx Successful (status code class) 121 9125 3 9126 300 Multiple Choices (status code) 129 9127 301 Moved Permanently (status code) 130 9128 302 Found (status code) 130 9129 303 See Other (status code) 131 9130 304 Not Modified (status code) 131 9131 305 Use Proxy (status code) 132 9132 306 (Unused) (status code) 132 9133 307 Temporary Redirect (status code) 132 9134 308 Permanent Redirect (status code) 133 9135 3xx Redirection (status code class) 127 9137 4 9138 400 Bad Request (status code) 133 9139 401 Unauthorized (status code) 133 9140 402 Payment Required (status code) 134 9141 403 Forbidden (status code) 134 9142 404 Not Found (status code) 134 9143 405 Method Not Allowed (status code) 135 9144 406 Not Acceptable (status code) 135 9145 407 Proxy Authentication Required (status code) 135 9146 408 Request Timeout (status code) 135 9147 409 Conflict (status code) 136 9148 410 Gone (status code) 136 9149 411 Length Required (status code) 136 9150 412 Precondition Failed (status code) 137 9151 413 Payload Too Large (status code) 137 9152 414 URI Too Long (status code) 137 9153 415 Unsupported Media Type (status code) 137 9154 416 Range Not Satisfiable (status code) 138 9155 417 Expectation Failed (status code) 138 9156 418 (Unused) (status code) 138 9157 422 Unprocessable Payload (status code) 139 9158 426 Upgrade Required (status code) 139 9159 4xx Client Error (status code class) 133 9161 5 9162 500 Internal Server Error (status code) 140 9163 501 Not Implemented (status code) 140 9164 502 Bad Gateway (status code) 140 9165 503 Service Unavailable (status code) 140 9166 504 Gateway Timeout (status code) 140 9167 505 HTTP Version Not Supported (status code) 140 9168 5xx Server Error (status code class) 139 9170 A 9171 Accept header field 104 9172 Accept-Charset header field 106 9173 Accept-Encoding header field 107 9174 Accept-Language header field 108 9175 Accept-Ranges header field 161 9176 Allow header field 161 9177 Authentication-Info header field 159 9178 Authorization header field 112 9179 accelerator 14 9180 authoritative response 163 9182 B 9183 browser 11 9185 C 9186 CONNECT method 83 9187 Canonical Root URI 111 9188 Content-Encoding header field 59 9189 Content-Language header field 60 9190 Content-Length header field 61 9191 Content-Location header field 62 9192 Content-MD5 header field 173 9193 Content-Range header field 66 9194 Content-Type header field 58 9195 cache 15 9196 cacheable 15 9197 captive portal 15 9198 client 11 9199 compress (Coding Format) 52 9200 compress (content coding) 51 9201 conditional request 91 9202 connection 11 9203 content coding 51 9204 content negotiation 9 9206 D 9207 DELETE method 82 9208 Date header field 145 9209 Delimiters 30 9210 deflate (Coding Format) 52 9211 deflate (content coding) 51 9212 downstream 14 9214 E 9215 ETag field 153 9216 Expect header field 88 9217 effective request URI 43 9219 F 9220 Fields 9221 Accept 104 9222 Accept-Charset 106 9223 Accept-Encoding 107 9224 Accept-Language 108 9225 Accept-Ranges 161 9226 Allow 161 9227 Authentication-Info 159 9228 Authorization 112 9229 Content-Encoding 59 9230 Content-Language 60 9231 Content-Length 61 9232 Content-Location 62 9233 Content-MD5 173 9234 Content-Range 66 9235 Content-Type 58 9236 Date 145 9237 ETag 153 9238 Expect 88 9239 From 115 9240 Host 43 9241 If-Match 95 9242 If-Modified-Since 97 9243 If-None-Match 96 9244 If-Range 100 9245 If-Unmodified-Since 98 9246 Last-Modified 151 9247 Location 146 9248 Max-Forwards 90 9249 Proxy-Authenticate 159 9250 Proxy-Authentication-Info 160 9251 Proxy-Authorization 112 9252 Range 101 9253 Referer 116 9254 Retry-After 147 9255 Server 162 9256 Trailer 34 9257 User-Agent 117 9258 Vary 147 9259 Via 45 9260 WWW-Authenticate 158 9261 Fragment Identifiers 20 9262 From header field 115 9263 field 24 9264 field line 24 9265 field line value 24 9266 field name 24 9267 field value 24 9269 G 9270 GET method 77 9271 Grammar 9272 absolute-path 16 9273 absolute-URI 16 9274 Accept 104 9275 Accept-Charset 106 9276 Accept-Encoding 107 9277 accept-ext 104 9278 Accept-Language 108 9279 accept-params 104 9280 Accept-Ranges 161 9281 acceptable-ranges 161 9282 Allow 161 9283 ALPHA 10 9284 asctime-date 144 9285 auth-param 110 9286 auth-scheme 110 9287 Authentication-Info 159 9288 authority 16 9289 Authorization 112 9290 BWS 11 9291 challenge 110 9292 charset 49 9293 codings 107 9294 comment 31 9295 complete-length 67 9296 content-coding 51 9297 Content-Encoding 59 9298 Content-Language 60 9299 Content-Length 61 9300 Content-Location 62 9301 Content-Range 67 9302 Content-Type 58 9303 CR 10 9304 credentials 111 9305 CRLF 10 9306 ctext 31 9307 CTL 10 9308 Date 145 9309 date1 144 9310 day 144 9311 day-name 144 9312 day-name-l 144 9313 delay-seconds 147 9314 DIGIT 10 9315 DQUOTE 10 9316 entity-tag 154 9317 ETag 154 9318 etagc 154 9319 Expect 88 9320 field-content 28 9321 field-name 26, 34 9322 field-value 28 9323 field-vchar 28 9324 first-pos 55, 67 9325 From 115 9326 GMT 144 9327 HEXDIG 10 9328 Host 43 9329 hour 144 9330 HTAB 10 9331 HTTP-date 143 9332 http-URI 17 9333 https-URI 18 9334 If-Match 95 9335 If-Modified-Since 97 9336 If-None-Match 96 9337 If-Range 100 9338 If-Unmodified-Since 98 9339 IMF-fixdate 144 9340 incl-range 67 9341 int-range 55 9342 language-range 108 9343 language-tag 53 9344 Last-Modified 151 9345 last-pos 55, 67 9346 LF 10 9347 Location 146 9348 Max-Forwards 90 9349 media-range 104 9350 media-type 49 9351 method 73 9352 minute 144 9353 month 144 9354 obs-date 144 9355 obs-text 30 9356 OCTET 10 9357 opaque-tag 154 9358 other-range 55 9359 OWS 11 9360 parameter 31 9361 parameter-name 31 9362 parameter-value 31 9363 partial-URI 16 9364 port 16 9365 product 117 9366 product-version 117 9367 protocol-name 45 9368 protocol-version 45 9369 Proxy-Authenticate 159 9370 Proxy-Authentication-Info 160 9371 Proxy-Authorization 112 9372 pseudonym 45 9373 qdtext 30 9374 query 16 9375 quoted-pair 30 9376 quoted-string 30 9377 qvalue 104 9378 Range 101 9379 range-resp 67 9380 range-set 55 9381 range-spec 55 9382 range-unit 54 9383 ranges-specifier 55 9384 received-by 45 9385 received-protocol 45 9386 Referer 116 9387 Retry-After 147 9388 rfc850-date 144 9389 RWS 11 9390 second 144 9391 segment 16 9392 Server 162 9393 SP 10 9394 subtype 49 9395 suffix-length 55 9396 suffix-range 55 9397 tchar 30 9398 time-of-day 144 9399 token 30 9400 token68 110 9401 Trailer 34 9402 type 49 9403 unsatisfied-range 67 9404 uri-host 16 9405 URI-reference 16 9406 User-Agent 117 9407 Vary 148 9408 VCHAR 10 9409 Via 45 9410 weak 154 9411 weight 104 9412 WWW-Authenticate 158 9413 year 144 9414 gateway 14 9415 gzip (Coding Format) 52 9416 gzip (content coding) 51 9418 H 9419 HEAD method 78 9420 Header Fields 9421 Accept 104 9422 Accept-Charset 106 9423 Accept-Encoding 107 9424 Accept-Language 108 9425 Accept-Ranges 161 9426 Allow 161 9427 Authentication-Info 159 9428 Authorization 112 9429 Content-Encoding 59 9430 Content-Language 60 9431 Content-Length 61 9432 Content-Location 62 9433 Content-MD5 173 9434 Content-Range 66 9435 Content-Type 58 9436 Date 145 9437 ETag 153 9438 Expect 88 9439 From 115 9440 Host 43 9441 If-Match 95 9442 If-Modified-Since 97 9443 If-None-Match 96 9444 If-Range 100 9445 If-Unmodified-Since 98 9446 Last-Modified 151 9447 Location 146 9448 Max-Forwards 90 9449 Proxy-Authenticate 159 9450 Proxy-Authentication-Info 160 9451 Proxy-Authorization 112 9452 Range 101 9453 Referer 116 9454 Retry-After 147 9455 Server 162 9456 Trailer 34 9457 User-Agent 117 9458 Vary 147 9459 Via 45 9460 WWW-Authenticate 158 9461 Host header field 43 9462 header section 24 9463 http URI scheme 17 9464 https URI scheme 18 9466 I 9467 If-Match header field 95 9468 If-Modified-Since header field 97 9469 If-None-Match header field 96 9470 If-Range header field 100 9471 If-Unmodified-Since header field 98 9472 idempotent 76 9473 inbound 14 9474 interception proxy 15 9475 intermediary 13 9477 L 9478 Last-Modified header field 151 9479 Location header field 146 9481 M 9482 Max-Forwards header field 90 9483 Media Type 9484 multipart/byteranges 68 9485 multipart/x-byteranges 69 9486 message 12 9487 metadata 149 9488 multipart/byteranges Media Type 68 9489 multipart/x-byteranges Media Type 69 9491 N 9492 non-transforming proxy 47 9494 O 9495 OPTIONS method 85 9496 origin 37 9497 origin server 11 9498 outbound 14 9500 P 9501 POST method 79 9502 PUT method 80 9503 Protection Space 111 9504 Proxy-Authenticate header field 159 9505 Proxy-Authentication-Info header field 160 9506 Proxy-Authorization header field 112 9507 payload 64 9508 phishing 163 9509 proxy 14 9511 R 9512 Range header field 101 9513 Realm 111 9514 Referer header field 116 9515 Retry-After header field 147 9516 recipient 11 9517 representation 48 9518 request 12 9519 resource 16 9520 response 12 9521 reverse proxy 14 9523 S 9524 Server header field 162 9525 Status Code 118 9526 Status Codes 9527 Final 119 9528 Informational 119 9529 Interim 119 9530 Status Codes Classes 9531 1xx Informational 120 9532 2xx Successful 121 9533 3xx Redirection 127 9534 4xx Client Error 133 9535 5xx Server Error 139 9536 safe 75 9537 secured 18 9538 selected representation 48, 91, 149 9539 sender 11 9540 server 11 9541 spider 11 9543 T 9544 TRACE method 86 9545 Trailer Fields 9546 ETag 153 9547 Trailer header field 34 9548 target URI 37 9549 target resource 37 9550 trailer fields 33 9551 trailer section 24 9552 trailers 33 9553 transforming proxy 47 9554 transparent proxy 15 9555 tunnel 14 9557 U 9558 URI 9559 origin 37 9560 URI scheme 9561 http 17 9562 https 18 9563 User-Agent header field 117 9564 upstream 14 9565 user agent 11 9567 V 9568 Vary header field 147 9569 Via header field 45 9570 validator 149 9571 strong 150 9572 weak 150 9574 W 9575 WWW-Authenticate header field 158 9577 X 9578 x-compress (content coding) 51 9579 x-gzip (content coding) 51 9581 Acknowledgments 9583 This edition of the HTTP specification builds on the many 9584 contributions that went into RFC 1945, RFC 2068, RFC 2145, RFC 2616, 9585 and RFC 2818, including substantial contributions made by the 9586 previous authors, editors, and Working Group Chairs: Tim Berners-Lee, 9587 Ari Luotonen, Roy T. Fielding, Henrik Frystyk Nielsen, Jim Gettys, 9588 Jeffrey C. Mogul, Larry Masinter, Paul J. Leach, Eric Rescorla, and 9589 Yves Lafon. 9591 See Section 10 of [RFC7230] for further acknowledgements from prior 9592 revisions. 9594 In addition, this document has reincorporated the HTTP Authentication 9595 Framework, previously defined in RFC 7235 and RFC 2617. We thank 9596 John Franks, Phillip M. Hallam-Baker, Jeffery L. Hostetler, Scott 9597 D. Lawrence, Paul J. Leach, Ari Luotonen, and Lawrence C. Stewart 9598 for their work on that specification. See Section 6 of [RFC2617] for 9599 further acknowledgements. 9601 [[newacks: New acks to be added here.]] 9603 Authors' Addresses 9605 Roy T. Fielding (editor) 9606 Adobe 9607 345 Park Ave 9608 San Jose, CA 95110 9609 United States of America 9611 EMail: fielding@gbiv.com 9612 URI: https://roy.gbiv.com/ 9614 Mark Nottingham (editor) 9615 Fastly 9617 EMail: mnot@mnot.net 9618 URI: https://www.mnot.net/ 9620 Julian F. Reschke (editor) 9621 greenbytes GmbH 9622 Hafenweg 16 9623 Muenster 48155 9624 Germany 9626 EMail: julian.reschke@greenbytes.de 9627 URI: https://greenbytes.de/tech/webdav/