RFC 9110
RFC 9110
HTTP Semantics
Abstract
This document updates RFC 3864 and obsoletes RFCs 2818, 7231, 7232,
7233, 7235, 7538, 7615, 7694, and portions of 7230.
Copyright Notice
Copyright (c) 2022 IETF Trust and the persons identified as the
document authors. All rights reserved.
Table of Contents
1. Introduction
1.1. Purpose
1.2. History and Evolution
1.3. Core Semantics
1.4. Specifications Obsoleted by This Document
2. Conformance
2.1. Syntax Notation
2.2. Requirements Notation
2.3. Length Requirements
2.4. Error Handling
2.5. Protocol Version
3. Terminology and Core Concepts
3.1. Resources
3.2. Representations
3.3. Connections, Clients, and Servers
3.4. Messages
3.5. User Agents
3.6. Origin Server
3.7. Intermediaries
3.8. Caches
3.9. Example Message Exchange
4. Identifiers in HTTP
4.1. URI References
4.2. HTTP-Related URI Schemes
4.2.1. http URI Scheme
4.2.2. https URI Scheme
4.2.3. http(s) Normalization and Comparison
4.2.4. Deprecation of userinfo in http(s) URIs
4.2.5. http(s) References with Fragment Identifiers
4.3. Authoritative Access
4.3.1. URI Origin
4.3.2. http Origins
4.3.3. https Origins
4.3.4. https Certificate Verification
4.3.5. IP-ID Reference Identity
5. Fields
5.1. Field Names
5.2. Field Lines and Combined Field Value
5.3. Field Order
5.4. Field Limits
5.5. Field Values
5.6. Common Rules for Defining Field Values
5.6.1. Lists (#rule ABNF Extension)
5.6.1.1. Sender Requirements
5.6.1.2. Recipient Requirements
5.6.2. Tokens
5.6.3. Whitespace
5.6.4. Quoted Strings
5.6.5. Comments
5.6.6. Parameters
5.6.7. Date/Time Formats
6. Message Abstraction
6.1. Framing and Completeness
6.2. Control Data
6.3. Header Fields
6.4. Content
6.4.1. Content Semantics
6.4.2. Identifying Content
6.5. Trailer Fields
6.5.1. Limitations on Use of Trailers
6.5.2. Processing Trailer Fields
6.6. Message Metadata
6.6.1. Date
6.6.2. Trailer
7. Routing HTTP Messages
7.1. Determining the Target Resource
7.2. Host and :authority
7.3. Routing Inbound Requests
7.3.1. To a Cache
7.3.2. To a Proxy
7.3.3. To the Origin
7.4. Rejecting Misdirected Requests
7.5. Response Correlation
7.6. Message Forwarding
7.6.1. Connection
7.6.2. Max-Forwards
7.6.3. Via
7.7. Message Transformations
7.8. Upgrade
8. Representation Data and Metadata
8.1. Representation Data
8.2. Representation Metadata
8.3. Content-Type
8.3.1. Media Type
8.3.2. Charset
8.3.3. Multipart Types
8.4. Content-Encoding
8.4.1. Content Codings
8.4.1.1. Compress Coding
8.4.1.2. Deflate Coding
8.4.1.3. Gzip Coding
8.5. Content-Language
8.5.1. Language Tags
8.6. Content-Length
8.7. Content-Location
8.8. Validator Fields
8.8.1. Weak versus Strong
8.8.2. Last-Modified
8.8.2.1. Generation
8.8.2.2. Comparison
8.8.3. ETag
8.8.3.1. Generation
8.8.3.2. Comparison
8.8.3.3. Example: Entity Tags Varying on Content-Negotiated
Resources
9. Methods
9.1. Overview
9.2. Common Method Properties
9.2.1. Safe Methods
9.2.2. Idempotent Methods
9.2.3. Methods and Caching
9.3. Method Definitions
9.3.1. GET
9.3.2. HEAD
9.3.3. POST
9.3.4. PUT
9.3.5. DELETE
9.3.6. CONNECT
9.3.7. OPTIONS
9.3.8. TRACE
10. Message Context
10.1. Request Context Fields
10.1.1. Expect
10.1.2. From
10.1.3. Referer
10.1.4. TE
10.1.5. User-Agent
10.2. Response Context Fields
10.2.1. Allow
10.2.2. Location
10.2.3. Retry-After
10.2.4. Server
11. HTTP Authentication
11.1. Authentication Scheme
11.2. Authentication Parameters
11.3. Challenge and Response
11.4. Credentials
11.5. Establishing a Protection Space (Realm)
11.6. Authenticating Users to Origin Servers
11.6.1. WWW-Authenticate
11.6.2. Authorization
11.6.3. Authentication-Info
11.7. Authenticating Clients to Proxies
11.7.1. Proxy-Authenticate
11.7.2. Proxy-Authorization
11.7.3. Proxy-Authentication-Info
12. Content Negotiation
12.1. Proactive Negotiation
12.2. Reactive Negotiation
12.3. Request Content Negotiation
12.4. Content Negotiation Field Features
12.4.1. Absence
12.4.2. Quality Values
12.4.3. Wildcard Values
12.5. Content Negotiation Fields
12.5.1. Accept
12.5.2. Accept-Charset
12.5.3. Accept-Encoding
12.5.4. Accept-Language
12.5.5. Vary
13. Conditional Requests
13.1. Preconditions
13.1.1. If-Match
13.1.2. If-None-Match
13.1.3. If-Modified-Since
13.1.4. If-Unmodified-Since
13.1.5. If-Range
13.2. Evaluation of Preconditions
13.2.1. When to Evaluate
13.2.2. Precedence of Preconditions
14. Range Requests
14.1. Range Units
14.1.1. Range Specifiers
14.1.2. Byte Ranges
14.2. Range
14.3. Accept-Ranges
14.4. Content-Range
14.5. Partial PUT
14.6. Media Type multipart/byteranges
15. Status Codes
15.1. Overview of Status Codes
15.2. Informational 1xx
15.2.1. 100 Continue
15.2.2. 101 Switching Protocols
15.3. Successful 2xx
15.3.1. 200 OK
15.3.2. 201 Created
15.3.3. 202 Accepted
15.3.4. 203 Non-Authoritative Information
15.3.5. 204 No Content
15.3.6. 205 Reset Content
15.3.7. 206 Partial Content
15.3.7.1. Single Part
15.3.7.2. Multiple Parts
15.3.7.3. Combining Parts
15.4. Redirection 3xx
15.4.1. 300 Multiple Choices
15.4.2. 301 Moved Permanently
15.4.3. 302 Found
15.4.4. 303 See Other
15.4.5. 304 Not Modified
15.4.6. 305 Use Proxy
15.4.7. 306 (Unused)
15.4.8. 307 Temporary Redirect
15.4.9. 308 Permanent Redirect
15.5. Client Error 4xx
15.5.1. 400 Bad Request
15.5.2. 401 Unauthorized
15.5.3. 402 Payment Required
15.5.4. 403 Forbidden
15.5.5. 404 Not Found
15.5.6. 405 Method Not Allowed
15.5.7. 406 Not Acceptable
15.5.8. 407 Proxy Authentication Required
15.5.9. 408 Request Timeout
15.5.10. 409 Conflict
15.5.11. 410 Gone
15.5.12. 411 Length Required
15.5.13. 412 Precondition Failed
15.5.14. 413 Content Too Large
15.5.15. 414 URI Too Long
15.5.16. 415 Unsupported Media Type
15.5.17. 416 Range Not Satisfiable
15.5.18. 417 Expectation Failed
15.5.19. 418 (Unused)
15.5.20. 421 Misdirected Request
15.5.21. 422 Unprocessable Content
15.5.22. 426 Upgrade Required
15.6. Server Error 5xx
15.6.1. 500 Internal Server Error
15.6.2. 501 Not Implemented
15.6.3. 502 Bad Gateway
15.6.4. 503 Service Unavailable
15.6.5. 504 Gateway Timeout
15.6.6. 505 HTTP Version Not Supported
16. Extending HTTP
16.1. Method Extensibility
16.1.1. Method Registry
16.1.2. Considerations for New Methods
16.2. Status Code Extensibility
16.2.1. Status Code Registry
16.2.2. Considerations for New Status Codes
16.3. Field Extensibility
16.3.1. Field Name Registry
16.3.2. Considerations for New Fields
16.3.2.1. Considerations for New Field Names
16.3.2.2. Considerations for New Field Values
16.4. Authentication Scheme Extensibility
16.4.1. Authentication Scheme Registry
16.4.2. Considerations for New Authentication Schemes
16.5. Range Unit Extensibility
16.5.1. Range Unit Registry
16.5.2. Considerations for New Range Units
16.6. Content Coding Extensibility
16.6.1. Content Coding Registry
16.6.2. Considerations for New Content Codings
16.7. Upgrade Token Registry
17. Security Considerations
17.1. Establishing Authority
17.2. Risks of Intermediaries
17.3. Attacks Based on File and Path Names
17.4. Attacks Based on Command, Code, or Query Injection
17.5. Attacks via Protocol Element Length
17.6. Attacks Using Shared-Dictionary Compression
17.7. Disclosure of Personal Information
17.8. Privacy of Server Log Information
17.9. Disclosure of Sensitive Information in URIs
17.10. Application Handling of Field Names
17.11. Disclosure of Fragment after Redirects
17.12. Disclosure of Product Information
17.13. Browser Fingerprinting
17.14. Validator Retention
17.15. Denial-of-Service Attacks Using Range
17.16. Authentication Considerations
17.16.1. Confidentiality of Credentials
17.16.2. Credentials and Idle Clients
17.16.3. Protection Spaces
17.16.4. Additional Response Fields
18. IANA Considerations
18.1. URI Scheme Registration
18.2. Method Registration
18.3. Status Code Registration
18.4. Field Name Registration
18.5. Authentication Scheme Registration
18.6. Content Coding Registration
18.7. Range Unit Registration
18.8. Media Type Registration
18.9. Port Registration
18.10. Upgrade Token Registration
19. References
19.1. Normative References
19.2. Informative References
Appendix A. Collected ABNF
Appendix B. Changes from Previous RFCs
B.1. Changes from RFC 2818
B.2. Changes from RFC 7230
B.3. Changes from RFC 7231
B.4. Changes from RFC 7232
B.5. Changes from RFC 7233
B.6. Changes from RFC 7235
B.7. Changes from RFC 7538
B.8. Changes from RFC 7615
B.9. Changes from RFC 7694
Acknowledgements
Index
Authors' Addresses
1. Introduction
1.1. Purpose
HTTP has been the primary information transfer protocol for the World
Wide Web since its introduction in 1990. It began as a trivial
mechanism for low-latency requests, with a single method (GET) to
request transfer of a presumed hypertext document identified by a
given pathname. 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. These protocols were eventually defined as HTTP/0.9
and HTTP/1.0 (see [HTTP/1.0]).
+============================================+===========+=====+
| Title | Reference | See |
+============================================+===========+=====+
| HTTP Over TLS | [RFC2818] | B.1 |
+--------------------------------------------+-----------+-----+
| HTTP/1.1 Message Syntax and Routing [*] | [RFC7230] | B.2 |
+--------------------------------------------+-----------+-----+
| HTTP/1.1 Semantics and Content | [RFC7231] | B.3 |
+--------------------------------------------+-----------+-----+
| HTTP/1.1 Conditional Requests | [RFC7232] | B.4 |
+--------------------------------------------+-----------+-----+
| HTTP/1.1 Range Requests | [RFC7233] | B.5 |
+--------------------------------------------+-----------+-----+
| HTTP/1.1 Authentication | [RFC7235] | B.6 |
+--------------------------------------------+-----------+-----+
| HTTP Status Code 308 (Permanent Redirect) | [RFC7538] | B.7 |
+--------------------------------------------+-----------+-----+
| HTTP Authentication-Info and Proxy- | [RFC7615] | B.8 |
| Authentication-Info Response Header Fields | | |
+--------------------------------------------+-----------+-----+
| HTTP Client-Initiated Content-Encoding | [RFC7694] | B.9 |
+--------------------------------------------+-----------+-----+
Table 1
[*] This document only obsoletes the portions of RFC 7230 that are
independent of the HTTP/1.1 messaging syntax and connection
management; the remaining bits of RFC 7230 are obsoleted by
"HTTP/1.1" [HTTP/1.1].
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.
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).
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 three decades of
HTTP use and is expected to continue changing in the future.
When a major version of HTTP does not define any minor versions, the
minor version "0" is implied. The "0" is used when referring to that
protocol within elements that require a minor version identifier.
HTTP was created for the World Wide Web (WWW) architecture and has
evolved over time to support the scalability needs of a worldwide
hypertext system. Much of that architecture is reflected in the
terminology used to define HTTP.
3.1. Resources
HTTP relies upon the Uniform Resource Identifier (URI) standard [URI]
to indicate the target resource (Section 7.1) and relationships
between resources.
3.2. Representations
The terms client and server refer only to the roles that these
programs perform for a particular connection. The same program might
act as a client on some connections and a server on others.
HTTP is defined as a stateless protocol, meaning that each request
message's semantics can be understood in isolation, and that the
relationship between connections and messages on them has no impact
on the interpretation of those messages. For example, a CONNECT
request (Section 9.3.6) or a request with the Upgrade header field
(Section 7.8) can occur at any time, not just in the first message on
a connection. Many implementations depend on HTTP's stateless design
in order to reuse proxied connections or dynamically load balance
requests across multiple servers.
As a result, a server MUST NOT assume that two requests on the same
connection are from the same user agent unless the connection is
secured and specific to that agent. Some non-standard HTTP
extensions (e.g., [RFC4559]) have been known to violate this
requirement, resulting in security and interoperability problems.
3.4. Messages
The term "user agent" refers to any of the various client programs
that initiate a request.
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.
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.
request >
UA ======================================= O
< response
Figure 1
3.7. Intermediaries
Figure 2
The figure above shows three intermediaries (A, B, and C) between the
user agent and origin server. A request or response message that
travels the whole chain will pass through four separate connections.
Some HTTP communication options might apply only to the connection
with the nearest, non-tunnel neighbor, only to the endpoints of the
chain, or to all connections along the chain. Although the diagram
is linear, each participant might be engaged in multiple,
simultaneous communications. For example, B might be receiving
requests from many clients other than A, and/or forwarding requests
to servers other than C, at the same time that it is handling A's
request. Likewise, later requests might be sent through a different
path of connections, often based on dynamic configuration for load
balancing.
3.8. Caches
> >
UA =========== A =========== B - - - - - - C - - - - - - O
< <
Figure 3
Client request:
HTTP/1.1 200 OK
Date: Mon, 27 Jul 2009 12:28:53 GMT
Server: Apache
Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
ETag: "34aa387-d-1568eb00"
Accept-Ranges: bytes
Content-Length: 51
Vary: Accept-Encoding
Content-Type: text/plain
4. Identifiers in HTTP
+============+====================================+=========+
| URI Scheme | Description | Section |
+============+====================================+=========+
| http | Hypertext Transfer Protocol | 4.2.1 |
+------------+------------------------------------+---------+
| https | Hypertext Transfer Protocol Secure | 4.2.2 |
+------------+------------------------------------+---------+
Table 2
Note that the presence of an "http" or "https" URI does not imply
that there is always an HTTP server at the identified origin
listening for connections. Anyone can mint a URI, whether or not a
server exists and whether or not that server currently maps that
identifier to a resource. The delegated nature of registered names
and IP addresses creates a federated namespace whether or not an HTTP
server is present.
A client MUST ensure that its HTTP requests for an "https" resource
are secured, prior to being communicated, and that it only accepts
secured responses to those requests. Note that the definition of
what cryptographic mechanisms are acceptable to client and server are
usually negotiated and can change over time.
HTTP does not require the use of a specific method for determining
equivalence. For example, a cache key might be compared as a simple
string, after syntax-based normalization, or after scheme-based
normalization.
* If the port is equal to the default port for a scheme, the normal
form is to omit the port subcomponent.
http://example.com:80/~smith/home.html
http://EXAMPLE.com/%7Esmith/home.html
http://EXAMPLE.com:/%7esmith/home.html
Two HTTP URIs that are equivalent after normalization (using any
method) can be assumed to identify the same resource, and any HTTP
component MAY perform normalization. As a result, distinct resources
SHOULD NOT be identified by HTTP URIs that are equivalent after
normalization (using any method defined in Section 6.2 of [URI]).
A sender MUST NOT generate the userinfo subcomponent (and its "@"
delimiter) when an "http" or "https" URI reference is generated
within a message as a target URI or field value.
The "origin" for a given URI is the triple of scheme, host, and port
after normalizing the scheme and host to lowercase and normalizing
the port to remove any leading zeros. If port is elided from the
URI, the default port for that scheme is used. For example, the URI
https://Example.Com/happy.js
which can also be described as the normalized URI prefix with port
always present:
https://example.com:443
Each origin defines its own namespace and controls how identifiers
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.
Origin is also used within HTML and related Web protocols, beyond the
scope of this document, as described in [RFC6454].
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 over that connection
an HTTP request message containing a request target that matches the
client's target URI (Section 7.1).
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 [ALTSVC] 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.
The request target's host and port value are passed within each HTTP
request, identifying the origin and distinguishing it from other
namespaces that might be controlled by the same server (Section 7.2).
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 (Section 7.4).
Note that the "https" scheme does not rely on TCP and the connected
port number for associating authority, since both are outside the
secured communication and thus cannot be trusted as definitive.
Hence, the HTTP communication might take place over any channel that
has been secured, as defined in Section 4.2.2, including protocols
that don't use TCP.
When an "https" 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, securing the connection end-to-
end by successfully initiating TLS over TCP with confidentiality and
integrity protection, and sending over that connection an HTTP
request message containing a request target that matches the client's
target URI (Section 7.1).
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]).
If the certificate is not valid for the target URI's origin, a user
agent MUST either obtain confirmation from the user before proceeding
(see Section 3.5) 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. Fields
field-name = token
A proxy MUST forward unrecognized header fields unless the field name
is listed in the Connection header field (Section 7.6.1) or the proxy
is specifically configured to block, or otherwise transform, such
fields. Other recipients SHOULD ignore unrecognized header and
trailer fields. Adhering to these requirements allows HTTP's
functionality to be extended without updating or removing deployed
intermediaries.
Field sections are composed of any number of "field lines", each with
a "field name" (see Section 5.1) identifying the field, and a "field
line value" that conveys data for that instance of the 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
second field line value is "Baz". The field value for "Example-
Field" is the list "Foo, Bar, Baz".
The order in which field lines with the same name are received is
therefore significant to the interpretation of the field value; a
proxy MUST NOT change the order of these field line values when
forwarding a message.
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
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,
unless that field's definition allows multiple field line values to
be recombined as a comma-separated list (i.e., at least one
alternative of the field's definition allows a comma-separated list,
such as an ABNF rule of #(values) defined in Section 5.6.1).
The order in which field lines with differing field names are
received in a section is not significant. However, it is good
practice to send header fields that contain additional control data
first, such as Host on requests and Date on responses, so that
implementations can decide when not to handle a message as early as
possible.
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
a whole, as described in Section 2. Various ad hoc limitations on
individual lengths are found in practice, often depending on the
specific field's semantics.
A client MAY discard or truncate received field lines that are larger
than the client wishes to process if the field semantics are such
that the dropped value(s) can be safely ignored without changing the
message framing or response semantics.
field-value = *field-content
field-content = field-vchar
[ 1*( SP / HTAB / field-vchar ) field-vchar ]
field-vchar = VCHAR / obs-text
obs-text = %x80-FF
Field values containing CR, LF, or NUL characters are invalid and
dangerous, due to the varying ways that implementations might parse
and interpret those characters; a recipient of CR, LF, or NUL within
a field value MUST either reject the message or replace each of those
characters with SP before further processing or forwarding of that
message. Field values containing other CTL characters are also
invalid; however, recipients MAY retain such characters for the sake
of robustness when they appear within a safe context (e.g., an
application-specific quoted string that will not be processed by any
downstream HTTP parser).
Fields that only anticipate a single member as the field value are
referred to as "singleton fields".
Fields that allow multiple members as the field value are referred to
as "list-based fields". The list operator extension of Section 5.6.1
is used as a common notation for defining field values that can
contain multiple members.
Because commas (",") are used as the delimiter between members, they
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
a singleton field might be erroneously sent with multiple members and
detecting such errors improves interoperability. Fields that expect
to contain a comma within a member, such as within an HTTP-date or
URI-reference element, ought to be defined with delimiters around
that element to distinguish any comma within that data from potential
list separators.
For example, a textual date and a URI (either of which might contain
a comma) could be safely carried in list-based field values like
these:
Example-URIs: "http://example.com/a.html,foo",
"http://without-a-comma.example.com/"
Example-Dates: "Sat, 04 May 1996", "Wed, 14 Sep 2005"
Note that double-quote delimiters are almost always used with the
quoted-string production (Section 5.6.4); using a different syntax
inside double-quotes will likely cause unnecessary confusion.
In any production that uses the list construct, a sender MUST NOT
generate empty list elements. In other words, a sender has to
generate lists that satisfy the following syntax:
and:
Appendix A shows the collected ABNF for senders after the list
constructs have been expanded.
example-list = 1#example-list-elmt
example-list-elmt = token ; see Section 5.6.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"
""
","
", ,"
5.6.2. Tokens
token = 1*tchar
Many HTTP field values are defined using common syntax components,
separated by whitespace or specific delimiting characters.
Delimiters are chosen from the set of US-ASCII visual characters not
allowed in a token (DQUOTE and "(),/:;<=>?@[\]{}").
5.6.3. 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 overwrite 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.6.5. Comments
5.6.6. Parameters
Preferred format:
day = 2DIGIT
month = %s"Jan" / %s"Feb" / %s"Mar" / %s"Apr"
/ %s"May" / %s"Jun" / %s"Jul" / %s"Aug"
/ %s"Sep" / %s"Oct" / %s"Nov" / %s"Dec"
year = 4DIGIT
GMT = %s"GMT"
hour = 2DIGIT
minute = 2DIGIT
second = 2DIGIT
Obsolete formats:
6. Message Abstraction
Each major version of HTTP defines its own syntax for communicating
messages. This section defines an abstract data type for HTTP
messages based on a generalization of those message characteristics,
common structure, and capacity for conveying semantics. This
abstraction is used to define requirements on senders and recipients
that are independent of the HTTP version, such that a message in one
version can be relayed through other versions without changing its
meaning.
Message framing indicates how each message begins and ends, such that
each message can be distinguished from other messages or noise on the
same connection. Each major version of HTTP defines its own framing
mechanism.
Messages start with control data that describe its primary purpose.
Request message control data includes a request method (Section 9),
request target (Section 7.1), and protocol version (Section 2.5).
Response message control data includes a status code (Section 15),
optional reason phrase, and protocol version.
Fields (Section 5) that are sent or received before the content are
referred to as "header fields" (or just "headers", colloquially).
6.4. Content
All 1xx (Informational), 204 (No Content), and 304 (Not Modified)
responses do not include content.
2. If the request method is GET and the response status code is 200
(OK), the content is a representation of the target resource
(Section 7.1).
3. If the request method is GET and the response status code is 203
(Non-Authoritative Information), the content is a potentially
modified or enhanced representation of the target resource as
provided by an intermediary.
4. If the request method is GET and the response status code is 206
(Partial Content), the content is one or more parts of a
representation of the target resource.
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. Trailer fields that might be generated more
than once during a message MUST be defined as a list-based field even
if each member value is only processed once per field line received.
Fields that describe the message itself, such as when and how the
message has been generated, can appear in both requests and
responses.
6.6.1. Date
The "Date" header field represents the date and time at which the
message was originated, having the same semantics as the Origination
Date Field (orig-date) defined in Section 3.6.1 of [RFC5322]. The
field value is an HTTP-date, as defined in Section 5.6.7.
Date = HTTP-date
An example is
A sender that generates a Date header field SHOULD generate its field
value as the best available approximation of the date and time of
message generation. In theory, the date ought to represent the
moment just before generating the message content. In practice, a
sender can generate the date value at any time during message
origination.
6.6.2. 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 content.
Trailer = #field-name
There are two unusual cases for which the request target components
are in a method-specific form:
* For CONNECT (Section 9.3.6), the request target is the host name
and port number of the tunnel destination, separated by a colon.
See the respective method definitions for details. These forms MUST
NOT be used with other methods.
The "Host" header field in a request provides the host and port
information from the target URI, enabling the origin server to
distinguish among resources while servicing requests for multiple
host names.
In HTTP/2 [HTTP/2] and HTTP/3 [HTTP/3], the Host header field is, in
some cases, supplanted by the ":authority" pseudo-header field of a
request's control data.
Once the target URI and its origin are determined, a client decides
whether a network request is necessary to accomplish the desired
semantics and, if so, where that request is to be directed.
7.3.1. To a Cache
If the client has a cache [CACHING] and the request can be satisfied
by it, then the request is usually directed there first.
7.3.2. To a Proxy
7.6.1. Connection
Connection = #connection-option
connection-option = token
* TE (Section 10.1.4)
7.6.2. Max-Forwards
Max-Forwards = 1*DIGIT
7.6.3. Via
Each member of the Via field value represents a proxy or gateway that
has forwarded the message. Each intermediary appends its own
information about how the message was received, such that the end
result is ordered according to the sequence of forwarding recipients.
The received-by portion is normally the host and optional port number
of a recipient server or client that subsequently forwarded the
message. However, if the real host is considered to be sensitive
information, a sender MAY replace it with a pseudonym. If a port is
not provided, a recipient MAY interpret that as meaning it was
received on the default port, if any, for the received-protocol.
could be collapsed to
A sender SHOULD NOT combine multiple list members unless they are all
under the same organizational control and the hosts have already been
replaced by pseudonyms. A sender MUST NOT combine members that have
different received-protocol values.
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
received when forwarding the request. A proxy MUST NOT change the
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
received target URI when forwarding it to the next inbound server
except as required by that forwarding protocol. For example, a proxy
forwarding a request to an origin server via HTTP/1.1 will replace an
empty path with "/" (Section 3.2.1 of [HTTP/1.1]) or "*"
(Section 3.2.4 of [HTTP/1.1]), depending on the request method.
A proxy MAY transform the content of a message that does not contain
a no-transform cache directive. A proxy that transforms the content
of a 200 (OK) response can inform downstream recipients that a
transformation has been applied by changing the response status code
to 203 (Non-Authoritative Information) (Section 15.3.4).
7.8. Upgrade
Upgrade = #protocol
This specification only defines the protocol name "HTTP" for use by
the family of Hypertext Transfer Protocols, as defined by the HTTP
version rules of Section 2.5 and future updates to this
specification. Additional protocol names ought to be registered
using the registration procedure defined in Section 16.7.
The data type of the representation data is determined via the header
fields Content-Type and Content-Encoding. These define a two-layer,
ordered encoding model:
8.3. Content-Type
Content-Type = media-type
HTTP uses media types [RFC2046] in the Content-Type (Section 8.3) and
Accept (Section 12.5.1) header fields in order to provide open and
extensible data typing and type negotiation. Media types define both
a data format and various processing models: how to process that data
in accordance with the message context.
text/html;charset=utf-8
Text/HTML;Charset="utf-8"
text/html; charset="utf-8"
text/html;charset=UTF-8
8.3.2. Charset
8.4. Content-Encoding
Content-Encoding = #content-coding
Content-Encoding: gzip
content-coding = token
8.5. Content-Language
Content-Language = #language-tag
Content-Language: da
Content-Language: mi, en
8.6. Content-Length
Content-Length = 1*DIGIT
An example is
Content-Length: 3495
8.7. Content-Location
8.8.2. Last-Modified
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.
Last-Modified = HTTP-date
8.8.2.1. Generation
An origin server with a clock (as defined in Section 5.6.7) MUST NOT
generate a Last-Modified date that is later than the server's time of
message origination (Date, Section 6.6.1). 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.
8.8.2.2. Comparison
or
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.
8.8.3. ETag
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.
ETag = entity-tag
ETag: "xyzzy"
ETag: W/"xyzzy"
ETag: ""
8.8.3.1. Generation
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.
8.8.3.2. Comparison
"Strong comparison": two entity tags are equivalent if both are not
weak and their opaque-tags match character-by-character.
The example below shows the results for a set of entity tag pairs and
both the weak and strong comparison function results:
+========+========+===================+=================+
| ETag 1 | ETag 2 | Strong Comparison | Weak Comparison |
+========+========+===================+=================+
| W/"1" | W/"1" | no match | match |
+--------+--------+-------------------+-----------------+
| W/"1" | W/"2" | no match | no match |
+--------+--------+-------------------+-----------------+
| W/"1" | "1" | no match | match |
+--------+--------+-------------------+-----------------+
| "1" | "1" | match | match |
+--------+--------+-------------------+-----------------+
Table 3
>> Request:
In this case, the response might or might not use the gzip content
coding. If it does not, the response might look like:
>> Response:
HTTP/1.1 200 OK
Date: Fri, 26 Mar 2010 00:05:00 GMT
ETag: "123-a"
Content-Length: 70
Vary: Accept-Encoding
Content-Type: text/plain
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
>> Response:
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
...binary data...
| *Note:* Content codings are a property of the representation
| data, so a strong entity tag for a content-encoded
| representation has to be distinct from the entity tag of an
| unencoded representation to prevent potential conflicts during
| cache updates and range requests. In contrast, transfer
| codings (Section 7 of [HTTP/1.1]) apply only during message
| transfer and do not result in distinct entity tags.
9. Methods
9.1. Overview
method = token
+=========+============================================+=========+
| Method | Description | Section |
| Name | | |
+=========+============================================+=========+
| GET | Transfer a current representation of the | 9.3.1 |
| | target resource. | |
+---------+--------------------------------------------+---------+
| HEAD | Same as GET, but do not transfer the | 9.3.2 |
| | response content. | |
+---------+--------------------------------------------+---------+
| POST | Perform resource-specific processing on | 9.3.3 |
| | the request content. | |
+---------+--------------------------------------------+---------+
| PUT | Replace all current representations of the | 9.3.4 |
| | target resource with the request content. | |
+---------+--------------------------------------------+---------+
| DELETE | Remove all current representations of the | 9.3.5 |
| | target resource. | |
+---------+--------------------------------------------+---------+
| CONNECT | Establish a tunnel to the server | 9.3.6 |
| | identified by the target resource. | |
+---------+--------------------------------------------+---------+
| OPTIONS | Describe the communication options for the | 9.3.7 |
| | target resource. | |
+---------+--------------------------------------------+---------+
| TRACE | Perform a message loop-back test along the | 9.3.8 |
| | path to the target resource. | |
+---------+--------------------------------------------+---------+
Table 4
All general-purpose servers MUST support the methods GET and HEAD.
All other methods are OPTIONAL.
A user agent SHOULD distinguish between safe and unsafe methods when
presenting potential actions to a user, such that the user can be
made aware of an unsafe action before it is requested.
For a cache to store and use a response, the associated method needs
to explicitly allow caching and to detail under what conditions a
response can be used to satisfy subsequent requests; a method
definition that does not do so cannot be cached. For additional
requirements see [CACHING].
This specification defines caching semantics for GET, HEAD, and POST,
although the overwhelming majority of cache implementations only
support GET and HEAD.
9.3.1. GET
9.3.2. HEAD
The HEAD method is identical to GET except that the server MUST NOT
send content in the response. HEAD is used to obtain metadata about
the selected representation without transferring its representation
data, often for the sake of testing hypertext links or finding recent
modifications.
The server SHOULD send the same header fields in response to a HEAD
request as it would have sent if the request method had been GET.
However, a server MAY omit header fields for which a value is
determined only while generating the content. For example, some
servers buffer a dynamic response to GET until a minimum amount of
data is generated so that they can more efficiently delimit small
responses or make late decisions with regard to content selection.
Such a response to GET might contain Content-Length and Vary fields,
for example, that are not generated within a HEAD response. These
minor inconsistencies are considered preferable to generating and
discarding the content for a HEAD request, since HEAD is usually
requested for the sake of efficiency.
9.3.3. POST
The POST method requests that the target resource process the
representation enclosed in the request according to the resource's
own specific semantics. For example, POST is used for the following
functions (among others):
9.3.4. PUT
The PUT method requests that the state of the target resource be
created or replaced with the state defined by the representation
enclosed in the request message content. A successful PUT of a given
representation would suggest that a subsequent GET on that same
target resource will result in an equivalent representation being
sent in a 200 (OK) response. However, there is no guarantee that
such a state change will be observable, since the target resource
might be acted upon by other user agents in parallel, or might be
subject to dynamic processing by the origin server, before any
subsequent GET is received. A successful response only implies that
the user agent's intent was achieved at the time of its processing by
the origin server.
If the target resource does not have a current representation and the
PUT successfully creates one, then the origin server MUST inform the
user agent by sending a 201 (Created) response. If the target
resource does have a current representation and that representation
is successfully modified in accordance with the state of the enclosed
representation, then the origin server MUST send either a 200 (OK) or
a 204 (No Content) response to indicate successful completion of the
request.
HTTP does not define exactly how a PUT method affects the state of an
origin server beyond what can be expressed by the intent of the user
agent request and the semantics of the origin server response. It
does not define what a resource might be, in any sense of that word,
beyond the interface provided via HTTP. It does not define how
resource state is "stored", nor how such storage might change as a
result of a change in resource state, nor how the origin server
translates resource state into representations. Generally speaking,
all implementation details behind the resource interface are
intentionally hidden by the server.
This extends to how header and trailer fields are stored; while
common header fields like Content-Type will typically be stored and
returned upon subsequent GET requests, header and trailer field
handling is specific to the resource that received the request. As a
result, an origin server SHOULD ignore unrecognized header and
trailer fields received in a PUT request (i.e., not save them as part
of the resource state).
An origin server MUST NOT send a validator field (Section 8.8), such
as an ETag or Last-Modified field, in a successful response to PUT
unless the request's representation data was saved without any
transformation applied to the content (i.e., the resource's new
representation data is identical to the content received in the PUT
request) and the validator field value reflects the new
representation. This requirement allows a user agent to know when
the representation it sent (and retains in memory) is the result of
the PUT, and thus it doesn't need to be retrieved again from the
origin server. The new validator(s) received in the response can be
used for future conditional requests in order to prevent accidental
overwrites (Section 13.1).
A PUT request applied to the target resource can have side effects on
other resources. For example, an article might have a URI for
identifying "the current version" (a resource) that is separate from
the URIs identifying each particular version (different resources
that at one point shared the same state as the current version
resource). A successful PUT request on "the current version" URI
might therefore create a new version resource in addition to changing
the state of the target resource, and might also cause links to be
added between the related resources.
9.3.5. DELETE
The DELETE method requests that the origin server remove the
association between the target resource and its current
functionality. In effect, this method is similar to the "rm" command
in UNIX: it expresses a deletion operation on the URI mapping of the
origin server rather than an expectation that the previously
associated information be deleted.
Relatively few resources allow the DELETE method -- its primary use
is for remote authoring environments, where the user has some
direction regarding its effect. For example, a resource that was
previously created using a PUT request, or identified via the
Location header field after a 201 (Created) response to a POST
request, might allow a corresponding DELETE request to undo those
actions. Similarly, custom user agent implementations that implement
an authoring function, such as revision control clients using HTTP
for remote operations, might use DELETE based on an assumption that
the server's URI space has been crafted to correspond to a version
repository.
* a 202 (Accepted) status code if the action will likely succeed but
has not yet been enacted,
* a 204 (No Content) status code if the action has been enacted and
no further information is to be supplied, or
* a 200 (OK) status code if the action has been enacted and the
response message includes a representation describing the status.
9.3.6. CONNECT
Any 2xx (Successful) response indicates that the sender (and all
inbound proxies) will switch to tunnel mode immediately after the
response header section; data received after that header section is
from the server identified by the request target. Any response other
than a successful response indicates that the tunnel has not yet been
formed.
9.3.7. OPTIONS
9.3.8. TRACE
TRACE allows the client to see what is being received at the other
end of the request chain and use that data for testing or diagnostic
information. The value of the Via header field (Section 7.6.3) is of
particular interest, since it acts as a trace of the request chain.
Use of the Max-Forwards header field allows the client to limit the
length of the request chain, which is useful for testing a chain of
proxies forwarding messages in an infinite loop.
10.1.1. Expect
Expect = #expectation
expectation = token [ "=" ( token / quoted-string ) parameters ]
* A server that responds with a final status code before reading the
entire request content SHOULD indicate whether it intends to close
the connection (e.g., see Section 9.6 of [HTTP/1.1]) or continue
reading the request content.
The origin server MUST NOT wait for the content before sending the
100 (Continue) response.
10.1.2. From
From = mailbox
An example is:
From: [email protected]
A robotic user agent SHOULD send a valid From header field so that
the person responsible for running the robot can be contacted if
problems occur on servers, such as if the robot is sending excessive,
unwanted, or invalid requests.
A server SHOULD NOT use the From header field for access control or
authentication, since its value is expected to be visible to anyone
receiving or observing the request and is often recorded within
logfiles and error reports without any expectation of privacy.
10.1.3. Referer
The "Referer" [sic] header field allows the user agent to specify a
URI reference for the resource from which the target URI was obtained
(i.e., the "referrer", though the field name is misspelled). A user
agent MUST NOT include the fragment and userinfo components of the
URI reference [URI], if any, when generating the Referer field value.
Example:
Referer: http://www.example.org/hypertext/Overview.html
If the target URI was obtained from a source that does not have its
own URI (e.g., input from the user keyboard, or an entry within the
user's bookmarks/favorites), the user agent MUST either exclude the
Referer header field or send it with a value of "about:blank".
The Referer header field value need not convey the full URI of the
referring resource; a user agent MAY truncate parts other than the
referring origin.
10.1.4. TE
The TE field value is a list of members, with each member (aside from
"trailers") consisting of a transfer coding name token with an
optional weight indicating the client's relative preference for that
transfer coding (Section 12.4.2) and optional parameters for that
transfer coding.
TE = #t-codings
t-codings = "trailers" / ( transfer-coding [ weight ] )
transfer-coding = token *( OWS ";" OWS transfer-parameter )
transfer-parameter = token BWS "=" BWS ( token / quoted-string )
10.1.5. User-Agent
Example:
10.2.1. Allow
Allow = #method
Example of use:
Allow: GET, HEAD, PUT
A proxy MUST NOT modify the Allow header field -- it does not need to
understand all of the indicated methods in order to handle them
according to the generic message handling rules.
10.2.2. Location
Location = URI-reference
For 201 (Created) responses, the Location value refers to the primary
resource created by the request. For 3xx (Redirection) responses,
the Location value refers to the preferred target resource for
automatically redirecting the request.
Location: /People.html#tim
Location: http://www.example.net/index.html
10.2.3. Retry-After
Servers send the "Retry-After" header field to indicate how long the
user agent ought to wait before making a follow-up request. When
sent with a 503 (Service Unavailable) response, Retry-After indicates
how long the service is expected to be unavailable to the client.
When sent with any 3xx (Redirection) response, Retry-After indicates
the minimum time that the user agent is asked to wait before issuing
the redirected request.
delay-seconds = 1*DIGIT
10.2.4. Server
Example:
auth-scheme = token
Aside from the general framework, this document does not specify any
authentication schemes. New and existing authentication schemes are
specified independently and ought to be registered within the
"Hypertext Transfer Protocol (HTTP) Authentication Scheme Registry".
For example, the "basic" and "digest" authentication schemes are
defined by [RFC7617] and [RFC7616], respectively.
11.4. Credentials
Note that various custom mechanisms for user authentication use the
Set-Cookie and Cookie header fields, defined in [COOKIE], for passing
tokens related to authentication.
The protection space determines the domain over which credentials can
be automatically applied. If a prior request has been authorized,
the user agent MAY reuse the same credentials for all other requests
within that protection space for a period of time determined by the
authentication scheme, parameters, and/or user preferences (such as a
configurable inactivity timeout).
11.6.1. WWW-Authenticate
WWW-Authenticate = #challenge
User agents are advised to take special care in parsing the field
value, as it might contain more than one challenge, and each
challenge can contain a comma-separated list of authentication
parameters. Furthermore, the header field itself can occur multiple
times.
For instance:
This header field contains two challenges, one for the "Basic" scheme
with a realm value of "simple" and another for the "Newauth" scheme
with a realm value of "apps". It also contains two additional
parameters, "type" and "title".
11.6.2. Authorization
Authorization = credentials
11.6.3. Authentication-Info
Authentication-Info = #auth-param
11.7.1. Proxy-Authenticate
Proxy-Authenticate = #challenge
11.7.2. Proxy-Authorization
Proxy-Authorization = credentials
11.7.3. Proxy-Authentication-Info
Proxy-Authentication-Info = #auth-param
Note that, in all cases, HTTP is not aware of the resource semantics.
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.
12.4.1. Absence
For each of the content negotiation fields, a request that does not
contain the field implies that the sender has no preference on that
dimension of negotiation.
A sender of qvalue MUST NOT generate more than three digits after the
decimal point. User configuration of these values ought to be
limited in the same fashion.
12.4.3. Wildcard Values
12.5.1. Accept
The "Accept" header field can be used by user agents to specify their
preferences regarding response media types. For example, Accept
header fields can be used to indicate that the request is
specifically limited to a small set of desired types, as in the case
of a request for an in-line image.
media-range = ( "*/*"
/ ( type "/" "*" )
/ ( type "/" subtype )
) parameters
The asterisk "*" character is used to group media types into ranges,
with "*/*" indicating all media types and "type/*" indicating all
subtypes of that type. The media-range can include media type
parameters that are applicable to that range.
The example
1. text/plain;format=flowed
2. text/plain
3. text/*
4. */*
+==========================+===============+
| Media Type | Quality Value |
+==========================+===============+
| text/plain;format=flowed | 1 |
+--------------------------+---------------+
| text/plain | 0.7 |
+--------------------------+---------------+
| text/html | 0.3 |
+--------------------------+---------------+
| image/jpeg | 0.5 |
+--------------------------+---------------+
| text/plain;format=fixed | 0.4 |
+--------------------------+---------------+
| text/html;level=3 | 0.7 |
+--------------------------+---------------+
Table 5
12.5.2. Accept-Charset
12.5.3. Accept-Encoding
Examples:
12.5.4. Accept-Language
would mean: "I prefer Danish, but will accept British English and
other types of English".
Note that some recipients treat the order in which language tags are
listed as an indication of descending priority, particularly for tags
that are assigned equal quality values (no value is the same as q=1).
However, this behavior cannot be relied upon. For consistency and to
maximize interoperability, many user agents assign each language tag
a unique quality value while also listing them in order of decreasing
quality. Additional discussion of language priority lists can be
found in Section 2.3 of [RFC4647].
12.5.5. Vary
A list containing the member "*" signals that other aspects of the
request might have played a role in selecting the response
representation, possibly including aspects outside the message syntax
(e.g., the client's network address). A recipient will not be able
to determine whether this response is appropriate for a later request
without forwarding the request to the origin server. A proxy MUST
NOT generate "*" in a Vary field value.
indicates that the origin server might have used the request's
Accept-Encoding and Accept-Language header fields (or lack thereof)
as determining factors while choosing the content for this response.
1. To inform cache recipients that they MUST NOT use this response
to satisfy a later request unless the later request has the same
values for the listed header fields as the original request
(Section 4.1 of [CACHING]) or reuse of the response has been
validated by the origin server. In other words, Vary expands the
cache key required to match a new request to the stored cache
entry.
Conditional GET requests are the most efficient mechanism for HTTP
cache updates [CACHING]. Conditionals can also be applied to state-
changing methods, such as PUT and DELETE, to prevent the "lost
update" problem: one client accidentally overwriting the work of
another client that has been acting in parallel.
13.1. Preconditions
13.1.1. If-Match
Examples:
If-Match: "xyzzy"
If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
If-Match: *
Note that an If-Match header field with a list value containing "*"
and other values (including other instances of "*") is syntactically
invalid (therefore not allowed to be generated) and furthermore is
unlikely to be interoperable.
13.1.2. If-None-Match
Examples:
If-None-Match: "xyzzy"
If-None-Match: W/"xyzzy"
If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
If-None-Match: *
13.1.3. If-Modified-Since
If-Modified-Since = HTTP-date
When used for cache updates, a cache will typically use the value of
the cached message's Last-Modified header field to generate the field
value of If-Modified-Since. This behavior is most interoperable for
cases where clocks are poorly synchronized or when the server has
chosen to only honor exact timestamp matches (due to a problem with
Last-Modified dates that appear to go "back in time" when the origin
server's clock is corrected or a representation is restored from an
archived backup). However, caches occasionally generate the field
value based on other data, such as the Date header field of the
cached message or the clock time at which the message was received,
particularly when the cached message does not contain a Last-Modified
header field.
13.1.4. If-Unmodified-Since
If-Unmodified-Since = HTTP-date
13.1.5. If-Range
A server that is not the origin server for the target resource and
cannot act as a cache for requests on the target resource MUST NOT
evaluate the conditional request header fields defined by this
specification, and it MUST forward them if the request is forwarded,
since the generating client intends that they be evaluated by a
server that can provide a current representation. Likewise, a server
MUST ignore the conditional request header fields defined by this
specification when received with a request method that does not
involve the selection or modification of a selected representation,
such as CONNECT, OPTIONS, or TRACE.
Note that protocol extensions can modify the conditions under which
preconditions are evaluated or the consequences of their evaluation.
For example, the immutable cache directive (defined by [RFC8246])
instructs caches to forgo forwarding conditional requests when they
hold a fresh response.
5. When the method is GET and both Range and If-Range are present,
evaluate the If-Range precondition:
* otherwise, ignore the Range header field and respond 200 (OK)
6. Otherwise,
range-unit = token
bytes=0-499
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).
bytes=-500
Or:
bytes=9500-
bytes=0-0,-1
bytes=500-600,601-999
bytes=500-700,601-999
14.2. Range
Range = ranges-specifier
A server MAY ignore the Range header field. However, origin servers
and intermediate caches ought to support byte ranges when possible,
since they support efficient recovery from partially failed transfers
and partial retrieval of large representations.
A server that supports range requests MAY ignore a Range header field
when the selected representation has no content (i.e., the selected
representation's data is of zero length).
If all of the preconditions are true, the server supports the Range
header field for the target resource, the received Range field-value
contains a valid ranges-specifier with a range-unit supported for
that target resource, and that ranges-specifier is satisfiable with
respect to the selected representation, the server SHOULD send a 206
(Partial Content) response with content containing one or more
partial representations that correspond to the satisfiable
range-spec(s) requested.
The above does not imply that a server will send all requested
ranges. In some cases, it may only be possible (or efficient) to
send a portion of the requested ranges first, while expecting the
client to re-request the remaining portions later if they are still
desired (see Section 15.3.7).
If all of the preconditions are true, the server supports the Range
header field for the target resource, the received Range field-value
contains a valid ranges-specifier, and either the range-unit is not
supported for that target resource or the ranges-specifier is
unsatisfiable with respect to the selected representation, the server
SHOULD send a 416 (Range Not Satisfiable) response.
14.3. Accept-Ranges
Accept-Ranges = acceptable-ranges
acceptable-ranges = 1#range-unit
Accept-Ranges: bytes
A server that does not support any kind of range request for the
target resource MAY send
Accept-Ranges: none
14.4. Content-Range
Content-Range = range-unit SP
( range-resp / unsatisfied-range )
complete-length = 1*DIGIT
For byte ranges, a sender SHOULD indicate the complete length of the
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 Content-Range header field has no meaning for status codes that
do not explicitly describe its semantic. For this specification,
only the 206 (Partial Content) and 416 (Range Not Satisfiable) status
codes describe a meaning for Content-Range.
An origin server SHOULD respond with a 400 (Bad Request) status code
if it receives Content-Range on a PUT for a target resource that does
not support partial PUT requests.
Implementation Notes:
--THIS_STRING_SEPARATES
Content-Type: video/example
Content-Range: exampleunit 1.2-4.3/25
Person and email address to contact for further information: See Aut
hors' Addresses section.
The first digit of the status code defines the class of response.
The last two digits do not have any categorization role. There are
five values for the first digit:
The status codes listed below are defined in this specification. The
reason phrases listed here are only recommendations -- they can be
replaced by local equivalents or left out altogether without
affecting the protocol.
Responses with status codes that are defined as heuristically
cacheable (e.g., 200, 203, 204, 206, 300, 301, 308, 404, 405, 410,
414, and 501 in this specification) can be reused by a cache with
heuristic expiration unless otherwise indicated by the method
definition or explicit cache controls [CACHING]; all other status
codes are not heuristically cacheable.
A proxy MUST forward 1xx responses unless the proxy itself requested
the generation of the 1xx response. For example, if a proxy adds an
"Expect: 100-continue" header field when it forwards a request, then
it need not forward the corresponding 100 (Continue) response(s).
The 100 (Continue) status code indicates that the initial part of a
request has been received and has not yet been rejected by the
server. The server intends to send a final response after the
request has been fully received and acted upon.
If the request did not contain an Expect header field containing the
100-continue expectation, the client can simply discard this interim
response.
The 101 (Switching Protocols) status code indicates that the server
understands and is willing to comply with the client's request, via
the Upgrade header field (Section 7.8), for a change in the
application protocol being used on this connection. The server MUST
generate an Upgrade header field in the response that indicates which
protocol(s) will be in effect after this response.
It is assumed that the server will only agree to switch protocols
when it is advantageous to do so. For example, switching to a newer
version of HTTP might be advantageous over older versions, and
switching to a real-time, synchronous protocol might be advantageous
when delivering resources that use such features.
The 2xx (Successful) class of status code indicates that the client's
request was successfully received, understood, and accepted.
15.3.1. 200 OK
The 200 (OK) status code indicates that the request has succeeded.
The content sent in a 200 response depends on the request method.
For the methods defined by this specification, the intended meaning
of the content can be summarized as:
+================+============================================+
| Request Method | Response content is a representation of: |
+================+============================================+
| GET | the target resource |
+----------------+--------------------------------------------+
| HEAD | the target resource, like GET, but without |
| | transferring the representation data |
+----------------+--------------------------------------------+
| POST | the status of, or results obtained from, |
| | the action |
+----------------+--------------------------------------------+
| PUT, DELETE | the status of the action |
+----------------+--------------------------------------------+
| OPTIONS | communication options for the target |
| | resource |
+----------------+--------------------------------------------+
| TRACE | the request message as received by the |
| | server returning the trace |
+----------------+--------------------------------------------+
Table 6
The 201 (Created) status code indicates that the request has been
fulfilled and has resulted in one or more new resources being
created. The primary resource created by the request is identified
by either a Location header field in the response or, if no Location
header field is received, by the target URI.
The 202 (Accepted) status code indicates that the request has been
accepted for processing, but the processing has not been completed.
The request might or might not eventually be acted upon, as it might
be disallowed when processing actually takes place. There is no
facility in HTTP for re-sending a status code from an asynchronous
operation.
The 204 (No Content) status code indicates that the server has
successfully fulfilled the request and that there is no additional
content to send in the response content. Metadata in the response
header fields refer to the target resource and its selected
representation after the requested action was applied.
For example, if a 204 status code is received in response to a PUT
request and the response contains an ETag field, then the PUT was
successful and the ETag field value contains the entity tag for the
new representation of that target resource.
The 204 response allows a server to indicate that the action has been
successfully applied to the target resource, while implying that the
user agent does not need to traverse away from its current "document
view" (if any). The server assumes that the user agent will provide
some indication of the success to its user, in accord with its own
interface, and apply any new or updated metadata in the response to
its active representation.
For example, a 204 status code is commonly used with document editing
interfaces corresponding to a "save" action, such that the document
being saved remains available to the user for editing. It is also
frequently used with interfaces that expect automated data transfers
to be prevalent, such as within distributed version control systems.
The 205 (Reset Content) status code indicates that the server has
fulfilled the request and desires that the user agent reset the
"document view", which caused the request to be sent, to its original
state as received from the origin server.
Since the 205 status code implies that no additional content will be
provided, a server MUST NOT generate content in a 205 response.
The 206 (Partial Content) status code indicates that the server is
successfully fulfilling a range request for the target resource by
transferring one or more parts of the selected representation.
Within the header area of each body part in the multipart content,
the server MUST generate a Content-Range header field corresponding
to the range being enclosed in that body part. If the selected
representation would have had a Content-Type header field in a 200
(OK) response, the server SHOULD generate that same Content-Type
header field in the header area of each body part. For example:
--THIS_STRING_SEPARATES
Content-Type: application/pdf
Content-Range: bytes 500-999/8000
When multiple ranges are requested, a server MAY coalesce any of the
ranges that overlap, or that are separated by a gap that is smaller
than the overhead of sending multiple parts, regardless of the order
in which the corresponding range-spec appeared in the received Range
header field. Since the typical overhead between each part of a
"multipart/byteranges" is around 80 bytes, depending on the selected
representation's media type and the chosen boundary parameter length,
it can be less efficient to transfer many small disjoint parts than
it is to transfer the entire selected representation.
1. Replace the target URI with the URI referenced by the redirection
response's Location header field value after resolving it
relative to the original request's target URI.
The 300 (Multiple Choices) status code indicates that the target
resource has more than one representation, each with its own more
specific identifier, and information about the alternatives is being
provided so that the user (or user agent) can select a preferred
representation by redirecting its request to one or more of those
identifiers. In other words, the server desires that the user agent
engage in reactive negotiation to select the most appropriate
representation(s) for its needs (Section 12).
For request methods other than HEAD, the server SHOULD generate
content in the 300 response containing a list of representation
metadata and URI reference(s) from which the user or user agent can
choose the one most preferred. The user agent MAY make a selection
from that list automatically if it understands the provided media
type. A specific format for automatic selection is not defined by
this specification because HTTP tries to remain orthogonal to the
definition of its content. In practice, the representation is
provided in some easily parsed format believed to be acceptable to
the user agent, as determined by shared design or content
negotiation, or in some commonly accepted hypertext format.
| *Note:* The original proposal for the 300 status code defined
| the URI header field as providing a list of alternative
| representations, such that it would be usable for 200, 300, and
| 406 responses and be transferred in responses to the HEAD
| method. However, lack of deployment and disagreement over
| syntax led to both URI and Alternates (a subsequent proposal)
| being dropped from this specification. It is possible to
| communicate the list as a Link header field value [RFC8288]
| whose members have a relationship of "alternate", though
| deployment is a chicken-and-egg problem.
The 301 (Moved Permanently) status code indicates that the target
resource has been assigned a new permanent URI and any future
references to this resource ought to use one of the enclosed URIs.
The server is suggesting that a user agent with link-editing
capability can permanently replace references to the target URI with
one of the new references sent by the server. However, this
suggestion is usually ignored unless the user agent is actively
editing references (e.g., engaged in authoring content), the
connection is secured, and the origin server is a trusted authority
for the content being edited.
The 302 (Found) status code indicates that the target resource
resides temporarily under a different URI. Since the redirection
might be altered on occasion, the client ought to continue to use the
target URI for future requests.
The 303 (See Other) status code indicates that the server is
redirecting the user agent to a different resource, as indicated by a
URI in the Location header field, which is intended to provide an
indirect response to the original request. A user agent can perform
a retrieval request targeting that URI (a GET or HEAD request if
using HTTP), which might also be redirected, and present the eventual
result as an answer to the original request. Note that the new URI
in the Location header field is not considered equivalent to the
target URI.
A 303 response to a GET request indicates that the origin server does
not have a representation of the target resource that can be
transferred by the server over HTTP. However, the Location field
value refers to a resource that is descriptive of the target
resource, such that making a retrieval request on that other resource
might result in a representation that is useful to recipients without
implying that it represents the original target resource. Note that
answers to the questions of what can be represented, what
representations are adequate, and what might be a useful description
are outside the scope of HTTP.
The 304 (Not Modified) status code indicates that a conditional GET
or HEAD request has been received and would have resulted in a 200
(OK) response if it were not for the fact that the condition
evaluated to false. In other words, there is no need for the server
to transfer a representation of the target resource because the
request indicates that the client, which made the request
conditional, already has a valid representation; the server is
therefore redirecting the client to make use of that stored
representation as if it were the content of a 200 (OK) response.
The 305 (Use Proxy) status code was defined in a previous version of
this specification and is now deprecated (Appendix B of [RFC7231]).
The 307 (Temporary Redirect) status code indicates that the target
resource resides temporarily under a different URI and the user agent
MUST NOT change the request method if it performs an automatic
redirection to that URI. Since the redirection can change over time,
the client ought to continue using the original target URI for future
requests.
The 308 (Permanent Redirect) status code indicates that the target
resource has been assigned a new permanent URI and any future
references to this resource ought to use one of the enclosed URIs.
The server is suggesting that a user agent with link-editing
capability can permanently replace references to the target URI with
one of the new references sent by the server. However, this
suggestion is usually ignored unless the user agent is actively
editing references (e.g., engaged in authoring content), the
connection is secured, and the origin server is a trusted authority
for the content being edited.
| *Note:* This status code is much younger (June 2014) than its
| sibling codes and thus might not be recognized everywhere. See
| Section 4 of [RFC7538] for deployment considerations.
The 4xx (Client Error) class of status code indicates that the client
seems to have erred. Except when responding to a HEAD request, the
server SHOULD send a representation containing an explanation of the
error situation, and whether it is a temporary or permanent
condition. These status codes are applicable to any request method.
User agents SHOULD display any included representation to the user.
The 400 (Bad Request) status code indicates that the server cannot or
will not process the request due to something that is perceived to be
a client error (e.g., malformed request syntax, invalid request
message framing, or deceptive request routing).
The 401 (Unauthorized) status code indicates that the request has not
been applied because it lacks valid authentication credentials for
the target resource. The server generating a 401 response MUST send
a WWW-Authenticate header field (Section 11.6.1) containing at least
one challenge applicable to the target resource.
The 402 (Payment Required) status code is reserved for future use.
The 403 (Forbidden) status code indicates that the server understood
the request but refuses to fulfill it. A server that wishes to make
public why the request has been forbidden can describe that reason in
the response content (if any).
The 404 (Not Found) status code indicates that the origin server did
not find a current representation for the target resource or is not
willing to disclose that one exists. A 404 status code does not
indicate whether this lack of representation is temporary or
permanent; the 410 (Gone) status code is preferred over 404 if the
origin server knows, presumably through some configurable means, that
the condition is likely to be permanent.
The 405 (Method Not Allowed) status code indicates that the method
received in the request-line is known by the origin server but not
supported by the target resource. The origin server MUST generate an
Allow header field in a 405 response containing a list of the target
resource's currently supported methods.
The 406 (Not Acceptable) status code indicates that the target
resource does not have a current representation that would be
acceptable to the user agent, according to the proactive negotiation
header fields received in the request (Section 12.1), and the server
is unwilling to supply a default representation.
The 408 (Request Timeout) status code indicates that the server did
not receive a complete request message within the time that it was
prepared to wait.
The 409 (Conflict) status code indicates that the request could not
be completed due to a conflict with the current state of the target
resource. This code is used in situations where the user might be
able to resolve the conflict and resubmit the request. The server
SHOULD generate content that includes enough information for a user
to recognize the source of the conflict.
The 410 (Gone) status code indicates that access to the target
resource is no longer available at the origin server and that this
condition is likely to be permanent. If the origin server does not
know, or has no facility to determine, whether or not the condition
is permanent, the status code 404 (Not Found) ought to be used
instead.
The 411 (Length Required) status code indicates that the server
refuses to accept the request without a defined Content-Length
(Section 8.6). The client MAY repeat the request if it adds a valid
Content-Length header field containing the length of the request
content.
The 412 (Precondition Failed) status code indicates that one or more
conditions given in the request header fields evaluated to false when
tested on the server (Section 13). This response status code allows
the client to place preconditions on the current resource state (its
current representations and metadata) and, thus, prevent the request
method from being applied if the target resource is in an unexpected
state.
The 413 (Content Too Large) status code indicates that the server is
refusing to process a request because the request content is larger
than the server is willing or able to process. The server MAY
terminate the request, if the protocol version in use allows it;
otherwise, the server MAY close the connection.
The 414 (URI Too Long) status code indicates that the server is
refusing to service the request because the target URI is longer than
the server is willing to interpret. This rare condition is only
likely to occur when a client has improperly converted a POST request
to a GET request with long query information, when the client has
descended into an infinite loop of redirection (e.g., a redirected
URI prefix that points to a suffix of itself) or when the server is
under attack by a client attempting to exploit potential security
holes.
The 415 (Unsupported Media Type) status code indicates that the
origin server is refusing to service the request because the content
is in a format not supported by this method on the target resource.
On the other hand, if the cause was an unsupported media type, the
Accept response header field (Section 12.5.1) can be used to indicate
which media types would have been accepted in the request.
The 416 (Range Not Satisfiable) status code indicates that the set of
ranges in the request's Range header field (Section 14.2) has been
rejected either because none of the requested ranges are satisfiable
or because the client has requested an excessive number of small or
overlapping ranges (a potential denial of service attack).
Each range unit defines what is required for its own range sets to be
satisfiable. For example, Section 14.1.2 defines what makes a bytes
range set satisfiable.
For example:
[RFC2324] was an April 1 RFC that lampooned the various ways HTTP was
abused; one such abuse was the definition of an application-specific
418 status code, which has been deployed as a joke often enough for
the code to be unusable for any future use.
Therefore, the 418 status code is reserved in the IANA HTTP Status
Code Registry. This indicates that the status code cannot be
assigned to other applications currently. If future circumstances
require its use (e.g., exhaustion of 4NN status codes), it can be re-
assigned to another use.
The 421 (Misdirected Request) status code indicates that the request
was directed at a server that is unable or unwilling to produce an
authoritative response for the target URI. An origin server (or
gateway acting on behalf of the origin server) sends 421 to reject a
target URI that does not match an origin for which the server has
been configured (Section 4.3.1) or does not match the connection
context over which the request was received (Section 7.4).
The 422 (Unprocessable Content) status code indicates that the server
understands the content type of the request content (hence a 415
(Unsupported Media Type) status code is inappropriate), and the
syntax of the request content is correct, but it was unable to
process the contained instructions. For example, this status code
can be sent if an XML request content contains well-formed (i.e.,
syntactically correct), but semantically erroneous XML instructions.
The 426 (Upgrade Required) status code indicates that the server
refuses to perform the request using the current protocol but might
be willing to do so after the client upgrades to a different
protocol. The server MUST send an Upgrade header field in a 426
response to indicate the required protocol(s) (Section 7.8).
Example:
The 5xx (Server Error) class of status code indicates that the server
is aware that it has erred or is incapable of performing the
requested method. Except when responding to a HEAD request, the
server SHOULD send a representation containing an explanation of the
error situation, and whether it is a temporary or permanent
condition. A user agent SHOULD display any included representation
to the user. These status codes are applicable to any request
method.
The 500 (Internal Server Error) status code indicates that the server
encountered an unexpected condition that prevented it from fulfilling
the request.
The 501 (Not Implemented) status code indicates that the server does
not support the functionality required to fulfill the request. This
is the appropriate response when the server does not recognize the
request method and is not capable of supporting it for any resource.
The 502 (Bad Gateway) status code indicates that the server, while
acting as a gateway or proxy, received an invalid response from an
inbound server it accessed while attempting to fulfill the request.
The 503 (Service Unavailable) status code indicates that the server
is currently unable to handle the request due to a temporary overload
or scheduled maintenance, which will likely be alleviated after some
delay. The server MAY send a Retry-After header field
(Section 10.2.3) to suggest an appropriate amount of time for the
client to wait before retrying the request.
| *Note:* The existence of the 503 status code does not imply
| that a server has to use it when becoming overloaded. Some
| servers might simply refuse the connection.
The 504 (Gateway Timeout) status code indicates that the server,
while acting as a gateway or proxy, did not receive a timely response
from an upstream server it needed to access in order to complete the
request.
Likewise, new methods cannot use the special host:port and asterisk
forms of request target that are allowed for CONNECT and OPTIONS,
respectively (Section 7.1). A full URI in absolute form is needed
for the target URI, which means either the request target needs to be
sent in absolute form or the target URI will be reconstructed from
the request context in the same way it is for other methods.
* Short Description
New status codes are required to fall under one of the categories
defined in Section 15. To allow existing parsers to process the
response message, new status codes cannot disallow content, although
they can mandate a zero-length content.
Proposals for new status codes that are not yet widely deployed ought
to avoid allocating a specific number for the code until there is
clear consensus that it will be registered; instead, early drafts can
use a notation such as "4NN", or "3N0" .. "3N9", to indicate the
class of the proposed status code(s) without consuming a number
prematurely.
Field name:
The requested field name. It MUST conform to the field-name
syntax defined in Section 5.1, and it SHOULD be restricted to just
letters, digits, and hyphen ('-') characters, with the first
character being a letter.
Status:
"permanent", "provisional", "deprecated", or "obsoleted".
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. Optional but encouraged for provisional registrations.
An indication of the relevant section(s) can also be included, but
is not required.
And optionally:
HTTP header and trailer fields are a widely used extension point for
the protocol. While they can be used in an ad hoc fashion, fields
that are intended for wider use need to be carefully documented to
ensure interoperability.
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, and "Content-"
is used as explained in Section 6.4. These prefixes are only an aid
to recognizing the purpose of a field and do not trigger automatic
processing.
Authors are encouraged (but not required) to use either the ABNF
rules in this specification or those in [RFC8941] to define the
syntax of new field values.
For example, the Content-Type field value only allows commas inside
quoted strings, which can be reliably parsed even when multiple
values are present. The Location field value provides a counter-
example that should not be emulated: because URIs can include commas,
it is not possible to reliably distinguish between a single value
that includes a comma from two values.
* Notes (optional)
*Note:* The fact that the value syntax for the "realm" parameter
is restricted to quoted-string was a bad design choice not to be
repeated for new parameters.
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>.
* Name
* Description
* Name
* Description
For example, UNIX, Microsoft Windows, and other operating systems use
".." as a path component to indicate a directory level above the
current one, and they use specially named paths or file names to send
data to system devices. Similar naming conventions might exist
within other types of storage systems. Likewise, local storage
systems have an annoying tendency to prefer user-friendliness over
security when handling invalid or unexpected characters,
recomposition of decomposed characters, and case-normalization of
case-insensitive names.
A server can reject a message that has a target URI that is too long
(Section 15.5.15) or request content that is too large
(Section 15.5.14). Additional status codes related to capacity
limits have been defined by extensions to HTTP [RFC6585].
URIs are intended to be shared, not secured, even when they identify
secure resources. URIs are often shown on displays, added to
templates when a page is printed, and stored in a variety of
unprotected bookmark lists. Many servers, proxies, and user agents
log or display the target URI in places where it might be visible to
third parties. It is therefore unwise to include information within
a URI that is sensitive, personally identifiable, or a risk to
disclose.
Since the Referer header field tells a target site about the context
that resulted in a request, it has the potential to reveal
information about the user's immediate browsing history and any
personal information that might be found in the referring resource's
URI. Limitations on the Referer header field are described in
Section 10.1.3 to address some of its security considerations.
Although fragment identifiers used within URI references are not sent
in requests, implementers ought to be aware that they will be visible
to the user agent and any extensions or scripts running as a result
of the response. In particular, when a redirect occurs and the
original request's fragment identifier is inherited by the new
reference in Location (Section 10.2.2), this might have the effect of
disclosing one site's fragment to another site. If the first site
uses personal information in fragments, it ought to ensure that
redirects to other sites include a (possibly empty) fragment
component in order to block that inheritance.
An entity tag can be abused in ways that create privacy risks. For
example, a site might deliberately construct a semantically invalid
entity tag that is unique to the user or user agent, send it in a
cacheable response with a long freshness time, and then read that
entity tag in later conditional requests as a means of re-identifying
that user or user agent. Such an identifying tag would become a
persistent identifier for as long as the user agent retained the
original cache entry. User agents that cache representations ought
to ensure that the cache is cleared or replaced whenever the user
performs privacy-maintaining actions, such as clearing stored cookies
or changing to a private browsing mode.
+=========+======+============+=========+
| Method | Safe | Idempotent | Section |
+=========+======+============+=========+
| CONNECT | no | no | 9.3.6 |
+---------+------+------------+---------+
| DELETE | no | yes | 9.3.5 |
+---------+------+------------+---------+
| GET | yes | yes | 9.3.1 |
+---------+------+------------+---------+
| HEAD | yes | yes | 9.3.2 |
+---------+------+------------+---------+
| OPTIONS | yes | yes | 9.3.7 |
+---------+------+------------+---------+
| POST | no | no | 9.3.3 |
+---------+------+------------+---------+
| PUT | no | yes | 9.3.4 |
+---------+------+------------+---------+
| TRACE | yes | yes | 9.3.8 |
+---------+------+------------+---------+
| * | no | no | 18.2 |
+---------+------+------------+---------+
Table 7
The method name "*" is reserved because using "*" as a method name
would conflict with its usage as a wildcard in some fields (e.g.,
"Access-Control-Request-Method").
IANA has updated the "Hypertext Transfer Protocol (HTTP) Status Code
Registry" at <https://www.iana.org/assignments/http-status-codes>
with the registration procedure of Section 16.2.1 and the status code
values summarized in the following table.
+=======+===============================+=========+
| Value | Description | Section |
+=======+===============================+=========+
| 100 | Continue | 15.2.1 |
+-------+-------------------------------+---------+
| 101 | Switching Protocols | 15.2.2 |
+-------+-------------------------------+---------+
| 200 | OK | 15.3.1 |
+-------+-------------------------------+---------+
| 201 | Created | 15.3.2 |
+-------+-------------------------------+---------+
| 202 | Accepted | 15.3.3 |
+-------+-------------------------------+---------+
| 203 | Non-Authoritative Information | 15.3.4 |
+-------+-------------------------------+---------+
| 204 | No Content | 15.3.5 |
+-------+-------------------------------+---------+
| 205 | Reset Content | 15.3.6 |
+-------+-------------------------------+---------+
| 206 | Partial Content | 15.3.7 |
+-------+-------------------------------+---------+
| 300 | Multiple Choices | 15.4.1 |
+-------+-------------------------------+---------+
| 301 | Moved Permanently | 15.4.2 |
+-------+-------------------------------+---------+
| 302 | Found | 15.4.3 |
+-------+-------------------------------+---------+
| 303 | See Other | 15.4.4 |
+-------+-------------------------------+---------+
| 304 | Not Modified | 15.4.5 |
+-------+-------------------------------+---------+
| 305 | Use Proxy | 15.4.6 |
+-------+-------------------------------+---------+
| 306 | (Unused) | 15.4.7 |
+-------+-------------------------------+---------+
| 307 | Temporary Redirect | 15.4.8 |
+-------+-------------------------------+---------+
| 308 | Permanent Redirect | 15.4.9 |
+-------+-------------------------------+---------+
| 400 | Bad Request | 15.5.1 |
+-------+-------------------------------+---------+
| 401 | Unauthorized | 15.5.2 |
+-------+-------------------------------+---------+
| 402 | Payment Required | 15.5.3 |
+-------+-------------------------------+---------+
| 403 | Forbidden | 15.5.4 |
+-------+-------------------------------+---------+
| 404 | Not Found | 15.5.5 |
+-------+-------------------------------+---------+
| 405 | Method Not Allowed | 15.5.6 |
+-------+-------------------------------+---------+
| 406 | Not Acceptable | 15.5.7 |
+-------+-------------------------------+---------+
| 407 | Proxy Authentication Required | 15.5.8 |
+-------+-------------------------------+---------+
| 408 | Request Timeout | 15.5.9 |
+-------+-------------------------------+---------+
| 409 | Conflict | 15.5.10 |
+-------+-------------------------------+---------+
| 410 | Gone | 15.5.11 |
+-------+-------------------------------+---------+
| 411 | Length Required | 15.5.12 |
+-------+-------------------------------+---------+
| 412 | Precondition Failed | 15.5.13 |
+-------+-------------------------------+---------+
| 413 | Content Too Large | 15.5.14 |
+-------+-------------------------------+---------+
| 414 | URI Too Long | 15.5.15 |
+-------+-------------------------------+---------+
| 415 | Unsupported Media Type | 15.5.16 |
+-------+-------------------------------+---------+
| 416 | Range Not Satisfiable | 15.5.17 |
+-------+-------------------------------+---------+
| 417 | Expectation Failed | 15.5.18 |
+-------+-------------------------------+---------+
| 418 | (Unused) | 15.5.19 |
+-------+-------------------------------+---------+
| 421 | Misdirected Request | 15.5.20 |
+-------+-------------------------------+---------+
| 422 | Unprocessable Content | 15.5.21 |
+-------+-------------------------------+---------+
| 426 | Upgrade Required | 15.5.22 |
+-------+-------------------------------+---------+
| 500 | Internal Server Error | 15.6.1 |
+-------+-------------------------------+---------+
| 501 | Not Implemented | 15.6.2 |
+-------+-------------------------------+---------+
| 502 | Bad Gateway | 15.6.3 |
+-------+-------------------------------+---------+
| 503 | Service Unavailable | 15.6.4 |
+-------+-------------------------------+---------+
| 504 | Gateway Timeout | 15.6.5 |
+-------+-------------------------------+---------+
| 505 | HTTP Version Not Supported | 15.6.6 |
+-------+-------------------------------+---------+
Table 8
IANA has moved all entries in the "Permanent Message Header Field
Names" and "Provisional Message Header Field Names" registries (see
<https://www.iana.org/assignments/message-headers/>) with the
protocol 'http' to this registry and has applied the following
changes:
IANA has annotated the "Permanent Message Header Field Names" and
"Provisional Message Header Field Names" registries with the
following note to indicate that HTTP field name registrations have
moved:
| *Note*
|
| HTTP field name registrations have been moved to
| [https://www.iana.org/assignments/http-fields] per [RFC9110].
IANA has updated the "Hypertext Transfer Protocol (HTTP) Field Name
Registry" with the field names listed in the following table.
+===========================+============+=========+============+
| Field Name | Status | Section | Comments |
+===========================+============+=========+============+
| Accept | permanent | 12.5.1 | |
+---------------------------+------------+---------+------------+
| Accept-Charset | deprecated | 12.5.2 | |
+---------------------------+------------+---------+------------+
| Accept-Encoding | permanent | 12.5.3 | |
+---------------------------+------------+---------+------------+
| Accept-Language | permanent | 12.5.4 | |
+---------------------------+------------+---------+------------+
| Accept-Ranges | permanent | 14.3 | |
+---------------------------+------------+---------+------------+
| Allow | permanent | 10.2.1 | |
+---------------------------+------------+---------+------------+
| Authentication-Info | permanent | 11.6.3 | |
+---------------------------+------------+---------+------------+
| Authorization | permanent | 11.6.2 | |
+---------------------------+------------+---------+------------+
| Connection | permanent | 7.6.1 | |
+---------------------------+------------+---------+------------+
| Content-Encoding | permanent | 8.4 | |
+---------------------------+------------+---------+------------+
| Content-Language | permanent | 8.5 | |
+---------------------------+------------+---------+------------+
| Content-Length | permanent | 8.6 | |
+---------------------------+------------+---------+------------+
| Content-Location | permanent | 8.7 | |
+---------------------------+------------+---------+------------+
| Content-Range | permanent | 14.4 | |
+---------------------------+------------+---------+------------+
| Content-Type | permanent | 8.3 | |
+---------------------------+------------+---------+------------+
| Date | permanent | 6.6.1 | |
+---------------------------+------------+---------+------------+
| ETag | permanent | 8.8.3 | |
+---------------------------+------------+---------+------------+
| Expect | permanent | 10.1.1 | |
+---------------------------+------------+---------+------------+
| From | permanent | 10.1.2 | |
+---------------------------+------------+---------+------------+
| Host | permanent | 7.2 | |
+---------------------------+------------+---------+------------+
| If-Match | permanent | 13.1.1 | |
+---------------------------+------------+---------+------------+
| If-Modified-Since | permanent | 13.1.3 | |
+---------------------------+------------+---------+------------+
| If-None-Match | permanent | 13.1.2 | |
+---------------------------+------------+---------+------------+
| If-Range | permanent | 13.1.5 | |
+---------------------------+------------+---------+------------+
| If-Unmodified-Since | permanent | 13.1.4 | |
+---------------------------+------------+---------+------------+
| Last-Modified | permanent | 8.8.2 | |
+---------------------------+------------+---------+------------+
| Location | permanent | 10.2.2 | |
+---------------------------+------------+---------+------------+
| Max-Forwards | permanent | 7.6.2 | |
+---------------------------+------------+---------+------------+
| Proxy-Authenticate | permanent | 11.7.1 | |
+---------------------------+------------+---------+------------+
| Proxy-Authentication-Info | permanent | 11.7.3 | |
+---------------------------+------------+---------+------------+
| Proxy-Authorization | permanent | 11.7.2 | |
+---------------------------+------------+---------+------------+
| Range | permanent | 14.2 | |
+---------------------------+------------+---------+------------+
| Referer | permanent | 10.1.3 | |
+---------------------------+------------+---------+------------+
| Retry-After | permanent | 10.2.3 | |
+---------------------------+------------+---------+------------+
| Server | permanent | 10.2.4 | |
+---------------------------+------------+---------+------------+
| TE | permanent | 10.1.4 | |
+---------------------------+------------+---------+------------+
| Trailer | permanent | 6.6.2 | |
+---------------------------+------------+---------+------------+
| Upgrade | permanent | 7.8 | |
+---------------------------+------------+---------+------------+
| User-Agent | permanent | 10.1.5 | |
+---------------------------+------------+---------+------------+
| Vary | permanent | 12.5.5 | |
+---------------------------+------------+---------+------------+
| Via | permanent | 7.6.3 | |
+---------------------------+------------+---------+------------+
| WWW-Authenticate | permanent | 11.6.1 | |
+---------------------------+------------+---------+------------+
| * | permanent | 12.5.5 | (reserved) |
+---------------------------+------------+---------+------------+
Table 9
The field name "*" is reserved because using that name as an HTTP
header field might conflict with its special semantics in the Vary
header field (Section 12.5.5).
IANA has updated the "Content-MD5" entry in the new registry to have
a status of 'obsoleted' with references to Section 14.15 of [RFC2616]
(for the definition of the header field) and Appendix B of [RFC7231]
(which removed the field definition from the updated specification).
+============+===========================================+=========+
| Name | Description | Section |
+============+===========================================+=========+
| compress | UNIX "compress" data format [Welch] | 8.4.1.1 |
+------------+-------------------------------------------+---------+
| deflate | "deflate" compressed data ([RFC1951]) | 8.4.1.2 |
| | inside the "zlib" data format ([RFC1950]) | |
+------------+-------------------------------------------+---------+
| gzip | GZIP file format [RFC1952] | 8.4.1.3 |
+------------+-------------------------------------------+---------+
| identity | Reserved | 12.5.3 |
+------------+-------------------------------------------+---------+
| x-compress | Deprecated (alias for compress) | 8.4.1.1 |
+------------+-------------------------------------------+---------+
| x-gzip | Deprecated (alias for gzip) | 8.4.1.3 |
+------------+-------------------------------------------+---------+
Table 10
+=================+==================================+=========+
| Range Unit Name | Description | Section |
+=================+==================================+=========+
| bytes | a range of octets | 14.1.2 |
+-----------------+----------------------------------+---------+
| none | reserved as keyword to indicate | 14.3 |
| | range requests are not supported | |
+-----------------+----------------------------------+---------+
Table 11
IANA has updated the "Service Name and Transport Protocol Port Number
Registry" at <https://www.iana.org/assignments/service-names-port-
numbers/> for the services on ports 80 and 443 that use UDP or TCP
to:
+======+===================+=========================+=========+
| Name | Description | Expected Version Tokens | Section |
+======+===================+=========================+=========+
| HTTP | Hypertext | any DIGIT.DIGIT (e.g., | 2.5 |
| | Transfer Protocol | "2.0") | |
+------+-------------------+-------------------------+---------+
Table 12
19. References
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234,
DOI 10.17487/RFC5234, January 2008,
<https://www.rfc-editor.org/info/rfc5234>.
[RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for Identifying
Languages", BCP 47, RFC 5646, DOI 10.17487/RFC5646,
September 2009, <https://www.rfc-editor.org/info/rfc5646>.
<https://www.rfc-editor.org/info/bcp13>
<https://www.rfc-editor.org/info/bcp178>
<https://www.rfc-editor.org/info/bcp35>
[BREACH] Gluck, Y., Harris, N., and A. Prado, "BREACH: Reviving the
CRIME Attack", July 2013,
<http://breachattack.com/resources/
BREACH%20-%20SSL,%20gone%20in%2030%20seconds.pdf>.
[Georgiev] Georgiev, M., Iyengar, S., Jana, S., Anubhai, R., Boneh,
D., and V. Shmatikov, "The Most Dangerous Code in the
World: Validating SSL Certificates in Non-Browser
Software", In Proceedings of the 2012 ACM Conference on
Computer and Communications Security (CCS '12), pp. 38-49,
DOI 10.1145/2382196.2382204, October 2012,
<https://doi.org/10.1145/2382196.2382204>.
[HTTP/2] Thomson, M., Ed. and C. Benfield, Ed., "HTTP/2", RFC 9113,
DOI 10.17487/RFC9113, June 2022,
<https://www.rfc-editor.org/info/rfc9113>.
[ISO-8859-1]
International Organization for Standardization,
"Information technology -- 8-bit single-byte coded graphic
character sets -- Part 1: Latin alphabet No. 1", ISO/
IEC 8859-1:1998, 1998.
[RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S.
Rose, "DNS Security Introduction and Requirements",
RFC 4033, DOI 10.17487/RFC4033, March 2005,
<https://www.rfc-editor.org/info/rfc4033>.
[RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch,
"Network Time Protocol Version 4: Protocol and Algorithms
Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010,
<https://www.rfc-editor.org/info/rfc5905>.
[RFC7233] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed.,
"Hypertext Transfer Protocol (HTTP/1.1): Range Requests",
RFC 7233, DOI 10.17487/RFC7233, June 2014,
<https://www.rfc-editor.org/info/rfc7233>.
BWS = OWS
Date = HTTP-date
ETag = entity-tag
Expect = [ expectation *( OWS "," OWS expectation ) ]
From = mailbox
Last-Modified = HTTP-date
Location = URI-reference
Max-Forwards = 1*DIGIT
OWS = *( SP / HTAB )
hour = 2DIGIT
http-URI = "http://" authority path-abempty [ "?" query ]
https-URI = "https://" authority path-abempty [ "?" query ]
second = 2DIGIT
segment = <segment, see [URI], Section 3.3>
subtype = token
suffix-length = 1*DIGIT
suffix-range = "-" suffix-length
year = 4DIGIT
None.
"Field value" now refers to the value after multiple field lines are
combined with commas -- by far the most common use. To refer to a
single header line's value, use "field line value". (Section 6.3)
The priority of the absolute form of the request URI over the Host
header field by origin servers has been made explicit to align with
proxy handling. (Section 7.2)
The grammar definition for the Via field's "received-by" was expanded
in RFC 7230 due to changes in the URI grammar for host [URI] that are
not desirable for Via. For simplicity, we have removed uri-host from
the received-by production because it can be encompassed by the
existing grammar for pseudonym. In particular, this change removed
comma from the allowed set of characters for a host name in received-
by. (Section 7.6.3)
B.3. Changes from RFC 7231
The following have been clarified: CR and NUL in field values are to
be rejected or mapped to SP, and leading and trailing whitespace
needs to be stripped from field values before they are consumed.
(Section 5.5)
An abstract data type for HTTP messages has been introduced to define
the components of a message and their semantics as an abstraction
across multiple HTTP versions, rather than in terms of the specific
syntax form of HTTP/1.1 in [HTTP/1.1], and reflect the contents after
the message is parsed. This makes it easier to distinguish between
requirements on the content (what is conveyed) versus requirements on
the messaging syntax (how it is conveyed) and avoids baking
limitations of early protocol versions into the future of HTTP.
(Section 6)
The terms "payload" and "payload body" have been replaced with
"content", to better align with its usage elsewhere (e.g., in field
names) and to avoid confusion with frame payloads in HTTP/2 and
HTTP/3. (Section 6.4)
The term "effective request URI" has been replaced with "target URI".
(Section 7.1)
The fact that request bodies on GET, HEAD, and DELETE are not
interoperable has been clarified. (Sections 9.3.1, 9.3.2, and 9.3.5)
The semantics of "*" in the Vary header field when other values are
present was clarified. (Section 12.5.5)
None.
None.
None.
Acknowledgements
This document builds on the many contributions that went into past
specifications of HTTP, including [HTTP/1.0], [RFC2068], [RFC2145],
[RFC2616], [RFC2617], [RFC2818], [RFC7230], [RFC7231], [RFC7232],
[RFC7233], [RFC7234], and [RFC7235]. The acknowledgements within
those documents still apply.
Index
1 2 3 4 5 A B C D E F G H I L M N O P R S T U V W X
Authors' Addresses