In March 2014, the voucher site Vouchercloud asked 2,392 Americans to define a handful of technical terms, and roughly one in ten concluded that HTML is a sexually transmitted disease.
The rest of the findings are, if anything, more magnificent. Twenty-seven percent placed the gigabyte among the insects of South America. Forty-two percent understood a motherboard to be the deck of a cruise ship. Eighteen percent filed Blu-ray under marine life. Thirteen percent recognised MP3 as a droid from Star Wars, which, honestly, I can see. And sixty-one percent of the same respondents agreed that a good knowledge of technology is important in this day and age, a sentence I have thought about more often than is healthy.
It would be easy to be snide about this. I would rather take the ten percent seriously. If HTML is a communicable condition, then the specification is a diagnostic manual, and the HTTP status codes are its list of presenting symptoms. So let us do the clinician's rounds.
Notes toward a differential diagnosis
411 Length Required is the classic complaint, and the one patients are least willing to discuss. It travels in company: where you find 411, you will often find 416 Range Not Satisfiable, and where you find 416 you will very shortly find 417 Expectation Failed. The literature is unkind here.
413 Content Too Large is 411 read in a mirror, and is not the triumph its sufferers imagine. It is frequently accompanied by 306 (Unused), a code the standards body reserved, never assigned, and quietly left in the register out of embarrassment. There is no sadder line in any specification.
An attempt at 101 Switching Protocols is where most of the drama lives. It may return 400 Bad Request, which is a matter of phrasing. It may return 405 Method Not Allowed, which is a matter of technique. It may return 403 Forbidden, which is a matter of principle. Or it may return 406 Not Acceptable, which is a matter of taste, and stings the longest.
Repeated attempts produce a suspicious frequency of 503 Service Unavailable, the polite fiction of protocols everywhere, and eventually 409 Conflict, which is what happens when two parties hold incompatible ideas about the current state of the resource and both consider themselves authoritative.
303 See Other is the outcome of a GET, HEAD request made once too often inside a 300 Multiple Choices environment. It resolves either to 410 Gone, which is honest, or to 301 Moved Permanently, which is honest and also has a forwarding address.
401 Unauthorised arrives when 412 Precondition Failed, and the preconditions in question were social. One may of course attempt 305 Use Proxy, routing around the whole awkward business through an intermediary gateway that responds with 402 Payment Required. This is legal in some jurisdictions and inadvisable in most, and the specification notes drily that the client should then continue with its request.
The joke has a point
HTTP is a protocol for two strangers who cannot see each other, who must nonetheless establish who is speaking, what is being asked, whether the asker is permitted to ask it, and what state the world was in when the question was posed. It is thick with codes for refusal, because refusal is the interesting case. It has a status for I will not, and I will not explain why, and another for I would, but not on these terms, and another for you have asked correctly and I am simply not available right now. Somebody sat in a room and specified the grammar of the brush-off.
Every protocol worth the name is a theory of consent, written by engineers who thought they were doing plumbing. Someone had to decide that a request could be well formed and still be refused; that being refused is not the same as being unheard; that a resource has the standing to say no. That decision is why the web works, and it is the same decision we keep having to make again, badly, each time we build a system that speaks to another system on someone's behalf. We are doing it right now, at considerable expense, for machines that are rather more complicated than a web server.
The ten percent were wrong about the acronym. They were closer than they knew about the anxiety.
Take precautions. Validate your input. And if you cannot commit to a handshake, at least be a 200 OK about it.
Comments