- From: Melvin Carvalho <melvincarvalho@gmail.com>
- Date: Sun, 6 May 2012 11:30:12 +0200
- To: public-rww <public-rww@w3.org>
- Message-ID: <CAKaEYhJybq6wvbN8ntcC0c6NbaqM_8wCFfdcNZuki1kniuUdBA@mail.gmail.com>
Just in case this one slipped thru the net. (I'll add it to the wiki too) 428 (Precondition Required) looks interesting especially in relation to 409 (Conflict) [snippet from design issues read-write linked data] "Note: 409 Conflict A SPARQL update message often contains both a DELETE and then an INSERT. This may be used to update a field from one value to another. When more than one application or user is using the same data, there may arise times when the DELETE fails because another user has already deleted the same data. In this case it very important that the delete does not fail silently. The HTTP server MUST return error status 409. ("409 Conflict" indicates that the request could not be processed because of conflict in the request, such as an edit conflict). The client can then for example inform the user by backing out the change the user was trying to make, or it can retry a reservation later. The atomicity of the DELETE,INSERT function can be used to provide various mutual exclusion systems, such as reserving a resource or generating unique sequential numbers, and so on." http://tools.ietf.org/html/rfc6585 Table of Contents 1. Introduction ....................................................2 2. Requirements ....................................................2 3. 428 Precondition Required .......................................2 4. 429 Too Many Requests ...........................................3 5. 431 Request Header Fields Too Large .............................4 6. 511 Network Authentication Required .............................4 7. Security Considerations .........................................6 8. IANA Considerations .............................................7 9. References ......................................................7 Appendix A. Acknowledgements .......................................9 Appendix B. Issues Raised by Captive Portals .......................9 1. Introduction This document specifies additional HTTP [RFC2616] status codes for a variety of common situations, to improve interoperability and avoid confusion when other, less precise status codes are used. Note that these status codes are optional; servers cannot be required to support them. However, because clients will treat unknown status codes as a generic error of the same class (e.g., 499 is treated as 400 if it is not recognized), they can be safely deployed by existing servers (see [RFC2616] Section 6.1.1 for more information). 2. Requirements The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. 3. 428 Precondition Required The 428 status code indicates that the origin server requires the request to be conditional. Its typical use is to avoid the "lost update" problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. By requiring requests to be conditional, the server can assure that clients are working with the correct copies. Responses using this status code SHOULD explain how to resubmit the request successfully. For example: HTTP/1.1 428 Precondition Required Content-Type: text/html Nottingham & Fielding Standards Track [Page 2] RFC 6585 Additional HTTP Status Codes April 2012 <html> <head> <title>Precondition Required</title> </head> <body> <h1>Precondition Required</h1> <p>This request is required to be conditional; try using "If-Match".</p> </body> </html> Responses with the 428 status code MUST NOT be stored by a cache. 4. 429 Too Many Requests The 429 status code indicates that the user has sent too many requests in a given amount of time ("rate limiting"). The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how long to wait before making a new request. For example: HTTP/1.1 429 Too Many Requests Content-Type: text/html Retry-After: 3600 <html> <head> <title>Too Many Requests</title> </head> <body> <h1>Too Many Requests</h1> <p>I only allow 50 requests per hour to this Web site per logged in user. Try again soon.</p> </body> </html> Note that this specification does not define how the origin server identifies the user, nor how it counts requests. For example, an origin server that is limiting request rates can do so based upon counts of requests on a per-resource basis, across the entire server, or even among a set of servers. Likewise, it might identify the user by its authentication credentials, or a stateful cookie. Responses with the 429 status code MUST NOT be stored by a cache. Nottingham & Fielding Standards Track [Page 3] RFC 6585 Additional HTTP Status Codes April 2012 5. 431 Request Header Fields Too Large The 431 status code indicates that the server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields. It can be used both when the set of request header fields in total is too large, and when a single header field is at fault. In the latter case, the response representation SHOULD specify which header field was too large. For example: HTTP/1.1 431 Request Header Fields Too Large Content-Type: text/html <html> <head> <title>Request Header Fields Too Large</title> </head> <body> <h1>Request Header Fields Too Large</h1> <p>The "Example" header was too large.</p> </body> </html> Responses with the 431 status code MUST NOT be stored by a cache. 6. 511 Network Authentication Required The 511 status code indicates that the client needs to authenticate to gain network access. The response representation SHOULD contain a link to a resource that allows the user to submit credentials (e.g., with an HTML form). Note that the 511 response SHOULD NOT contain a challenge or the login interface itself, because browsers would show the login interface as being associated with the originally requested URL, which may cause confusion. The 511 status SHOULD NOT be generated by origin servers; it is intended for use by intercepting proxies that are interposed as a means of controlling access to the network. Responses with the 511 status code MUST NOT be stored by a cache. Nottingham & Fielding Standards Track [Page 4] RFC 6585 Additional HTTP Status Codes April 2012 6.1. The 511 Status Code and Captive Portals The 511 status code is designed to mitigate problems caused by "captive portals" to software (especially non-browser agents) that is expecting a response from the server that a request was made to, not the intervening network infrastructure. It is not intended to encourage deployment of captive portals -- only to limit the damage caused by them. A network operator wishing to require some authentication, acceptance of terms, or other user interaction before granting access usually does so by identifying clients who have not done so ("unknown clients") using their Media Access Control (MAC) addresses. Unknown clients then have all traffic blocked, except for that on TCP port 80, which is sent to an HTTP server (the "login server") dedicated to "logging in" unknown clients, and of course traffic to the login server itself. For example, a user agent might connect to a network and make the following HTTP request on TCP port 80: GET /index.htm HTTP/1.1 Host: www.example.com Upon receiving such a request, the login server would generate a 511 response: HTTP/1.1 511 Network Authentication Required Content-Type: text/html <html> <head> <title>Network Authentication Required</title> <meta http-equiv="refresh" content="0; url=https://login.example.net/"> </head> <body> <p>You need to <a href="https://login.example.net/"> authenticate with the local network</a> in order to gain access.</p> </body> </html> Here, the 511 status code assures that non-browser clients will not interpret the response as being from the origin server, and the META HTML element redirects the user agent to the login server.
Received on Sunday, 6 May 2012 09:30:42 UTC