In other words, the error has to do with the client’s request but it's not necessarily the client’s fault. For a similar example see the response code “410 Gone”:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10...
The IETF's HTML RFC generator makes really nice documents.
FWIW, the RFC Editor is working on modernising the RFC format -- we'll even have non-ASCII characters soon!
The IETF generator links to plain-text and PDF versions of the RFC, diffs between the current version and previous versions of the document, errata applicable to the RFC, and uses a fixed-width font. These are all nice properties.
So. I'm glad that you're not in charge of the IETF's HTML RFC output. :)
5xx means that the client can, because there's a chance repeating the request will succeed. 4xx means the client shouldn't, because it needs to change in some fashion before it will work.
This is so that clients that don't understand a specific status code can fall back to the more generic x00 code and still behave sensibly.
This is because censorship is almost never global—instead, it's because something about your request (often, your country of origin) forbids you from receiving it.
In that context, 451 makes perfect sense.
"We can't serve you this because our jurisdiction forbids it" seems likely to arise more often.
That said, I also don't think the 4xx/5xx distinction matters as much here as the evocative implication of using 451 specifically.
Uh, it happens all the time. In fact, it's by far the most frequent kind of censorship.
From TFA:
- https://en.wikipedia.org/wiki/Censorship_of_Facebook
- https://en.wikipedia.org/wiki/Censorship_by_Google
- https://en.wikipedia.org/wiki/Censorship_of_Twitter
Most major web services are based in a country with relatively lax censorship laws but still comply with censorship laws in other jurisdictions.
What is a good use case for HTTP 451 then?
Rarely does the calculus favor getting your entire site blocked because you refuse to censor one piece of content. At least by serving HTTP 451 you could also potentially offer suggestions like using Tor.
I really dislike it when, e.g., Ruby HTTP client libraries treat any non 2xx-3xx response as an exception.
If I'm wrong about this usage, like, say I have a REST endpoint that, when the client doesn't send bad data, but a request fails for some reason (upstream service rejected request), what kind of code is my endpoint supposed to return?
(I would say 4xx, and leave it at that, getting rid of the "client" part of "client error", and leaving 5xx for something like ISE, fatal error "maybe ain't your fault, or at all under your control, client-man!" But I'm happy to learn more.)