draft-ietf-httpbis-semantics-11.txt   draft-ietf-httpbis-semantics-12.txt 
HTTP Working Group R. Fielding, Ed. HTTP Working Group R. Fielding, Ed.
Internet-Draft Adobe Internet-Draft Adobe
Obsoletes: 2818, 7230, 7231, 7232, 7233, 7235, M. Nottingham, Ed. Obsoletes: 2818, 7230, 7231, 7232, 7233, 7235, M. Nottingham, Ed.
7538, 7615, 7694 (if approved) Fastly 7538, 7615, 7694 (if approved) Fastly
Intended status: Standards Track J. F. Reschke, Ed. Intended status: Standards Track J. Reschke, Ed.
Expires: February 28, 2021 greenbytes Expires: April 5, 2021 greenbytes
August 27, 2020 October 2, 2020
HTTP Semantics HTTP Semantics
draft-ietf-httpbis-semantics-11 draft-ietf-httpbis-semantics-12
Abstract Abstract
The Hypertext Transfer Protocol (HTTP) is a stateless application- The Hypertext Transfer Protocol (HTTP) is a stateless application-
level protocol for distributed, collaborative, hypertext information level protocol for distributed, collaborative, hypertext information
systems. This document defines the semantics of HTTP: its systems. This document defines the semantics of HTTP: its
architecture, terminology, the "http" and "https" Uniform Resource architecture, terminology, the "http" and "https" Uniform Resource
Identifier (URI) schemes, core request methods, request header Identifier (URI) schemes, core request methods, request header
fields, response status codes, response header fields, and content fields, response status codes, response header fields, and content
negotiation. negotiation.
skipping to change at page 1, line 39 skipping to change at page 1, line 39
This note is to be removed before publishing as an RFC. This note is to be removed before publishing as an RFC.
Discussion of this draft takes place on the HTTP working group Discussion of this draft takes place on the HTTP working group
mailing list (ietf-http-wg@w3.org), which is archived at mailing list (ietf-http-wg@w3.org), which is archived at
<https://lists.w3.org/Archives/Public/ietf-http-wg/>. <https://lists.w3.org/Archives/Public/ietf-http-wg/>.
Working Group information can be found at <https://httpwg.org/>; Working Group information can be found at <https://httpwg.org/>;
source code and issues list for this draft can be found at source code and issues list for this draft can be found at
<https://github.com/httpwg/http-core>. <https://github.com/httpwg/http-core>.
The changes in this draft are summarized in Appendix C.12. The changes in this draft are summarized in Appendix C.13.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on February 28, 2021. This Internet-Draft will expire on April 5, 2021.
Copyright Notice Copyright Notice
Copyright (c) 2020 IETF Trust and the persons identified as the Copyright (c) 2020 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents (https://trustee.ietf.org/ Provisions Relating to IETF Documents (https://trustee.ietf.org/
license-info) in effect on the date of publication of this document. license-info) in effect on the date of publication of this document.
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
skipping to change at page 2, line 40 skipping to change at page 2, line 40
modifications of such material outside the IETF Standards Process. modifications of such material outside the IETF Standards Process.
Without obtaining an adequate license from the person(s) controlling Without obtaining an adequate license from the person(s) controlling
the copyright in such materials, this document may not be modified the copyright in such materials, this document may not be modified
outside the IETF Standards Process, and derivative works of it may outside the IETF Standards Process, and derivative works of it may
not be created outside the IETF Standards Process, except to format not be created outside the IETF Standards Process, except to format
it for publication as an RFC or to translate it into languages other it for publication as an RFC or to translate it into languages other
than English. than English.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 9
1.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2. Evolution . . . . . . . . . . . . . . . . . . . . . . . . 9 1.2. Evolution . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3. Semantics . . . . . . . . . . . . . . . . . . . . . . . . 9 1.3. Semantics . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4. Obsoletes . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4. Obsoletes . . . . . . . . . . . . . . . . . . . . . . . . 11
1.5. Requirements Notation . . . . . . . . . . . . . . . . . . 11 2. Conformance . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.6. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 11 2.1. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 12
1.6.1. Whitespace . . . . . . . . . . . . . . . . . . . . . 12 2.2. Requirements Notation . . . . . . . . . . . . . . . . . . 12
2. Architecture . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3. Length Requirements . . . . . . . . . . . . . . . . . . . 13
2.1. Client/Server Messaging . . . . . . . . . . . . . . . . . 13 2.4. Error Handling . . . . . . . . . . . . . . . . . . . . . 14
2.2. Intermediaries . . . . . . . . . . . . . . . . . . . . . 15 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3. Caches . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4. Uniform Resource Identifiers . . . . . . . . . . . . . . 18 3.2. Connections . . . . . . . . . . . . . . . . . . . . . . . 15
2.5. Resources . . . . . . . . . . . . . . . . . . . . . . . . 19 3.3. Messages . . . . . . . . . . . . . . . . . . . . . . . . 15
2.5.1. http URI Scheme . . . . . . . . . . . . . . . . . . . 19 3.4. User Agent . . . . . . . . . . . . . . . . . . . . . . . 15
2.5.2. https URI Scheme . . . . . . . . . . . . . . . . . . 20 3.5. Origin Server . . . . . . . . . . . . . . . . . . . . . . 16
2.5.3. http and https URI Normalization and Comparison . . . 21 3.6. Example Request and Response . . . . . . . . . . . . . . 16
2.5.4. Deprecated userinfo . . . . . . . . . . . . . . . . . 21 3.7. Intermediaries . . . . . . . . . . . . . . . . . . . . . 17
2.5.5. Fragment Identifiers on http(s) URI References . . . 22 3.8. Caches . . . . . . . . . . . . . . . . . . . . . . . . . 19
3. Conformance . . . . . . . . . . . . . . . . . . . . . . . . . 22 4. Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1. Implementation Diversity . . . . . . . . . . . . . . . . 22 4.1. URI References . . . . . . . . . . . . . . . . . . . . . 20
3.2. Role-based Requirements . . . . . . . . . . . . . . . . . 23 4.2. URI Schemes . . . . . . . . . . . . . . . . . . . . . . . 21
3.3. Parsing Elements . . . . . . . . . . . . . . . . . . . . 24 4.2.1. http URI Scheme . . . . . . . . . . . . . . . . . . . 22
3.4. Error Handling . . . . . . . . . . . . . . . . . . . . . 24 4.2.2. https URI Scheme . . . . . . . . . . . . . . . . . . 22
4. Extending and Versioning HTTP . . . . . . . . . . . . . . . . 25 4.2.3. http(s) Normalization and Comparison . . . . . . . . 23
4.1. Extending HTTP . . . . . . . . . . . . . . . . . . . . . 25 4.2.4. http(s) Deprecated userinfo . . . . . . . . . . . . . 24
4.2. Protocol Versioning . . . . . . . . . . . . . . . . . . . 26 4.2.5. http(s) References with Fragment Identifiers . . . . 24
5. Header and Trailer Fields . . . . . . . . . . . . . . . . . . 27 4.3. Authoritative Access . . . . . . . . . . . . . . . . . . 24
5.1. Field Ordering and Combination . . . . . . . . . . . . . 28 4.3.1. URI Origin . . . . . . . . . . . . . . . . . . . . . 24
5.2. Field Limits . . . . . . . . . . . . . . . . . . . . . . 29 4.3.2. http origins . . . . . . . . . . . . . . . . . . . . 25
5.3. Field Names . . . . . . . . . . . . . . . . . . . . . . . 30 4.3.3. https origins . . . . . . . . . . . . . . . . . . . . 26
5.3.1. Field Extensibility . . . . . . . . . . . . . . . . . 30 4.3.4. https certificate verification . . . . . . . . . . . 27
5.3.2. Field Name Registry . . . . . . . . . . . . . . . . . 31 5. Message Abstraction . . . . . . . . . . . . . . . . . . . . . 28
5.4. Field Values . . . . . . . . . . . . . . . . . . . . . . 32 5.1. Protocol Version . . . . . . . . . . . . . . . . . . . . 28
5.4.1. Common Field Value Components . . . . . . . . . . . . 34 5.2. Framing . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.5. ABNF List Extension: #rule . . . . . . . . . . . . . . . 37 5.3. Control Data . . . . . . . . . . . . . . . . . . . . . . 30
5.5.1. Sender Requirements . . . . . . . . . . . . . . . . . 38 5.3.1. Request . . . . . . . . . . . . . . . . . . . . . . . 30
5.5.2. Recipient Requirements . . . . . . . . . . . . . . . 38 5.3.2. Response . . . . . . . . . . . . . . . . . . . . . . 30
5.6. Trailer Fields . . . . . . . . . . . . . . . . . . . . . 39 5.4. Header Fields . . . . . . . . . . . . . . . . . . . . . . 30
5.6.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . 39 5.4.1. Field Ordering and Combination . . . . . . . . . . . 32
5.6.2. Limitations . . . . . . . . . . . . . . . . . . . . . 39 5.4.2. Field Limits . . . . . . . . . . . . . . . . . . . . 33
5.6.3. Processing . . . . . . . . . . . . . . . . . . . . . 40 5.4.3. Field Names . . . . . . . . . . . . . . . . . . . . . 33
5.6.4. Trailer . . . . . . . . . . . . . . . . . . . . . . . 41 5.4.4. Field Values . . . . . . . . . . . . . . . . . . . . 33
5.6.5. TE . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.5. Payload . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.7. Considerations for New HTTP Fields . . . . . . . . . . . 41 5.5.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . 35
5.8. Fields Defined In This Document . . . . . . . . . . . . . 43 5.5.2. Identification . . . . . . . . . . . . . . . . . . . 36
6. Message Routing . . . . . . . . . . . . . . . . . . . . . . . 44 5.5.3. Payload Metadata . . . . . . . . . . . . . . . . . . 37
6.1. Identifying a Target Resource . . . . . . . . . . . . . . 44 5.5.4. Payload Body . . . . . . . . . . . . . . . . . . . . 37
6.2. Determining Origin . . . . . . . . . . . . . . . . . . . 45 5.6. Trailer Fields . . . . . . . . . . . . . . . . . . . . . 37
6.3. Routing Inbound . . . . . . . . . . . . . . . . . . . . . 45 5.6.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . 38
6.3.1. To a Cache . . . . . . . . . . . . . . . . . . . . . 46 5.6.2. Limitations . . . . . . . . . . . . . . . . . . . . . 38
6.3.2. To a Proxy . . . . . . . . . . . . . . . . . . . . . 46 5.6.3. Processing . . . . . . . . . . . . . . . . . . . . . 39
6.3.3. To the Origin . . . . . . . . . . . . . . . . . . . . 46 5.7. Common Rules for Defining Field Values . . . . . . . . . 39
6.4. Reconstructing the Target URI . . . . . . . . . . . . . . 49 5.7.1. Lists (#rule ABNF Extension) . . . . . . . . . . . . 39
6.5. Host . . . . . . . . . . . . . . . . . . . . . . . . . . 50 5.7.2. Tokens . . . . . . . . . . . . . . . . . . . . . . . 41
6.6. Message Forwarding . . . . . . . . . . . . . . . . . . . 50 5.7.3. Whitespace . . . . . . . . . . . . . . . . . . . . . 41
6.6.1. Via . . . . . . . . . . . . . . . . . . . . . . . . . 51 5.7.4. Quoted Strings . . . . . . . . . . . . . . . . . . . 42
6.6.2. Transformations . . . . . . . . . . . . . . . . . . . 53 5.7.5. Comments . . . . . . . . . . . . . . . . . . . . . . 42
6.7. Upgrading HTTP . . . . . . . . . . . . . . . . . . . . . 54 5.7.6. Parameters . . . . . . . . . . . . . . . . . . . . . 43
6.7.1. Upgrade Protocol Names . . . . . . . . . . . . . . . 56 5.7.7. Date/Time Formats . . . . . . . . . . . . . . . . . . 43
6.7.2. Upgrade Token Registry . . . . . . . . . . . . . . . 56 6. Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.1. Target Resource . . . . . . . . . . . . . . . . . . . . . 45
6.8. Connection-Specific Fields . . . . . . . . . . . . . . . 57 6.1.1. Request Target . . . . . . . . . . . . . . . . . . . 45
7. Representations . . . . . . . . . . . . . . . . . . . . . . . 59 6.1.2. Host . . . . . . . . . . . . . . . . . . . . . . . . 46
7.1. Representation Data . . . . . . . . . . . . . . . . . . . 59 6.1.3. Reconstructing the Target URI . . . . . . . . . . . . 47
7.1.1. Media Type . . . . . . . . . . . . . . . . . . . . . 60 6.2. Routing Inbound . . . . . . . . . . . . . . . . . . . . . 47
7.1.2. Content Codings . . . . . . . . . . . . . . . . . . . 62 6.2.1. To a Cache . . . . . . . . . . . . . . . . . . . . . 47
7.1.3. Language Tags . . . . . . . . . . . . . . . . . . . . 64 6.2.2. To a Proxy . . . . . . . . . . . . . . . . . . . . . 48
7.1.4. Range Units . . . . . . . . . . . . . . . . . . . . . 64 6.2.3. To the Origin . . . . . . . . . . . . . . . . . . . . 48
7.2. Representation Metadata . . . . . . . . . . . . . . . . . 68 6.3. Response Correlation . . . . . . . . . . . . . . . . . . 48
7.2.1. Content-Type . . . . . . . . . . . . . . . . . . . . 69 6.4. Message Forwarding . . . . . . . . . . . . . . . . . . . 48
7.2.2. Content-Encoding . . . . . . . . . . . . . . . . . . 70 6.4.1. Connection . . . . . . . . . . . . . . . . . . . . . 49
7.2.3. Content-Language . . . . . . . . . . . . . . . . . . 71 6.4.2. Max-Forwards . . . . . . . . . . . . . . . . . . . . 50
7.2.4. Content-Length . . . . . . . . . . . . . . . . . . . 72 6.4.3. Via . . . . . . . . . . . . . . . . . . . . . . . . . 51
7.2.5. Content-Location . . . . . . . . . . . . . . . . . . 73 6.5. Transformations . . . . . . . . . . . . . . . . . . . . . 53
7.3. Payload . . . . . . . . . . . . . . . . . . . . . . . . . 75 6.6. Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . 54
7.3.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . 75 7. Representations . . . . . . . . . . . . . . . . . . . . . . . 56
7.3.2. Identification . . . . . . . . . . . . . . . . . . . 76 7.1. Selected Representation . . . . . . . . . . . . . . . . . 57
7.3.3. Payload Body . . . . . . . . . . . . . . . . . . . . 77 7.2. Data . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7.3.4. Content-Range . . . . . . . . . . . . . . . . . . . . 78 7.3. Metadata . . . . . . . . . . . . . . . . . . . . . . . . 57
7.3.5. Media Type multipart/byteranges . . . . . . . . . . . 79 7.4. Content-Type . . . . . . . . . . . . . . . . . . . . . . 58
7.4. Content Negotiation . . . . . . . . . . . . . . . . . . . 81 7.4.1. Media Type . . . . . . . . . . . . . . . . . . . . . 59
7.4.1. Proactive Negotiation . . . . . . . . . . . . . . . . 82 7.4.2. Charset . . . . . . . . . . . . . . . . . . . . . . . 59
7.4.2. Reactive Negotiation . . . . . . . . . . . . . . . . 83 7.4.3. Canonicalization and Text Defaults . . . . . . . . . 60
7.4.3. Request Payload Negotiation . . . . . . . . . . . . . 84 7.4.4. Multipart Types . . . . . . . . . . . . . . . . . . . 61
7.4.4. Quality Values . . . . . . . . . . . . . . . . . . . 84 7.5. Content-Encoding . . . . . . . . . . . . . . . . . . . . 61
8. Request Methods . . . . . . . . . . . . . . . . . . . . . . . 85 7.5.1. Content Codings . . . . . . . . . . . . . . . . . . . 62
8.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 85 7.6. Content-Language . . . . . . . . . . . . . . . . . . . . 63
8.2. Common Method Properties . . . . . . . . . . . . . . . . 86 7.6.1. Language Tags . . . . . . . . . . . . . . . . . . . . 64
8.2.1. Safe Methods . . . . . . . . . . . . . . . . . . . . 87 7.7. Content-Length . . . . . . . . . . . . . . . . . . . . . 65
8.2.2. Idempotent Methods . . . . . . . . . . . . . . . . . 88 7.8. Content-Location . . . . . . . . . . . . . . . . . . . . 66
8.2.3. Methods and Caching . . . . . . . . . . . . . . . . . 89 7.9. Validators . . . . . . . . . . . . . . . . . . . . . . . 68
8.3. Method Definitions . . . . . . . . . . . . . . . . . . . 89 7.9.1. Weak versus Strong . . . . . . . . . . . . . . . . . 69
8.3.1. GET . . . . . . . . . . . . . . . . . . . . . . . . . 89 7.9.2. Last-Modified . . . . . . . . . . . . . . . . . . . . 71
8.3.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . 90 7.9.3. ETag . . . . . . . . . . . . . . . . . . . . . . . . 73
8.3.3. POST . . . . . . . . . . . . . . . . . . . . . . . . 91 7.9.4. When to Use Entity-Tags and Last-Modified Dates . . . 76
8.3.4. PUT . . . . . . . . . . . . . . . . . . . . . . . . . 92 8. Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
8.3.5. DELETE . . . . . . . . . . . . . . . . . . . . . . . 95 8.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 77
8.3.6. CONNECT . . . . . . . . . . . . . . . . . . . . . . . 96 8.2. Common Method Properties . . . . . . . . . . . . . . . . 78
8.3.7. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . 97 8.2.1. Safe Methods . . . . . . . . . . . . . . . . . . . . 79
8.3.8. TRACE . . . . . . . . . . . . . . . . . . . . . . . . 98 8.2.2. Idempotent Methods . . . . . . . . . . . . . . . . . 80
8.4. Method Extensibility . . . . . . . . . . . . . . . . . . 99 8.2.3. Methods and Caching . . . . . . . . . . . . . . . . . 81
8.4.1. Method Registry . . . . . . . . . . . . . . . . . . . 99 8.3. Method Definitions . . . . . . . . . . . . . . . . . . . 81
8.4.2. Considerations for New Methods . . . . . . . . . . . 100 8.3.1. GET . . . . . . . . . . . . . . . . . . . . . . . . . 81
9. Request Header Fields . . . . . . . . . . . . . . . . . . . . 100 8.3.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . 82
9.1. Controls . . . . . . . . . . . . . . . . . . . . . . . . 100 8.3.3. POST . . . . . . . . . . . . . . . . . . . . . . . . 83
9.1.1. Expect . . . . . . . . . . . . . . . . . . . . . . . 101 8.3.4. PUT . . . . . . . . . . . . . . . . . . . . . . . . . 84
9.1.2. Max-Forwards . . . . . . . . . . . . . . . . . . . . 103 8.3.5. DELETE . . . . . . . . . . . . . . . . . . . . . . . 87
9.2. Preconditions . . . . . . . . . . . . . . . . . . . . . . 104 8.3.6. CONNECT . . . . . . . . . . . . . . . . . . . . . . . 88
9.2.1. Evaluation . . . . . . . . . . . . . . . . . . . . . 105 8.3.7. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . 89
9.2.2. Precedence . . . . . . . . . . . . . . . . . . . . . 106 8.3.8. TRACE . . . . . . . . . . . . . . . . . . . . . . . . 90
9.2.3. If-Match . . . . . . . . . . . . . . . . . . . . . . 107 9. Context . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
9.2.4. If-None-Match . . . . . . . . . . . . . . . . . . . . 109 9.1. Request Context . . . . . . . . . . . . . . . . . . . . . 91
9.2.5. If-Modified-Since . . . . . . . . . . . . . . . . . . 110 9.1.1. Expect . . . . . . . . . . . . . . . . . . . . . . . 92
9.2.6. If-Unmodified-Since . . . . . . . . . . . . . . . . . 112 9.1.2. From . . . . . . . . . . . . . . . . . . . . . . . . 94
9.2.7. If-Range . . . . . . . . . . . . . . . . . . . . . . 113 9.1.3. Referer . . . . . . . . . . . . . . . . . . . . . . . 95
9.3. Range . . . . . . . . . . . . . . . . . . . . . . . . . . 114 9.1.4. TE . . . . . . . . . . . . . . . . . . . . . . . . . 96
9.4. Negotiation . . . . . . . . . . . . . . . . . . . . . . . 116 9.1.5. Trailer . . . . . . . . . . . . . . . . . . . . . . . 96
9.4.1. Accept . . . . . . . . . . . . . . . . . . . . . . . 117 9.1.6. User-Agent . . . . . . . . . . . . . . . . . . . . . 97
9.4.2. Accept-Charset . . . . . . . . . . . . . . . . . . . 119 9.2. Response Context . . . . . . . . . . . . . . . . . . . . 98
9.4.3. Accept-Encoding . . . . . . . . . . . . . . . . . . . 120 9.2.1. Allow . . . . . . . . . . . . . . . . . . . . . . . . 98
9.4.4. Accept-Language . . . . . . . . . . . . . . . . . . . 122 9.2.2. Date . . . . . . . . . . . . . . . . . . . . . . . . 99
9.5. Authentication Credentials . . . . . . . . . . . . . . . 123 9.2.3. Location . . . . . . . . . . . . . . . . . . . . . . 100
9.5.1. Challenge and Response . . . . . . . . . . . . . . . 123 9.2.4. Retry-After . . . . . . . . . . . . . . . . . . . . . 101
9.5.2. Protection Space (Realm) . . . . . . . . . . . . . . 125 9.2.5. Server . . . . . . . . . . . . . . . . . . . . . . . 102
9.5.3. Authorization . . . . . . . . . . . . . . . . . . . . 126 10. Authentication . . . . . . . . . . . . . . . . . . . . . . . 102
9.5.4. Proxy-Authorization . . . . . . . . . . . . . . . . . 126 10.1. Authentication Scheme . . . . . . . . . . . . . . . . . 102
9.5.5. Authentication Scheme Extensibility . . . . . . . . . 127 10.2. Authentication Parameters . . . . . . . . . . . . . . . 103
9.6. Request Context . . . . . . . . . . . . . . . . . . . . . 129 10.3. Challenge and Response . . . . . . . . . . . . . . . . . 103
9.6.1. From . . . . . . . . . . . . . . . . . . . . . . . . 129 10.4. Credentials . . . . . . . . . . . . . . . . . . . . . . 104
9.6.2. Referer . . . . . . . . . . . . . . . . . . . . . . . 130 10.5. Protection Space (Realm) . . . . . . . . . . . . . . . . 105
9.6.3. User-Agent . . . . . . . . . . . . . . . . . . . . . 131 10.6. Authenticating User to Origin Server . . . . . . . . . . 106
10. Response Status Codes . . . . . . . . . . . . . . . . . . . . 132 10.6.1. WWW-Authenticate . . . . . . . . . . . . . . . . . . 106
10.1. Overview of Status Codes . . . . . . . . . . . . . . . . 133 10.6.2. Authorization . . . . . . . . . . . . . . . . . . . 107
10.2. Informational 1xx . . . . . . . . . . . . . . . . . . . 134 10.6.3. Authentication-Info . . . . . . . . . . . . . . . . 107
10.2.1. 100 Continue . . . . . . . . . . . . . . . . . . . . 134 10.7. Authenticating Client to Proxy . . . . . . . . . . . . . 108
10.2.2. 101 Switching Protocols . . . . . . . . . . . . . . 135 10.7.1. Proxy-Authenticate . . . . . . . . . . . . . . . . . 108
10.3. Successful 2xx . . . . . . . . . . . . . . . . . . . . . 135 10.7.2. Proxy-Authorization . . . . . . . . . . . . . . . . 108
10.3.1. 200 OK . . . . . . . . . . . . . . . . . . . . . . . 135 10.7.3. Proxy-Authentication-Info . . . . . . . . . . . . . 109
10.3.2. 201 Created . . . . . . . . . . . . . . . . . . . . 136 11. Content Negotiation . . . . . . . . . . . . . . . . . . . . . 109
10.3.3. 202 Accepted . . . . . . . . . . . . . . . . . . . . 136 11.1. Proactive Negotiation . . . . . . . . . . . . . . . . . 110
10.3.4. 203 Non-Authoritative Information . . . . . . . . . 137 11.1.1. Shared Negotiation Features . . . . . . . . . . . . 111
10.3.5. 204 No Content . . . . . . . . . . . . . . . . . . . 137 11.1.2. Accept . . . . . . . . . . . . . . . . . . . . . . . 113
10.3.6. 205 Reset Content . . . . . . . . . . . . . . . . . 138 11.1.3. Accept-Charset . . . . . . . . . . . . . . . . . . . 115
10.3.7. 206 Partial Content . . . . . . . . . . . . . . . . 138 11.1.4. Accept-Encoding . . . . . . . . . . . . . . . . . . 116
10.4. Redirection 3xx . . . . . . . . . . . . . . . . . . . . 141 11.1.5. Accept-Language . . . . . . . . . . . . . . . . . . 117
10.4.1. 300 Multiple Choices . . . . . . . . . . . . . . . . 144 11.2. Reactive Negotiation . . . . . . . . . . . . . . . . . . 119
10.4.2. 301 Moved Permanently . . . . . . . . . . . . . . . 145 11.2.1. Vary . . . . . . . . . . . . . . . . . . . . . . . . 120
10.4.3. 302 Found . . . . . . . . . . . . . . . . . . . . . 145 11.3. Request Payload Negotiation . . . . . . . . . . . . . . 121
10.4.4. 303 See Other . . . . . . . . . . . . . . . . . . . 146 12. Conditional Requests . . . . . . . . . . . . . . . . . . . . 121
10.4.5. 304 Not Modified . . . . . . . . . . . . . . . . . . 146 12.1. Preconditions . . . . . . . . . . . . . . . . . . . . . 122
10.4.6. 305 Use Proxy . . . . . . . . . . . . . . . . . . . 147 12.1.1. If-Match . . . . . . . . . . . . . . . . . . . . . . 122
10.4.7. 306 (Unused) . . . . . . . . . . . . . . . . . . . . 147 12.1.2. If-None-Match . . . . . . . . . . . . . . . . . . . 124
10.4.8. 307 Temporary Redirect . . . . . . . . . . . . . . . 147 12.1.3. If-Modified-Since . . . . . . . . . . . . . . . . . 125
10.4.9. 308 Permanent Redirect . . . . . . . . . . . . . . . 148 12.1.4. If-Unmodified-Since . . . . . . . . . . . . . . . . 127
10.5. Client Error 4xx . . . . . . . . . . . . . . . . . . . . 148 12.1.5. If-Range . . . . . . . . . . . . . . . . . . . . . . 128
10.5.1. 400 Bad Request . . . . . . . . . . . . . . . . . . 148 12.2. Evaluation . . . . . . . . . . . . . . . . . . . . . . . 129
10.5.2. 401 Unauthorized . . . . . . . . . . . . . . . . . . 148 12.3. Precedence . . . . . . . . . . . . . . . . . . . . . . . 130
10.5.3. 402 Payment Required . . . . . . . . . . . . . . . . 149 13. Range Requests . . . . . . . . . . . . . . . . . . . . . . . 131
10.5.4. 403 Forbidden . . . . . . . . . . . . . . . . . . . 149 13.1. Range Units . . . . . . . . . . . . . . . . . . . . . . 132
10.5.5. 404 Not Found . . . . . . . . . . . . . . . . . . . 149 13.1.1. Range Specifiers . . . . . . . . . . . . . . . . . . 133
10.5.6. 405 Method Not Allowed . . . . . . . . . . . . . . . 150 13.1.2. Byte Ranges . . . . . . . . . . . . . . . . . . . . 134
10.5.7. 406 Not Acceptable . . . . . . . . . . . . . . . . . 150 13.2. Range . . . . . . . . . . . . . . . . . . . . . . . . . 135
10.5.8. 407 Proxy Authentication Required . . . . . . . . . 150 13.3. Accept-Ranges . . . . . . . . . . . . . . . . . . . . . 137
10.5.9. 408 Request Timeout . . . . . . . . . . . . . . . . 150 13.4. Content-Range . . . . . . . . . . . . . . . . . . . . . 137
10.5.10. 409 Conflict . . . . . . . . . . . . . . . . . . . . 151 13.5. Media Type multipart/byteranges . . . . . . . . . . . . 139
10.5.11. 410 Gone . . . . . . . . . . . . . . . . . . . . . . 151 14. Status Codes . . . . . . . . . . . . . . . . . . . . . . . . 141
10.5.12. 411 Length Required . . . . . . . . . . . . . . . . 151 14.1. Overview of Status Codes . . . . . . . . . . . . . . . . 142
10.5.13. 412 Precondition Failed . . . . . . . . . . . . . . 152 14.2. Informational 1xx . . . . . . . . . . . . . . . . . . . 142
10.5.14. 413 Payload Too Large . . . . . . . . . . . . . . . 152 14.2.1. 100 Continue . . . . . . . . . . . . . . . . . . . . 142
10.5.15. 414 URI Too Long . . . . . . . . . . . . . . . . . . 152 14.2.2. 101 Switching Protocols . . . . . . . . . . . . . . 143
10.5.16. 415 Unsupported Media Type . . . . . . . . . . . . . 152 14.3. Successful 2xx . . . . . . . . . . . . . . . . . . . . . 143
10.5.17. 416 Range Not Satisfiable . . . . . . . . . . . . . 153 14.3.1. 200 OK . . . . . . . . . . . . . . . . . . . . . . . 143
10.5.18. 417 Expectation Failed . . . . . . . . . . . . . . . 153 14.3.2. 201 Created . . . . . . . . . . . . . . . . . . . . 144
10.5.19. 418 (Unused) . . . . . . . . . . . . . . . . . . . . 154 14.3.3. 202 Accepted . . . . . . . . . . . . . . . . . . . . 144
10.5.20. 422 Unprocessable Payload . . . . . . . . . . . . . 154 14.3.4. 203 Non-Authoritative Information . . . . . . . . . 145
10.5.21. 426 Upgrade Required . . . . . . . . . . . . . . . . 154 14.3.5. 204 No Content . . . . . . . . . . . . . . . . . . . 145
10.6. Server Error 5xx . . . . . . . . . . . . . . . . . . . . 155 14.3.6. 205 Reset Content . . . . . . . . . . . . . . . . . 146
10.6.1. 500 Internal Server Error . . . . . . . . . . . . . 155 14.3.7. 206 Partial Content . . . . . . . . . . . . . . . . 146
10.6.2. 501 Not Implemented . . . . . . . . . . . . . . . . 155 14.4. Redirection 3xx . . . . . . . . . . . . . . . . . . . . 149
10.6.3. 502 Bad Gateway . . . . . . . . . . . . . . . . . . 155 14.4.1. 300 Multiple Choices . . . . . . . . . . . . . . . . 152
10.6.4. 503 Service Unavailable . . . . . . . . . . . . . . 155 14.4.2. 301 Moved Permanently . . . . . . . . . . . . . . . 153
10.6.5. 504 Gateway Timeout . . . . . . . . . . . . . . . . 156 14.4.3. 302 Found . . . . . . . . . . . . . . . . . . . . . 153
10.6.6. 505 HTTP Version Not Supported . . . . . . . . . . . 156 14.4.4. 303 See Other . . . . . . . . . . . . . . . . . . . 154
10.7. Status Code Extensibility . . . . . . . . . . . . . . . 156 14.4.5. 304 Not Modified . . . . . . . . . . . . . . . . . . 154
10.7.1. Status Code Registry . . . . . . . . . . . . . . . . 156 14.4.6. 305 Use Proxy . . . . . . . . . . . . . . . . . . . 155
10.7.2. Considerations for New Status Codes . . . . . . . . 157 14.4.7. 306 (Unused) . . . . . . . . . . . . . . . . . . . . 155
11. Response Header Fields . . . . . . . . . . . . . . . . . . . 158 14.4.8. 307 Temporary Redirect . . . . . . . . . . . . . . . 155
11.1. Control Data . . . . . . . . . . . . . . . . . . . . . . 158 14.4.9. 308 Permanent Redirect . . . . . . . . . . . . . . . 156
11.1.1. Date . . . . . . . . . . . . . . . . . . . . . . . . 158 14.5. Client Error 4xx . . . . . . . . . . . . . . . . . . . . 156
11.1.2. Location . . . . . . . . . . . . . . . . . . . . . . 159 14.5.1. 400 Bad Request . . . . . . . . . . . . . . . . . . 156
11.1.3. Retry-After . . . . . . . . . . . . . . . . . . . . 161 14.5.2. 401 Unauthorized . . . . . . . . . . . . . . . . . . 156
11.1.4. Vary . . . . . . . . . . . . . . . . . . . . . . . . 161 14.5.3. 402 Payment Required . . . . . . . . . . . . . . . . 157
11.2. Validators . . . . . . . . . . . . . . . . . . . . . . . 162 14.5.4. 403 Forbidden . . . . . . . . . . . . . . . . . . . 157
11.2.1. Weak versus Strong . . . . . . . . . . . . . . . . . 163 14.5.5. 404 Not Found . . . . . . . . . . . . . . . . . . . 157
11.2.2. Last-Modified . . . . . . . . . . . . . . . . . . . 165 14.5.6. 405 Method Not Allowed . . . . . . . . . . . . . . . 158
11.2.3. ETag . . . . . . . . . . . . . . . . . . . . . . . . 167 14.5.7. 406 Not Acceptable . . . . . . . . . . . . . . . . . 158
11.2.4. When to Use Entity-Tags and Last-Modified Dates . . 170 14.5.8. 407 Proxy Authentication Required . . . . . . . . . 158
11.3. Authentication Challenges . . . . . . . . . . . . . . . 171 14.5.9. 408 Request Timeout . . . . . . . . . . . . . . . . 158
11.3.1. WWW-Authenticate . . . . . . . . . . . . . . . . . . 172 14.5.10. 409 Conflict . . . . . . . . . . . . . . . . . . . . 159
11.3.2. Proxy-Authenticate . . . . . . . . . . . . . . . . . 173 14.5.11. 410 Gone . . . . . . . . . . . . . . . . . . . . . . 159
11.3.3. Authentication-Info . . . . . . . . . . . . . . . . 173 14.5.12. 411 Length Required . . . . . . . . . . . . . . . . 159
11.3.4. Proxy-Authentication-Info . . . . . . . . . . . . . 174 14.5.13. 412 Precondition Failed . . . . . . . . . . . . . . 160
11.4. Response Context . . . . . . . . . . . . . . . . . . . . 175 14.5.14. 413 Payload Too Large . . . . . . . . . . . . . . . 160
11.4.1. Accept-Ranges . . . . . . . . . . . . . . . . . . . 175 14.5.15. 414 URI Too Long . . . . . . . . . . . . . . . . . . 160
11.4.2. Allow . . . . . . . . . . . . . . . . . . . . . . . 175 14.5.16. 415 Unsupported Media Type . . . . . . . . . . . . . 160
11.4.3. Server . . . . . . . . . . . . . . . . . . . . . . . 176 14.5.17. 416 Range Not Satisfiable . . . . . . . . . . . . . 161
12. Security Considerations . . . . . . . . . . . . . . . . . . . 177 14.5.18. 417 Expectation Failed . . . . . . . . . . . . . . . 161
12.1. Establishing Authority . . . . . . . . . . . . . . . . . 177 14.5.19. 418 (Unused) . . . . . . . . . . . . . . . . . . . . 162
12.2. Risks of Intermediaries . . . . . . . . . . . . . . . . 178 14.5.20. 422 Unprocessable Payload . . . . . . . . . . . . . 162
12.3. Attacks Based on File and Path Names . . . . . . . . . . 179 14.5.21. 426 Upgrade Required . . . . . . . . . . . . . . . . 162
12.4. Attacks Based on Command, Code, or Query Injection . . . 179 14.6. Server Error 5xx . . . . . . . . . . . . . . . . . . . . 163
12.5. Attacks via Protocol Element Length . . . . . . . . . . 180 14.6.1. 500 Internal Server Error . . . . . . . . . . . . . 163
12.6. Attacks using Shared-dictionary Compression . . . . . . 180 14.6.2. 501 Not Implemented . . . . . . . . . . . . . . . . 163
12.7. Disclosure of Personal Information . . . . . . . . . . . 181 14.6.3. 502 Bad Gateway . . . . . . . . . . . . . . . . . . 163
12.8. Privacy of Server Log Information . . . . . . . . . . . 181 14.6.4. 503 Service Unavailable . . . . . . . . . . . . . . 163
12.9. Disclosure of Sensitive Information in URIs . . . . . . 182 14.6.5. 504 Gateway Timeout . . . . . . . . . . . . . . . . 164
12.10. Disclosure of Fragment after Redirects . . . . . . . . . 182 14.6.6. 505 HTTP Version Not Supported . . . . . . . . . . . 164
12.11. Disclosure of Product Information . . . . . . . . . . . 183 15. Extending HTTP . . . . . . . . . . . . . . . . . . . . . . . 164
12.12. Browser Fingerprinting . . . . . . . . . . . . . . . . . 183 15.1. Method Extensibility . . . . . . . . . . . . . . . . . . 165
12.13. Validator Retention . . . . . . . . . . . . . . . . . . 184 15.1.1. Method Registry . . . . . . . . . . . . . . . . . . 165
12.14. Denial-of-Service Attacks Using Range . . . . . . . . . 184 15.1.2. Considerations for New Methods . . . . . . . . . . . 165
12.15. Authentication Considerations . . . . . . . . . . . . . 185 15.2. Status Code Extensibility . . . . . . . . . . . . . . . 166
12.15.1. Confidentiality of Credentials . . . . . . . . . . 185 15.2.1. Status Code Registry . . . . . . . . . . . . . . . . 166
12.15.2. Credentials and Idle Clients . . . . . . . . . . . 186 15.2.2. Considerations for New Status Codes . . . . . . . . 166
12.15.3. Protection Spaces . . . . . . . . . . . . . . . . . 186 15.3. Field Name Extensibility . . . . . . . . . . . . . . . . 167
12.15.4. Additional Response Fields . . . . . . . . . . . . 187 15.3.1. Field Name Registry . . . . . . . . . . . . . . . . 167
13. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 187 15.3.2. Considerations for New Field Names . . . . . . . . . 168
13.1. URI Scheme Registration . . . . . . . . . . . . . . . . 187 15.3.3. Considerations for New Field Values . . . . . . . . 169
13.2. Method Registration . . . . . . . . . . . . . . . . . . 187 15.4. Authentication Scheme Extensibility . . . . . . . . . . 171
13.3. Status Code Registration . . . . . . . . . . . . . . . . 187 15.4.1. Authentication Scheme Registry . . . . . . . . . . . 171
13.4. HTTP Field Name Registration . . . . . . . . . . . . . . 188 15.4.2. Considerations for New Authentication Schemes . . . 171
13.5. Authentication Scheme Registration . . . . . . . . . . . 189 15.5. Range Unit Extensibility . . . . . . . . . . . . . . . . 172
13.6. Content Coding Registration . . . . . . . . . . . . . . 189 15.5.1. Range Unit Registry . . . . . . . . . . . . . . . . 172
13.7. Range Unit Registration . . . . . . . . . . . . . . . . 189 15.5.2. Considerations for New Range Units . . . . . . . . . 173
13.8. Media Type Registration . . . . . . . . . . . . . . . . 189 15.6. Content Coding Extensibility . . . . . . . . . . . . . . 173
13.9. Port Registration . . . . . . . . . . . . . . . . . . . 189 15.6.1. Content Coding Registry . . . . . . . . . . . . . . 173
14. References . . . . . . . . . . . . . . . . . . . . . . . . . 189 15.6.2. Considerations for New Content Codings . . . . . . . 173
14.1. Normative References . . . . . . . . . . . . . . . . . . 189 15.7. Upgrade Token Registry . . . . . . . . . . . . . . . . . 174
14.2. Informative References . . . . . . . . . . . . . . . . . 191 16. Security Considerations . . . . . . . . . . . . . . . . . . . 174
Appendix A. Collected ABNF . . . . . . . . . . . . . . . . . . . 197 16.1. Establishing Authority . . . . . . . . . . . . . . . . . 175
Appendix B. Changes from previous RFCs . . . . . . . . . . . . . 202 16.2. Risks of Intermediaries . . . . . . . . . . . . . . . . 176
B.1. Changes from RFC 2818 . . . . . . . . . . . . . . . . . . 202 16.3. Attacks Based on File and Path Names . . . . . . . . . . 176
B.2. Changes from RFC 7230 . . . . . . . . . . . . . . . . . . 202 16.4. Attacks Based on Command, Code, or Query Injection . . . 177
B.3. Changes from RFC 7231 . . . . . . . . . . . . . . . . . . 203 16.5. Attacks via Protocol Element Length . . . . . . . . . . 177
B.4. Changes from RFC 7232 . . . . . . . . . . . . . . . . . . 204 16.6. Attacks using Shared-dictionary Compression . . . . . . 178
16.7. Disclosure of Personal Information . . . . . . . . . . . 178
16.8. Privacy of Server Log Information . . . . . . . . . . . 179
16.9. Disclosure of Sensitive Information in URIs . . . . . . 179
16.10. Disclosure of Fragment after Redirects . . . . . . . . . 180
16.11. Disclosure of Product Information . . . . . . . . . . . 180
16.12. Browser Fingerprinting . . . . . . . . . . . . . . . . . 181
16.13. Validator Retention . . . . . . . . . . . . . . . . . . 182
16.14. Denial-of-Service Attacks Using Range . . . . . . . . . 182
16.15. Authentication Considerations . . . . . . . . . . . . . 183
16.15.1. Confidentiality of Credentials . . . . . . . . . . 183
16.15.2. Credentials and Idle Clients . . . . . . . . . . . 183
16.15.3. Protection Spaces . . . . . . . . . . . . . . . . . 184
16.15.4. Additional Response Fields . . . . . . . . . . . . 184
17. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 184
17.1. URI Scheme Registration . . . . . . . . . . . . . . . . 185
17.2. Method Registration . . . . . . . . . . . . . . . . . . 185
17.3. Status Code Registration . . . . . . . . . . . . . . . . 185
17.4. HTTP Field Name Registration . . . . . . . . . . . . . . 187
17.5. Authentication Scheme Registration . . . . . . . . . . . 189
17.6. Content Coding Registration . . . . . . . . . . . . . . 189
17.7. Range Unit Registration . . . . . . . . . . . . . . . . 189
17.8. Media Type Registration . . . . . . . . . . . . . . . . 189
17.9. Port Registration . . . . . . . . . . . . . . . . . . . 189
17.10. Upgrade Token Registration . . . . . . . . . . . . . . . 190
18. References . . . . . . . . . . . . . . . . . . . . . . . . . 190
18.1. Normative References . . . . . . . . . . . . . . . . . . 190
18.2. Informative References . . . . . . . . . . . . . . . . . 192
Appendix A. Collected ABNF . . . . . . . . . . . . . . . . . . . 198
Appendix B. Changes from previous RFCs . . . . . . . . . . . . . 203
B.1. Changes from RFC 2818 . . . . . . . . . . . . . . . . . . 203
B.2. Changes from RFC 7230 . . . . . . . . . . . . . . . . . . 203
B.3. Changes from RFC 7231 . . . . . . . . . . . . . . . . . . 204
B.4. Changes from RFC 7232 . . . . . . . . . . . . . . . . . . 205
B.5. Changes from RFC 7233 . . . . . . . . . . . . . . . . . . 205 B.5. Changes from RFC 7233 . . . . . . . . . . . . . . . . . . 205
B.6. Changes from RFC 7235 . . . . . . . . . . . . . . . . . . 205 B.6. Changes from RFC 7235 . . . . . . . . . . . . . . . . . . 205
B.7. Changes from RFC 7538 . . . . . . . . . . . . . . . . . . 205 B.7. Changes from RFC 7538 . . . . . . . . . . . . . . . . . . 205
B.8. Changes from RFC 7615 . . . . . . . . . . . . . . . . . . 205 B.8. Changes from RFC 7615 . . . . . . . . . . . . . . . . . . 205
B.9. Changes from RFC 7694 . . . . . . . . . . . . . . . . . . 205 B.9. Changes from RFC 7694 . . . . . . . . . . . . . . . . . . 206
Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 205 Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 206
C.1. Between RFC723x and draft 00 . . . . . . . . . . . . . . 205 C.1. Between RFC723x and draft 00 . . . . . . . . . . . . . . 206
C.2. Since draft-ietf-httpbis-semantics-00 . . . . . . . . . . 206 C.2. Since draft-ietf-httpbis-semantics-00 . . . . . . . . . . 206
C.3. Since draft-ietf-httpbis-semantics-01 . . . . . . . . . . 206 C.3. Since draft-ietf-httpbis-semantics-01 . . . . . . . . . . 207
C.4. Since draft-ietf-httpbis-semantics-02 . . . . . . . . . . 208 C.4. Since draft-ietf-httpbis-semantics-02 . . . . . . . . . . 208
C.5. Since draft-ietf-httpbis-semantics-03 . . . . . . . . . . 208 C.5. Since draft-ietf-httpbis-semantics-03 . . . . . . . . . . 209
C.6. Since draft-ietf-httpbis-semantics-04 . . . . . . . . . . 209 C.6. Since draft-ietf-httpbis-semantics-04 . . . . . . . . . . 210
C.7. Since draft-ietf-httpbis-semantics-05 . . . . . . . . . . 210 C.7. Since draft-ietf-httpbis-semantics-05 . . . . . . . . . . 210
C.8. Since draft-ietf-httpbis-semantics-06 . . . . . . . . . . 211 C.8. Since draft-ietf-httpbis-semantics-06 . . . . . . . . . . 212
C.9. Since draft-ietf-httpbis-semantics-07 . . . . . . . . . . 212 C.9. Since draft-ietf-httpbis-semantics-07 . . . . . . . . . . 213
C.10. Since draft-ietf-httpbis-semantics-08 . . . . . . . . . . 214 C.10. Since draft-ietf-httpbis-semantics-08 . . . . . . . . . . 214
C.11. Since draft-ietf-httpbis-semantics-09 . . . . . . . . . . 215 C.11. Since draft-ietf-httpbis-semantics-09 . . . . . . . . . . 216
C.12. Since draft-ietf-httpbis-semantics-10 . . . . . . . . . . 215 C.12. Since draft-ietf-httpbis-semantics-10 . . . . . . . . . . 216
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 217 C.13. Since draft-ietf-httpbis-semantics-11 . . . . . . . . . . 217
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 217 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 218
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 218
1. Introduction 1. Introduction
1.1. Purpose 1.1. Purpose
The Hypertext Transfer Protocol (HTTP) is a family of stateless, The Hypertext Transfer Protocol (HTTP) is a family of stateless,
application-level, request/response protocols that share a generic application-level, request/response protocols that share a generic
interface, extensible semantics, and self-descriptive messages to interface, extensible semantics, and self-descriptive messages to
enable flexible interaction with network-based hypertext information enable flexible interaction with network-based hypertext information
systems. systems.
skipping to change at page 9, line 11 skipping to change at page 9, line 45
interface provided by servers. However, since multiple clients might interface provided by servers. However, since multiple clients might
act in parallel and perhaps at cross-purposes, we cannot require that act in parallel and perhaps at cross-purposes, we cannot require that
such changes be observable beyond the scope of a single response. such changes be observable beyond the scope of a single response.
1.2. Evolution 1.2. Evolution
HTTP has been the primary information transfer protocol for the World HTTP has been the primary information transfer protocol for the World
Wide Web since its introduction in 1990. It began as a trivial Wide Web since its introduction in 1990. It began as a trivial
mechanism for low-latency requests, with a single method (GET) to mechanism for low-latency requests, with a single method (GET) to
request transfer of a presumed hypertext document identified by a request transfer of a presumed hypertext document identified by a
given pathname (HTTP/0.9). As the Web grew, HTTP was extended to given pathname. This original protocol is now referred to as
enclose requests and responses within messages, transfer arbitrary HTTP/0.9.
data formats using MIME-like media types, and route requests through
intermediaries, eventually being defined as HTTP/1.0 [RFC1945]. HTTP's version number consists of two decimal digits separated by a
"." (period or decimal point). The first digit ("major version")
indicates the messaging syntax, whereas the second digit ("minor
version") indicates the highest minor version within that major
version to which the sender is conformant (able to understand for
future communication).
As the Web grew, HTTP was extended to enclose requests and responses
within messages, transfer arbitrary data formats using MIME-like
media types, and route requests through intermediaries, eventually
being defined as HTTP/1.0 [RFC1945].
HTTP/1.1 was designed to refine the protocol's features while HTTP/1.1 was designed to refine the protocol's features while
retaining compatibility with the existing text-based messaging retaining compatibility with the existing text-based messaging
syntax, improving its interoperability, scalability, and robustness syntax, improving its interoperability, scalability, and robustness
across the Internet. This included length-based payload delimiters across the Internet. This included length-based payload delimiters
for both fixed and dynamic (chunked) content, a consistent framework for both fixed and dynamic (chunked) content, a consistent framework
for content negotiation, opaque validators for conditional requests, for content negotiation, opaque validators for conditional requests,
cache controls for better cache consistency, range requests for cache controls for better cache consistency, range requests for
partial updates, and default persistent connections. HTTP/1.1 was partial updates, and default persistent connections. HTTP/1.1 was
introduced in 1995 and published on the standards track in 1997 introduced in 1995 and published on the standards track in 1997
skipping to change at page 9, line 48 skipping to change at page 10, line 49
transport and messaging syntax for their particular context. transport and messaging syntax for their particular context.
This revision of HTTP separates the definition of semantics (this This revision of HTTP separates the definition of semantics (this
document) and caching ([Caching]) from the current HTTP/1.1 messaging document) and caching ([Caching]) from the current HTTP/1.1 messaging
syntax ([Messaging]) to allow each major protocol version to progress syntax ([Messaging]) to allow each major protocol version to progress
independently while referring to the same core semantics. independently while referring to the same core semantics.
1.3. Semantics 1.3. Semantics
HTTP provides a uniform interface for interacting with a resource HTTP provides a uniform interface for interacting with a resource
(Section 2.5), regardless of its type, nature, or implementation, by (Section 3.1), regardless of its type, nature, or implementation, by
sending messages that manipulate or transfer representations sending messages that manipulate or transfer representations
(Section 7). (Section 7).
Each message is either a request or a response. A client constructs Each message is either a request or a response. A client constructs
request messages that communicate its intentions and routes those request messages that communicate its intentions and routes those
messages toward an identified origin server. A server listens for messages toward an identified origin server. A server listens for
requests, parses each message received, interprets the message requests, parses each message received, interprets the message
semantics in relation to the identified target resource, and responds semantics in relation to the identified target resource, and responds
to that request with one or more response messages. The client to that request with one or more response messages. The client
examines received responses to see if its intentions were carried examines received responses to see if its intentions were carried
out, determining what to do next based on the received status and out, determining what to do next based on the received status and
payloads. payloads.
HTTP semantics include the intentions defined by each request method HTTP semantics include the intentions defined by each request method
(Section 8), extensions to those semantics that might be described in (Section 8), extensions to those semantics that might be described in
request header fields (Section 9), status codes that describe the request header fields, status codes that describe the response
response (Section 10), and other control data and resource metadata (Section 14), and other control data and resource metadata that might
that might be given in response fields (Section 11). be given in response fields.
Semantics also include representation metadata that describe how a Semantics also include representation metadata that describe how a
payload is intended to be interpreted by a recipient, request header payload is intended to be interpreted by a recipient, request header
fields that might influence content selection, and the various fields that might influence content selection, and the various
selection algorithms that are collectively referred to as "content selection algorithms that are collectively referred to as "content
negotiation" (Section 7.4). negotiation" (Section 11).
1.4. Obsoletes 1.4. Obsoletes
This document obsoletes the following specifications: This document obsoletes the following specifications:
-------------------------------------------- ----------- --------- -------------------------------------------- ----------- ---------
Title Reference Changes Title Reference Changes
-------------------------------------------- ----------- --------- -------------------------------------------- ----------- ---------
HTTP Over TLS [RFC2818] B.1 HTTP Over TLS [RFC2818] B.1
HTTP/1.1 Message Syntax and Routing [*] [RFC7230] B.2 HTTP/1.1 Message Syntax and Routing [*] [RFC7230] B.2
skipping to change at page 11, line 5 skipping to change at page 12, line 5
HTTP Client-Initiated Content-Encoding [RFC7694] B.9 HTTP Client-Initiated Content-Encoding [RFC7694] B.9
-------------------------------------------- ----------- --------- -------------------------------------------- ----------- ---------
Table 1 Table 1
[*] This document only obsoletes the portions of RFC 7230 that are [*] This document only obsoletes the portions of RFC 7230 that are
independent of the HTTP/1.1 messaging syntax and connection independent of the HTTP/1.1 messaging syntax and connection
management; the remaining bits of RFC 7230 are obsoleted by "HTTP/1.1 management; the remaining bits of RFC 7230 are obsoleted by "HTTP/1.1
Messaging" [Messaging]. Messaging" [Messaging].
1.5. Requirements Notation 2. Conformance
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here.
Conformance criteria and considerations regarding error handling are
defined in Section 3.
1.6. Syntax Notation 2.1. Syntax Notation
This specification uses the Augmented Backus-Naur Form (ABNF) This specification uses the Augmented Backus-Naur Form (ABNF)
notation of [RFC5234], extended with the notation for case- notation of [RFC5234], extended with the notation for case-
sensitivity in strings defined in [RFC7405]. sensitivity in strings defined in [RFC7405].
It also uses a list extension, defined in Section 5.5, that allows It also uses a list extension, defined in Section 5.7.1, that allows
for compact definition of comma-separated lists using a '#' operator for compact definition of comma-separated lists using a '#' operator
(similar to how the '*' operator indicates repetition). Appendix A (similar to how the '*' operator indicates repetition). Appendix A
shows the collected grammar with all list operators expanded to shows the collected grammar with all list operators expanded to
standard ABNF notation. standard ABNF notation.
As a convention, ABNF rule names prefixed with "obs-" denote As a convention, ABNF rule names prefixed with "obs-" denote
"obsolete" grammar rules that appear for historical reasons. "obsolete" grammar rules that appear for historical reasons.
The following core rules are included by reference, as defined in The following core rules are included by reference, as defined in
Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return), Appendix B.1 of [RFC5234]: ALPHA (letters), CR (carriage return),
CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double
quote), HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF quote), HEXDIG (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF
(line feed), OCTET (any 8-bit sequence of data), SP (space), and (line feed), OCTET (any 8-bit sequence of data), SP (space), and
VCHAR (any visible US-ASCII character). VCHAR (any visible US-ASCII character).
Section 5.4.1 defines some generic syntactic components for field Section 5.7 defines some generic syntactic components for field
values. values.
The rule below is defined in [Messaging]; The rule below is defined in [Messaging];
transfer-coding = <transfer-coding, see [Messaging], Section 7> transfer-coding = <transfer-coding, see [Messaging], Section 7>
This specification uses the terms "character", "character encoding This specification uses the terms "character", "character encoding
scheme", "charset", and "protocol element" as they are defined in scheme", "charset", and "protocol element" as they are defined in
[RFC6365]. [RFC6365].
1.6.1. Whitespace 2.2. Requirements Notation
This specification uses three rules to denote the use of linear The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
whitespace: OWS (optional whitespace), RWS (required whitespace), and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
BWS ("bad" whitespace). "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here.
The OWS rule is used where zero or more linear whitespace octets This specification targets conformance criteria according to the role
might appear. For protocol elements where optional whitespace is of a participant in HTTP communication. Hence, requirements are
preferred to improve readability, a sender SHOULD generate the placed on senders, recipients, clients, servers, user agents,
optional whitespace as a single SP; otherwise, a sender SHOULD NOT intermediaries, origin servers, proxies, gateways, or caches,
generate optional whitespace except as needed to white out invalid or depending on what behavior is being constrained by the requirement.
unwanted protocol elements during in-place message filtering.
The RWS rule is used when at least one linear whitespace octet is Additional (social) requirements are placed on implementations,
required to separate field tokens. A sender SHOULD generate RWS as a resource owners, and protocol element registrations when they apply
single SP. beyond the scope of a single communication.
OWS and RWS have the same semantics as a single SP. Any content The verb "generate" is used instead of "send" where a requirement
known to be defined as OWS or RWS MAY be replaced with a single SP applies only to implementations that create the protocol element,
before interpreting it or forwarding the message downstream. rather than an implementation that forwards a received element
downstream.
The BWS rule is used where the grammar allows optional whitespace An implementation is considered conformant if it complies with all of
only for historical reasons. A sender MUST NOT generate BWS in the requirements associated with the roles it partakes in HTTP.
messages. A recipient MUST parse for such bad whitespace and remove
it before interpreting the protocol element.
BWS has no semantics. Any content known to be defined as BWS MAY be Conformance includes both the syntax and semantics of protocol
removed before interpreting it or forwarding the message downstream. elements. A sender MUST NOT generate protocol elements that convey a
meaning that is known by that sender to be false. A sender MUST NOT
generate protocol elements that do not match the grammar defined by
the corresponding ABNF rules. Within a given message, a sender MUST
NOT generate protocol elements or syntax alternatives that are only
allowed to be generated by participants in other roles (i.e., a role
that the sender does not have for that message).
OWS = *( SP / HTAB ) 2.3. Length Requirements
; optional whitespace
RWS = 1*( SP / HTAB )
; required whitespace
BWS = OWS
; "bad" whitespace
2. Architecture When a received protocol element is parsed, the recipient MUST be
able to parse any value of reasonable length that is applicable to
the recipient's role and that matches the grammar defined by the
corresponding ABNF rules. Note, however, that some received protocol
elements might not be parsed. For example, an intermediary
forwarding a message might parse a field into generic field name and
field value components, but then forward the field without further
parsing inside the field value.
HTTP does not have specific length limitations for many of its
protocol elements because the lengths that might be appropriate will
vary widely, depending on the deployment context and purpose of the
implementation. Hence, interoperability between senders and
recipients depends on shared expectations regarding what is a
reasonable length for each protocol element. Furthermore, what is
commonly understood to be a reasonable length for some protocol
elements has changed over the course of the past two decades of HTTP
use and is expected to continue changing in the future.
At a minimum, a recipient MUST be able to parse and process protocol
element lengths that are at least as long as the values that it
generates for those same protocol elements in other messages. For
example, an origin server that publishes very long URI references to
its own resources needs to be able to parse and process those same
references when received as a target URI.
2.4. Error Handling
A recipient MUST interpret a received protocol element according to
the semantics defined for it by this specification, including
extensions to this specification, unless the recipient has determined
(through experience or configuration) that the sender incorrectly
implements what is implied by those semantics. For example, an
origin server might disregard the contents of a received
Accept-Encoding header field if inspection of the User-Agent header
field indicates a specific implementation version that is known to
fail on receipt of certain content codings.
Unless noted otherwise, a recipient MAY attempt to recover a usable
protocol element from an invalid construct. HTTP does not define
specific error handling mechanisms except when they have a direct
impact on security, since different applications of the protocol
require different error handling strategies. For example, a Web
browser might wish to transparently recover from a response where the
Location header field doesn't parse according to the ABNF, whereas a
systems control client might consider any form of error recovery to
be dangerous.
Some requests can be automatically retried by a client in the event
of an underlying connection failure, as described in Section 8.2.2.
3. Terminology
HTTP was created for the World Wide Web (WWW) architecture and has HTTP was created for the World Wide Web (WWW) architecture and has
evolved over time to support the scalability needs of a worldwide evolved over time to support the scalability needs of a worldwide
hypertext system. Much of that architecture is reflected in the hypertext system. Much of that architecture is reflected in the
terminology and syntax productions used to define HTTP. terminology and syntax productions used to define HTTP.
2.1. Client/Server Messaging 3.1. Resources
HTTP is a stateless request/response protocol that operates by The target of an HTTP request is called a "resource". HTTP does not
exchanging messages across a reliable transport- or session-layer limit the nature of a resource; it merely defines an interface that
"connection". An HTTP "client" is a program that establishes a might be used to interact with resources. Most resources are
connection to a server for the purpose of sending one or more HTTP identified by a Uniform Resource Identifier (URI), as described in
requests. An HTTP "server" is a program that accepts connections in Section 4.
order to service HTTP requests by sending HTTP responses.
The terms "client" and "server" refer only to the roles that these One design goal of HTTP is to separate resource identification from
programs perform for a particular connection. The same program might request semantics, which is made possible by vesting the request
act as a client on some connections and a server on others. The term semantics in the request method (Section 8) and a few request-
"user agent" refers to any of the various client programs that modifying header fields. If there is a conflict between the method
initiate a request, including (but not limited to) browsers, spiders semantics and any semantic implied by the URI itself, as described in
(web-based robots), command-line tools, custom applications, and Section 8.2.1, the method semantics take precedence.
mobile apps. The term "origin server" refers to the program that can
originate authoritative responses for a given target resource. The
terms "sender" and "recipient" refer to any implementation that sends
or receives a given message, respectively.
HTTP relies upon the Uniform Resource Identifier (URI) standard HTTP relies upon the Uniform Resource Identifier (URI) standard
[RFC3986] to indicate the target resource (Section 6.1) and [RFC3986] to indicate the target resource (Section 6.1) and
relationships between resources. relationships between resources.
Most HTTP communication consists of a retrieval request (GET) for a 3.2. Connections
representation of some resource identified by a URI. In the simplest
case, this might be accomplished via a single bidirectional
connection (===) between the user agent (UA) and the origin server
(O).
request > HTTP is a client/server protocol that operates over a reliable
UA ======================================= O transport- or session-layer "connection".
< response
Figure 1 An HTTP "client" is a program that establishes a connection to a
server for the purpose of sending one or more HTTP requests. An HTTP
"server" is a program that accepts connections in order to service
HTTP requests by sending HTTP responses.
Each major version of HTTP defines its own syntax for the The terms "client" and "server" refer only to the roles that these
communication of messages. Nevertheless, a common abstraction is programs perform for a particular connection. The same program might
that each message contains some form of envelope/framing with self- act as a client on some connections and a server on others.
descriptive control data that indicates its semantics and routing, a
potential set of named fields up front (a header section), a 3.3. Messages
potential body, and potential fields sent after the body begins
(trailer sections). HTTP is a stateless request/response protocol for exchanging
"messages" across a connection. The terms "sender" and "recipient"
refer to any implementation that sends or receives a given message,
respectively.
A client sends requests to a server in the form of a request message A client sends requests to a server in the form of a request message
with a method (Section 8) and request target. The request might also with a method (Section 8) and request target (Section 6.1.1). The
contain header fields for request modifiers, client information, and request might also contain header fields (Section 5.4) for request
representation metadata (Section 5), a payload body (Section 7.3.3) modifiers, client information, and representation metadata, a payload
to be processed in accordance with the method, and trailer fields for body (Section 5.5.4) to be processed in accordance with the method,
metadata collected while sending the payload. and trailer fields (Section 5.6) for metadata collected while sending
the payload.
A server responds to a client's request by sending one or more A server responds to a client's request by sending one or more
response messages, each including a status code (Section 10). The response messages, each including a status code (Section 14). The
response might also contain header fields for server information, response might also contain header fields for server information,
resource metadata, and representation metadata (Section 5), a payload resource metadata, and representation metadata, a payload body to be
body (Section 7.3.3) to be interpreted in accordance with the status interpreted in accordance with the status code, and trailer fields
code, and trailer fields for metadata collected while sending the for metadata collected while sending the payload.
payload.
One of the functions of message framing is to assure that messages 3.4. User Agent
are complete. A message is considered complete when all of the
octets indicated by its framing are available. Note that, when no
explicit framing is used, a response message that is ended by the
transport connection's close is considered complete even though it
might be indistinguishable from an incomplete response, unless a
transport-level error indicates that it is not complete.
A connection might be used for multiple request/response exchanges. The term "user agent" refers to any of the various client programs
The mechanism used to correlate between request and response messages that initiate a request.
is version dependent; some versions of HTTP use implicit ordering of
messages, while others use an explicit identifier.
Responses (both final and interim) can be sent at any time after a The most familiar form of user agent is the general-purpose Web
request is received, even if it is not yet complete. However, browser, but that's only a small percentage of implementations.
clients (including intermediaries) might abandon a request if the Other common user agents include spiders (web-traversing robots),
response is not forthcoming within a reasonable period of time. command-line tools, billboard screens, household appliances, scales,
light bulbs, firmware update scripts, mobile apps, and communication
devices in a multitude of shapes and sizes.
Being a user agent does not imply that there is a human user directly
interacting with the software agent at the time of a request. In
many cases, a user agent is installed or configured to run in the
background and save its results for later inspection (or save only a
subset of those results that might be interesting or erroneous).
Spiders, for example, are typically given a start URI and configured
to follow certain behavior while crawling the Web as a hypertext
graph.
Many user agents cannot, or choose not to, make interactive
suggestions to their user or provide adequate warning for security or
privacy concerns. In the few cases where this specification requires
reporting of errors to the user, it is acceptable for such reporting
to only be observable in an error console or log file. Likewise,
requirements that an automated action be confirmed by the user before
proceeding might be met via advance configuration choices, run-time
options, or simple avoidance of the unsafe action; confirmation does
not imply any specific user interface or interruption of normal
processing if the user has already made that choice.
3.5. Origin Server
The term "origin server" refers to a program that can originate
authoritative responses for a given target resource.
The most familiar form of origin server are large public websites.
However, like user agents being equated with browsers, it is easy to
be misled into thinking that all origin servers are alike. Common
origin servers also include home automation units, configurable
networking components, office machines, autonomous robots, news
feeds, traffic cameras, real-time ad selectors, and video-on-demand
platforms.
3.6. Example Request and Response
Most HTTP communication consists of a retrieval request (GET) for a
representation of some resource identified by a URI. In the simplest
case, this might be accomplished via a single bidirectional
connection (===) between the user agent (UA) and the origin server
(O).
request >
UA ======================================= O
< response
Figure 1
The following example illustrates a typical message exchange for a The following example illustrates a typical message exchange for a
GET request (Section 8.3.1) on the URI "http://www.example.com/ GET request (Section 8.3.1) on the URI "http://www.example.com/
hello.txt": hello.txt":
Client request: Client request:
GET /hello.txt HTTP/1.1 GET /hello.txt HTTP/1.1
User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
Host: www.example.com Host: www.example.com
skipping to change at page 15, line 17 skipping to change at page 17, line 32
Server: Apache Server: Apache
Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
ETag: "34aa387-d-1568eb00" ETag: "34aa387-d-1568eb00"
Accept-Ranges: bytes Accept-Ranges: bytes
Content-Length: 51 Content-Length: 51
Vary: Accept-Encoding Vary: Accept-Encoding
Content-Type: text/plain Content-Type: text/plain
Hello World! My payload includes a trailing CRLF. Hello World! My payload includes a trailing CRLF.
2.2. Intermediaries 3.7. Intermediaries
HTTP enables the use of intermediaries to satisfy requests through a HTTP enables the use of intermediaries to satisfy requests through a
chain of connections. There are three common forms of HTTP chain of connections. There are three common forms of HTTP
intermediary: proxy, gateway, and tunnel. In some cases, a single intermediary: proxy, gateway, and tunnel. In some cases, a single
intermediary might act as an origin server, proxy, gateway, or intermediary might act as an origin server, proxy, gateway, or
tunnel, switching behavior based on the nature of each request. tunnel, switching behavior based on the nature of each request.
> > > > > > > >
UA =========== A =========== B =========== C =========== O UA =========== A =========== B =========== C =========== O
< < < < < < < <
skipping to change at page 16, line 5 skipping to change at page 18, line 19
path of connections, often based on dynamic configuration for load path of connections, often based on dynamic configuration for load
balancing. balancing.
The terms "upstream" and "downstream" are used to describe The terms "upstream" and "downstream" are used to describe
directional requirements in relation to the message flow: all directional requirements in relation to the message flow: all
messages flow from upstream to downstream. The terms "inbound" and messages flow from upstream to downstream. The terms "inbound" and
"outbound" are used to describe directional requirements in relation "outbound" are used to describe directional requirements in relation
to the request route: "inbound" means toward the origin server and to the request route: "inbound" means toward the origin server and
"outbound" means toward the user agent. "outbound" means toward the user agent.
A "proxy" is a message-forwarding agent that is selected by the A "proxy" is a message-forwarding agent that is chosen by the client,
client, usually via local configuration rules, to receive requests usually via local configuration rules, to receive requests for some
for some type(s) of absolute URI and attempt to satisfy those type(s) of absolute URI and attempt to satisfy those requests via
requests via translation through the HTTP interface. Some translation through the HTTP interface. Some translations are
translations are minimal, such as for proxy requests for "http" URIs, minimal, such as for proxy requests for "http" URIs, whereas other
whereas other requests might require translation to and from entirely requests might require translation to and from entirely different
different application-level protocols. Proxies are often used to application-level protocols. Proxies are often used to group an
group an organization's HTTP requests through a common intermediary organization's HTTP requests through a common intermediary for the
for the sake of security, annotation services, or shared caching. sake of security, annotation services, or shared caching. Some
Some proxies are designed to apply transformations to selected proxies are designed to apply transformations to selected messages or
messages or payloads while they are being forwarded, as described in payloads while they are being forwarded, as described in Section 6.5.
Section 6.6.2.
A "gateway" (a.k.a. "reverse proxy") is an intermediary that acts as A "gateway" (a.k.a. "reverse proxy") is an intermediary that acts as
an origin server for the outbound connection but translates received an origin server for the outbound connection but translates received
requests and forwards them inbound to another server or servers. requests and forwards them inbound to another server or servers.
Gateways are often used to encapsulate legacy or untrusted Gateways are often used to encapsulate legacy or untrusted
information services, to improve server performance through information services, to improve server performance through
"accelerator" caching, and to enable partitioning or load balancing "accelerator" caching, and to enable partitioning or load balancing
of HTTP services across multiple machines. of HTTP services across multiple machines.
All HTTP requirements applicable to an origin server also apply to All HTTP requirements applicable to an origin server also apply to
skipping to change at page 17, line 7 skipping to change at page 19, line 19
participants in the HTTP communication. There are also participants in the HTTP communication. There are also
intermediaries that can act on lower layers of the network protocol intermediaries that can act on lower layers of the network protocol
stack, filtering or redirecting HTTP traffic without the knowledge or stack, filtering or redirecting HTTP traffic without the knowledge or
permission of message senders. Network intermediaries are permission of message senders. Network intermediaries are
indistinguishable (at a protocol level) from an on-path attacker, indistinguishable (at a protocol level) from an on-path attacker,
often introducing security flaws or interoperability problems due to often introducing security flaws or interoperability problems due to
mistakenly violating HTTP semantics. mistakenly violating HTTP semantics.
For example, an "interception proxy" [RFC3040] (also commonly known For example, an "interception proxy" [RFC3040] (also commonly known
as a "transparent proxy" [RFC1919] or "captive portal") differs from as a "transparent proxy" [RFC1919] or "captive portal") differs from
an HTTP proxy because it is not selected by the client. Instead, an an HTTP proxy because it is not chosen by the client. Instead, an
interception proxy filters or redirects outgoing TCP port 80 packets interception proxy filters or redirects outgoing TCP port 80 packets
(and occasionally other common port traffic). Interception proxies (and occasionally other common port traffic). Interception proxies
are commonly found on public network access points, as a means of are commonly found on public network access points, as a means of
enforcing account subscription prior to allowing use of non-local enforcing account subscription prior to allowing use of non-local
Internet services, and within corporate firewalls to enforce network Internet services, and within corporate firewalls to enforce network
usage policies. usage policies.
HTTP is defined as a stateless protocol, meaning that each request HTTP is defined as a stateless protocol, meaning that each request
message can be understood in isolation. Many implementations depend message can be understood in isolation. Many implementations depend
on HTTP's stateless design in order to reuse proxied connections or on HTTP's stateless design in order to reuse proxied connections or
dynamically load balance requests across multiple servers. Hence, a dynamically load balance requests across multiple servers. Hence, a
server MUST NOT assume that two requests on the same connection are server MUST NOT assume that two requests on the same connection are
from the same user agent unless the connection is secured and from the same user agent unless the connection is secured and
specific to that agent. Some non-standard HTTP extensions (e.g., specific to that agent. Some non-standard HTTP extensions (e.g.,
[RFC4559]) have been known to violate this requirement, resulting in [RFC4559]) have been known to violate this requirement, resulting in
security and interoperability problems. security and interoperability problems.
2.3. Caches 3.8. Caches
A "cache" is a local store of previous response messages and the A "cache" is a local store of previous response messages and the
subsystem that controls its message storage, retrieval, and deletion. subsystem that controls its message storage, retrieval, and deletion.
A cache stores cacheable responses in order to reduce the response A cache stores cacheable responses in order to reduce the response
time and network bandwidth consumption on future, equivalent time and network bandwidth consumption on future, equivalent
requests. Any client or server MAY employ a cache, though a cache requests. Any client or server MAY employ a cache, though a cache
cannot be used by a server while it is acting as a tunnel. cannot be used by a server while it is acting as a tunnel.
The effect of a cache is that the request/response chain is shortened The effect of a cache is that the request/response chain is shortened
if one of the participants along the chain has a cached response if one of the participants along the chain has a cached response
skipping to change at page 18, line 12 skipping to change at page 20, line 26
cache behavior and cacheable responses are defined in Section 2 of cache behavior and cacheable responses are defined in Section 2 of
[Caching]. [Caching].
There is a wide variety of architectures and configurations of caches There is a wide variety of architectures and configurations of caches
deployed across the World Wide Web and inside large organizations. deployed across the World Wide Web and inside large organizations.
These include national hierarchies of proxy caches to save These include national hierarchies of proxy caches to save
transoceanic bandwidth, collaborative systems that broadcast or transoceanic bandwidth, collaborative systems that broadcast or
multicast cache entries, archives of pre-fetched cache entries for multicast cache entries, archives of pre-fetched cache entries for
use in off-line or high-latency environments, and so on. use in off-line or high-latency environments, and so on.
2.4. Uniform Resource Identifiers 4. Identifiers
Uniform Resource Identifiers (URIs) [RFC3986] are used throughout Uniform Resource Identifiers (URIs) [RFC3986] are used throughout
HTTP as the means for identifying resources (Section 2.5). URI HTTP as the means for identifying resources (Section 3.1).
references are used to target requests, indicate redirects, and
4.1. URI References
URI references are used to target requests, indicate redirects, and
define relationships. define relationships.
The definitions of "URI-reference", "absolute-URI", "relative-part", The definitions of "URI-reference", "absolute-URI", "relative-part",
"authority", "port", "host", "path-abempty", "segment", and "query" "authority", "port", "host", "path-abempty", "segment", and "query"
are adopted from the URI generic syntax. An "absolute-path" rule is are adopted from the URI generic syntax. An "absolute-path" rule is
defined for protocol elements that can contain a non-empty path defined for protocol elements that can contain a non-empty path
component. (This rule differs slightly from the path-abempty rule of component. (This rule differs slightly from the path-abempty rule of
RFC 3986, which allows for an empty path to be used in references, RFC 3986, which allows for an empty path to be used in references,
and path-absolute rule, which does not allow paths that begin with and path-absolute rule, which does not allow paths that begin with
"//".) A "partial-URI" rule is defined for protocol elements that "//".) A "partial-URI" rule is defined for protocol elements that
skipping to change at page 19, line 11 skipping to change at page 21, line 31
URI), only the path and optional query components, or some URI), only the path and optional query components, or some
combination of the above. Unless otherwise indicated, URI references combination of the above. Unless otherwise indicated, URI references
are parsed relative to the target URI (Section 6.1). are parsed relative to the target URI (Section 6.1).
It is RECOMMENDED that all senders and recipients support, at a It is RECOMMENDED that all senders and recipients support, at a
minimum, URIs with lengths of 8000 octets in protocol elements. Note minimum, URIs with lengths of 8000 octets in protocol elements. Note
that this implies some structures and on-wire representations (for that this implies some structures and on-wire representations (for
example, the request line in HTTP/1.1) will necessarily be larger in example, the request line in HTTP/1.1) will necessarily be larger in
some cases. some cases.
2.5. Resources 4.2. URI Schemes
The target of an HTTP request is called a "resource". HTTP does not
limit the nature of a resource; it merely defines an interface that
might be used to interact with resources. Most resources are
identified by a Uniform Resource Identifier (URI), as described in
Section 2.4.
One design goal of HTTP is to separate resource identification from
request semantics, which is made possible by vesting the request
semantics in the request method (Section 8) and a few request-
modifying header fields (Section 9). If there is a conflict between
the method semantics and any semantic implied by the URI itself, as
described in Section 8.2.1, the method semantics take precedence.
IANA maintains the registry of URI Schemes [BCP35] at IANA maintains the registry of URI Schemes [BCP35] at
<https://www.iana.org/assignments/uri-schemes/>. Although requests <https://www.iana.org/assignments/uri-schemes/>. Although requests
might target any URI scheme, the following schemes are inherent to might target any URI scheme, the following schemes are inherent to
HTTP servers: HTTP servers:
------------ ------------------------------------ ------- ------------ ------------------------------------ -------
URI Scheme Description Ref. URI Scheme Description Ref.
------------ ------------------------------------ ------- ------------ ------------------------------------ -------
http Hypertext Transfer Protocol 2.5.1 http Hypertext Transfer Protocol 4.2.1
https Hypertext Transfer Protocol Secure 2.5.2 https Hypertext Transfer Protocol Secure 4.2.2
------------ ------------------------------------ ------- ------------ ------------------------------------ -------
Table 2 Table 2
Note that the presence of an "http" or "https" URI does not imply Note that the presence of an "http" or "https" URI does not imply
that there is always an HTTP server at the identified origin that there is always an HTTP server at the identified origin
listening for connections. Anyone can mint a URI, whether or not a listening for connections. Anyone can mint a URI, whether or not a
server exists and whether or not that server currently maps that server exists and whether or not that server currently maps that
identifier to a resource. The delegated nature of registered names identifier to a resource. The delegated nature of registered names
and IP addresses creates a federated namespace whether or not an HTTP and IP addresses creates a federated namespace whether or not an HTTP
server is present. server is present.
2.5.1. http URI Scheme 4.2.1. http URI Scheme
The "http" URI scheme is hereby defined for minting identifiers The "http" URI scheme is hereby defined for minting identifiers
within the hierarchical namespace governed by a potential HTTP origin within the hierarchical namespace governed by a potential HTTP origin
server listening for TCP ([RFC0793]) connections on a given port. server listening for TCP ([RFC0793]) connections on a given port.
http-URI = "http" "://" authority path-abempty [ "?" query ] http-URI = "http" "://" authority path-abempty [ "?" query ]
The origin server for an "http" URI is identified by the authority The origin server for an "http" URI is identified by the authority
component, which includes a host identifier and optional port number component, which includes a host identifier and optional port number
([RFC3986], Section 3.2.2). If the port subcomponent is empty or not ([RFC3986], Section 3.2.2). If the port subcomponent is empty or not
given, TCP port 80 (the reserved port for WWW services) is the given, TCP port 80 (the reserved port for WWW services) is the
default. The origin determines who has the right to respond default. The origin determines who has the right to respond
authoritatively to requests that target the identified resource, as authoritatively to requests that target the identified resource, as
defined in Section 6.3.3.1. defined in Section 4.3.2.
A sender MUST NOT generate an "http" URI with an empty host A sender MUST NOT generate an "http" URI with an empty host
identifier. A recipient that processes such a URI reference MUST identifier. A recipient that processes such a URI reference MUST
reject it as invalid. reject it as invalid.
The hierarchical path component and optional query component identify The hierarchical path component and optional query component identify
the target resource within that origin server's name space. the target resource within that origin server's name space.
2.5.2. https URI Scheme 4.2.2. https URI Scheme
The "https" URI scheme is hereby defined for minting identifiers The "https" URI scheme is hereby defined for minting identifiers
within the hierarchical namespace governed by a potential origin within the hierarchical namespace governed by a potential origin
server listening for TCP connections on a given port and capable of server listening for TCP connections on a given port and capable of
establishing a TLS ([RFC8446]) connection that has been secured for establishing a TLS ([RFC8446]) connection that has been secured for
HTTP communication. In this context, "secured" specifically means HTTP communication. In this context, "secured" specifically means
that the server has been authenticated as acting on behalf of the that the server has been authenticated as acting on behalf of the
identified authority and all HTTP communication with that server has identified authority and all HTTP communication with that server has
been protected for confidentiality and integrity through the use of been protected for confidentiality and integrity through the use of
strong encryption. strong encryption.
https-URI = "https" "://" authority path-abempty [ "?" query ] https-URI = "https" "://" authority path-abempty [ "?" query ]
The origin server for an "https" URI is identified by the authority The origin server for an "https" URI is identified by the authority
component, which includes a host identifier and optional port number component, which includes a host identifier and optional port number
([RFC3986], Section 3.2.2). If the port subcomponent is empty or not ([RFC3986], Section 3.2.2). If the port subcomponent is empty or not
given, TCP port 443 (the reserved port for HTTP over TLS) is the given, TCP port 443 (the reserved port for HTTP over TLS) is the
default. The origin determines who has the right to respond default. The origin determines who has the right to respond
authoritatively to requests that target the identified resource, as authoritatively to requests that target the identified resource, as
defined in Section 6.3.3.2. defined in Section 4.3.3.
A sender MUST NOT generate an "https" URI with an empty host A sender MUST NOT generate an "https" URI with an empty host
identifier. A recipient that processes such a URI reference MUST identifier. A recipient that processes such a URI reference MUST
reject it as invalid. reject it as invalid.
The hierarchical path component and optional query component identify The hierarchical path component and optional query component identify
the target resource within that origin server's name space. the target resource within that origin server's name space.
A client MUST ensure that its HTTP requests for an "https" resource A client MUST ensure that its HTTP requests for an "https" resource
are secured, prior to being communicated, and that it only accepts are secured, prior to being communicated, and that it only accepts
secured responses to those requests. secured responses to those requests.
Resources made available via the "https" scheme have no shared Resources made available via the "https" scheme have no shared
identity with the "http" scheme. They are distinct origins with identity with the "http" scheme. They are distinct origins with
separate namespaces. However, an extension to HTTP that is defined separate namespaces. However, an extension to HTTP that is defined
to apply to all origins with the same host, such as the Cookie to apply to all origins with the same host, such as the Cookie
protocol [RFC6265], can allow information set by one service to protocol [RFC6265], can allow information set by one service to
impact communication with other services within a matching group of impact communication with other services within a matching group of
host domains. host domains.
2.5.3. http and https URI Normalization and Comparison 4.2.3. http(s) Normalization and Comparison
Since the "http" and "https" schemes conform to the URI generic Since the "http" and "https" schemes conform to the URI generic
syntax, such URIs are normalized and compared according to the syntax, such URIs are normalized and compared according to the
algorithm defined in Section 6 of [RFC3986], using the defaults algorithm defined in Section 6 of [RFC3986], using the defaults
described above for each scheme. described above for each scheme.
If the port is equal to the default port for a scheme, the normal If the port is equal to the default port for a scheme, the normal
form is to omit the port subcomponent. When not being used as the form is to omit the port subcomponent. When not being used as the
target of an OPTIONS request, an empty path component is equivalent target of an OPTIONS request, an empty path component is equivalent
to an absolute path of "/", so the normal form is to provide a path to an absolute path of "/", so the normal form is to provide a path
skipping to change at page 21, line 41 skipping to change at page 24, line 5
"reserved" set are equivalent to their percent-encoded octets: the "reserved" set are equivalent to their percent-encoded octets: the
normal form is to not encode them (see Sections 2.1 and 2.2 of normal form is to not encode them (see Sections 2.1 and 2.2 of
[RFC3986]). [RFC3986]).
For example, the following three URIs are equivalent: For example, the following three URIs are equivalent:
http://example.com:80/~smith/home.html http://example.com:80/~smith/home.html
http://EXAMPLE.com/%7Esmith/home.html http://EXAMPLE.com/%7Esmith/home.html
http://EXAMPLE.com:/%7esmith/home.html http://EXAMPLE.com:/%7esmith/home.html
2.5.4. Deprecated userinfo 4.2.4. http(s) Deprecated userinfo
The URI generic syntax for authority also includes a userinfo The URI generic syntax for authority also includes a userinfo
subcomponent ([RFC3986], Section 3.2.1) for including user subcomponent ([RFC3986], Section 3.2.1) for including user
authentication information in the URI. In that subcomponent, the use authentication information in the URI. In that subcomponent, the use
of the format "user:password" is deprecated. of the format "user:password" is deprecated.
Some implementations make use of the userinfo component for internal Some implementations make use of the userinfo component for internal
configuration of authentication information, such as within command configuration of authentication information, such as within command
invocation options, configuration files, or bookmark lists, even invocation options, configuration files, or bookmark lists, even
though such usage might expose a user identifier or password. though such usage might expose a user identifier or password.
A sender MUST NOT generate the userinfo subcomponent (and its "@" A sender MUST NOT generate the userinfo subcomponent (and its "@"
delimiter) when an "http" or "https" URI reference is generated delimiter) when an "http" or "https" URI reference is generated
within a message as a target URI or field value. within a message as a target URI or field value.
Before making use of an "http" or "https" URI reference received from Before making use of an "http" or "https" URI reference received from
an untrusted source, a recipient SHOULD parse for userinfo and treat an untrusted source, a recipient SHOULD parse for userinfo and treat
its presence as an error; it is likely being used to obscure the its presence as an error; it is likely being used to obscure the
authority for the sake of phishing attacks. authority for the sake of phishing attacks.
2.5.5. Fragment Identifiers on http(s) URI References 4.2.5. http(s) References with Fragment Identifiers
Fragment identifiers allow for indirect identification of a secondary Fragment identifiers allow for indirect identification of a secondary
resource, independent of the URI scheme, as defined in Section 3.5 of resource, independent of the URI scheme, as defined in Section 3.5 of
[RFC3986]. Some protocol elements that refer to a URI allow [RFC3986]. Some protocol elements that refer to a URI allow
inclusion of a fragment, while others do not. They are distinguished inclusion of a fragment, while others do not. They are distinguished
by use of the ABNF rule for elements where fragment is allowed; by use of the ABNF rule for elements where fragment is allowed;
otherwise, a specific rule that excludes fragments is used (see otherwise, a specific rule that excludes fragments is used (see
Section 6.1). Section 6.1).
| *Note:* the fragment identifier component is not part of the | *Note:* the fragment identifier component is not part of the
| actual scheme definition for a URI scheme (see Section 4.3 of | actual scheme definition for a URI scheme (see Section 4.3 of
| [RFC3986]), thus does not appear in the ABNF definitions for | [RFC3986]), thus does not appear in the ABNF definitions for
| the "http" and "https" URI schemes above. | the "http" and "https" URI schemes above.
3. Conformance 4.3. Authoritative Access
3.1. Implementation Diversity See Section 16.1 for security considerations related to establishing
authority.
When considering the design of HTTP, it is easy to fall into a trap 4.3.1. URI Origin
of thinking that all user agents are general-purpose browsers and all
origin servers are large public websites. That is not the case in
practice. Common HTTP user agents include household appliances,
stereos, scales, firmware update scripts, command-line programs,
mobile apps, and communication devices in a multitude of shapes and
sizes. Likewise, common HTTP origin servers include home automation
units, configurable networking components, office machines,
autonomous robots, news feeds, traffic cameras, ad selectors, and
video-delivery platforms.
The term "user agent" does not imply that there is a human user The "origin" for a given URI is the triple of scheme, host, and port
directly interacting with the software agent at the time of a after normalizing the scheme and host to lowercase and normalizing
request. In many cases, a user agent is installed or configured to the port to remove any leading zeros. If port is elided from the
run in the background and save its results for later inspection (or URI, the default port for that scheme is used. For example, the URI
save only a subset of those results that might be interesting or https://Example.Com/happy.js
erroneous). Spiders, for example, are typically given a start URI
and configured to follow certain behavior while crawling the Web as a
hypertext graph.
The implementation diversity of HTTP means that not all user agents would have the origin
can make interactive suggestions to their user or provide adequate
warning for security or privacy concerns. In the few cases where
this specification requires reporting of errors to the user, it is
acceptable for such reporting to only be observable in an error
console or log file. Likewise, requirements that an automated action
be confirmed by the user before proceeding might be met via advance
configuration choices, run-time options, or simple avoidance of the
unsafe action; confirmation does not imply any specific user
interface or interruption of normal processing if the user has
already made that choice.
3.2. Role-based Requirements { "https", "example.com", "443" }
This specification targets conformance criteria according to the role which can also be described as the normalized URI prefix with port
of a participant in HTTP communication. Hence, HTTP requirements are always present:
placed on senders, recipients, clients, servers, user agents,
intermediaries, origin servers, proxies, gateways, or caches,
depending on what behavior is being constrained by the requirement.
Additional (social) requirements are placed on implementations,
resource owners, and protocol element registrations when they apply
beyond the scope of a single communication.
The verb "generate" is used instead of "send" where a requirement https://example.com:443
differentiates between creating a protocol element and merely
forwarding a received element downstream.
An implementation is considered conformant if it complies with all of Each origin defines its own namespace and controls how identifiers
the requirements associated with the roles it partakes in HTTP. within that namespace are mapped to resources. In turn, how the
origin responds to valid requests, consistently over time, determines
the semantics that users will associate with a URI, and the
usefulness of those semantics is what ultimately transforms these
mechanisms into a "resource" for users to reference and access in the
future.
Conformance includes both the syntax and semantics of protocol Two origins are distinct if they differ in scheme, host, or port.
elements. A sender MUST NOT generate protocol elements that convey a Even when it can be verified that the same entity controls two
meaning that is known by that sender to be false. A sender MUST NOT distinct origins, the two namespaces under those origins are distinct
generate protocol elements that do not match the grammar defined by unless explicitly aliased by a server authoritative for that origin.
the corresponding ABNF rules. Within a given message, a sender MUST
NOT generate protocol elements or syntax alternatives that are only
allowed to be generated by participants in other roles (i.e., a role
that the sender does not have for that message).
3.3. Parsing Elements Origin is also used within HTML and related Web protocols, beyond the
scope of this document, as described in [RFC6454].
When a received protocol element is parsed, the recipient MUST be 4.3.2. http origins
able to parse any value of reasonable length that is applicable to
the recipient's role and that matches the grammar defined by the
corresponding ABNF rules. Note, however, that some received protocol
elements might not be parsed. For example, an intermediary
forwarding a message might parse a field into generic field name and
field value components, but then forward the field without further
parsing inside the field value.
HTTP does not have specific length limitations for many of its Although HTTP is independent of the transport protocol, the "http"
protocol elements because the lengths that might be appropriate will scheme (Section 4.2.1) is specific to associating authority with
vary widely, depending on the deployment context and purpose of the whomever controls the origin server listening for TCP connections on
implementation. Hence, interoperability between senders and the indicated port of whatever host is identified within the
recipients depends on shared expectations regarding what is a authority component. This is a very weak sense of authority because
reasonable length for each protocol element. Furthermore, what is it depends on both client-specific name resolution mechanisms and
commonly understood to be a reasonable length for some protocol communication that might not be secured from an on-path attacker.
elements has changed over the course of the past two decades of HTTP Nevertheless, it is a sufficient minimum for binding "http"
use and is expected to continue changing in the future. identifiers to an origin server for consistent resolution within a
trusted environment.
At a minimum, a recipient MUST be able to parse and process protocol If the host identifier is provided as an IP address, the origin
element lengths that are at least as long as the values that it server is the listener (if any) on the indicated TCP port at that IP
generates for those same protocol elements in other messages. For address. If host is a registered name, the registered name is an
example, an origin server that publishes very long URI references to indirect identifier for use with a name resolution service, such as
its own resources needs to be able to parse and process those same DNS, to find an address for an appropriate origin server.
references when received as a target URI.
3.4. Error Handling When an "http" URI is used within a context that calls for access to
the indicated resource, a client MAY attempt access by resolving the
host identifier to an IP address, establishing a TCP connection to
that address on the indicated port, and sending an HTTP request
message to the server containing the URI's identifying data.
A recipient MUST interpret a received protocol element according to If the server responds to such a request with a non-interim HTTP
the semantics defined for it by this specification, including response message, as described in Section 14, then that response is
extensions to this specification, unless the recipient has determined considered an authoritative answer to the client's request.
(through experience or configuration) that the sender incorrectly
implements what is implied by those semantics. For example, an
origin server might disregard the contents of a received
Accept-Encoding header field if inspection of the User-Agent header
field indicates a specific implementation version that is known to
fail on receipt of certain content codings.
Unless noted otherwise, a recipient MAY attempt to recover a usable Note, however, that the above is not the only means for obtaining an
protocol element from an invalid construct. HTTP does not define authoritative response, nor does it imply that an authoritative
specific error handling mechanisms except when they have a direct response is always necessary (see [Caching]). For example, the Alt-
impact on security, since different applications of the protocol Svc header field [RFC7838] allows an origin server to identify other
require different error handling strategies. For example, a Web services that are also authoritative for that origin. Access to
browser might wish to transparently recover from a response where the "http" identified resources might also be provided by protocols
Location header field doesn't parse according to the ABNF, whereas a outside the scope of this document.
systems control client might consider any form of error recovery to
be dangerous.
Some requests can be automatically retried by a client in the event 4.3.3. https origins
of an underlying connection failure, as described in Section 8.2.2.
4. Extending and Versioning HTTP The "https" scheme (Section 4.2.2) associates authority based on the
ability of a server to use the private key corresponding to a
certificate that the client considers to be trustworthy for the
identified origin server. The client usually relies upon a chain of
trust, conveyed from some prearranged or configured trust anchor, to
deem a certificate trustworthy (Section 4.3.4).
While HTTP's core semantics don't change between protocol versions, In HTTP/1.1 and earlier, a client will only attribute authority to a
the expression of them "on the wire" can change, and so the HTTP server when they are communicating over a successfully established
version number changes when incompatible changes are made to the wire and secured connection specifically to that URI origin's host. The
format. Additionally, HTTP allows incremental, backwards-compatible connection establishment and certificate verification are used as
changes to be made to the protocol without changing its version proof of authority.
through the use of defined extension points.
4.1. Extending HTTP In HTTP/2 and HTTP/3, a client will attribute authority to a server
when they are communicating over a successfully established and
secured connection if the URI origin's host matches any of the hosts
present in the server's certificate and the client believes that it
could open a connection to that host for that URI. In practice, a
client will make a DNS query to check that the origin's host contains
the same server IP address as the established connection. This
restriction can be removed by the origin server sending an equivalent
ORIGIN frame [RFC8336].
HTTP defines a number of generic extension points that can be used to The request target's host and port value are passed within each HTTP
introduce capabilities to the protocol without introducing a new request, identifying the origin and distinguishing it from other
version, including methods (Section 8.4), status codes namespaces that might be controlled by the same server. It is the
(Section 10.7), header and trailer fields (Section 5.7), and further origin's responsibility to ensure that any services provided with
extensibility points within defined fields (such as Cache-Control in control over its certificate's private key are equally responsible
Section 5.2.3 of [Caching]). Because the semantics of HTTP are not for managing the corresponding "https" namespaces, or at least
versioned, these extension points are persistent; the version of the prepared to reject requests that appear to have been misdirected. A
protocol in use does not affect their semantics. server might be unwilling to serve as the origin for some hosts even
when they have the authority to do so.
Version-independent extensions are discouraged from depending on or For example, if a network attacker causes connections for port N to
interacting with the specific version of the protocol in use. When be received at port Q, checking the target URI is necessary to ensure
this is unavoidable, careful consideration needs to be given to how that the attacker can't cause "https://example.com:N/foo" to be
the extension can interoperate across versions. replaced by "https://example.com:Q/foo" without consent.
Additionally, specific versions of HTTP might have their own Note that the "https" scheme does not rely on TCP and the connected
extensibility points, such as transfer-codings in HTTP/1.1 port number for associating authority, since both are outside the
(Section 6.1 of [Messaging]) and HTTP/2 ([RFC7540]) SETTINGS or frame secured communication and thus cannot be trusted as definitive.
types. These extension points are specific to the version of the Hence, the HTTP communication might take place over any channel that
protocol they occur within. has been secured, as defined in Section 4.2.2, including protocols
that don't use TCP.
Version-specific extensions cannot override or modify the semantics When an "https" URI is used within a context that calls for access to
of a version-independent mechanism or extension point (like a method the indicated resource, a client MAY attempt access by resolving the
or header field) without explicitly being allowed by that protocol host identifier to an IP address, establishing a TCP connection to
element. For example, the CONNECT method (Section 8.3.6) allows that address on the indicated port, securing the connection end-to-
this. end by successfully initiating TLS over TCP with confidentiality and
integrity protection, and sending an HTTP request message over that
connection containing the URI's identifying data.
These guidelines assure that the protocol operates correctly and If the server responds to such a request with a non-interim HTTP
predictably, even when parts of the path implement different versions response message, as described in Section 14, then that response is
of HTTP. considered an authoritative answer to the client's request.
4.2. Protocol Versioning Note, however, that the above is not the only means for obtaining an
authoritative response, nor does it imply that an authoritative
response is always necessary (see [Caching]).
The HTTP version number consists of two decimal digits separated by a 4.3.4. https certificate verification
"." (period or decimal point). The first digit ("major version")
indicates the HTTP messaging syntax, whereas the second digit ("minor To establish a secured connection to dereference a URI, a client MUST
version") indicates the highest minor version within that major verify that the service's identity is an acceptable match for the
version to which the sender is conformant and able to understand for URI's origin server. Certificate verification is used to prevent
future communication. server impersonation by an on-path attacker or by an attacker that
controls name resolution. This process requires that a client be
configured with a set of trust anchors.
In general, a client MUST verify the service identity using the
verification process defined in Section 6 of [RFC6125] (for a
reference identifier of type URI-ID) unless the client has been
specifically configured to accept some other form of verification.
For example, a client might be connecting to a server whose address
and hostname are dynamic, with an expectation that the service will
present a specific certificate (or a certificate matching some
externally defined reference identity) rather than one matching the
dynamic URI's origin server identifier.
In special cases, it might be appropriate for a client to simply
ignore the server's identity, but it must be understood that this
leaves a connection open to active attack.
If the certificate is not valid for the URI's origin server, a user
agent MUST either notify the user (user agents MAY give the user an
option to continue with the connection in any case) or terminate the
connection with a bad certificate error. Automated clients MUST log
the error to an appropriate audit log (if available) and SHOULD
terminate the connection (with a bad certificate error). Automated
clients MAY provide a configuration setting that disables this check,
but MUST provide a setting which enables it.
5. Message Abstraction
Each major version of HTTP defines its own syntax for the
communication of messages. However, they share a common data
abstraction.
A message consists of control data to describe and route the message,
optional header fields that modify or extend the message semantics,
describe the sender, the payload, or provide additional context, a
potentially unbounded stream of payload data, and optional trailer
fields for metadata collected while sending the payload.
Messages are intended to be self-descriptive. This means that
everything a recipient needs to know about the message can be
determined by looking at the message itself, after decoding or
reconstituting parts that have been compressed or elided in transit,
without requiring an understanding of the sender's current
application state (established via prior messages).
5.1. Protocol Version
While HTTP's core semantics don't change between protocol versions,
the expression of them "on the wire" can change, and so the HTTP
version number changes when incompatible changes are made to the wire
format. Additionally, HTTP allows incremental, backwards-compatible
changes to be made to the protocol without changing its version
through the use of defined extension points (Section 15).
The protocol version as a whole indicates the sender's conformance The protocol version as a whole indicates the sender's conformance
with the set of requirements laid out in that version's corresponding with the set of requirements laid out in that version's corresponding
specification of HTTP. For example, the version "HTTP/1.1" is specification of HTTP. For example, the version "HTTP/1.1" is
defined by the combined specifications of this document, "HTTP defined by the combined specifications of this document, "HTTP
Caching" [Caching], and "HTTP/1.1 Messaging" [Messaging]. Caching" [Caching], and "HTTP/1.1 Messaging" [Messaging].
HTTP's major version number is incremented when an incompatible
message syntax is introduced. The minor number is incremented when
changes made to the protocol have the effect of adding to the message
semantics or implying additional capabilities of the sender.
The minor version advertises the sender's communication capabilities The minor version advertises the sender's communication capabilities
even when the sender is only using a backwards-compatible subset of even when the sender is only using a backwards-compatible subset of
the protocol, thereby letting the recipient know that more advanced the protocol, thereby letting the recipient know that more advanced
features can be used in response (by servers) or in future requests features can be used in response (by servers) or in future requests
(by clients). (by clients).
A client SHOULD send a request version equal to the highest version A client SHOULD send a request version equal to the highest version
to which the client is conformant and whose major version is no to which the client is conformant and whose major version is no
higher than the highest version supported by the server, if this is higher than the highest version supported by the server, if this is
known. A client MUST NOT send a version to which it is not known. A client MUST NOT send a version to which it is not
skipping to change at page 27, line 12 skipping to change at page 29, line 41
from the response status code or header fields (e.g., Server) that from the response status code or header fields (e.g., Server) that
the server improperly handles higher request versions. the server improperly handles higher request versions.
A server SHOULD send a response version equal to the highest version A server SHOULD send a response version equal to the highest version
to which the server is conformant that has a major version less than to which the server is conformant that has a major version less than
or equal to the one received in the request. A server MUST NOT send or equal to the one received in the request. A server MUST NOT send
a version to which it is not conformant. A server can send a 505 a version to which it is not conformant. A server can send a 505
(HTTP Version Not Supported) response if it wishes, for any reason, (HTTP Version Not Supported) response if it wishes, for any reason,
to refuse service of the client's major protocol version. to refuse service of the client's major protocol version.
HTTP's major version number is incremented when an incompatible
message syntax is introduced. The minor number is incremented when
changes made to the protocol have the effect of adding to the message
semantics or implying additional capabilities of the sender.
When an HTTP message is received with a major version number that the When an HTTP message is received with a major version number that the
recipient implements, but a higher minor version number than what the recipient implements, but a higher minor version number than what the
recipient implements, the recipient SHOULD process the message as if recipient implements, the recipient SHOULD process the message as if
it were in the highest minor version within that major version to it were in the highest minor version within that major version to
which the recipient is conformant. A recipient can assume that a which the recipient is conformant. A recipient can assume that a
message with a higher minor version, when sent to a recipient that message with a higher minor version, when sent to a recipient that
has not yet indicated support for that higher version, is has not yet indicated support for that higher version, is
sufficiently backwards-compatible to be safely processed by any sufficiently backwards-compatible to be safely processed by any
implementation of the same major version. implementation of the same major version.
When a major version of HTTP does not define any minor versions, the When a major version of HTTP does not define any minor versions, the
minor version "0" is implied and is used when referring to that minor version "0" is implied and is used when referring to that
protocol within a protocol element that requires sending a minor protocol within a protocol element that requires sending a minor
version. version.
5. Header and Trailer Fields 5.2. Framing
// Message framing defines how each message begins and ends, such
// that the message can be distinguished from other message (or
// noise) on the same connection. Framing is specific to each major
// version of HTTP.
One of the functions of message framing is to assure that messages
are complete. A message is considered complete when all of the
octets indicated by its framing are available. Note that, when no
explicit framing is used, a response message that is ended by the
transport connection's close is considered complete even though it
might be indistinguishable from an incomplete response, unless a
transport-level error indicates that it is not complete.
5.3. Control Data
5.3.1. Request
HTTP communication is initiated by a user agent for some purpose.
The purpose is a combination of request semantics and a target
resource upon which to apply those semantics.
5.3.2. Response
5.4. Header Fields
HTTP messages use key/value pairs to convey data about the message, HTTP messages use key/value pairs to convey data about the message,
its payload, the target resource, or the connection. They are called its payload, the target resource, or the connection. They are called
"HTTP fields" or just "fields". "HTTP fields" or just "fields".
Fields that are sent/received before the message body are referred to Fields that are sent/received before the message body are referred to
as "header fields" (or just "headers", colloquially) and are located as "header fields" (or just "headers", colloquially) and are located
within the "header section" of a message. We refer to some named within the "header section" of a message. We refer to some named
fields specifically as a "header field" when they are only allowed to fields specifically as a "header field" when they are only allowed to
be sent in the header section. be sent in the header section.
Fields that are sent/received after the header section has ended Fields that are sent/received after the header section has ended
(usually after the message body begins to stream) are referred to as (usually after the message body begins to stream) are referred to as
"trailer fields" (or just "trailers", colloquially) and located "trailer fields" (or just "trailers", colloquially) and located
within a "trailer section". One or more trailer sections are only within a "trailer section". One or more trailer sections are only
possible when supported by the version of HTTP in use and enabled by possible when supported by the version of HTTP in use and enabled by
an extensible mechanism for framing message sections. an extensible mechanism for framing message sections.
Both sections are composed of any number of "field lines", each with Both sections are composed of any number of "field lines", each with
a "field name" (see Section 5.3) identifying the field, and a "field a "field name" (see Section 5.4.3) identifying the field, and a
line value" that conveys data for the field. "field line value" that conveys data for the field.
Each field name present in a section has a corresponding "field Each field name present in a section has a corresponding "field
value" for that section, composed from all field line values with value" for that section, composed from all field line values with
that given field name in that section, concatenated together and that given field name in that section, concatenated together and
separated with commas. See Section 5.1 for further discussion of the separated with commas. See Section 5.4.1 for further discussion of
semantics of field ordering and combination in messages, and the semantics of field ordering and combination in messages, and
Section 5.4 for more discussion of field values. Section 5.4.4 for more discussion of field values.
For example, this section: For example, this section:
Example-Field: Foo, Bar Example-Field: Foo, Bar
Example-Field: Baz Example-Field: Baz
contains two field lines, both with the field name "Example-Field". contains two field lines, both with the field name "Example-Field".
The first field line has a field line value of "Foo, Bar", while the The first field line has a field line value of "Foo, Bar", while the
second field line value is "Baz". The field value for "Example- second field line value is "Baz". The field value for "Example-
Field" is a list with three members: "Foo", "Bar", and "Baz". Field" is a list with three members: "Foo", "Bar", and "Baz".
skipping to change at page 28, line 36 skipping to change at page 31, line 43
The interpretation of a field does not change between minor versions The interpretation of a field does not change between minor versions
of the same major HTTP version, though the default behavior of a of the same major HTTP version, though the default behavior of a
recipient in the absence of such a field can change. Unless recipient in the absence of such a field can change. Unless
specified otherwise, fields are defined for all versions of HTTP. In specified otherwise, fields are defined for all versions of HTTP. In
particular, the Host and Connection fields ought to be implemented by particular, the Host and Connection fields ought to be implemented by
all HTTP/1.x implementations whether or not they advertise all HTTP/1.x implementations whether or not they advertise
conformance with HTTP/1.1. conformance with HTTP/1.1.
New fields can be introduced without changing the protocol version if New fields can be introduced without changing the protocol version if
their defined semantics allow them to be safely ignored by recipients their defined semantics allow them to be safely ignored by recipients
that do not recognize them; see Section 5.3.1. that do not recognize them; see Section 15.3.
5.1. Field Ordering and Combination A proxy MUST forward unrecognized header fields unless the field name
is listed in the Connection header field (Section 6.4.1) or the proxy
is specifically configured to block, or otherwise transform, such
fields. Other recipients SHOULD ignore unrecognized header and
trailer fields. These requirements allow HTTP's functionality to be
enhanced without requiring prior update of deployed intermediaries.
5.4.1. Field Ordering and Combination
The order in which field lines with differing names are received in a The order in which field lines with differing names are received in a
message is not significant. However, it is good practice to send message is not significant. However, it is good practice to send
header fields that contain control data first, such as Host on header fields that contain control data first, such as Host on
requests and Date on responses, so that implementations can decide requests and Date on responses, so that implementations can decide
when not to handle a message as early as possible. A server MUST NOT when not to handle a message as early as possible. A server MUST NOT
apply a request to the target resource until the entire request apply a request to the target resource until the entire request
header section is received, since later header field lines might header section is received, since later header field lines might
include conditionals, authentication credentials, or deliberately include conditionals, authentication credentials, or deliberately
misleading duplicate header fields that would impact request misleading duplicate header fields that would impact request
skipping to change at page 29, line 23 skipping to change at page 32, line 36
proxy MUST NOT change the order of these field line values when proxy MUST NOT change the order of these field line values when
forwarding a message. forwarding a message.
This means that, aside from the well-known exception noted below, a This means that, aside from the well-known exception noted below, a
sender MUST NOT generate multiple field lines with the same name in a sender MUST NOT generate multiple field lines with the same name in a
message (whether in the headers or trailers), or append a field line message (whether in the headers or trailers), or append a field line
when a field line of the same name already exists in the message, when a field line of the same name already exists in the message,
unless that field's definition allows multiple field line values to unless that field's definition allows multiple field line values to
be recombined as a comma-separated list [i.e., at least one be recombined as a comma-separated list [i.e., at least one
alternative of the field's definition allows a comma-separated list, alternative of the field's definition allows a comma-separated list,
such as an ABNF rule of #(values) defined in Section 5.5]. such as an ABNF rule of #(values) defined in Section 5.7.1].
| *Note:* In practice, the "Set-Cookie" header field ([RFC6265]) | *Note:* In practice, the "Set-Cookie" header field ([RFC6265])
| often appears in a response message across multiple field lines | often appears in a response message across multiple field lines
| and does not use the list syntax, violating the above | and does not use the list syntax, violating the above
| requirements on multiple field lines with the same field name. | requirements on multiple field lines with the same field name.
| Since it cannot be combined into a single field value, | Since it cannot be combined into a single field value,
| recipients ought to handle "Set-Cookie" as a special case while | recipients ought to handle "Set-Cookie" as a special case while
| processing fields. (See Appendix A.2.3 of [Kri2001] for | processing fields. (See Appendix A.2.3 of [Kri2001] for
| details.) | details.)
5.2. Field Limits 5.4.2. Field Limits
HTTP does not place a predefined limit on the length of each field HTTP does not place a predefined limit on the length of each field
line, field value, or on the length of a header or trailer section as line, field value, or on the length of a header or trailer section as
a whole, as described in Section 3. Various ad hoc limitations on a whole, as described in Section 2. Various ad hoc limitations on
individual lengths are found in practice, often depending on the individual lengths are found in practice, often depending on the
specific field's semantics. specific field's semantics.
A server that receives a request header field line, field value, or A server that receives a request header field line, field value, or
set of fields larger than it wishes to process MUST respond with an set of fields larger than it wishes to process MUST respond with an
appropriate 4xx (Client Error) status code. Ignoring such header appropriate 4xx (Client Error) status code. Ignoring such header
fields would increase the server's vulnerability to request smuggling fields would increase the server's vulnerability to request smuggling
attacks (Section 11.2 of [Messaging]). attacks (Section 11.2 of [Messaging]).
A client MAY discard or truncate received field lines that are larger A client MAY discard or truncate received field lines that are larger
than the client wishes to process if the field semantics are such than the client wishes to process if the field semantics are such
that the dropped value(s) can be safely ignored without changing the that the dropped value(s) can be safely ignored without changing the
message framing or response semantics. message framing or response semantics.
5.3. Field Names 5.4.3. Field Names
The field-name token labels the corresponding field value as having The field-name token labels the corresponding field value as having
the semantics defined by that field. For example, the Date header the semantics defined by that field. For example, the Date header
field is defined in Section 11.1.1 as containing the origination field is defined in Section 9.2.2 as containing the origination
timestamp for the message in which it appears. timestamp for the message in which it appears.
field-name = token field-name = token
Field names are case-insensitive and ought to be registered within Field names are case-insensitive and ought to be registered within
the "Hypertext Transfer Protocol (HTTP) Field Name Registry"; see the "Hypertext Transfer Protocol (HTTP) Field Name Registry"; see
Section 5.3.2. Section 15.3.1.
Authors of specifications defining new fields are advised to choose a
short but descriptive field name. Short names avoid needless data
transmission; descriptive names avoid confusion and "squatting" on
names that might have broader uses.
To that end, limited-use fields (such as a header confined to a
single application or use case) are encouraged to use a name that
includes its name (or an abbreviation) as a prefix; for example, if
the Foo Application needs a Description field, it might use "Foo-
Desc"; "Description" is too generic, and "Foo-Description" is
needlessly long.
While the field-name syntax is defined to allow any token character,
in practice some implementations place limits on the characters they
accept in field-names. To be interoperable, new field names SHOULD
constrain themselves to alphanumeric characters, "-", and ".", and
SHOULD begin with an alphanumeric character.
Field names ought not be prefixed with "X-"; see [BCP178] for further
information.
Other prefixes are sometimes used in HTTP field names; for example,
"Accept-" is used in many content negotiation headers. These
prefixes are only an aid to recognizing the purpose of a field, and
do not trigger automatic processing.
5.3.1. Field Extensibility
There is no limit on the introduction of new field names, each
presumably defining new semantics.
New fields can be defined such that, when they are understood by a
recipient, they might override or enhance the interpretation of
previously defined fields, define preconditions on request
evaluation, or refine the meaning of responses.
A proxy MUST forward unrecognized header fields unless the field name
is listed in the Connection header field (Section 6.8) or the proxy
is specifically configured to block, or otherwise transform, such
fields. Other recipients SHOULD ignore unrecognized header and
trailer fields. These requirements allow HTTP's functionality to be
enhanced without requiring prior update of deployed intermediaries.
5.3.2. Field Name Registry
The "Hypertext Transfer Protocol (HTTP) Field Name Registry" defines
the namespace for HTTP field names.
Any party can request registration of a HTTP field. See Section 5.7
for considerations to take into account when creating a new HTTP
field.
The "Hypertext Transfer Protocol (HTTP) Field Name Registry" is
located at <https://www.iana.org/assignments/http-fields/>.
Registration requests can be made by following the instructions
located there or by sending an email to the "ietf-http-wg@ietf.org"
mailing list.
Field names are registered on the advice of a Designated Expert
(appointed by the IESG or their delegate). Fields with the status
'permanent' are Specification Required ([RFC8126], Section 4.6).
Registration requests consist of at least the following information:
Field name:
The requested field name. It MUST conform to the field-name
syntax defined in Section 5.3, and SHOULD be restricted to just
letters, digits, hyphen ('-') and underscore ('_') characters,
with the first character being a letter.
Status:
"permanent" or "provisional".
Specification document(s):
Reference to the document that specifies the field, preferably
including a URI that can be used to retrieve a copy of the
document. An indication of the relevant section(s) can also be
included, but is not required.
And, optionally:
Comments: Additional information, such as about reserved entries.
The Expert(s) can define additional fields to be collected in the
registry, in consultation with the community.
Standards-defined names have a status of "permanent". Other names
can also be registered as permanent, if the Expert(s) find that they
are in use, in consultation with the community. Other names should
be registered as "provisional".
Provisional entries can be removed by the Expert(s) if - in
consultation with the community - the Expert(s) find that they are
not in use. The Experts can change a provisional entry's status to
permanent at any time.
Note that names can be registered by third parties (including the
Expert(s)), if the Expert(s) determines that an unregistered name is
widely deployed and not likely to be registered in a timely manner
otherwise.
5.4. Field Values 5.4.4. Field Values
HTTP field values typically have their syntax defined using ABNF HTTP field values typically have their syntax defined using ABNF
([RFC5234]), using the extension defined in Section 5.5 as necessary, ([RFC5234]), using the extension defined in Section 5.7.1 as
and are usually constrained to the range of US-ASCII characters. necessary, and are usually constrained to the range of US-ASCII
Fields needing a greater range of characters can use an encoding such characters. Fields needing a greater range of characters can use an
as the one defined in [RFC8187]. encoding such as the one defined in [RFC8187].
field-value = *field-content field-value = *field-content
field-content = field-vchar field-content = field-vchar
[ 1*( SP / HTAB / field-vchar ) field-vchar ] [ 1*( SP / HTAB / field-vchar ) field-vchar ]
field-vchar = VCHAR / obs-text field-vchar = VCHAR / obs-text
Historically, HTTP allowed field content with text in the ISO-8859-1 Historically, HTTP allowed field content with text in the ISO-8859-1
charset [ISO-8859-1], supporting other charsets only through use of charset [ISO-8859-1], supporting other charsets only through use of
[RFC2047] encoding. In practice, most HTTP field values use only a [RFC2047] encoding. In practice, most HTTP field values use only a
subset of the US-ASCII charset [USASCII]. Newly defined fields subset of the US-ASCII charset [USASCII]. Newly defined fields
skipping to change at page 32, line 51 skipping to change at page 34, line 16
treat other octets in field content (obs-text) as opaque data. treat other octets in field content (obs-text) as opaque data.
Field values containing control (CTL) characters such as CR or LF are Field values containing control (CTL) characters such as CR or LF are
invalid; recipients MUST either reject a field value containing invalid; recipients MUST either reject a field value containing
control characters, or convert them to SP before processing or control characters, or convert them to SP before processing or
forwarding the message. forwarding the message.
Leading and trailing whitespace in raw field values is removed upon Leading and trailing whitespace in raw field values is removed upon
field parsing (e.g., Section 5.1 of [Messaging]). Field definitions field parsing (e.g., Section 5.1 of [Messaging]). Field definitions
where leading or trailing whitespace in values is significant will where leading or trailing whitespace in values is significant will
have to use a container syntax such as quoted-string have to use a container syntax such as quoted-string (Section 5.7.4).
(Section 5.4.1.2).
Commas (",") often are used to separate members in field values. Commas (",") often are used to separate members in field values.
Fields that allow multiple members are referred to as list-based Fields that allow multiple members are referred to as list-based
fields. Fields that only anticipate a single member are referred to fields. Fields that only anticipate a single member are referred to
as singleton fields. as singleton fields.
Because commas are used as a generic delimiter between members, they Because commas are used as a generic delimiter between members, they
need to be treated with care if they are allowed as data within a need to be treated with care if they are allowed as data within a
member. This is true for both list-based and singleton fields, since member. This is true for both list-based and singleton fields, since
a singleton field might be sent with multiple members erroneously; a singleton field might be sent with multiple members erroneously;
skipping to change at page 33, line 32 skipping to change at page 34, line 45
these: these:
Example-URI-Field: "http://example.com/a.html,foo", Example-URI-Field: "http://example.com/a.html,foo",
"http://without-a-comma.example.com/" "http://without-a-comma.example.com/"
Example-Date-Field: "Sat, 04 May 1996", "Wed, 14 Sep 2005" Example-Date-Field: "Sat, 04 May 1996", "Wed, 14 Sep 2005"
Note that double-quote delimiters almost always are used with the Note that double-quote delimiters almost always are used with the
quoted-string production; using a different syntax inside double- quoted-string production; using a different syntax inside double-
quotes will likely cause unnecessary confusion. quotes will likely cause unnecessary confusion.
Many fields (such as Content-Type, defined in Section 7.2.1) use a Many fields (such as Content-Type, defined in Section 7.4) use a
common syntax for parameters that allows both unquoted (token) and common syntax for parameters that allows both unquoted (token) and
quoted (quoted-string) syntax for a parameter value quoted (quoted-string) syntax for a parameter value (Section 5.7.6).
(Section 5.4.1.4). Use of common syntax allows recipients to reuse Use of common syntax allows recipients to reuse existing parser
existing parser components. When allowing both forms, the meaning of components. When allowing both forms, the meaning of a parameter
a parameter value ought to be the same whether it was received as a value ought to be the same whether it was received as a token or a
token or a quoted string. quoted string.
Historically, HTTP field values could be extended over multiple lines Historically, HTTP field values could be extended over multiple lines
by preceding each extra line with at least one space or horizontal by preceding each extra line with at least one space or horizontal
tab (obs-fold). This document assumes that any such obsolete line tab (obs-fold). This document assumes that any such obsolete line
folding has been replaced with one or more SP octets prior to folding has been replaced with one or more SP octets prior to
interpreting the field value, as described in Section 5.2 of interpreting the field value, as described in Section 5.2 of
[Messaging]. [Messaging].
| *Note:* This specification does not use ABNF rules to define | *Note:* This specification does not use ABNF rules to define
| each "Field Name: Field Value" pair, as was done in earlier | each "Field Name: Field Value" pair, as was done in earlier
| editions (published before [RFC7230]). Instead, ABNF rules are | editions (published before [RFC7230]). Instead, ABNF rules are
| named according to each registered field name, wherein the rule | named according to each registered field name, wherein the rule
| defines the valid grammar for that field's corresponding field | defines the valid grammar for that field's corresponding field
| values (i.e., after the field value has been extracted by a | values (i.e., after the field value has been extracted by a
| generic field parser). | generic field parser).
5.4.1. Common Field Value Components 5.5. Payload
Some HTTP messages transfer a complete or partial representation as
the message "payload". In some cases, a payload might contain only
the associated representation's header fields (e.g., responses to
HEAD) or only some part(s) of the representation data (e.g., the 206
(Partial Content) status code).
5.5.1. Purpose
The purpose of a payload in a request is defined by the method
semantics. For example, a representation in the payload of a PUT
request (Section 8.3.4) represents the desired state of the target
resource if the request is successfully applied, whereas a
representation in the payload of a POST request (Section 8.3.3)
represents information to be processed by the target resource.
In a response, the payload's purpose is defined by both the request
method and the response status code. For example, the payload of a
200 (OK) response to GET (Section 8.3.1) represents the current state
of the target resource, as observed at the time of the message
origination date (Section 9.2.2), whereas the payload of the same
status code in a response to POST might represent either the
processing result or the new state of the target resource after
applying the processing. Response messages with an error status code
usually contain a payload that represents the error condition, such
that it describes the error state and what next steps are suggested
for resolving it.
5.5.2. Identification
When a complete or partial representation is transferred in a message
payload, it is often desirable for the sender to supply, or the
recipient to determine, an identifier for a resource corresponding to
that representation.
For a request message:
o If the request has a Content-Location header field, then the
sender asserts that the payload is a representation of the
resource identified by the Content-Location field value. However,
such an assertion cannot be trusted unless it can be verified by
other means (not defined by this specification). The information
might still be useful for revision history links.
o Otherwise, the payload is unidentified.
For a response message, the following rules are applied in order
until a match is found:
1. If the request method is GET or HEAD and the response status code
is 200 (OK), 204 (No Content), 206 (Partial Content), or 304 (Not
Modified), the payload is a representation of the resource
identified by the target URI (Section 6.1).
2. If the request method is GET or HEAD and the response status code
is 203 (Non-Authoritative Information), the payload is a
potentially modified or enhanced representation of the target
resource as provided by an intermediary.
3. If the response has a Content-Location header field and its field
value is a reference to the same URI as the target URI, the
payload is a representation of the target resource.
4. If the response has a Content-Location header field and its field
value is a reference to a URI different from the target URI, then
the sender asserts that the payload is a representation of the
resource identified by the Content-Location field value.
However, such an assertion cannot be trusted unless it can be
verified by other means (not defined by this specification).
5. Otherwise, the payload is unidentified.
5.5.3. Payload Metadata
Header fields that specifically describe the payload, rather than the
associated representation, are referred to as "payload header
fields". Payload header fields are defined in other parts of this
specification, due to their impact on message parsing.
5.5.4. Payload Body
The payload body contains the data of a request or response. This is
distinct from the message body (e.g., Section 6 of [Messaging]),
which is how the payload body is transferred "on the wire", and might
be encoded, depending on the HTTP version in use.
It is also distinct from a request or response's representation data
(Section 7.2), which can be inferred from protocol operation, rather
than necessarily appearing "on the wire."
The presence of a payload body in a request depends on whether the
request method used defines semantics for it.
The presence of a payload body in a response depends on both the
request method to which it is responding and the response status code
(Section 14).
Responses to the HEAD request method (Section 8.3.2) never include a
payload body because the associated response header fields indicate
only what their values would have been if the request method had been
GET (Section 8.3.1).
2xx (Successful) responses to a CONNECT request method
(Section 8.3.6) switch the connection to tunnel mode instead of
having a payload body.
All 1xx (Informational), 204 (No Content), and 304 (Not Modified)
responses do not include a payload body.
All other responses do include a payload body, although that body
might be of zero length.
5.6. Trailer Fields
5.6.1. Purpose
In some HTTP versions, additional metadata can be sent after the
initial header section has been completed (during or after
transmission of the payload body), such as a message integrity check,
digital signature, or post-processing status. For example, the
chunked coding in HTTP/1.1 allows a trailer section after the payload
body (Section 7.1.2 of [Messaging]) which can contain trailer fields:
field names and values that share the same syntax and namespace as
header fields but that are received after the header section.
Trailer fields ought to be processed and stored separately from the
fields in the header section to avoid contradicting message semantics
known at the time the header section was complete. The presence or
absence of certain header fields might impact choices made for the
routing or processing of the message as a whole before the trailers
are received; those choices cannot be unmade by the later discovery
of trailer fields.
5.6.2. Limitations
Many fields cannot be processed outside the header section because
their evaluation is necessary prior to receiving the message body,
such as those that describe message framing, routing, authentication,
request modifiers, response controls, or payload format. A sender
MUST NOT generate a trailer field unless the sender knows the
corresponding header field name's definition permits the field to be
sent in trailers.
Trailer fields can be difficult to process by intermediaries that
forward messages from one protocol version to another. If the entire
message can be buffered in transit, some intermediaries could merge
trailer fields into the header section (as appropriate) before it is
forwarded. However, in most cases, the trailers are simply
discarded. A recipient MUST NOT merge a trailer field into a header
section unless the recipient understands the corresponding header
field definition and that definition explicitly permits and defines
how trailer field values can be safely merged.
The presence of the keyword "trailers" in the TE header field
(Section 9.1.4) indicates that the client is willing to accept
trailer fields, on behalf of itself and any downstream clients. For
requests from an intermediary, this implies that all downstream
clients are willing to accept trailer fields in the forwarded
response. Note that the presence of "trailers" does not mean that
the client(s) will process any particular trailer field in the
response; only that the trailer section(s) will not be dropped by any
of the clients.
Because of the potential for trailer fields to be discarded in
transit, a server SHOULD NOT generate trailer fields that it believes
are necessary for the user agent to receive.
5.6.3. Processing
Like header fields, trailer fields with the same name are processed
in the order received; multiple trailer field lines with the same
name have the equivalent semantics as appending the multiple values
as a list of members, even when the field lines are received in
separate trailer sections. Trailer fields that might be generated
more than once during a message MUST be defined as a list value even
if each member value is only processed once per field line received.
Trailer fields are expected (but not required) to be processed one
trailer section at a time. That is, for each trailer section
received, a recipient that is looking for trailer fields will parse
the received section into fields, invoke any associated processing
for those fields at that point in the message processing, and then
append those fields to the set of trailer fields received for the
overall message.
This behavior allows for iterative processing of trailer fields that
contain incremental signatures or mid-stream status information, and
fields that might refer to each other's values within the same
section. However, there is no guarantee that trailer sections won't
shift in relation to the message body stream, or won't be recombined
(or dropped) in transit, so trailer fields that refer to data outside
the present trailer section need to use self-descriptive references
(i.e., refer to the data by name, ordinal position, or an octet
range) rather than assume it is the data most recently received.
Likewise, at the end of a message, a recipient MAY treat the entire
set of received trailer fields as one data structure to be considered
as the message concludes. Additional processing expectations, if
any, can be defined within the field specification for a field
intended for use in trailers.
5.7. Common Rules for Defining Field Values
5.7.1. Lists (#rule ABNF Extension)
A #rule extension to the ABNF rules of [RFC5234] is used to improve
readability in the definitions of some list-based field values.
A construct "#" is defined, similar to "*", for defining comma-
delimited lists of elements. The full form is "<n>#<m>element"
indicating at least <n> and at most <m> elements, each separated by a
single comma (",") and optional whitespace (OWS).
5.7.1.1. Sender Requirements
In any production that uses the list construct, a sender MUST NOT
generate empty list elements. In other words, a sender MUST generate
lists that satisfy the following syntax:
1#element => element *( OWS "," OWS element )
and:
#element => [ 1#element ]
and for n >= 1 and m > 1:
<n>#<m>element => element <n-1>*<m-1>( OWS "," OWS element )
Appendix A shows the collected ABNF for senders after the list
constructs have been expanded.
5.7.1.2. Recipient Requirements
Empty elements do not contribute to the count of elements present. A
recipient MUST parse and ignore a reasonable number of empty list
elements: enough to handle common mistakes by senders that merge
values, but not so much that they could be used as a denial-of-
service mechanism. In other words, a recipient MUST accept lists
that satisfy the following syntax:
#element => [ element ] *( OWS "," OWS [ element ] )
Note that because of the potential presence of empty list elements,
the RFC 5234 ABNF cannot enforce the cardinality of list elements,
and consequently all cases are mapped as if there was no cardinality
specified.
For example, given these ABNF productions:
example-list = 1#example-list-elmt
example-list-elmt = token ; see Section 5.7.2
Then the following are valid values for example-list (not including
the double quotes, which are present for delimitation only):
"foo,bar"
"foo ,bar,"
"foo , ,bar,charlie"
In contrast, the following values would be invalid, since at least
one non-empty element is required by the example-list production:
""
","
", ,"
5.7.2. Tokens
Many HTTP field values are defined using common syntax components, Many HTTP field values are defined using common syntax components,
separated by whitespace or specific delimiting characters. separated by whitespace or specific delimiting characters.
Delimiters are chosen from the set of US-ASCII visual characters not Delimiters are chosen from the set of US-ASCII visual characters not
allowed in a token (DQUOTE and "(),/:;<=>?@[\]{}"). allowed in a token (DQUOTE and "(),/:;<=>?@[\]{}").
5.4.1.1. Tokens
Tokens are short textual identifiers that do not include whitespace Tokens are short textual identifiers that do not include whitespace
or delimiters. or delimiters.
token = 1*tchar token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
/ "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
/ DIGIT / ALPHA / DIGIT / ALPHA
; any VCHAR, except delimiters ; any VCHAR, except delimiters
5.4.1.2. Quoted Strings 5.7.3. Whitespace
This specification uses three rules to denote the use of linear
whitespace: OWS (optional whitespace), RWS (required whitespace), and
BWS ("bad" whitespace).
The OWS rule is used where zero or more linear whitespace octets
might appear. For protocol elements where optional whitespace is
preferred to improve readability, a sender SHOULD generate the
optional whitespace as a single SP; otherwise, a sender SHOULD NOT
generate optional whitespace except as needed to white out invalid or
unwanted protocol elements during in-place message filtering.
The RWS rule is used when at least one linear whitespace octet is
required to separate field tokens. A sender SHOULD generate RWS as a
single SP.
OWS and RWS have the same semantics as a single SP. Any content
known to be defined as OWS or RWS MAY be replaced with a single SP
before interpreting it or forwarding the message downstream.
The BWS rule is used where the grammar allows optional whitespace
only for historical reasons. A sender MUST NOT generate BWS in
messages. A recipient MUST parse for such bad whitespace and remove
it before interpreting the protocol element.
BWS has no semantics. Any content known to be defined as BWS MAY be
removed before interpreting it or forwarding the message downstream.
OWS = *( SP / HTAB )
; optional whitespace
RWS = 1*( SP / HTAB )
; required whitespace
BWS = OWS
; "bad" whitespace
5.7.4. Quoted Strings
A string of text is parsed as a single value if it is quoted using A string of text is parsed as a single value if it is quoted using
double-quote marks. double-quote marks.
quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
obs-text = %x80-FF obs-text = %x80-FF
The backslash octet ("\") can be used as a single-octet quoting The backslash octet ("\") can be used as a single-octet quoting
mechanism within quoted-string and comment constructs. Recipients mechanism within quoted-string and comment constructs. Recipients
skipping to change at page 35, line 5 skipping to change at page 42, line 42
as if it were replaced by the octet following the backslash. as if it were replaced by the octet following the backslash.
quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
A sender SHOULD NOT generate a quoted-pair in a quoted-string except A sender SHOULD NOT generate a quoted-pair in a quoted-string except
where necessary to quote DQUOTE and backslash octets occurring within where necessary to quote DQUOTE and backslash octets occurring within
that string. A sender SHOULD NOT generate a quoted-pair in a comment that string. A sender SHOULD NOT generate a quoted-pair in a comment
except where necessary to quote parentheses ["(" and ")"] and except where necessary to quote parentheses ["(" and ")"] and
backslash octets occurring within that comment. backslash octets occurring within that comment.
5.4.1.3. Comments 5.7.5. Comments
Comments can be included in some HTTP fields by surrounding the Comments can be included in some HTTP fields by surrounding the
comment text with parentheses. Comments are only allowed in fields comment text with parentheses. Comments are only allowed in fields
containing "comment" as part of their field value definition. containing "comment" as part of their field value definition.
comment = "(" *( ctext / quoted-pair / comment ) ")" comment = "(" *( ctext / quoted-pair / comment ) ")"
ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text
5.4.1.4. Parameters 5.7.6. Parameters
Parameters are zero or more instances of a name=value pair; they are Parameters are zero or more instances of a name=value pair; they are
often used in field values as a common syntax for appending auxiliary often used in field values as a common syntax for appending auxiliary
information to an item. Each parameter is usually delimited by an information to an item. Each parameter is usually delimited by an
immediately preceding semicolon. immediately preceding semicolon.
parameters = *( OWS ";" OWS [ parameter ] ) parameters = *( OWS ";" OWS [ parameter ] )
parameter = parameter-name "=" parameter-value parameter = parameter-name "=" parameter-value
parameter-name = token parameter-name = token
parameter-value = ( token / quoted-string ) parameter-value = ( token / quoted-string )
Parameter names are case-insensitive. Parameter values might or Parameter names are case-insensitive. Parameter values might or
might not be case-sensitive, depending on the semantics of the might not be case-sensitive, depending on the semantics of the
parameter name. Examples of parameters and some equivalent forms can parameter name. Examples of parameters and some equivalent forms can
be seen in media types (Section 7.1.1) and the Accept header field be seen in media types (Section 7.4.1) and the Accept header field
(Section 9.4.1). (Section 11.1.2).
A parameter value that matches the token production can be A parameter value that matches the token production can be
transmitted either as a token or within a quoted-string. The quoted transmitted either as a token or within a quoted-string. The quoted
and unquoted values are equivalent. and unquoted values are equivalent.
| *Note:* Parameters do not allow whitespace (not even "bad" | *Note:* Parameters do not allow whitespace (not even "bad"
| whitespace) around the "=" character. | whitespace) around the "=" character.
5.4.1.5. Date/Time Formats 5.7.7. Date/Time Formats
Prior to 1995, there were three different formats commonly used by Prior to 1995, there were three different formats commonly used by
servers to communicate timestamps. For compatibility with old servers to communicate timestamps. For compatibility with old
implementations, all three are defined here. The preferred format is implementations, all three are defined here. The preferred format is
a fixed-length and single-zone subset of the date and time a fixed-length and single-zone subset of the date and time
specification used by the Internet Message Format [RFC5322]. specification used by the Internet Message Format [RFC5322].
HTTP-date = IMF-fixdate / obs-date HTTP-date = IMF-fixdate / obs-date
An example of the preferred format is An example of the preferred format is
skipping to change at page 37, line 39 skipping to change at page 45, line 32
timestamps unless otherwise restricted by the field definition. For timestamps unless otherwise restricted by the field definition. For
example, messages are occasionally forwarded over HTTP from a non- example, messages are occasionally forwarded over HTTP from a non-
HTTP source that might generate any of the date and time HTTP source that might generate any of the date and time
specifications defined by the Internet Message Format. specifications defined by the Internet Message Format.
| *Note:* HTTP requirements for the date/time stamp format apply | *Note:* HTTP requirements for the date/time stamp format apply
| only to their usage within the protocol stream. | only to their usage within the protocol stream.
| Implementations are not required to use these formats for user | Implementations are not required to use these formats for user
| presentation, request logging, etc. | presentation, request logging, etc.
5.5. ABNF List Extension: #rule 6. Routing
A #rule extension to the ABNF rules of [RFC5234] is used to improve
readability in the definitions of some list-based field values.
A construct "#" is defined, similar to "*", for defining comma-
delimited lists of elements. The full form is "<n>#<m>element"
indicating at least <n> and at most <m> elements, each separated by a
single comma (",") and optional whitespace (OWS).
5.5.1. Sender Requirements
In any production that uses the list construct, a sender MUST NOT
generate empty list elements. In other words, a sender MUST generate
lists that satisfy the following syntax:
1#element => element *( OWS "," OWS element )
and:
#element => [ 1#element ]
and for n >= 1 and m > 1:
<n>#<m>element => element <n-1>*<m-1>( OWS "," OWS element )
Appendix A shows the collected ABNF for senders after the list
constructs have been expanded.
5.5.2. Recipient Requirements
Empty elements do not contribute to the count of elements present. A
recipient MUST parse and ignore a reasonable number of empty list
elements: enough to handle common mistakes by senders that merge
values, but not so much that they could be used as a denial-of-
service mechanism. In other words, a recipient MUST accept lists
that satisfy the following syntax:
#element => [ element ] *( OWS "," OWS [ element ] )
Note that because of the potential presence of empty list elements,
the RFC 5234 ABNF cannot enforce the cardinality of list elements,
and consequently all cases are mapped is if there was no cardinality
specified.
For example, given these ABNF productions:
example-list = 1#example-list-elmt
example-list-elmt = token ; see Section 5.4.1.1
Then the following are valid values for example-list (not including
the double quotes, which are present for delimitation only):
"foo,bar"
"foo ,bar,"
"foo , ,bar,charlie"
In contrast, the following values would be invalid, since at least
one non-empty element is required by the example-list production:
""
","
", ,"
5.6. Trailer Fields
5.6.1. Purpose
In some HTTP versions, additional metadata can be sent after the
initial header section has been completed (during or after
transmission of the payload body), such as a message integrity check,
digital signature, or post-processing status. For example, the
chunked coding in HTTP/1.1 allows a trailer section after the payload
body (Section 7.1.2 of [Messaging]) which can contain trailer fields:
field names and values that share the same syntax and namespace as
header fields but that are received after the header section.
Trailer fields ought to be processed and stored separately from the
fields in the header section to avoid contradicting message semantics
known at the time the header section was complete. The presence or
absence of certain header fields might impact choices made for the
routing or processing of the message as a whole before the trailers
are received; those choices cannot be unmade by the later discovery
of trailer fields.
5.6.2. Limitations
Many fields cannot be processed outside the header section because
their evaluation is necessary prior to receiving the message body,
such as those that describe message framing, routing, authentication,
request modifiers, response controls, or payload format. A sender
MUST NOT generate a trailer field unless the sender knows the
corresponding header field name's definition permits the field to be
sent in trailers.
Trailer fields can be difficult to process by intermediaries that
forward messages from one protocol version to another. If the entire
message can be buffered in transit, some intermediaries could merge
trailer fields into the header section (as appropriate) before it is
forwarded. However, in most cases, the trailers are simply
discarded. A recipient MUST NOT merge a trailer field into a header
section unless the recipient understands the corresponding header
field definition and that definition explicitly permits and defines
how trailer field values can be safely merged.
The presence of the keyword "trailers" in the TE header field
(Section 5.6.5) indicates that the client is willing to accept
trailer fields, on behalf of itself and any downstream clients. For
requests from an intermediary, this implies that all downstream
clients are willing to accept trailer fields in the forwarded
response. Note that the presence of "trailers" does not mean that
the client(s) will process any particular trailer field in the
response; only that the trailer section(s) will not be dropped by any
of the clients.
Because of the potential for trailer fields to be discarded in
transit, a server SHOULD NOT generate trailer fields that it believes
are necessary for the user agent to receive.
5.6.3. Processing
Like header fields, trailer fields with the same name are processed
in the order received; multiple trailer field lines with the same
name have the equivalent semantics as appending the multiple values
as a list of members, even when the field lines are received in
separate trailer sections. Trailer fields that might be generated
more than once during a message MUST be defined as a list value even
if each member value is only processed once per field line received.
Trailer fields are expected (but not required) to be processed one
trailer section at a time. That is, for each trailer section
received, a recipient that is looking for trailer fields will parse
the received section into fields, invoke any associated processing
for those fields at that point in the message processing, and then
append those fields to the set of trailer fields received for the
overall message.
This behavior allows for iterative processing of trailer fields that
contain incremental signatures or mid-stream status information, and
fields that might refer to each other's values within the same
section. However, there is no guarantee that trailer sections won't
shift in relation to the message body stream, or won't be recombined
(or dropped) in transit, so trailer fields that refer to data outside
the present trailer section need to use self-descriptive references
(i.e., refer to the data by name, ordinal position, or an octet
range) rather than assume it is the data most recently received.
Likewise, at the end of a message, a recipient MAY treat the entire
set of received trailer fields as one data structure to be considered
as the message concludes. Additional processing expectations, if
any, can be defined within the field specification for a field
intended for use in trailers.
5.6.4. Trailer
The "Trailer" header field provides a list of field names that the
sender anticipates sending as trailer fields within that message.
This allows a recipient to prepare for receipt of the indicated
metadata before it starts processing the body.
Trailer = #field-name
For example, a sender might indicate that a message integrity check
will be computed as the payload is being streamed and provide the
final signature as a trailer field. This allows a recipient to
perform the same check on the fly as the payload data is received.
A sender that intends to generate one or more trailer fields in a
message SHOULD generate a Trailer header field in the header section
of that message to indicate which fields might be present in the
trailers.
5.6.5. TE
The "TE" header field in a request can be used to indicate that the
sender will not discard trailer fields when it contains a "trailers"
member, as described in Section 5.6.
Additionally, specific HTTP versions can use it to indicate the
transfer codings the client is willing to accept in the response.
The TE field-value consists of a list of tokens, each allowing for
optional parameters (as described in Section 5.4.1.4).
TE = #t-codings
t-codings = "trailers" / ( transfer-coding [ t-ranking ] )
t-ranking = OWS ";" OWS "q=" rank
rank = ( "0" [ "." 0*3DIGIT ] )
/ ( "1" [ "." 0*3("0") ] )
5.7. Considerations for New HTTP Fields
See Section 5.3 for a general requirements for field names, and
Section 5.4 for a discussion of field values.
Authors of specifications defining new fields are advised to consider
documenting:
o Whether the field has a singleton or list-based value (see
Section 5.4).
If it is a singleton field, document how to treat messages where
the multiple members are present (a sensible default would be to
ignore the field, but this might not always be the right choice).
Note that intermediaries and software libraries might combine
multiple field instances into a single one, despite the field
being defined as a singleton. A robust format enables recipients
to discover these situations (good example: "Content-Type", as the
comma can only appear inside quoted strings; bad example:
"Location", as a comma can occur inside a URI).
o Under what conditions the field can be used; e.g., only in
responses or requests, in all messages, only on responses to a
particular request method, etc.
o What the scope of applicability for the information conveyed in
the field is. By default, fields apply only to the message they
are associated with, but some response fields are designed to
apply to all representations of a resource, the resource itself,
or an even broader scope. Specifications that expand the scope of
a response field will need to carefully consider issues such as
content negotiation, the time period of applicability, and (in
some cases) multi-tenant server deployments.
o Whether the field should be stored by origin servers that
understand it upon a PUT request.
o Whether the field semantics are further refined by the context,
such as by existing request methods or status codes.
o Whether it is appropriate to list the field name in the Connection
header field (i.e., if the field is to be hop-by-hop; see
Section 6.8).
o Under what conditions intermediaries are allowed to insert,
delete, or modify the field's value.
o Whether it is appropriate to list the field name in a Vary
response header field (e.g., when the request header field is used
by an origin server's content selection algorithm; see
Section 11.1.4).
o Whether the field is allowable in trailers (see Section 5.6).
o Whether the field ought to be preserved across redirects.
o Whether it introduces any additional security considerations, such
as disclosure of privacy-related data.
5.8. Fields Defined In This Document
The following fields are defined by this document:
--------------------------- ------------ --------
Field Name Status Ref.
--------------------------- ------------ --------
Accept standard 9.4.1
Accept-Charset deprecated 9.4.2
Accept-Encoding standard 9.4.3
Accept-Language standard 9.4.4
Accept-Ranges standard 11.4.1
Allow standard 11.4.2
Authentication-Info standard 11.3.3
Authorization standard 9.5.3
Connection standard 6.8
Content-Encoding standard 7.2.2
Content-Language standard 7.2.3
Content-Length standard 7.2.4
Content-Location standard 7.2.5
Content-Range standard 7.3.4
Content-Type standard 7.2.1
Date standard 11.1.1
ETag standard 11.2.3
Expect standard 9.1.1
From standard 9.6.1
Host standard 6.5
If-Match standard 9.2.3
If-Modified-Since standard 9.2.5
If-None-Match standard 9.2.4
If-Range standard 9.2.7
If-Unmodified-Since standard 9.2.6
Last-Modified standard 11.2.2
Location standard 11.1.2
Max-Forwards standard 9.1.2
Proxy-Authenticate standard 11.3.2
Proxy-Authentication-Info standard 11.3.4
Proxy-Authorization standard 9.5.4
Range standard 9.3
Referer standard 9.6.2
Retry-After standard 11.1.3
Server standard 11.4.3
TE standard 5.6.5
Trailer standard 5.6.4
Upgrade standard 6.7
User-Agent standard 9.6.3
Vary standard 11.1.4
Via standard 6.6.1
WWW-Authenticate standard 11.3.1
--------------------------- ------------ --------
Table 3
Furthermore, the field name "*" is reserved, since using that name as
an HTTP header field might conflict with its special semantics in the
Vary header field (Section 11.1.4).
------------ ---------- ------ ------------
Field Name Status Ref. Comments
------------ ---------- ------ ------------
* standard 5.8 (reserved)
------------ ---------- ------ ------------
Table 4
6. Message Routing HTTP is used in a wide variety of applications, ranging from general-
purpose computers to home appliances. In some cases, communication
options are hard-coded in a client's configuration. However, most
HTTP clients rely on the same resource identification mechanism and
configuration techniques as general-purpose Web browsers.
HTTP request message routing is determined by each client based on HTTP request message routing is determined by each client based on
the target resource, the client's proxy configuration, and the target resource, the client's proxy configuration, and
establishment or reuse of an inbound connection. The corresponding establishment or reuse of an inbound connection. The corresponding
response routing follows the same connection chain back to the response routing follows the same connection chain back to the
client. client.
6.1. Identifying a Target Resource 6.1. Target Resource
HTTP is used in a wide variety of applications, ranging from general- 6.1.1. Request Target
purpose computers to home appliances. In some cases, communication
options are hard-coded in a client's configuration. However, most
HTTP clients rely on the same resource identification mechanism and
configuration techniques as general-purpose Web browsers.
HTTP communication is initiated by a user agent for some purpose. The "request target" is the protocol element that identifies the
The purpose is a combination of request semantics and a target "target resource".
resource upon which to apply those semantics. The "request target"
is the protocol element that identifies the "target resource".
Typically, the request target is a URI reference (Section 2.4) which Typically, the request target is a URI reference (Section 4) which a
a user agent would resolve to its absolute form in order to obtain user agent would resolve to its absolute form in order to obtain the
the "target URI". The target URI excludes the reference's fragment "target URI". The target URI excludes the reference's fragment
component, if any, since fragment identifiers are reserved for component, if any, since fragment identifiers are reserved for
client-side processing ([RFC3986], Section 3.5). client-side processing ([RFC3986], Section 3.5).
However, there are two special, method-specific forms allowed for the However, there are two special, method-specific forms allowed for the
request target in specific circumstances: request target in specific circumstances:
o For CONNECT (Section 8.3.6), the request target is the host name o For CONNECT (Section 8.3.6), the request target is the host name
and port number of the tunnel destination, separated by a colon. and port number of the tunnel destination, separated by a colon.
o For OPTIONS (Section 8.3.7), the request target can be a single o For OPTIONS (Section 8.3.7), the request target can be a single
asterisk ("*"). asterisk ("*").
See the respective method definitions for details. These forms MUST See the respective method definitions for details. These forms MUST
NOT be used with other methods. NOT be used with other methods.
6.2. Determining Origin 6.1.2. Host
The "origin" for a given URI is the triple of scheme, host, and port The "Host" header field in a request provides the host and port
after normalizing the scheme and host to lowercase and normalizing information from the target URI, enabling the origin server to
the port to remove any leading zeros. If port is elided from the distinguish among resources while servicing requests for multiple
URI, the default port for that scheme is used. For example, the URI host names on a single IP address.
https://Example.Com/happy.js Host = uri-host [ ":" port ] ; Section 4
would have the origin Since the Host field value is critical information for handling a
request, a user agent SHOULD generate Host as the first field in the
header section.
{ "https", "example.com", "443" } For example, a GET request to the origin server for
<http://www.example.org/pub/WWW/> would begin with:
which can also be described as the normalized URI prefix with port GET /pub/WWW/ HTTP/1.1
always present: Host: www.example.org
https://example.com:443 Since the Host header field acts as an application-level routing
mechanism, it is a frequent target for malware seeking to poison a
shared cache or redirect a request to an unintended server. An
interception proxy is particularly vulnerable if it relies on the
Host field value for redirecting requests to internal servers, or for
use as a cache key in a shared cache, without first verifying that
the intercepted connection is targeting a valid IP address for that
host.
Each origin defines its own namespace and controls how identifiers 6.1.3. Reconstructing the Target URI
within that namespace are mapped to resources. In turn, how the
origin responds to valid requests, consistently over time, determines
the semantics that users will associate with a URI, and the
usefulness of those semantics is what ultimately transforms these
mechanisms into a "resource" for users to reference and access in the
future.
Two origins are distinct if they differ in scheme, host, or port. Once an inbound connection is obtained, the client sends an HTTP
Even when it can be verified that the same entity controls two request message.
distinct origins, the two namespaces under those origins are distinct
unless explicitly aliased by a server authoritative for that origin.
Origin is also used within HTML and related Web protocols, beyond the Depending on the nature of the request, the client's target URI might
scope of this document, as described in [RFC6454]. be split into components and transmitted (or implied) within various
parts of a request message. These parts are recombined by each
recipient, in accordance with their local configuration and incoming
connection context, to determine the target URI. Appendix of
[Messaging] defines how a server determines the target URI for an
HTTP/1.1 request.
6.3. Routing Inbound Once the target URI has been reconstructed, an origin server needs to
decide whether or not to provide service for that URI via the
connection in which the request was received. For example, the
request might have been misdirected, deliberately or accidentally,
such that the information within a received Host header field differs
from the host or port upon which the connection has been made. If
the connection is from a trusted gateway, that inconsistency might be
expected; otherwise, it might indicate an attempt to bypass security
filters, trick the server into delivering non-public content, or
poison a cache. See Section 16 for security considerations regarding
message routing.
| *Note:* previous specifications defined the recomposed target
| URI as a distinct concept, the effective request URI.
6.2. Routing Inbound
Once the target URI and its origin are determined, a client decides Once the target URI and its origin are determined, a client decides
whether a network request is necessary to accomplish the desired whether a network request is necessary to accomplish the desired
semantics and, if so, where that request is to be directed. semantics and, if so, where that request is to be directed.
6.3.1. To a Cache 6.2.1. To a Cache
If the client has a cache [Caching] and the request can be satisfied If the client has a cache [Caching] and the request can be satisfied
by it, then the request is usually directed there first. by it, then the request is usually directed there first.
6.3.2. To a Proxy 6.2.2. To a Proxy
If the request is not satisfied by a cache, then a typical client If the request is not satisfied by a cache, then a typical client
will check its configuration to determine whether a proxy is to be will check its configuration to determine whether a proxy is to be
used to satisfy the request. Proxy configuration is implementation- used to satisfy the request. Proxy configuration is implementation-
dependent, but is often based on URI prefix matching, selective dependent, but is often based on URI prefix matching, selective
authority matching, or both, and the proxy itself is usually authority matching, or both, and the proxy itself is usually
identified by an "http" or "https" URI. If a proxy is applicable, identified by an "http" or "https" URI. If a proxy is applicable,
the client connects inbound by establishing (or reusing) a connection the client connects inbound by establishing (or reusing) a connection
to that proxy. to that proxy.
6.3.3. To the Origin 6.2.3. To the Origin
If no proxy is applicable, a typical client will invoke a handler If no proxy is applicable, a typical client will invoke a handler
routine, usually specific to the target URI's scheme, to connect routine, usually specific to the target URI's scheme, to connect
directly to an origin for the target resource. How that is directly to an origin for the target resource. How that is
accomplished is dependent on the target URI scheme and defined by its accomplished is dependent on the target URI scheme and defined by its
associated specification. associated specification.
6.3.3.1. http origins 6.3. Response Correlation
Although HTTP is independent of the transport protocol, the "http"
scheme (Section 2.5.1) is specific to associating authority with
whomever controls the origin server listening for TCP connections on
the indicated port of whatever host is identified within the
authority component. This is a very weak sense of authority because
it depends on both client-specific name resolution mechanisms and
communication that might not be secured from an on-path attacker.
Nevertheless, it is a sufficient minimum for binding "http"
identifiers to an origin server for consistent resolution within a
trusted environment.
If the host identifier is provided as an IP address, the origin
server is the listener (if any) on the indicated TCP port at that IP
address. If host is a registered name, the registered name is an
indirect identifier for use with a name resolution service, such as
DNS, to find an address for an appropriate origin server.
When an "http" URI is used within a context that calls for access to
the indicated resource, a client MAY attempt access by resolving the
host identifier to an IP address, establishing a TCP connection to
that address on the indicated port, and sending an HTTP request
message to the server containing the URI's identifying data
(Section 2.1).
If the server responds to such a request with a non-interim HTTP
response message, as described in Section 10, then that response is
considered an authoritative answer to the client's request.
Note, however, that the above is not the only means for obtaining an
authoritative response, nor does it imply that an authoritative
response is always necessary (see [Caching]). For example, the Alt-
Svc header field [RFC7838] allows an origin server to identify other
services that are also authoritative for that origin. Access to
"http" identified resources might also be provided by protocols
outside the scope of this document.
See Section 12.1 for security considerations related to establishing
authority.
6.3.3.2. https origins
The "https" scheme (Section 2.5.2) associates authority based on the
ability of a server to use the private key corresponding to a
certificate that the client considers to be trustworthy for the
identified origin server. The client usually relies upon a chain of
trust, conveyed from some prearranged or configured trust anchor, to
deem a certificate trustworthy (Section 6.3.3.3).
In HTTP/1.1 and earlier, a client will only attribute authority to a A connection might be used for multiple request/response exchanges.
server when they are communicating over a successfully established The mechanism used to correlate between request and response messages
and secured connection specifically to that URI origin's host. The is version dependent; some versions of HTTP use implicit ordering of
connection establishment and certificate verification are used as messages, while others use an explicit identifier.
proof of authority.
In HTTP/2 and HTTP/3, a client will attribute authority to a server Responses (both final and interim) can be sent at any time after a
when they are communicating over a successfully established and request is received, even if it is not yet complete. However,
secured connection if the URI origin's host matches any of the hosts clients (including intermediaries) might abandon a request if the
present in the server's certificate and the client believes that it response is not forthcoming within a reasonable period of time.
could open a connection to that host for that URI. In practice, a
client will make a DNS query to check that the origin's host contains
the same server IP address as the established connection. This
restriction can be removed by the origin server sending an equivalent
ORIGIN frame [RFC8336].
The request target's host and port value are passed within each HTTP 6.4. Message Forwarding
request, identifying the origin and distinguishing it from other
namespaces that might be controlled by the same server. It is the
origin's responsibility to ensure that any services provided with
control over its certificate's private key are equally responsible
for managing the corresponding "https" namespaces, or at least
prepared to reject requests that appear to have been misdirected. A
server might be unwilling to serve as the origin for some hosts even
when they have the authority to do so.
For example, if a network attacker causes connections for port N to As described in Section 3.7, intermediaries can serve a variety of
be received at port Q, checking the target URI is necessary to ensure roles in the processing of HTTP requests and responses. Some
that the attacker can't cause "https://example.com:N/foo" to be intermediaries are used to improve performance or availability.
replaced by "https://example.com:Q/foo" without consent. Others are used for access control or to filter content. Since an
HTTP stream has characteristics similar to a pipe-and-filter
architecture, there are no inherent limits to the extent an
intermediary can enhance (or interfere) with either direction of the
stream.
Note that the "https" scheme does not rely on TCP and the connected An intermediary not acting as a tunnel MUST implement the Connection
port number for associating authority, since both are outside the header field, as specified in Section 6.4.1, and exclude fields from
secured communication and thus cannot be trusted as definitive. being forwarded that are only intended for the incoming connection.
Hence, the HTTP communication might take place over any channel that
has been secured, as defined in Section 2.5.2, including protocols
that don't use TCP.
When an "https" URI is used within a context that calls for access to An intermediary MUST NOT forward a message to itself unless it is
the indicated resource, a client MAY attempt access by resolving the protected from an infinite request loop. In general, an intermediary
host identifier to an IP address, establishing a TCP connection to ought to recognize its own server names, including any aliases, local
that address on the indicated port, securing the connection end-to- variations, or literal IP addresses, and respond to such requests
end by successfully initiating TLS over TCP with confidentiality and directly.
integrity protection, and sending an HTTP request message over that
connection containing the URI's identifying data (Section 2.1).
If the server responds to such a request with a non-interim HTTP An HTTP message can be parsed as a stream for incremental processing
response message, as described in Section 10, then that response is or forwarding downstream. However, recipients cannot rely on
considered an authoritative answer to the client's request. incremental delivery of partial messages, since some implementations
will buffer or delay message forwarding for the sake of network
efficiency, security checks, or payload transformations.
Note, however, that the above is not the only means for obtaining an 6.4.1. Connection
authoritative response, nor does it imply that an authoritative
response is always necessary (see [Caching]).
6.3.3.3. https certificate verification The "Connection" header field allows the sender to list desired
control options for the current connection.
To establish a secured connection to dereference a URI, a client MUST When a field aside from Connection is used to supply control
verify that the service's identity is an acceptable match for the information for or about the current connection, the sender MUST list
URI's origin server. Certificate verification is used to prevent the corresponding field name within the Connection header field.
server impersonation by an on-path attacker or by an attacker that Note that some versions of HTTP prohibit the use of fields for such
controls name resolution. This process requires that a client be information, and therefore do not allow the Connection field.
configured with a set of trust anchors.
In general, a client MUST verify the service identity using the Intermediaries MUST parse a received Connection header field before a
verification process defined in Section 6 of [RFC6125] (for a message is forwarded and, for each connection-option in this field,
reference identifier of type URI-ID) unless the client has been remove any header or trailer field(s) from the message with the same
specifically configured to accept some other form of verification. name as the connection-option, and then remove the Connection header
For example, a client might be connecting to a server whose address field itself (or replace it with the intermediary's own connection
and hostname are dynamic, with an expectation that the service will options for the forwarded message).
present a specific certificate (or a certificate matching some
externally defined reference identity) rather than one matching the
dynamic URI's origin server identifier.
In special cases, it might be appropriate for a client to simply Hence, the Connection header field provides a declarative way of
ignore the server's identity, but it must be understood that this distinguishing fields that are only intended for the immediate
leaves a connection open to active attack. recipient ("hop-by-hop") from those fields that are intended for all
recipients on the chain ("end-to-end"), enabling the message to be
self-descriptive and allowing future connection-specific extensions
to be deployed without fear that they will be blindly forwarded by
older intermediaries.
If the certificate is not valid for the URI's origin server, a user Furthermore, intermediaries SHOULD remove or replace field(s) whose
agent MUST either notify the user (user agents MAY give the user an semantics are known to require removal before forwarding, whether or
option to continue with the connection in any case) or terminate the not they appear as a Connection option, after applying those fields'
connection with a bad certificate error. Automated clients MUST log semantics. This includes but is not limited to:
the error to an appropriate audit log (if available) and SHOULD
terminate the connection (with a bad certificate error). Automated
clients MAY provide a configuration setting that disables this check,
but MUST provide a setting which enables it.
6.4. Reconstructing the Target URI o Proxy-Connection (Appendix C.1.2 of [Messaging])
Once an inbound connection is obtained, the client sends an HTTP o Keep-Alive (Section 19.7.1 of [RFC2068])
request message (Section 2.1).
Depending on the nature of the request, the client's target URI might o TE (Section 9.1.4)
be split into components and transmitted (or implied) within various o Trailer (Section 9.1.5)
parts of a request message. These parts are recombined by each
recipient, in accordance with their local configuration and incoming
connection context, to determine the target URI. Appendix of
[Messaging] defines how a server determines the target URI for an
HTTP/1.1 request.
Once the target URI has been reconstructed, an origin server needs to o Transfer-Encoding (Section 6.1 of [Messaging])
decide whether or not to provide service for that URI via the
connection in which the request was received. For example, the
request might have been misdirected, deliberately or accidentally,
such that the information within a received Host header field differs
from the host or port upon which the connection has been made. If
the connection is from a trusted gateway, that inconsistency might be
expected; otherwise, it might indicate an attempt to bypass security
filters, trick the server into delivering non-public content, or
poison a cache. See Section 12 for security considerations regarding
message routing.
| *Note:* previous specifications defined the recomposed target o Upgrade (Section 6.6)
| URI as a distinct concept, the effective request URI.
6.5. Host The Connection header field's value has the following grammar:
The "Host" header field in a request provides the host and port Connection = #connection-option
information from the target URI, enabling the origin server to connection-option = token
distinguish among resources while servicing requests for multiple
host names on a single IP address.
Host = uri-host [ ":" port ] ; Section 2.4 Connection options are case-insensitive.
Since the Host field value is critical information for handling a A sender MUST NOT send a connection option corresponding to a field
request, a user agent SHOULD generate Host as the first field in the that is intended for all recipients of the payload. For example,
header section. Cache-Control is never appropriate as a connection option
(Section 5.2 of [Caching]).
For example, a GET request to the origin server for The connection options do not always correspond to a field present in
<http://www.example.org/pub/WWW/> would begin with: the message, since a connection-specific field might not be needed if
there are no parameters associated with a connection option. In
contrast, a connection-specific field that is received without a
corresponding connection option usually indicates that the field has
been improperly forwarded by an intermediary and ought to be ignored
by the recipient.
GET /pub/WWW/ HTTP/1.1 When defining new connection options, specification authors ought to
Host: www.example.org document it as reserved field name and register that definition in
the Hypertext Transfer Protocol (HTTP) Field Name Registry
(Section 15.3.1), to avoid collisions.
Since the Host header field acts as an application-level routing 6.4.2. Max-Forwards
mechanism, it is a frequent target for malware seeking to poison a
shared cache or redirect a request to an unintended server. An
interception proxy is particularly vulnerable if it relies on the
Host field value for redirecting requests to internal servers, or for
use as a cache key in a shared cache, without first verifying that
the intercepted connection is targeting a valid IP address for that
host.
6.6. Message Forwarding The "Max-Forwards" header field provides a mechanism with the TRACE
(Section 8.3.8) and OPTIONS (Section 8.3.7) request methods to limit
the number of times that the request is forwarded by proxies. This
can be useful when the client is attempting to trace a request that
appears to be failing or looping mid-chain.
As described in Section 2.2, intermediaries can serve a variety of Max-Forwards = 1*DIGIT
roles in the processing of HTTP requests and responses. Some
intermediaries are used to improve performance or availability.
Others are used for access control or to filter content. Since an
HTTP stream has characteristics similar to a pipe-and-filter
architecture, there are no inherent limits to the extent an
intermediary can enhance (or interfere) with either direction of the
stream.
An intermediary not acting as a tunnel MUST implement the Connection The Max-Forwards value is a decimal integer indicating the remaining
header field, as specified in Section 6.8, and exclude fields from number of times this request message can be forwarded.
being forwarded that are only intended for the incoming connection.
An intermediary MUST NOT forward a message to itself unless it is Each intermediary that receives a TRACE or OPTIONS request containing
protected from an infinite request loop. In general, an intermediary a Max-Forwards header field MUST check and update its value prior to
ought to recognize its own server names, including any aliases, local forwarding the request. If the received value is zero (0), the
variations, or literal IP addresses, and respond to such requests intermediary MUST NOT forward the request; instead, the intermediary
directly. MUST respond as the final recipient. If the received Max-Forwards
value is greater than zero, the intermediary MUST generate an updated
Max-Forwards field in the forwarded message with a field value that
is the lesser of a) the received value decremented by one (1) or b)
the recipient's maximum supported value for Max-Forwards.
An HTTP message can be parsed as a stream for incremental processing A recipient MAY ignore a Max-Forwards header field received with any
or forwarding downstream. However, recipients cannot rely on other request methods.
incremental delivery of partial messages, since some implementations
will buffer or delay message forwarding for the sake of network
efficiency, security checks, or payload transformations.
6.6.1. Via 6.4.3. Via
The "Via" header field indicates the presence of intermediate The "Via" header field indicates the presence of intermediate
protocols and recipients between the user agent and the server (on protocols and recipients between the user agent and the server (on
requests) or between the origin server and the client (on responses), requests) or between the origin server and the client (on responses),
similar to the "Received" header field in email (Section 3.6.7 of similar to the "Received" header field in email (Section 3.6.7 of
[RFC5322]). Via can be used for tracking message forwards, avoiding [RFC5322]). Via can be used for tracking message forwards, avoiding
request loops, and identifying the protocol capabilities of senders request loops, and identifying the protocol capabilities of senders
along the request/response chain. along the request/response chain.
Via = #( received-protocol RWS received-by [ RWS comment ] ) Via = #( received-protocol RWS received-by [ RWS comment ] )
received-protocol = [ protocol-name "/" ] protocol-version received-protocol = [ protocol-name "/" ] protocol-version
; see Section 6.7 ; see Section 6.6
received-by = pseudonym [ ":" port ] received-by = pseudonym [ ":" port ]
pseudonym = token pseudonym = token
Each member of the Via field value represents a proxy or gateway that Each member of the Via field value represents a proxy or gateway that
has forwarded the message. Each intermediary appends its own has forwarded the message. Each intermediary appends its own
information about how the message was received, such that the end information about how the message was received, such that the end
result is ordered according to the sequence of forwarding recipients. result is ordered according to the sequence of forwarding recipients.
A proxy MUST send an appropriate Via header field, as described A proxy MUST send an appropriate Via header field, as described
below, in each message that it forwards. An HTTP-to-HTTP gateway below, in each message that it forwards. An HTTP-to-HTTP gateway
MUST send an appropriate Via header field in each inbound request MUST send an appropriate Via header field in each inbound request
message and MAY send a Via header field in forwarded response message and MAY send a Via header field in forwarded response
messages. messages.
For each intermediary, the received-protocol indicates the protocol For each intermediary, the received-protocol indicates the protocol
and protocol version used by the upstream sender of the message. and protocol version used by the upstream sender of the message.
Hence, the Via field value records the advertised protocol Hence, the Via field value records the advertised protocol
capabilities of the request/response chain such that they remain capabilities of the request/response chain such that they remain
visible to downstream recipients; this can be useful for determining visible to downstream recipients; this can be useful for determining
what backwards-incompatible features might be safe to use in what backwards-incompatible features might be safe to use in
response, or within a later request, as described in Section 4.2. response, or within a later request, as described in Section 5.1.
For brevity, the protocol-name is omitted when the received protocol For brevity, the protocol-name is omitted when the received protocol
is HTTP. is HTTP.
The received-by portion is normally the host and optional port number The received-by portion is normally the host and optional port number
of a recipient server or client that subsequently forwarded the of a recipient server or client that subsequently forwarded the
message. However, if the real host is considered to be sensitive message. However, if the real host is considered to be sensitive
information, a sender MAY replace it with a pseudonym. If a port is information, a sender MAY replace it with a pseudonym. If a port is
not provided, a recipient MAY interpret that as meaning it was not provided, a recipient MAY interpret that as meaning it was
received on the default TCP port, if any, for the received-protocol. received on the default TCP port, if any, for the received-protocol.
skipping to change at page 53, line 10 skipping to change at page 53, line 5
could be collapsed to could be collapsed to
Via: 1.0 ricky, 1.1 mertz, 1.0 lucy Via: 1.0 ricky, 1.1 mertz, 1.0 lucy
A sender SHOULD NOT combine multiple list members unless they are all A sender SHOULD NOT combine multiple list members unless they are all
under the same organizational control and the hosts have already been under the same organizational control and the hosts have already been
replaced by pseudonyms. A sender MUST NOT combine members that have replaced by pseudonyms. A sender MUST NOT combine members that have
different received-protocol values. different received-protocol values.
6.6.2. Transformations 6.5. Transformations
Some intermediaries include features for transforming messages and Some intermediaries include features for transforming messages and
their payloads. A proxy might, for example, convert between image their payloads. A proxy might, for example, convert between image
formats in order to save cache space or to reduce the amount of formats in order to save cache space or to reduce the amount of
traffic on a slow link. However, operational problems might occur traffic on a slow link. However, operational problems might occur
when these transformations are applied to payloads intended for when these transformations are applied to payloads intended for
critical applications, such as medical imaging or scientific data critical applications, such as medical imaging or scientific data
analysis, particularly when integrity checks or digital signatures analysis, particularly when integrity checks or digital signatures
are used to ensure that the payload received is identical to the are used to ensure that the payload received is identical to the
original. original.
skipping to change at page 53, line 32 skipping to change at page 53, line 27
An HTTP-to-HTTP proxy is called a "transforming proxy" if it is An HTTP-to-HTTP proxy is called a "transforming proxy" if it is
designed or configured to modify messages in a semantically designed or configured to modify messages in a semantically
meaningful way (i.e., modifications, beyond those required by normal meaningful way (i.e., modifications, beyond those required by normal
HTTP processing, that change the message in a way that would be HTTP processing, that change the message in a way that would be
significant to the original sender or potentially significant to significant to the original sender or potentially significant to
downstream recipients). For example, a transforming proxy might be downstream recipients). For example, a transforming proxy might be
acting as a shared annotation server (modifying responses to include acting as a shared annotation server (modifying responses to include
references to a local annotation database), a malware filter, a references to a local annotation database), a malware filter, a
format transcoder, or a privacy filter. Such transformations are format transcoder, or a privacy filter. Such transformations are
presumed to be desired by whichever client (or client organization) presumed to be desired by whichever client (or client organization)
selected the proxy. chose the proxy.
If a proxy receives a target URI with a host name that is not a fully If a proxy receives a target URI with a host name that is not a fully
qualified domain name, it MAY add its own domain to the host name it qualified domain name, it MAY add its own domain to the host name it
received when forwarding the request. A proxy MUST NOT change the received when forwarding the request. A proxy MUST NOT change the
host name if the target URI contains a fully qualified domain name. host name if the target URI contains a fully qualified domain name.
A proxy MUST NOT modify the "absolute-path" and "query" parts of the A proxy MUST NOT modify the "absolute-path" and "query" parts of the
received target URI when forwarding it to the next inbound server, received target URI when forwarding it to the next inbound server,
except as noted above to replace an empty path with "/" or "*". except as noted above to replace an empty path with "/" or "*".
A proxy MUST NOT transform the payload (Section 7.3) of a message A proxy MUST NOT transform the payload (Section 5.5) of a message
that contains a no-transform cache-control response directive that contains a no-transform cache-control response directive
(Section 5.2 of [Caching]). Note that this does not include changes (Section 5.2 of [Caching]). Note that this does not include changes
to the message body that do not affect the payload, such as transfer to the message body that do not affect the payload, such as transfer
codings (Section 7 of [Messaging]). codings (Section 7 of [Messaging]).
A proxy MAY transform the payload of a message that does not contain A proxy MAY transform the payload of a message that does not contain
a no-transform cache-control directive. A proxy that transforms the a no-transform cache-control directive. A proxy that transforms the
payload of a 200 (OK) response can inform downstream recipients that payload of a 200 (OK) response can inform downstream recipients that
a transformation has been applied by changing the response status a transformation has been applied by changing the response status
code to 203 (Non-Authoritative Information) (Section 10.3.4). code to 203 (Non-Authoritative Information) (Section 14.3.4).
A proxy SHOULD NOT modify header fields that provide information A proxy SHOULD NOT modify header fields that provide information
about the endpoints of the communication chain, the resource state, about the endpoints of the communication chain, the resource state,
or the selected representation (other than the payload) unless the or the selected representation (other than the payload) unless the
field's definition specifically allows such modification or the field's definition specifically allows such modification or the
modification is deemed necessary for privacy or security. modification is deemed necessary for privacy or security.
6.7. Upgrading HTTP 6.6. Upgrade
The "Upgrade" header field is intended to provide a simple mechanism The "Upgrade" header field is intended to provide a simple mechanism
for transitioning from HTTP/1.1 to some other protocol on the same for transitioning from HTTP/1.1 to some other protocol on the same
connection. connection.
A client MAY send a list of protocol names in the Upgrade header A client MAY send a list of protocol names in the Upgrade header
field of a request to invite the server to switch to one or more of field of a request to invite the server to switch to one or more of
the named protocols, in order of descending preference, before the named protocols, in order of descending preference, before
sending the final response. A server MAY ignore a received Upgrade sending the final response. A server MAY ignore a received Upgrade
header field if it wishes to continue using the current protocol on header field if it wishes to continue using the current protocol on
skipping to change at page 56, line 6 skipping to change at page 55, line 43
request: request:
HTTP/1.1 101 Switching Protocols HTTP/1.1 101 Switching Protocols
Connection: upgrade Connection: upgrade
Upgrade: websocket Upgrade: websocket
[... data stream switches to websocket with an appropriate response [... data stream switches to websocket with an appropriate response
(as defined by new protocol) to the "GET /hello" request ...] (as defined by new protocol) to the "GET /hello" request ...]
When Upgrade is sent, the sender MUST also send a Connection header When Upgrade is sent, the sender MUST also send a Connection header
field (Section 6.8) that contains an "upgrade" connection option, in field (Section 6.4.1) that contains an "upgrade" connection option,
order to prevent Upgrade from being accidentally forwarded by in order to prevent Upgrade from being accidentally forwarded by
intermediaries that might not implement the listed protocols. A intermediaries that might not implement the listed protocols. A
server MUST ignore an Upgrade header field that is received in an server MUST ignore an Upgrade header field that is received in an
HTTP/1.0 request. HTTP/1.0 request.
A client cannot begin using an upgraded protocol on the connection A client cannot begin using an upgraded protocol on the connection
until it has completely sent the request message (i.e., the client until it has completely sent the request message (i.e., the client
can't change the protocol it is sending in the middle of a message). can't change the protocol it is sending in the middle of a message).
If a server receives both an Upgrade and an Expect header field with If a server receives both an Upgrade and an Expect header field with
the "100-continue" expectation (Section 9.1.1), the server MUST send the "100-continue" expectation (Section 9.1.1), the server MUST send
a 100 (Continue) response before sending a 101 (Switching Protocols) a 100 (Continue) response before sending a 101 (Switching Protocols)
response. response.
The Upgrade header field only applies to switching protocols on top The Upgrade header field only applies to switching protocols on top
of the existing connection; it cannot be used to switch the of the existing connection; it cannot be used to switch the
underlying connection (transport) protocol, nor to switch the underlying connection (transport) protocol, nor to switch the
existing communication to a different connection. For those existing communication to a different connection. For those
purposes, it is more appropriate to use a 3xx (Redirection) response purposes, it is more appropriate to use a 3xx (Redirection) response
skipping to change at page 56, line 25 skipping to change at page 56, line 15
If a server receives both an Upgrade and an Expect header field with If a server receives both an Upgrade and an Expect header field with
the "100-continue" expectation (Section 9.1.1), the server MUST send the "100-continue" expectation (Section 9.1.1), the server MUST send
a 100 (Continue) response before sending a 101 (Switching Protocols) a 100 (Continue) response before sending a 101 (Switching Protocols)
response. response.
The Upgrade header field only applies to switching protocols on top The Upgrade header field only applies to switching protocols on top
of the existing connection; it cannot be used to switch the of the existing connection; it cannot be used to switch the
underlying connection (transport) protocol, nor to switch the underlying connection (transport) protocol, nor to switch the
existing communication to a different connection. For those existing communication to a different connection. For those
purposes, it is more appropriate to use a 3xx (Redirection) response purposes, it is more appropriate to use a 3xx (Redirection) response
(Section 10.4). (Section 14.4).
6.7.1. Upgrade Protocol Names
This specification only defines the protocol name "HTTP" for use by This specification only defines the protocol name "HTTP" for use by
the family of Hypertext Transfer Protocols, as defined by the HTTP the family of Hypertext Transfer Protocols, as defined by the HTTP
version rules of Section 4.2 and future updates to this version rules of Section 5.1 and future updates to this
specification. Additional protocol names ought to be registered specification. Additional protocol names ought to be registered
using the registration procedure defined in Section 6.7.2. using the registration procedure defined in Section 15.7.
------ ------------------- ------------------------- ------
Name Description Expected Version Tokens Ref.
------ ------------------- ------------------------- ------
HTTP Hypertext any DIGIT.DIGIT (e.g, 4.2
Transfer Protocol "2.0")
------ ------------------- ------------------------- ------
Table 5
6.7.2. Upgrade Token Registry
The "Hypertext Transfer Protocol (HTTP) Upgrade Token Registry"
defines the namespace for protocol-name tokens used to identify
protocols in the Upgrade header field. The registry is maintained at
<https://www.iana.org/assignments/http-upgrade-tokens>.
Each registered protocol name is associated with contact information
and an optional set of specifications that details how the connection
will be processed after it has been upgraded.
Registrations happen on a "First Come First Served" basis (see
Section 4.4 of [RFC8126]) and are subject to the following rules:
1. A protocol-name token, once registered, stays registered forever.
2. A protocol-name token is case-insensitive and registered with the
preferred case to be generated by senders.
3. The registration MUST name a responsible party for the
registration.
4. The registration MUST name a point of contact.
5. The registration MAY name a set of specifications associated with
that token. Such specifications need not be publicly available.
6. The registration SHOULD name a set of expected "protocol-version"
tokens associated with that token at the time of registration.
7. The responsible party MAY change the registration at any time.
The IANA will keep a record of all such changes, and make them
available upon request.
8. The IESG MAY reassign responsibility for a protocol token. This
will normally only be used in the case when a responsible party
cannot be contacted.
6.8. Connection-Specific Fields
The "Connection" header field allows the sender to list desired
control options for the current connection.
When a field aside from Connection is used to supply control
information for or about the current connection, the sender MUST list
the corresponding field name within the Connection header field.
Note that some versions of HTTP prohibit the use of fields for such
information, and therefore do not allow the Connection field.
Intermediaries MUST parse a received Connection header field before a
message is forwarded and, for each connection-option in this field,
remove any header or trailer field(s) from the message with the same
name as the connection-option, and then remove the Connection header
field itself (or replace it with the intermediary's own connection
options for the forwarded message).
Hence, the Connection header field provides a declarative way of
distinguishing fields that are only intended for the immediate
recipient ("hop-by-hop") from those fields that are intended for all
recipients on the chain ("end-to-end"), enabling the message to be
self-descriptive and allowing future connection-specific extensions
to be deployed without fear that they will be blindly forwarded by
older intermediaries.
Furthermore, intermediaries SHOULD remove or replace field(s) whose
semantics are known to require removal before forwarding, whether or
not they appear as a Connection option, after applying those fields'
semantics. This includes but is not limited to:
o Proxy-Connection (Appendix C.1.2 of [Messaging])
o Keep-Alive (Section 19.7.1 of [RFC2068])
o TE (Section 5.6.5)
o Trailer (Section 5.6.4)
o Transfer-Encoding (Section 6.1 of [Messaging])
o Upgrade (Section 6.7)
The Connection header field's value has the following grammar:
Connection = #connection-option
connection-option = token
Connection options are case-insensitive.
A sender MUST NOT send a connection option corresponding to a field
that is intended for all recipients of the payload. For example,
Cache-Control is never appropriate as a connection option
(Section 5.2 of [Caching]).
The connection options do not always correspond to a field present in 7. Representations
the message, since a connection-specific field might not be needed if
there are no parameters associated with a connection option. In
contrast, a connection-specific field that is received without a
corresponding connection option usually indicates that the field has
been improperly forwarded by an intermediary and ought to be ignored
by the recipient.
When defining new connection options, specification authors ought to A "representation" is information that is intended to reflect a past,
document it as reserved field name and register that definition in current, or desired state of a given resource, in a format that can
the Hypertext Transfer Protocol (HTTP) Field Name Registry be readily communicated via the protocol. A representation consists
(Section 5.3.2), to avoid collisions. of a set of representation metadata and a potentially unbounded
stream of representation data.
7. Representations HTTP allows "information hiding" behind its uniform interface by
phrasing communication with respect to a transferable representation
of the resource state, rather than transferring the resource itself.
This allows the resource identified by a URI to be anything,
including temporal functions like "the current weather in Laguna
Beach", while potentially providing information that represents that
resource at the time a message is generated [REST].
Considering that a resource could be anything, and that the uniform The uniform interface is similar to a window through which one can
interface provided by HTTP is similar to a window through which one observe and act upon a thing only through the communication of
can observe and act upon such a thing only through the communication messages to an independent actor on the other side. A shared
of messages to some independent actor on the other side, an
abstraction is needed to represent ("take the place of") the current abstraction is needed to represent ("take the place of") the current
or desired state of that thing in our communications. That or desired state of that thing in our communications. When a
abstraction is called a representation [REST]. representation is hypertext, it can provide both a representation of
the resource state and processing instructions that help guide the
recipient's future interactions.
For the purposes of HTTP, a "representation" is information that is 7.1. Selected Representation
intended to reflect a past, current, or desired state of a given
resource, in a format that can be readily communicated via the
protocol, and that consists of a set of representation metadata and a
potentially unbounded stream of representation data.
An origin server might be provided with, or be capable of generating, An origin server might be provided with, or be capable of generating,
multiple representations that are each intended to reflect the multiple representations that are each intended to reflect the
current state of a target resource. In such cases, some algorithm is current state of a target resource. In such cases, some algorithm is
used by the origin server to select one of those representations as used by the origin server to select one of those representations as
most applicable to a given request, usually based on content most applicable to a given request, usually based on content
negotiation. This "selected representation" is used to provide the negotiation. This "selected representation" is used to provide the
data and metadata for evaluating conditional requests (Section 9.2) data and metadata for evaluating conditional requests (Section 12.1)
and constructing the payload for 200 (OK), 206 (Partial Content), and and constructing the payload for 200 (OK), 206 (Partial Content), and
304 (Not Modified) responses to GET (Section 8.3.1). 304 (Not Modified) responses to GET (Section 8.3.1).
7.1. Representation Data 7.2. Data
The representation data associated with an HTTP message is either The representation data associated with an HTTP message is either
provided as the payload body of the message or referred to by the provided as the payload body of the message or referred to by the
message semantics and the target URI. The representation data is in message semantics and the target URI. The representation data is in
a format and encoding defined by the representation metadata header a format and encoding defined by the representation metadata header
fields. fields.
The data type of the representation data is determined via the header The data type of the representation data is determined via the header
fields Content-Type and Content-Encoding. These define a two-layer, fields Content-Type and Content-Encoding. These define a two-layer,
ordered encoding model: ordered encoding model:
representation-data := Content-Encoding( Content-Type( bits ) ) representation-data := Content-Encoding( Content-Type( bits ) )
7.1.1. Media Type 7.3. Metadata
HTTP uses media types [RFC2046] in the Content-Type (Section 7.2.1) Representation header fields provide metadata about the
and Accept (Section 9.4.1) header fields in order to provide open and representation. When a message includes a payload body, the
representation header fields describe how to interpret the
representation data enclosed in the payload body. In a response to a
HEAD request, the representation header fields describe the
representation data that would have been enclosed in the payload body
if the same request had been a GET.
The following header fields convey representation metadata:
------------------ ------
Field Name Ref.
------------------ ------
Content-Type 7.4
Content-Encoding 7.5
Content-Language 7.6
Content-Length 7.7
Content-Location 7.8
------------------ ------
Table 3
7.4. Content-Type
The "Content-Type" header field indicates the media type of the
associated representation: either the representation enclosed in the
message payload or the selected representation, as determined by the
message semantics. The indicated media type defines both the data
format and how that data is intended to be processed by a recipient,
within the scope of the received message semantics, after any content
codings indicated by Content-Encoding are decoded.
Content-Type = media-type
Media types are defined in Section 7.4.1. An example of the field is
Content-Type: text/html; charset=ISO-8859-4
A sender that generates a message containing a payload body SHOULD
generate a Content-Type header field in that message unless the
intended media type of the enclosed representation is unknown to the
sender. If a Content-Type header field is not present, the recipient
MAY either assume a media type of "application/octet-stream"
([RFC2046], Section 4.5.1) or examine the data to determine its type.
In practice, resource owners do not always properly configure their
origin server to provide the correct Content-Type for a given
representation. Some user agents examine a payload's content and, in
certain cases, override the received type (for example, see
[Sniffing]). This "MIME sniffing" risks drawing incorrect
conclusions about the data, which might expose the user to additional
security risks (e.g., "privilege escalation"). Furthermore, it is
impossible to determine the sender's intended processing model by
examining the data format: many data formats match multiple media
types that differ only in processing semantics. Implementers are
encouraged to provide a means to disable such sniffing.
Furthermore, although Content-Type is defined as a singleton field,
it is sometimes incorrectly generated multiple times, resulting in a
combined field value that appears to be a list. Recipients often
attempt to handle this error by using the last syntactically valid
member of the list, but note that some implementations might have
different error handling behaviors, leading to interoperability and/
or security issues.
7.4.1. Media Type
HTTP uses media types [RFC2046] in the Content-Type (Section 7.4) and
Accept (Section 11.1.2) header fields in order to provide open and
extensible data typing and type negotiation. Media types define both extensible data typing and type negotiation. Media types define both
a data format and various processing models: how to process that data a data format and various processing models: how to process that data
in accordance with each context in which it is received. in accordance with each context in which it is received.
media-type = type "/" subtype parameters media-type = type "/" subtype parameters
type = token type = token
subtype = token subtype = token
The type and subtype tokens are case-insensitive. The type and subtype tokens are case-insensitive.
The type/subtype MAY be followed by semicolon-delimited parameters The type/subtype MAY be followed by semicolon-delimited parameters
(Section 5.4.1.4) in the form of name=value pairs. The presence or (Section 5.7.6) in the form of name=value pairs. The presence or
absence of a parameter might be significant to the processing of a absence of a parameter might be significant to the processing of a
media type, depending on its definition within the media type media type, depending on its definition within the media type
registry. Parameter values might or might not be case-sensitive, registry. Parameter values might or might not be case-sensitive,
depending on the semantics of the parameter name. depending on the semantics of the parameter name.
For example, the following media types are equivalent in describing For example, the following media types are equivalent in describing
HTML text data encoded in the UTF-8 character encoding scheme, but HTML text data encoded in the UTF-8 character encoding scheme, but
the first is preferred for consistency (the "charset" parameter value the first is preferred for consistency (the "charset" parameter value
is defined as being case-insensitive in [RFC2046], Section 4.1.2): is defined as being case-insensitive in [RFC2046], Section 4.1.2):
text/html;charset=utf-8 text/html;charset=utf-8
Text/HTML;Charset="utf-8" Text/HTML;Charset="utf-8"
text/html; charset="utf-8" text/html; charset="utf-8"
text/html;charset=UTF-8 text/html;charset=UTF-8
Media types ought to be registered with IANA according to the Media types ought to be registered with IANA according to the
procedures defined in [BCP13]. procedures defined in [BCP13].
7.1.1.1. Charset 7.4.2. Charset
HTTP uses charset names to indicate or negotiate the character HTTP uses charset names to indicate or negotiate the character
encoding scheme of a textual representation [RFC6365]. A charset is encoding scheme of a textual representation [RFC6365]. A charset is
identified by a case-insensitive token. identified by a case-insensitive token.
charset = token charset = token
Charset names ought to be registered in the IANA "Character Sets" Charset names ought to be registered in the IANA "Character Sets"
registry (<https://www.iana.org/assignments/character-sets>) registry (<https://www.iana.org/assignments/character-sets>)
according to the procedures defined in Section 2 of [RFC2978]. according to the procedures defined in Section 2 of [RFC2978].
| *Note:* In theory, charset names are defined by the "mime- | *Note:* In theory, charset names are defined by the "mime-
| charset" ABNF rule defined in Section 2.3 of [RFC2978] (as | charset" ABNF rule defined in Section 2.3 of [RFC2978] (as
| corrected in [Err1912]). That rule allows two characters that | corrected in [Err1912]). That rule allows two characters that
| are not included in "token" ("{" and "}"), but no charset name | are not included in "token" ("{" and "}"), but no charset name
| registered at the time of this writing includes braces (see | registered at the time of this writing includes braces (see
| [Err5433]). | [Err5433]).
7.1.1.2. Canonicalization and Text Defaults 7.4.3. Canonicalization and Text Defaults
Media types are registered with a canonical form in order to be Media types are registered with a canonical form in order to be
interoperable among systems with varying native encoding formats. interoperable among systems with varying native encoding formats.
Representations selected or transferred via HTTP ought to be in Representations selected or transferred via HTTP ought to be in
canonical form, for many of the same reasons described by the canonical form, for many of the same reasons described by the
Multipurpose Internet Mail Extensions (MIME) [RFC2045]. However, the Multipurpose Internet Mail Extensions (MIME) [RFC2045]. However, the
performance characteristics of email deployments (i.e., store and performance characteristics of email deployments (i.e., store and
forward messages to peers) are significantly different from those forward messages to peers) are significantly different from those
common to HTTP and the Web (server-based information services). common to HTTP and the Web (server-based information services).
Furthermore, MIME's constraints for the sake of compatibility with Furthermore, MIME's constraints for the sake of compatibility with
skipping to change at page 61, line 42 skipping to change at page 61, line 5
addition, text media in HTTP is not limited to charsets that use addition, text media in HTTP is not limited to charsets that use
octets 13 and 10 for CR and LF, respectively. This flexibility octets 13 and 10 for CR and LF, respectively. This flexibility
regarding line breaks applies only to text within a representation regarding line breaks applies only to text within a representation
that has been assigned a "text" media type; it does not apply to that has been assigned a "text" media type; it does not apply to
"multipart" types or HTTP elements outside the payload body (e.g., "multipart" types or HTTP elements outside the payload body (e.g.,
header fields). header fields).
If a representation is encoded with a content-coding, the underlying If a representation is encoded with a content-coding, the underlying
data ought to be in a form defined above prior to being encoded. data ought to be in a form defined above prior to being encoded.
7.1.1.3. Multipart Types 7.4.4. Multipart Types
MIME provides for a number of "multipart" types - encapsulations of MIME provides for a number of "multipart" types - encapsulations of
one or more representations within a single message body. All one or more representations within a single message body. All
multipart types share a common syntax, as defined in Section 5.1.1 of multipart types share a common syntax, as defined in Section 5.1.1 of
[RFC2046], and include a boundary parameter as part of the media type [RFC2046], and include a boundary parameter as part of the media type
value. The message body is itself a protocol element; a sender MUST value. The message body is itself a protocol element; a sender MUST
generate only CRLF to represent line breaks between body parts. generate only CRLF to represent line breaks between body parts.
HTTP message framing does not use the multipart boundary as an HTTP message framing does not use the multipart boundary as an
indicator of message body length, though it might be used by indicator of message body length, though it might be used by
implementations that generate or process the payload. For example, implementations that generate or process the payload. For example,
the "multipart/form-data" type is often used for carrying form data the "multipart/form-data" type is often used for carrying form data
in a request, as described in [RFC7578], and the "multipart/ in a request, as described in [RFC7578], and the "multipart/
byteranges" type is defined by this specification for use in some 206 byteranges" type is defined by this specification for use in some 206
(Partial Content) responses (see Section 10.3.7). (Partial Content) responses (see Section 14.3.7).
7.1.2. Content Codings
Content coding values indicate an encoding transformation that has
been or can be applied to a representation. Content codings are
primarily used to allow a representation to be compressed or
otherwise usefully transformed without losing the identity of its
underlying media type and without loss of information. Frequently,
the representation is stored in coded form, transmitted directly, and
only decoded by the final recipient.
content-coding = token
All content codings are case-insensitive and ought to be registered
within the "HTTP Content Coding Registry", as defined in
Section 7.1.2.4
Content-coding values are used in the Accept-Encoding (Section 9.4.3)
and Content-Encoding (Section 7.2.2) header fields.
The following content-coding values are defined by this
specification:
------------ ------------------------------------------- ---------
Name Description Ref.
------------ ------------------------------------------- ---------
compress UNIX "compress" data format [Welch] 7.1.2.1
deflate "deflate" compressed data ([RFC1951]) 7.1.2.2
inside the "zlib" data format ([RFC1950])
gzip GZIP file format [RFC1952] 7.1.2.3
identity Reserved 9.4.3
x-compress Deprecated (alias for compress) 7.1.2.1
x-gzip Deprecated (alias for gzip) 7.1.2.3
------------ ------------------------------------------- ---------
Table 6
7.1.2.1. Compress Coding
The "compress" coding is an adaptive Lempel-Ziv-Welch (LZW) coding
[Welch] that is commonly produced by the UNIX file compression
program "compress". A recipient SHOULD consider "x-compress" to be
equivalent to "compress".
7.1.2.2. Deflate Coding
The "deflate" coding is a "zlib" data format [RFC1950] containing a
"deflate" compressed data stream [RFC1951] that uses a combination of
the Lempel-Ziv (LZ77) compression algorithm and Huffman coding.
| *Note:* Some non-conformant implementations send the "deflate"
| compressed data without the zlib wrapper.
7.1.2.3. Gzip Coding
The "gzip" coding is an LZ77 coding with a 32-bit Cyclic Redundancy
Check (CRC) that is commonly produced by the gzip file compression
program [RFC1952]. A recipient SHOULD consider "x-gzip" to be
equivalent to "gzip".
7.1.2.4. Content Coding Registry
The "HTTP Content Coding Registry", maintained by IANA at
<https://www.iana.org/assignments/http-parameters/>, registers
content-coding names.
Content coding registrations MUST include the following fields:
o Name
o Description
o Pointer to specification text
Names of content codings MUST NOT overlap with names of transfer
codings (Section 7 of [Messaging]), unless the encoding
transformation is identical (as is the case for the compression
codings defined in Section 7.1.2).
Values to be added to this namespace require IETF Review (see
Section 4.8 of [RFC8126]) and MUST conform to the purpose of content
coding defined in Section 7.1.2.
New content codings ought to be self-descriptive whenever possible,
with optional parameters discoverable within the coding format
itself, rather than rely on external metadata that might be lost
during transit.
7.1.3. Language Tags
A language tag, as defined in [RFC5646], identifies a natural
language spoken, written, or otherwise conveyed by human beings for
communication of information to other human beings. Computer
languages are explicitly excluded.
HTTP uses language tags within the Accept-Language and
Content-Language header fields. Accept-Language uses the broader
language-range production defined in Section 9.4.4, whereas
Content-Language uses the language-tag production defined below.
language-tag = <Language-Tag, see [RFC5646], Section 2.1>
A language tag is a sequence of one or more case-insensitive subtags,
each separated by a hyphen character ("-", %x2D). In most cases, a
language tag consists of a primary language subtag that identifies a
broad family of related languages (e.g., "en" = English), which is
optionally followed by a series of subtags that refine or narrow that
language's range (e.g., "en-CA" = the variety of English as
communicated in Canada). Whitespace is not allowed within a language
tag. Example tags include:
fr, en-US, es-419, az-Arab, x-pig-latin, man-Nkoo-GN
See [RFC5646] for further information.
7.1.4. Range Units
Representation data can be partitioned into subranges when there are
addressable structural units inherent to that data's content coding
or media type. For example, octet (a.k.a., byte) boundaries are a
structural unit common to all representation data, allowing
partitions of the data to be identified as a range of bytes at some
offset from the start or end of that data.
This general notion of a "range unit" is used in the Accept-Ranges
(Section 11.4.1) response header field to advertise support for range
requests, the Range (Section 9.3) request header field to delineate
the parts of a representation that are requested, and the
Content-Range (Section 7.3.4) payload header field to describe which
part of a representation is being transferred.
range-unit = token
All range unit names are case-insensitive and ought to be registered
within the "HTTP Range Unit Registry", as defined in Section 7.1.4.4
The following range unit names are defined by this document:
----------------- ---------------------------------- ---------
Range Unit Name Description Ref.
----------------- ---------------------------------- ---------
bytes a range of octets 7.1.4.2
none reserved as keyword to indicate 11.4.1
range requests are not supported
----------------- ---------------------------------- ---------
Table 7
7.1.4.1. Range Specifiers
Ranges are expressed in terms of a range unit paired with a set of
range specifiers. The range unit name determines what kinds of
range-spec are applicable to its own specifiers. Hence, the
following gramar is generic: each range unit is expected to specify
requirements on when int-range, suffix-range, and other-range are
allowed.
A range request can specify a single range or a set of ranges within
a single representation.
ranges-specifier = range-unit "=" range-set
range-set = 1#range-spec
range-spec = int-range
/ suffix-range
/ other-range
An int-range is a range expressed as two non-negative integers or as
one non-negative integer through to the end of the representation
data. The range unit specifies what the integers mean (e.g., they
might indicate unit offsets from the beginning, inclusive numbered
parts, etc.).
int-range = first-pos "-" [ last-pos ]
first-pos = 1*DIGIT
last-pos = 1*DIGIT
An int-range is invalid if the last-pos value is present and less
than the first-pos.
A suffix-range is a range expressed as a suffix of the representation
data with the provided non-negative integer maximum length (in range
units). In other words, the last N units of the representation data.
suffix-range = "-" suffix-length
suffix-length = 1*DIGIT
To provide for extensibility, the other-range rule is a mostly
unconstrained grammar that allows application-specific or future
range units to define additional range specifiers.
other-range = 1*( %x21-2B / %x2D-7E )
; 1*(VCHAR excluding comma)
7.1.4.2. Byte Ranges
The "bytes" range unit is used to express subranges of a
representation data's octet sequence. Each byte range is expressed
as an integer range at some offset, relative to either the beginning
(int-range) or end (suffix-range) of the representation data. Byte
ranges do not use the other-range specifier.
The first-pos value in a bytes int-range gives the offset of the
first byte in a range. The last-pos value gives the offset of the
last byte in the range; that is, the byte positions specified are
inclusive. Byte offsets start at zero.
If the representation data has a content coding applied, each byte
range is calculated with respect to the encoded sequence of bytes,
not the sequence of underlying bytes that would be obtained after
decoding.
Examples of bytes range specifiers:
o The first 500 bytes (byte offsets 0-499, inclusive):
bytes=0-499
o The second 500 bytes (byte offsets 500-999, inclusive):
bytes=500-999
A client can limit the number of bytes requested without knowing the
size of the selected representation. If the last-pos value is
absent, or if the value is greater than or equal to the current
length of the representation data, the byte range is interpreted as
the remainder of the representation (i.e., the server replaces the
value of last-pos with a value that is one less than the current
length of the selected representation).
A client can request the last N bytes (N > 0) of the selected
representation using a suffix-range. If the selected representation
is shorter than the specified suffix-length, the entire
representation is used.
Additional examples, assuming a representation of length 10000:
o The final 500 bytes (byte offsets 9500-9999, inclusive):
bytes=-500
Or:
bytes=9500-
o The first and last bytes only (bytes 0 and 9999):
bytes=0-0,-1
o The first, middle, and last 1000 bytes:
bytes= 0-999, 4500-5499, -1000
o Other valid (but not canonical) specifications of the second 500
bytes (byte offsets 500-999, inclusive):
bytes=500-600,601-999
bytes=500-700,601-999
If a valid bytes range-set includes at least one range-spec with a
first-pos that is less than the current length of the representation,
or at least one suffix-range with a non-zero suffix-length, then the
bytes range-set is satisfiable. Otherwise, the bytes range-set is
unsatisfiable.
If the selected representation has zero length, the only satisfiable
form of range-spec is a suffix-range with a non-zero suffix-length.
In the byte-range syntax, first-pos, last-pos, and suffix-length are
expressed as decimal number of octets. Since there is no predefined
limit to the length of a payload, recipients MUST anticipate
potentially large decimal numerals and prevent parsing errors due to
integer conversion overflows.
7.1.4.3. Other Range Units
Other range units, such as format-specific boundaries like pages,
sections, records, rows, or time, are potentially usable in HTTP for
application-specific purposes, but are not commonly used in practice.
Implementors of alternative range units ought to consider how they
would work with content codings and general-purpose intermediaries.
Range units are intended to be extensible. New range units ought to
be registered with IANA, as defined in Section 7.1.4.4.
7.1.4.4. Range Unit Registry
The "HTTP Range Unit Registry" defines the namespace for the range
unit names and refers to their corresponding specifications. It is
maintained at <https://www.iana.org/assignments/http-parameters>.
Registration of an HTTP Range Unit MUST include the following fields:
o Name
o Description
o Pointer to specification text
Values to be added to this namespace require IETF Review (see
[RFC8126], Section 4.8).
7.2. Representation Metadata
Representation header fields provide metadata about the
representation. When a message includes a payload body, the
representation header fields describe how to interpret the
representation data enclosed in the payload body. In a response to a
HEAD request, the representation header fields describe the
representation data that would have been enclosed in the payload body
if the same request had been a GET.
The following header fields convey representation metadata:
------------------ -------
Field Name Ref.
------------------ -------
Content-Type 7.2.1
Content-Encoding 7.2.2
Content-Language 7.2.3
Content-Length 7.2.4
Content-Location 7.2.5
------------------ -------
Table 8
7.2.1. Content-Type
The "Content-Type" header field indicates the media type of the
associated representation: either the representation enclosed in the
message payload or the selected representation, as determined by the
message semantics. The indicated media type defines both the data
format and how that data is intended to be processed by a recipient,
within the scope of the received message semantics, after any content
codings indicated by Content-Encoding are decoded.
Content-Type = media-type
Media types are defined in Section 7.1.1. An example of the field is
Content-Type: text/html; charset=ISO-8859-4
A sender that generates a message containing a payload body SHOULD
generate a Content-Type header field in that message unless the
intended media type of the enclosed representation is unknown to the
sender. If a Content-Type header field is not present, the recipient
MAY either assume a media type of "application/octet-stream"
([RFC2046], Section 4.5.1) or examine the data to determine its type.
In practice, resource owners do not always properly configure their
origin server to provide the correct Content-Type for a given
representation. Some user agents examine a payload's content and, in
certain cases, override the received type (for example, see
[Sniffing]). This "MIME sniffing" risks drawing incorrect
conclusions about the data, which might expose the user to additional
security risks (e.g., "privilege escalation"). Furthermore, it is
impossible to determine the sender's intended processing model by
examining the data format: many data formats match multiple media
types that differ only in processing semantics. Implementers are
encouraged to provide a means to disable such sniffing.
Furthermore, although Content-Type is defined as a singleton field,
it is sometimes incorrectly generated multiple times, resulting in a
combined field value that appears to be a list. Recipients often
attempt to handle this error by using the last syntactically valid
member of the list, but note that some implementations might have
different error handling behaviors, leading to interoperability and/
or security issues.
7.2.2. Content-Encoding 7.5. Content-Encoding
The "Content-Encoding" header field indicates what content codings The "Content-Encoding" header field indicates what content codings
have been applied to the representation, beyond those inherent in the have been applied to the representation, beyond those inherent in the
media type, and thus what decoding mechanisms have to be applied in media type, and thus what decoding mechanisms have to be applied in
order to obtain data in the media type referenced by the Content-Type order to obtain data in the media type referenced by the Content-Type
header field. Content-Encoding is primarily used to allow a header field. Content-Encoding is primarily used to allow a
representation's data to be compressed without losing the identity of representation's data to be compressed without losing the identity of
its underlying media type. its underlying media type.
Content-Encoding = #content-coding Content-Encoding = #content-coding
skipping to change at page 71, line 14 skipping to change at page 62, line 29
choose to publish the same data as multiple representations that choose to publish the same data as multiple representations that
differ only in whether the coding is defined as part of Content-Type differ only in whether the coding is defined as part of Content-Type
or Content-Encoding, since some user agents will behave differently or Content-Encoding, since some user agents will behave differently
in their handling of each response (e.g., open a "Save as ..." dialog in their handling of each response (e.g., open a "Save as ..." dialog
instead of automatic decompression and rendering of content). instead of automatic decompression and rendering of content).
An origin server MAY respond with a status code of 415 (Unsupported An origin server MAY respond with a status code of 415 (Unsupported
Media Type) if a representation in the request message has a content Media Type) if a representation in the request message has a content
coding that is not acceptable. coding that is not acceptable.
7.2.3. Content-Language 7.5.1. Content Codings
Content coding values indicate an encoding transformation that has
been or can be applied to a representation. Content codings are
primarily used to allow a representation to be compressed or
otherwise usefully transformed without losing the identity of its
underlying media type and without loss of information. Frequently,
the representation is stored in coded form, transmitted directly, and
only decoded by the final recipient.
content-coding = token
All content codings are case-insensitive and ought to be registered
within the "HTTP Content Coding Registry", as described in
Section 15.6
Content-coding values are used in the Accept-Encoding
(Section 11.1.4) and Content-Encoding (Section 7.5) header fields.
The following content-coding values are defined by this
specification:
------------ ------------------------------------------- ---------
Name Description Ref.
------------ ------------------------------------------- ---------
compress UNIX "compress" data format [Welch] 7.5.1.1
deflate "deflate" compressed data ([RFC1951]) 7.5.1.2
inside the "zlib" data format ([RFC1950])
gzip GZIP file format [RFC1952] 7.5.1.3
identity Reserved 11.1.4
x-compress Deprecated (alias for compress) 7.5.1.1
x-gzip Deprecated (alias for gzip) 7.5.1.3
------------ ------------------------------------------- ---------
Table 4
7.5.1.1. Compress Coding
The "compress" coding is an adaptive Lempel-Ziv-Welch (LZW) coding
[Welch] that is commonly produced by the UNIX file compression
program "compress". A recipient SHOULD consider "x-compress" to be
equivalent to "compress".
7.5.1.2. Deflate Coding
The "deflate" coding is a "zlib" data format [RFC1950] containing a
"deflate" compressed data stream [RFC1951] that uses a combination of
the Lempel-Ziv (LZ77) compression algorithm and Huffman coding.
| *Note:* Some non-conformant implementations send the "deflate"
| compressed data without the zlib wrapper.
7.5.1.3. Gzip Coding
The "gzip" coding is an LZ77 coding with a 32-bit Cyclic Redundancy
Check (CRC) that is commonly produced by the gzip file compression
program [RFC1952]. A recipient SHOULD consider "x-gzip" to be
equivalent to "gzip".
7.6. Content-Language
The "Content-Language" header field describes the natural language(s) The "Content-Language" header field describes the natural language(s)
of the intended audience for the representation. Note that this of the intended audience for the representation. Note that this
might not be equivalent to all the languages used within the might not be equivalent to all the languages used within the
representation. representation.
Content-Language = #language-tag Content-Language = #language-tag
Language tags are defined in Section 7.1.3. The primary purpose of Language tags are defined in Section 7.6.1. The primary purpose of
Content-Language is to allow a user to identify and differentiate Content-Language is to allow a user to identify and differentiate
representations according to the users' own preferred language. representations according to the users' own preferred language.
Thus, if the content is intended only for a Danish-literate audience, Thus, if the content is intended only for a Danish-literate audience,
the appropriate field is the appropriate field is
Content-Language: da Content-Language: da
If no Content-Language is specified, the default is that the content If no Content-Language is specified, the default is that the content
is intended for all language audiences. This might mean that the is intended for all language audiences. This might mean that the
sender does not consider it to be specific to any natural language, sender does not consider it to be specific to any natural language,
skipping to change at page 72, line 5 skipping to change at page 64, line 35
However, just because multiple languages are present within a However, just because multiple languages are present within a
representation does not mean that it is intended for multiple representation does not mean that it is intended for multiple
linguistic audiences. An example would be a beginner's language linguistic audiences. An example would be a beginner's language
primer, such as "A First Lesson in Latin", which is clearly intended primer, such as "A First Lesson in Latin", which is clearly intended
to be used by an English-literate audience. In this case, the to be used by an English-literate audience. In this case, the
Content-Language would properly only include "en". Content-Language would properly only include "en".
Content-Language MAY be applied to any media type - it is not limited Content-Language MAY be applied to any media type - it is not limited
to textual documents. to textual documents.
7.2.4. Content-Length 7.6.1. Language Tags
A language tag, as defined in [RFC5646], identifies a natural
language spoken, written, or otherwise conveyed by human beings for
communication of information to other human beings. Computer
languages are explicitly excluded.
HTTP uses language tags within the Accept-Language and
Content-Language header fields. Accept-Language uses the broader
language-range production defined in Section 11.1.5, whereas
Content-Language uses the language-tag production defined below.
language-tag = <Language-Tag, see [RFC5646], Section 2.1>
A language tag is a sequence of one or more case-insensitive subtags,
each separated by a hyphen character ("-", %x2D). In most cases, a
language tag consists of a primary language subtag that identifies a
broad family of related languages (e.g., "en" = English), which is
optionally followed by a series of subtags that refine or narrow that
language's range (e.g., "en-CA" = the variety of English as
communicated in Canada). Whitespace is not allowed within a language
tag. Example tags include:
fr, en-US, es-419, az-Arab, x-pig-latin, man-Nkoo-GN
See [RFC5646] for further information.
7.7. Content-Length
The "Content-Length" header field indicates the associated The "Content-Length" header field indicates the associated
representation's data length as a decimal non-negative integer number representation's data length as a decimal non-negative integer number
of octets. When transferring a representation in a message, Content- of octets. When transferring a representation in a message, Content-
Length refers specifically to the amount of data enclosed so that it Length refers specifically to the amount of data enclosed so that it
can be used to delimit framing of the message body (e.g., Section 6.2 can be used to delimit framing of the message body (e.g., Section 6.2
of [Messaging]). In other cases, Content-Length indicates the of [Messaging]). In other cases, Content-Length indicates the
selected representation's current length, which can be used by selected representation's current length, which can be used by
recipients to estimate transfer time or compare to previously stored recipients to estimate transfer time or compare to previously stored
representations. representations.
skipping to change at page 72, line 42 skipping to change at page 66, line 6
a payload body and the method semantics do not anticipate such a a payload body and the method semantics do not anticipate such a
body. body.
A server MAY send a Content-Length header field in a response to a A server MAY send a Content-Length header field in a response to a
HEAD request (Section 8.3.2); a server MUST NOT send Content-Length HEAD request (Section 8.3.2); a server MUST NOT send Content-Length
in such a response unless its field value equals the decimal number in such a response unless its field value equals the decimal number
of octets that would have been sent in the payload body of a response of octets that would have been sent in the payload body of a response
if the same request had used the GET method. if the same request had used the GET method.
A server MAY send a Content-Length header field in a 304 (Not A server MAY send a Content-Length header field in a 304 (Not
Modified) response to a conditional GET request (Section 10.4.5); a Modified) response to a conditional GET request (Section 14.4.5); a
server MUST NOT send Content-Length in such a response unless its server MUST NOT send Content-Length in such a response unless its
field value equals the decimal number of octets that would have been field value equals the decimal number of octets that would have been
sent in the payload body of a 200 (OK) response to the same request. sent in the payload body of a 200 (OK) response to the same request.
A server MUST NOT send a Content-Length header field in any response A server MUST NOT send a Content-Length header field in any response
with a status code of 1xx (Informational) or 204 (No Content). A with a status code of 1xx (Informational) or 204 (No Content). A
server MUST NOT send a Content-Length header field in any 2xx server MUST NOT send a Content-Length header field in any 2xx
(Successful) response to a CONNECT request (Section 8.3.6). (Successful) response to a CONNECT request (Section 8.3.6).
Aside from the cases defined above, in the absence of Transfer- Aside from the cases defined above, in the absence of Transfer-
Encoding, an origin server SHOULD send a Content-Length header field Encoding, an origin server SHOULD send a Content-Length header field
when the payload body size is known prior to sending the complete when the payload body size is known prior to sending the complete
header section. This will allow downstream recipients to measure header section. This will allow downstream recipients to measure
transfer progress, know when a received message is complete, and transfer progress, know when a received message is complete, and
potentially reuse the connection for additional requests. potentially reuse the connection for additional requests.
Any Content-Length field value greater than or equal to zero is Any Content-Length field value greater than or equal to zero is
valid. Since there is no predefined limit to the length of a valid. Since there is no predefined limit to the length of a
payload, a recipient MUST anticipate potentially large decimal payload, a recipient MUST anticipate potentially large decimal
numerals and prevent parsing errors due to integer conversion numerals and prevent parsing errors due to integer conversion
overflows (Section 12.5). overflows (Section 16.5).
If a message is received that has a Content-Length header field value If a message is received that has a Content-Length header field value
consisting of the same decimal value as a comma-separated list consisting of the same decimal value as a comma-separated list
(Section 5.5) - for example, "Content-Length: 42, 42" - indicating (Section 5.7.1) - for example, "Content-Length: 42, 42" - indicating
that duplicate Content-Length header fields have been generated or that duplicate Content-Length header fields have been generated or
combined by an upstream message processor, then the recipient MUST combined by an upstream message processor, then the recipient MUST
either reject the message as invalid or replace the duplicated field either reject the message as invalid or replace the duplicated field
values with a single valid Content-Length field containing that values with a single valid Content-Length field containing that
decimal value prior to determining the message body length or decimal value prior to determining the message body length or
forwarding the message. forwarding the message.
7.2.5. Content-Location 7.8. Content-Location
The "Content-Location" header field references a URI that can be used The "Content-Location" header field references a URI that can be used
as an identifier for a specific resource corresponding to the as an identifier for a specific resource corresponding to the
representation in this message's payload. In other words, if one representation in this message's payload. In other words, if one
were to perform a GET request on this URI at the time of this were to perform a GET request on this URI at the time of this
message's generation, then a 200 (OK) response would contain the same message's generation, then a 200 (OK) response would contain the same
representation that is enclosed as payload in this message. representation that is enclosed as payload in this message.
Content-Location = absolute-URI / partial-URI Content-Location = absolute-URI / partial-URI
The field value is either an absolute-URI or a partial-URI. In the The field value is either an absolute-URI or a partial-URI. In the
latter case (Section 2.4), the referenced URI is relative to the latter case (Section 4), the referenced URI is relative to the target
target URI ([RFC3986], Section 5). URI ([RFC3986], Section 5).
The Content-Location value is not a replacement for the target URI The Content-Location value is not a replacement for the target URI
(Section 6.1). It is representation metadata. It has the same (Section 6.1). It is representation metadata. It has the same
syntax and semantics as the header field of the same name defined for syntax and semantics as the header field of the same name defined for
MIME body parts in Section 4 of [RFC2557]. However, its appearance MIME body parts in Section 4 of [RFC2557]. However, its appearance
in an HTTP message has some special implications for HTTP recipients. in an HTTP message has some special implications for HTTP recipients.
If Content-Location is included in a 2xx (Successful) response If Content-Location is included in a 2xx (Successful) response
message and its value refers (after conversion to absolute form) to a message and its value refers (after conversion to absolute form) to a
URI that is the same as the target URI, then the recipient MAY URI that is the same as the target URI, then the recipient MAY
skipping to change at page 75, line 17 skipping to change at page 68, line 29
For example, if a client makes a PUT request on a negotiated resource For example, if a client makes a PUT request on a negotiated resource
and the origin server accepts that PUT (without redirection), then and the origin server accepts that PUT (without redirection), then
the new state of that resource is expected to be consistent with the the new state of that resource is expected to be consistent with the
one representation supplied in that PUT; the Content-Location cannot one representation supplied in that PUT; the Content-Location cannot
be used as a form of reverse content selection identifier to update be used as a form of reverse content selection identifier to update
only one of the negotiated representations. If the user agent had only one of the negotiated representations. If the user agent had
wanted the latter semantics, it would have applied the PUT directly wanted the latter semantics, it would have applied the PUT directly
to the Content-Location URI. to the Content-Location URI.
7.3. Payload 7.9. Validators
Some HTTP messages transfer a complete or partial representation as
the message "payload". In some cases, a payload might contain only
the associated representation's header fields (e.g., responses to
HEAD) or only some part(s) of the representation data (e.g., the 206
(Partial Content) status code).
Header fields that specifically describe the payload, rather than the
associated representation, are referred to as "payload header
fields". Payload header fields are defined in other parts of this
specification, due to their impact on message parsing.
------------------- ----------------------------
Field Name Ref.
------------------- ----------------------------
Content-Range 7.3.4
Trailer 5.6.4
Transfer-Encoding Section 6.1 of [Messaging]
------------------- ----------------------------
Table 9
7.3.1. Purpose
The purpose of a payload in a request is defined by the method
semantics. For example, a representation in the payload of a PUT
request (Section 8.3.4) represents the desired state of the target
resource if the request is successfully applied, whereas a
representation in the payload of a POST request (Section 8.3.3)
represents information to be processed by the target resource.
In a response, the payload's purpose is defined by both the request
method and the response status code. For example, the payload of a
200 (OK) response to GET (Section 8.3.1) represents the current state
of the target resource, as observed at the time of the message
origination date (Section 11.1.1), whereas the payload of the same
status code in a response to POST might represent either the
processing result or the new state of the target resource after
applying the processing. Response messages with an error status code
usually contain a payload that represents the error condition, such
that it describes the error state and what next steps are suggested
for resolving it.
7.3.2. Identification
When a complete or partial representation is transferred in a message
payload, it is often desirable for the sender to supply, or the
recipient to determine, an identifier for a resource corresponding to
that representation.
For a request message:
o If the request has a Content-Location header field, then the
sender asserts that the payload is a representation of the
resource identified by the Content-Location field value. However,
such an assertion cannot be trusted unless it can be verified by
other means (not defined by this specification). The information
might still be useful for revision history links.
o Otherwise, the payload is unidentified.
For a response message, the following rules are applied in order
until a match is found:
1. If the request method is GET or HEAD and the response status code
is 200 (OK), 204 (No Content), 206 (Partial Content), or 304 (Not
Modified), the payload is a representation of the resource
identified by the target URI (Section 6.1).
2. If the request method is GET or HEAD and the response status code
is 203 (Non-Authoritative Information), the payload is a
potentially modified or enhanced representation of the target
resource as provided by an intermediary.
3. If the response has a Content-Location header field and its field
value is a reference to the same URI as the target URI, the
payload is a representation of the target resource.
4. If the response has a Content-Location header field and its field
value is a reference to a URI different from the target URI, then
the sender asserts that the payload is a representation of the
resource identified by the Content-Location field value.
However, such an assertion cannot be trusted unless it can be
verified by other means (not defined by this specification).
5. Otherwise, the payload is unidentified.
7.3.3. Payload Body
The payload body contains the data of a request or response. This is
distinct from the message body (e.g., Section 6 of [Messaging]),
which is how the payload body is transferred "on the wire", and might
be encoded, depending on the HTTP version in use.
It is also distinct from a request or response's representation data
(Section 7.1), which can be inferred from protocol operation, rather
than necessarily appearing "on the wire."
The presence of a payload body in a request depends on whether the
request method used defines semantics for it.
The presence of a payload body in a response depends on both the
request method to which it is responding and the response status code
(Section 10).
Responses to the HEAD request method (Section 8.3.2) never include a
payload body because the associated response header fields indicate
only what their values would have been if the request method had been
GET (Section 8.3.1).
2xx (Successful) responses to a CONNECT request method
(Section 8.3.6) switch the connection to tunnel mode instead of
having a payload body.
All 1xx (Informational), 204 (No Content), and 304 (Not Modified)
responses do not include a payload body.
All other responses do include a payload body, although that body
might be of zero length.
7.3.4. Content-Range Validator header fields convey metadata about the selected
representation (Section 7). In responses to safe requests, validator
fields describe the selected representation chosen by the origin
server while handling the response. Note that, depending on the
status code semantics, the selected representation for a given
response is not necessarily the same as the representation enclosed
as response payload.
The "Content-Range" header field is sent in a single part 206 In a successful response to a state-changing request, validator
(Partial Content) response to indicate the partial range of the fields describe the new representation that has replaced the prior
selected representation enclosed as the message payload, sent in each selected representation as a result of processing the request.
part of a multipart 206 response to indicate the range enclosed
within each body part, and sent in 416 (Range Not Satisfiable)
responses to provide information about the selected representation.
Content-Range = range-unit SP For example, an ETag field in a 201 (Created) response communicates
( range-resp / unsatisfied-range ) the entity-tag of the newly created resource's representation, so
that it can be used in later conditional requests to prevent the
"lost update" problem Section 12.1.
range-resp = incl-range "/" ( complete-length / "*" ) --------------- -------
incl-range = first-pos "-" last-pos Field Name Ref.
unsatisfied-range = "*/" complete-length --------------- -------
ETag 7.9.3
Last-Modified 7.9.2
--------------- -------
complete-length = 1*DIGIT Table 5
If a 206 (Partial Content) response contains a Content-Range header This specification defines two forms of metadata that are commonly
field with a range unit (Section 7.1.4) that the recipient does not used to observe resource state and test for preconditions:
understand, the recipient MUST NOT attempt to recombine it with a modification dates (Section 7.9.2) and opaque entity tags
stored representation. A proxy that receives such a message SHOULD (Section 7.9.3). Additional metadata that reflects resource state
forward it downstream. has been defined by various extensions of HTTP, such as Web
Distributed Authoring and Versioning (WebDAV, [RFC4918]), that are
beyond the scope of this specification. A resource metadata value is
referred to as a "validator" when it is used within a precondition.
For byte ranges, a sender SHOULD indicate the complete length of the 7.9.1. Weak versus Strong
representation from which the range has been extracted, unless the
complete length is unknown or difficult to determine. An asterisk
character ("*") in place of the complete-length indicates that the
representation length was unknown when the header field was
generated.
The following example illustrates when the complete length of the Validators come in two flavors: strong or weak. Weak validators are
selected representation is known by the sender to be 1234 bytes: easy to generate but are far less useful for comparisons. Strong
validators are ideal for comparisons but can be very difficult (and
occasionally impossible) to generate efficiently. Rather than impose
that all forms of resource adhere to the same strength of validator,
HTTP exposes the type of validator in use and imposes restrictions on
when weak validators can be used as preconditions.
Content-Range: bytes 42-1233/1234 A "strong validator" is representation metadata that changes value
whenever a change occurs to the representation data that would be
observable in the payload body of a 200 (OK) response to GET.
and this second example illustrates when the complete length is A strong validator might change for reasons other than a change to
unknown: the representation data, such as when a semantically significant part
of the representation metadata is changed (e.g., Content-Type), but
it is in the best interests of the origin server to only change the
value when it is necessary to invalidate the stored responses held by
remote caches and authoring tools.
Content-Range: bytes 42-1233/* Cache entries might persist for arbitrarily long periods, regardless
of expiration times. Thus, a cache might attempt to validate an
entry using a validator that it obtained in the distant past. A
strong validator is unique across all versions of all representations
associated with a particular resource over time. However, there is
no implication of uniqueness across representations of different
resources (i.e., the same strong validator might be in use for
representations of multiple resources at the same time and does not
imply that those representations are equivalent).
A Content-Range field value is invalid if it contains a range-resp There are a variety of strong validators used in practice. The best
that has a last-pos value less than its first-pos value, or a are based on strict revision control, wherein each change to a
complete-length value less than or equal to its last-pos value. The representation always results in a unique node name and revision
recipient of an invalid Content-Range MUST NOT attempt to recombine identifier being assigned before the representation is made
the received content with a stored representation. accessible to GET. A collision-resistant hash function applied to
the representation data is also sufficient if the data is available
prior to the response header fields being sent and the digest does
not need to be recalculated every time a validation request is
received. However, if a resource has distinct representations that
differ only in their metadata, such as might occur with content
negotiation over media types that happen to share the same data
format, then the origin server needs to incorporate additional
information in the validator to distinguish those representations.
A server generating a 416 (Range Not Satisfiable) response to a byte- In contrast, a "weak validator" is representation metadata that might
range request SHOULD send a Content-Range header field with an not change for every change to the representation data. This
unsatisfied-range value, as in the following example: weakness might be due to limitations in how the value is calculated,
such as clock resolution, an inability to ensure uniqueness for all
possible representations of the resource, or a desire of the resource
owner to group representations by some self-determined set of
equivalency rather than unique sequences of data. An origin server
SHOULD change a weak entity-tag whenever it considers prior
representations to be unacceptable as a substitute for the current
representation. In other words, a weak entity-tag ought to change
whenever the origin server wants caches to invalidate old responses.
Content-Range: bytes */1234 For example, the representation of a weather report that changes in
content every second, based on dynamic measurements, might be grouped
into sets of equivalent representations (from the origin server's
perspective) with the same weak validator in order to allow cached
representations to be valid for a reasonable period of time (perhaps
adjusted dynamically based on server load or weather quality).
Likewise, a representation's modification time, if defined with only
one-second resolution, might be a weak validator if it is possible
for the representation to be modified twice during a single second
and retrieved between those modifications.
The complete-length in a 416 response indicates the current length of Likewise, a validator is weak if it is shared by two or more
the selected representation. representations of a given resource at the same time, unless those
representations have identical representation data. For example, if
the origin server sends the same validator for a representation with
a gzip content coding applied as it does for a representation with no
content coding, then that validator is weak. However, two
simultaneous representations might share the same strong validator if
they differ only in the representation metadata, such as when two
different media types are available for the same representation data.
The Content-Range header field has no meaning for status codes that Strong validators are usable for all conditional requests, including
do not explicitly describe its semantic. For this specification, cache validation, partial content ranges, and "lost update"
only the 206 (Partial Content) and 416 (Range Not Satisfiable) status avoidance. Weak validators are only usable when the client does not
codes describe a meaning for Content-Range. require exact equality with previously obtained representation data,
such as when validating a cache entry or limiting a web traversal to
recent changes.
The following are examples of Content-Range values in which the 7.9.2. Last-Modified
selected representation contains a total of 1234 bytes:
o The first 500 bytes: The "Last-Modified" header field in a response provides a timestamp
indicating the date and time at which the origin server believes the
selected representation was last modified, as determined at the
conclusion of handling the request.
Content-Range: bytes 0-499/1234 Last-Modified = HTTP-date
o The second 500 bytes: An example of its use is
Content-Range: bytes 500-999/1234 Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
o All except for the first 500 bytes: 7.9.2.1. Generation
Content-Range: bytes 500-1233/1234 An origin server SHOULD send Last-Modified for any selected
representation for which a last modification date can be reasonably
and consistently determined, since its use in conditional requests
and evaluating cache freshness ([Caching]) results in a substantial
reduction of HTTP traffic on the Internet and can be a significant
factor in improving service scalability and reliability.
o The last 500 bytes: A representation is typically the sum of many parts behind the
resource interface. The last-modified time would usually be the most
recent time that any of those parts were changed. How that value is
determined for any given resource is an implementation detail beyond
the scope of this specification. What matters to HTTP is how
recipients of the Last-Modified header field can use its value to
make conditional requests and test the validity of locally cached
responses.
Content-Range: bytes 734-1233/1234 An origin server SHOULD obtain the Last-Modified value of the
representation as close as possible to the time that it generates the
Date field value for its response. This allows a recipient to make
an accurate assessment of the representation's modification time,
especially if the representation changes near the time that the
response is generated.
7.3.5. Media Type multipart/byteranges An origin server with a clock MUST NOT send a Last-Modified date that
is later than the server's time of message origination (Date). If
the last modification time is derived from implementation-specific
metadata that evaluates to some time in the future, according to the
origin server's clock, then the origin server MUST replace that value
with the message origination date. This prevents a future
modification date from having an adverse impact on cache validation.
When a 206 (Partial Content) response message includes the content of An origin server without a clock MUST NOT assign Last-Modified values
multiple ranges, they are transmitted as body parts in a multipart to a response unless these values were associated with the resource
message body ([RFC2046], Section 5.1) with the media type of by some other system or user with a reliable clock.
"multipart/byteranges".
The multipart/byteranges media type includes one or more body parts, 7.9.2.2. Comparison
each with its own Content-Type and Content-Range fields. The
required boundary parameter specifies the boundary string used to
separate each body part.
Implementation Notes: A Last-Modified time, when used as a validator in a request, is
implicitly weak unless it is possible to deduce that it is strong,
using the following rules:
1. Additional CRLFs might precede the first boundary string in the o The validator is being compared by an origin server to the actual
body. current validator for the representation and,
2. Although [RFC2046] permits the boundary string to be quoted, some o That origin server reliably knows that the associated
existing implementations handle a quoted boundary string representation did not change twice during the second covered by
incorrectly. the presented validator.
3. A number of clients and servers were coded to an early draft of or
the byteranges specification that used a media type of multipart/
x-byteranges , which is almost (but not quite) compatible with
this type.
Despite the name, the "multipart/byteranges" media type is not o The validator is about to be used by a client in an
limited to byte ranges. The following example uses an "exampleunit" If-Modified-Since, If-Unmodified-Since, or If-Range header field,
range unit: because the client has a cache entry for the associated
representation, and
HTTP/1.1 206 Partial Content o That cache entry includes a Date value, which gives the time when
Date: Tue, 14 Nov 1995 06:25:24 GMT the origin server sent the original response, and
Last-Modified: Tue, 14 July 04:58:08 GMT
Content-Length: 2331785
Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
--THIS_STRING_SEPARATES o The presented Last-Modified time is at least 60 seconds before the
Content-Type: video/example Date value.
Content-Range: exampleunit 1.2-4.3/25
...the first range... or
--THIS_STRING_SEPARATES
Content-Type: video/example
Content-Range: exampleunit 11.2-14.3/25
...the second range o The validator is being compared by an intermediate cache to the
--THIS_STRING_SEPARATES-- validator stored in its cache entry for the representation, and
The following information serves as the registration form for the o That cache entry includes a Date value, which gives the time when
multipart/byteranges media type. the origin server sent the original response, and
Type name: multipart o The presented Last-Modified time is at least 60 seconds before the
Date value.
Subtype name: byteranges This method relies on the fact that if two different responses were
sent by the origin server during the same second, but both had the
same Last-Modified time, then at least one of those responses would
have a Date value equal to its Last-Modified time. The arbitrary
60-second limit guards against the possibility that the Date and
Last-Modified values are generated from different clocks or at
somewhat different times during the preparation of the response. An
implementation MAY use a value larger than 60 seconds, if it is
believed that 60 seconds is too short.
Required parameters: boundary 7.9.3. ETag
Optional parameters: N/A The "ETag" field in a response provides the current entity-tag for
the selected representation, as determined at the conclusion of
handling the request. An entity-tag is an opaque validator for
differentiating between multiple representations of the same
resource, regardless of whether those multiple representations are
due to resource state changes over time, content negotiation
resulting in multiple representations being valid at the same time,
or both. An entity-tag consists of an opaque quoted string, possibly
prefixed by a weakness indicator.
Encoding considerations: only "7bit", "8bit", or "binary" are ETag = entity-tag
permitted
Security considerations: see Section 12 entity-tag = [ weak ] opaque-tag
weak = %s"W/"
opaque-tag = DQUOTE *etagc DQUOTE
etagc = %x21 / %x23-7E / obs-text
; VCHAR except double quotes, plus obs-text
Interoperability considerations: N/A | *Note:* Previously, opaque-tag was defined to be a quoted-
| string ([RFC2616], Section 3.11); thus, some recipients might
| perform backslash unescaping. Servers therefore ought to avoid
| backslash characters in entity tags.
Published specification: This specification (see Section 7.3.5). An entity-tag can be more reliable for validation than a modification
date in situations where it is inconvenient to store modification
dates, where the one-second resolution of HTTP date values is not
sufficient, or where modification dates are not consistently
maintained.
Applications that use this media type: HTTP components supporting Examples:
multiple ranges in a single request.
Fragment identifier considerations: N/A ETag: "xyzzy"
ETag: W/"xyzzy"
ETag: ""
Additional information: Deprecated alias names for this type: N/A An entity-tag can be either a weak or strong validator, with strong
being the default. If an origin server provides an entity-tag for a
representation and the generation of that entity-tag does not satisfy
all of the characteristics of a strong validator (Section 7.9.1),
then the origin server MUST mark the entity-tag as weak by prefixing
its opaque value with "W/" (case-sensitive).
Magic number(s): N/A A sender MAY send the Etag field in a trailer section (see
Section 5.6). However, since trailers are often ignored, it is
preferable to send Etag as a header field unless the entity-tag is
generated while sending the message body.
File extension(s): N/A 7.9.3.1. Generation
Macintosh file type code(s): N/A The principle behind entity-tags is that only the service author
knows the implementation of a resource well enough to select the most
accurate and efficient validation mechanism for that resource, and
that any such mechanism can be mapped to a simple sequence of octets
for easy comparison. Since the value is opaque, there is no need for
the client to be aware of how each entity-tag is constructed.
Person and email address to contact for further information: See Aut For example, a resource that has implementation-specific versioning
hors' Addresses section. applied to all changes might use an internal revision number, perhaps
combined with a variance identifier for content negotiation, to
accurately differentiate between representations. Other
implementations might use a collision-resistant hash of
representation content, a combination of various file attributes, or
a modification timestamp that has sub-second resolution.
Intended usage: COMMON An origin server SHOULD send an ETag for any selected representation
for which detection of changes can be reasonably and consistently
determined, since the entity-tag's use in conditional requests and
evaluating cache freshness ([Caching]) can result in a substantial
reduction of HTTP network traffic and can be a significant factor in
improving service scalability and reliability.
Restrictions on usage: N/A 7.9.3.2. Comparison
Author: See Authors' Addresses section. There are two entity-tag comparison functions, depending on whether
or not the comparison context allows the use of weak validators:
Change controller: IESG o Strong comparison: two entity-tags are equivalent if both are not
weak and their opaque-tags match character-by-character.
7.4. Content Negotiation o Weak comparison: two entity-tags are equivalent if their opaque-
tags match character-by-character, regardless of either or both
being tagged as "weak".
When responses convey payload information, whether indicating a The example below shows the results for a set of entity-tag pairs and
success or an error, the origin server often has different ways of both the weak and strong comparison function results:
representing that information; for example, in different formats,
languages, or encodings. Likewise, different users or user agents
might have differing capabilities, characteristics, or preferences
that could influence which representation, among those available,
would be best to deliver. For this reason, HTTP provides mechanisms
for content negotiation.
This specification defines three patterns of content negotiation that -------- -------- ------------------- -----------------
can be made visible within the protocol: "proactive" negotiation, ETag 1 ETag 2 Strong Comparison Weak Comparison
where the server selects the representation based upon the user -------- -------- ------------------- -----------------
agent's stated preferences, "reactive" negotiation, where the server W/"1" W/"1" no match match
provides a list of representations for the user agent to choose from, W/"1" W/"2" no match no match
and "request payload" negotiation, where the user agent selects the W/"1" "1" no match match
representation for a future request based upon the server's stated "1" "1" match match
preferences in past responses. Other patterns of content negotiation -------- -------- ------------------- -----------------
include "conditional content", where the representation consists of
multiple parts that are selectively rendered based on user agent
parameters, "active content", where the representation contains a
script that makes additional (more specific) requests based on the
user agent characteristics, and "Transparent Content Negotiation"
([RFC2295]), where content selection is performed by an intermediary.
These patterns are not mutually exclusive, and each has trade-offs in
applicability and practicality.
Note that, in all cases, HTTP is not aware of the resource semantics. Table 6
The consistency with which an origin server responds to requests,
over time and over the varying dimensions of content negotiation, and
thus the "sameness" of a resource's observed representations over
time, is determined entirely by whatever entity or algorithm selects
or generates those responses.
7.4.1. Proactive Negotiation 7.9.3.3. Example: Entity-Tags Varying on Content-Negotiated Resources
When content negotiation preferences are sent by the user agent in a Consider a resource that is subject to content negotiation
request to encourage an algorithm located at the server to select the (Section 11), and where the representations sent in response to a GET
preferred representation, it is called proactive negotiation (a.k.a., request vary based on the Accept-Encoding request header field
server-driven negotiation). Selection is based on the available (Section 11.1.4):
representations for a response (the dimensions over which it might
vary, such as language, content-coding, etc.) compared to various
information supplied in the request, including both the explicit
negotiation fields of Section 9.4 and implicit characteristics, such
as the client's network address or parts of the User-Agent field.
Proactive negotiation is advantageous when the algorithm for >> Request:
selecting from among the available representations is difficult to
describe to a user agent, or when the server desires to send its
"best guess" to the user agent along with the first response (hoping
to avoid the round trip delay of a subsequent request if the "best
guess" is good enough for the user). In order to improve the
server's guess, a user agent MAY send request header fields that
describe its preferences.
Proactive negotiation has serious disadvantages: GET /index HTTP/1.1
Host: www.example.com
Accept-Encoding: gzip
o It is impossible for the server to accurately determine what might In this case, the response might or might not use the gzip content
be "best" for any given user, since that would require complete coding. If it does not, the response might look like:
knowledge of both the capabilities of the user agent and the
intended use for the response (e.g., does the user want to view it
on screen or print it on paper?);
o Having the user agent describe its capabilities in every request >> Response:
can be both very inefficient (given that only a small percentage
of responses have multiple representations) and a potential risk
to the user's privacy;
o It complicates the implementation of an origin server and the HTTP/1.1 200 OK
algorithms for generating responses to a request; and, Date: Fri, 26 Mar 2010 00:05:00 GMT
ETag: "123-a"
Content-Length: 70
Vary: Accept-Encoding
Content-Type: text/plain
o It limits the reusability of responses for shared caching. Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
A user agent cannot rely on proactive negotiation preferences being An alternative representation that does use gzip content coding would
consistently honored, since the origin server might not implement be:
proactive negotiation for the requested resource or might decide that
sending a response that doesn't conform to the user agent's
preferences is better than sending a 406 (Not Acceptable) response.
A Vary header field (Section 11.1.4) is often sent in a response >> Response:
subject to proactive negotiation to indicate what parts of the
request information were used in the selection algorithm.
7.4.2. Reactive Negotiation HTTP/1.1 200 OK
Date: Fri, 26 Mar 2010 00:05:00 GMT
ETag: "123-b"
Content-Length: 43
Vary: Accept-Encoding
Content-Type: text/plain
Content-Encoding: gzip
With reactive negotiation (a.k.a., agent-driven negotiation), ...binary data...
selection of the best response representation (regardless of the
status code) is performed by the user agent after receiving an
initial response from the origin server that contains a list of
resources for alternative representations. If the user agent is not
satisfied by the initial response representation, it can perform a
GET request on one or more of the alternative resources, selected
based on metadata included in the list, to obtain a different form of
representation for that response. Selection of alternatives might be
performed automatically by the user agent or manually by the user
selecting from a generated (possibly hypertext) menu.
Note that the above refers to representations of the response, in | *Note:* Content codings are a property of the representation
general, not representations of the resource. The alternative | data, so a strong entity-tag for a content-encoded
representations are only considered representations of the target | representation has to be distinct from the entity tag of an
resource if the response in which those alternatives are provided has | unencoded representation to prevent potential conflicts during
the semantics of being a representation of the target resource (e.g., | cache updates and range requests. In contrast, transfer
a 200 (OK) response to a GET request) or has the semantics of | codings (Section 7 of [Messaging]) apply only during message
providing links to alternative representations for the target | transfer and do not result in distinct entity-tags.
resource (e.g., a 300 (Multiple Choices) response to a GET request).
A server might choose not to send an initial representation, other 7.9.4. When to Use Entity-Tags and Last-Modified Dates
than the list of alternatives, and thereby indicate that reactive
negotiation by the user agent is preferred. For example, the
alternatives listed in responses with the 300 (Multiple Choices) and
406 (Not Acceptable) status codes include information about the
available representations so that the user or user agent can react by
making a selection.
Reactive negotiation is advantageous when the response would vary In 200 (OK) responses to GET or HEAD, an origin server:
over commonly used dimensions (such as type, language, or encoding),
when the origin server is unable to determine a user agent's
capabilities from examining the request, and generally when public
caches are used to distribute server load and reduce network usage.
Reactive negotiation suffers from the disadvantages of transmitting a o SHOULD send an entity-tag validator unless it is not feasible to
list of alternatives to the user agent, which degrades user-perceived generate one.
latency if transmitted in the header section, and needing a second
request to obtain an alternate representation. Furthermore, this
specification does not define a mechanism for supporting automatic
selection, though it does not prevent such a mechanism from being
developed as an extension.
7.4.3. Request Payload Negotiation o MAY send a weak entity-tag instead of a strong entity-tag, if
performance considerations support the use of weak entity-tags, or
if it is unfeasible to send a strong entity-tag.
When content negotiation preferences are sent in a server's response, o SHOULD send a Last-Modified value if it is feasible to send one.
the listed preferences are called request payload negotiation because
they intend to influence selection of an appropriate payload for
subsequent requests to that resource. For example, the
Accept-Encoding field (Section 9.4.3) can be sent in a response to
indicate preferred content codings for subsequent requests to that
resource [RFC7694].
| Similarly, Section 3.1 of [RFC5789] defines the "Accept-Patch" In other words, the preferred behavior for an origin server is to
| response header field which allows discovery of which content send both a strong entity-tag and a Last-Modified value in successful
| types are accepted in PATCH requests. responses to a retrieval request.
7.4.4. Quality Values A client:
The content negotiation fields defined by this specification use a o MUST send that entity-tag in any cache validation request (using
common parameter, named "q" (case-insensitive), to assign a relative If-Match or If-None-Match) if an entity-tag has been provided by
"weight" to the preference for that associated kind of content. This the origin server.
weight is referred to as a "quality value" (or "qvalue") because the
same parameter name is often used within server configurations to
assign a weight to the relative quality of the various
representations that can be selected for a resource.
The weight is normalized to a real number in the range 0 through 1, o SHOULD send the Last-Modified value in non-subrange cache
where 0.001 is the least preferred and 1 is the most preferred; a validation requests (using If-Modified-Since) if only a Last-
value of 0 means "not acceptable". If no "q" parameter is present, Modified value has been provided by the origin server.
the default weight is 1.
weight = OWS ";" OWS "q=" qvalue o MAY send the Last-Modified value in subrange cache validation
qvalue = ( "0" [ "." 0*3DIGIT ] ) requests (using If-Unmodified-Since) if only a Last-Modified value
/ ( "1" [ "." 0*3("0") ] ) has been provided by an HTTP/1.0 origin server. The user agent
SHOULD provide a way to disable this, in case of difficulty.
A sender of qvalue MUST NOT generate more than three digits after the o SHOULD send both validators in cache validation requests if both
decimal point. User configuration of these values ought to be an entity-tag and a Last-Modified value have been provided by the
limited in the same fashion. origin server. This allows both HTTP/1.0 and HTTP/1.1 caches to
respond appropriately.
8. Request Methods 8. Methods
8.1. Overview 8.1. Overview
The request method token is the primary source of request semantics; The request method token is the primary source of request semantics;
it indicates the purpose for which the client has made this request it indicates the purpose for which the client has made this request
and what is expected by the client as a successful result. and what is expected by the client as a successful result.
The request method's semantics might be further specialized by the The request method's semantics might be further specialized by the
semantics of some header fields when present in a request (Section 9) semantics of some header fields when present in a request if those
if those additional semantics do not conflict with the method. For additional semantics do not conflict with the method. For example, a
example, a client can send conditional request header fields client can send conditional request header fields (Section 12.1) to
(Section 9.2) to make the requested action conditional on the current make the requested action conditional on the current state of the
state of the target resource. target resource.
method = token method = token
HTTP was originally designed to be usable as an interface to HTTP was originally designed to be usable as an interface to
distributed object systems. The request method was envisioned as distributed object systems. The request method was envisioned as
applying semantics to a target resource in much the same way as applying semantics to a target resource in much the same way as
invoking a defined method on an identified object would apply invoking a defined method on an identified object would apply
semantics. semantics.
The method token is case-sensitive because it might be used as a The method token is case-sensitive because it might be used as a
skipping to change at page 86, line 29 skipping to change at page 78, line 26
DELETE Remove all current representations of the 8.3.5 DELETE Remove all current representations of the 8.3.5
target resource. target resource.
CONNECT Establish a tunnel to the server 8.3.6 CONNECT Establish a tunnel to the server 8.3.6
identified by the target resource. identified by the target resource.
OPTIONS Describe the communication options for the 8.3.7 OPTIONS Describe the communication options for the 8.3.7
target resource. target resource.
TRACE Perform a message loop-back test along the 8.3.8 TRACE Perform a message loop-back test along the 8.3.8
path to the target resource. path to the target resource.
--------- -------------------------------------------- ------- --------- -------------------------------------------- -------
Table 10 Table 7
All general-purpose servers MUST support the methods GET and HEAD. All general-purpose servers MUST support the methods GET and HEAD.
All other methods are OPTIONAL. All other methods are OPTIONAL.
The set of methods allowed by a target resource can be listed in an The set of methods allowed by a target resource can be listed in an
Allow header field (Section 11.4.2). However, the set of allowed Allow header field (Section 9.2.1). However, the set of allowed
methods can change dynamically. When a request method is received methods can change dynamically. When a request method is received
that is unrecognized or not implemented by an origin server, the that is unrecognized or not implemented by an origin server, the
origin server SHOULD respond with the 501 (Not Implemented) status origin server SHOULD respond with the 501 (Not Implemented) status
code. When a request method is received that is known by an origin code. When a request method is received that is known by an origin
server but not allowed for the target resource, the origin server server but not allowed for the target resource, the origin server
SHOULD respond with the 405 (Method Not Allowed) status code. SHOULD respond with the 405 (Method Not Allowed) status code.
8.2. Common Method Properties Additional methods, outside the scope of this specification, have
been specified for use in HTTP. All such methods ought to be
--------- ------ ------------ ------- registered within the "Hypertext Transfer Protocol (HTTP) Method
Method Safe Idempotent Ref. Registry", as described in Section 15.1.
--------- ------ ------------ -------
CONNECT no no 8.3.6
DELETE no yes 8.3.5
GET yes yes 8.3.1
HEAD yes yes 8.3.2
OPTIONS yes yes 8.3.7
POST no no 8.3.3
PUT no yes 8.3.4
TRACE yes yes 8.3.8
--------- ------ ------------ -------
Table 11
8.2. Common Method Properties
8.2.1. Safe Methods 8.2.1. Safe Methods
Request methods are considered "safe" if their defined semantics are Request methods are considered "safe" if their defined semantics are
essentially read-only; i.e., the client does not request, and does essentially read-only; i.e., the client does not request, and does
not expect, any state change on the origin server as a result of not expect, any state change on the origin server as a result of
applying a safe method to a target resource. Likewise, reasonable applying a safe method to a target resource. Likewise, reasonable
use of a safe method is not expected to cause any harm, loss of use of a safe method is not expected to cause any harm, loss of
property, or unusual burden on the origin server. property, or unusual burden on the origin server.
This definition of safe methods does not prevent an implementation This definition of safe methods does not prevent an implementation
skipping to change at page 89, line 40 skipping to change at page 81, line 37
referring to making a GET request. A successful response reflects referring to making a GET request. A successful response reflects
the quality of "sameness" identified by the target URI. In turn, the quality of "sameness" identified by the target URI. In turn,
constructing applications such that they produce a URI for each constructing applications such that they produce a URI for each
important resource results in more resources being available for important resource results in more resources being available for
other applications, producing a network effect that promotes further other applications, producing a network effect that promotes further
expansion of the Web. expansion of the Web.
It is tempting to think of resource identifiers as remote file system It is tempting to think of resource identifiers as remote file system
pathnames and of representations as being a copy of the contents of pathnames and of representations as being a copy of the contents of
such files. In fact, that is how many resources are implemented (see such files. In fact, that is how many resources are implemented (see
Section 12.3 for related security considerations). However, there Section 16.3 for related security considerations). However, there
are no such limitations in practice. are no such limitations in practice.
The HTTP interface for a resource is just as likely to be implemented The HTTP interface for a resource is just as likely to be implemented
as a tree of content objects, a programmatic view on various database as a tree of content objects, a programmatic view on various database
records, or a gateway to other information systems. Even when the records, or a gateway to other information systems. Even when the
URI mapping mechanism is tied to a file system, an origin server URI mapping mechanism is tied to a file system, an origin server
might be configured to execute the files with the request as input might be configured to execute the files with the request as input
and send the output as the representation rather than transfer the and send the output as the representation rather than transfer the
files directly. Regardless, only the origin server needs to know how files directly. Regardless, only the origin server needs to know how
each of its resource identifiers corresponds to an implementation and each of its resource identifiers corresponds to an implementation and
how each implementation manages to select and send a current how each implementation manages to select and send a current
representation of the target resource in a response to GET. representation of the target resource in a response to GET.
A client can alter the semantics of GET to be a "range request", A client can alter the semantics of GET to be a "range request",
requesting transfer of only some part(s) of the selected requesting transfer of only some part(s) of the selected
representation, by sending a Range header field in the request representation, by sending a Range header field in the request
(Section 9.3). (Section 13.2).
A client SHOULD NOT generate a body in a GET request. A payload A client SHOULD NOT generate a body in a GET request. A payload
received in a GET request has no defined semantics, cannot alter the received in a GET request has no defined semantics, cannot alter the
meaning or target of the request, and might lead some implementations meaning or target of the request, and might lead some implementations
to reject the request and close the connection because of its to reject the request and close the connection because of its
potential as a request smuggling attack (Section 11.2 of potential as a request smuggling attack (Section 11.2 of
[Messaging]). [Messaging]).
The response to a GET request is cacheable; a cache MAY use it to The response to a GET request is cacheable; a cache MAY use it to
satisfy subsequent GET and HEAD requests unless otherwise indicated satisfy subsequent GET and HEAD requests unless otherwise indicated
by the Cache-Control header field (Section 5.2 of [Caching]). A by the Cache-Control header field (Section 5.2 of [Caching]). A
cache that receives a payload in a GET request is likely to ignore cache that receives a payload in a GET request is likely to ignore
that payload and cache regardless of the payload contents. that payload and cache regardless of the payload contents.
When information retrieval is performed with a mechanism that When information retrieval is performed with a mechanism that