- 1) Introduction
- 2) Notational Conventions and Generic Grammar
- 3) Protocol Parameters
- 4) HTTP Message
- 5) Request
- 6) Response
- 7) Entity
- 8) Connections
- 9) Method Definitions
- 10) Status Code Definitions
- 1) Informational 1xx
- 2) Successful 2xx
- 3) Redirection 3xx
- 4) Client Error 4xx
- 1) 400 Bad Request
- 2) 401 Unauthorized
- 3) 402 Payment Required
- 4) 403 Forbidden
- 5) 404 Not Found
- 6) 405 Method Not Allowed
- 7) 406 Not Acceptable
- 8) 407 Proxy Authentication Required
- 9) 408 Request Timeout
- 10) 409 Conflict
- 11) 410 Gone
- 12) 411 Length Required
- 13) 412 Precondition Failed
- 14) 413 Request Entity Too Large
- 15) 414 Request-URI Too Long
- 16) 415 Unsupported Media Type
- 17) 416 Requested Range Not Satisfiable
- 18) 417 Expectation Failed
- 5) Server Error 5xx
- 11) Access Authentication
- 12) Content Negotiation
- 13) Caching in HTTP
- 1) ..
- 2) Expiration Model
- 3) Validation Model
- 4) Response Cacheability
- 5) Constructing Responses From Caches
- 6) Caching Negotiated Responses
- 7) Shared and Non-Shared Caches
- 8) Errors or Incomplete Response Cache Behavior
- 9) Side Effects of GET and HEAD
- 10) Invalidation After Updates or Deletions
- 11) Write-Through Mandatory
- 12) Cache Replacement
- 13) History Lists
- 14) Header Field Definitions
- 1) Accept
- 2) Accept-Charset
- 3) Accept-Encoding
- 4) Accept-Language
- 5) Accept-Ranges
- 6) Age
- 7) Allow
- 8) Authorization
- 9) Cache-Control
- 10) Connection
- 11) Content-Encoding
- 12) Content-Language
- 13) Content-Length
- 14) Content-Location
- 15) Content-MD5
- 16) Content-Range
- 17) Content-Type
- 18) Date
- 19) ETag
- 20) Expect
- 21) Expires
- 22) From
- 23) Host
- 24) If-Match
- 25) If-Modified-Since
- 26) If-None-Match
- 27) If-Range
- 28) If-Unmodified-Since
- 29) Last-Modified
- 30) Location
- 31) Max-Forwards
- 32) Pragma
- 33) Proxy-Authenticate
- 34) Proxy-Authorization
- 35) Range
- 36) Referer
- 37) Retry-After
- 38) Server
- 39) TE
- 40) Trailer
- 41) Transfer-Encoding
- 42) Upgrade
- 43) User-Agent
- 44) Vary
- 45) Via
- 46) Warning
- 47) WWW-Authenticate
- 15) Security Considerations
- 16) Acknowledgments
- 17) References
- 18) Authors' Addresses
- 19) Appendices
- 20) Index
- 21) Full Copyright Statement
- 22) Acknowledgement
6 Response
After receiving and interpreting a request message, a server responds with an HTTP response message.
Response | = Status-Line | |
*(( general-header | ||
| response-header | ||
| entity-header ) CRLF) | ||
CRLF | ||
[ message-body ] |
6.1 Status-Line
The first line of a Response message is the Status-Line, consisting of the protocol version followed by a numeric status code and its associated textual phrase, with each element separated by SP characters. No CR or LF is allowed except in the final CRLF sequence.
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
6.1.1 Status Code and Reason Phrase
The Status-Code element is a 3-digit integer result code of the attempt to understand and satisfy the request. These codes are fully defined in Section 10. The Reason-Phrase is intended to give a short textual description of the Status-Code. The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason- Phrase.
The first digit of the Status-Code defines the class of response. The last two digits do not have any categorization role. There are 5 values for the first digit:
- 1xx: Informational - Request received, continuing process
- 2xx: Success - The action was successfully received, understood, and accepted
- 3xx: Redirection - Further action must be taken in order to complete the request
- 4xx: Client Error - The request contains bad syntax or cannot be fulfilled
- 5xx: Server Error - The server failed to fulfill an apparently valid request
The individual values of the numeric status codes defined for HTTP/1.1, and an example set of corresponding Reason-Phrase's, are presented below. The reason phrases listed here are only recommendations -- they MAY be replaced by local equivalents without affecting the protocol.
Status-Code | = "100" | ; Section 10.1.1: Continue |
| "101" | ; Section 10.1.2: Switching Protocols | |
| "200" | ; Section 10.2.1: OK | |
| "201" | ; Section 10.2.2: Created | |
| "202 | ; Section 10.2.3: Accepted | |
| "203" | ; Section 10.2.4: Non-Authoritative Information | |
| "204" | ; Section 10.2.5: No Content | |
| "205" | ; Section 10.2.6: Reset Content | |
| "206" | ; Section 10.2.7: Partial Content | |
| "300" | ; Section 10.3.1: Multiple Choice | |
| "301" | ; Section 10.3.2: Moved Permanently | |
| "302" | ; Section 10.3.3: Found | |
| "303" | ; Section 10.3.4: See Other | |
| "304" | ; Section 10.3.5: Not Modified | |
| "305" | ; Section 10.3.6: Use Proxy | |
| "307" | ; Section 10.3.8: Temporary Redirect | |
| "400" | ; Section 10.4.1: Bad Request | |
| "401" | ; Section 10.4.2: Unauthorized | |
| "402" | ; Section 10.4.3: Payment Required | |
| "403" | ; Section 10.4.4: Forbidden | |
| "404" | ; Section 10.4.5: Not Found | |
| "405" | ; Section 10.4.6: Method Not Allowed | |
| "406" | ; Section 10.4.7: Not Acceptable | |
| "407" | ; Section 10.4.8: Proxy Authentication Required | |
| "408" | ; Section 10.4.9: Request Time-out | |
| "409 | ; Section 10.4.10: Conflict | |
| "410" | ; Section 10.4.11: Gone | |
| "411" | ; Section 10.4.12: Length Required | |
| "412" | ; Section 10.4.13: Precondition Failed | |
| "413" | ; Section 10.4.14: Request Entity Too Large | |
| "414" | ; Section 10.4.15: Request-URI Too Large | |
| "415" | ; Section 10.4.16: Unsupported Media Type | |
| "416" | ; Section 10.4.17: Requested range not satisfiable | |
| "417" | ; Section 10.4.18: Expectation Failed | |
| "500" | ; Section 10.5.1: Internal Server Error | |
| "501" | ; Section 10.5.2: Not Implemented | |
| "502" | ; Section 10.5.3: Bad Gateway | |
| "503" | ; Section 10.5.4: Service Unavailable | |
| "504" | ; Section 10.5.5: Gateway Time-out | |
| "505" | ; Section 10.5.6: HTTP Version not supported | |
| extension-code | ||
extension-code | = 3DIGIT | |
Reason-Phrase | =*<TEXT, excluding CR, LF> |
HTTP status codes are extensible. HTTP applications are not required to understand the meaning of all registered status codes, though such understanding is obviously desirable. However, applications MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class, with the exception that an unrecognized response MUST NOT be cached. For example, if an unrecognized status code of 431 is received by the client, it can safely assume that there was something wrong with its request and treat the response as if it had received a 400 status code. In such cases, user agents SHOULD present to the user the entity returned with the response, since that entity is likely to include human- readable information which will explain the unusual status.
6.2 Response Header Fields
The response-header fields allow the server to pass additional information about the response which cannot be placed in the Status- Line. These header fields give information about the server and about further access to the resource identified by the Request-URI.
response-header | = Accept-Ranges | |
| Age | ||
| ETag | ||
| Location | ||
| Proxy-Authenticate | ||
| Retry-After | ||
| Serve | ||
| Vary | ||
| WWW-Authenticate |
Response-header field names can be extended reliably only in combination with a change in the protocol version. However, new or experimental header fields MAY be given the semantics of response- header fields if all parties in the communication recognize them to be response-header fields. Unrecognized header fields are treated as entity-header fields.