2 local response_codes = {
3 -- Source: http://www.iana.org/assignments/http-status-codes
4 -- s/^\(\d*\)\s*\(.*\S\)\s*\[RFC.*\]\s*$/^I["\1"] = "\2";
6 [101] = "Switching Protocols";
12 [203] = "Non-Authoritative Information";
14 [205] = "Reset Content";
15 [206] = "Partial Content";
16 [207] = "Multi-Status";
17 [208] = "Already Reported";
20 [300] = "Multiple Choices";
21 [301] = "Moved Permanently";
24 [304] = "Not Modified";
26 -- The 306 status code was used in a previous version of [RFC2616], is no longer used, and the code is reserved.
27 [307] = "Temporary Redirect";
28 [308] = "Permanent Redirect";
30 [400] = "Bad Request";
31 [401] = "Unauthorized";
32 [402] = "Payment Required";
35 [405] = "Method Not Allowed";
36 [406] = "Not Acceptable";
37 [407] = "Proxy Authentication Required";
38 [408] = "Request Timeout";
41 [411] = "Length Required";
42 [412] = "Precondition Failed";
43 [413] = "Payload Too Large";
44 [414] = "URI Too Long";
45 [415] = "Unsupported Media Type";
46 [416] = "Range Not Satisfiable";
47 [417] = "Expectation Failed";
48 [418] = "I'm a teapot";
49 [421] = "Misdirected Request";
50 [422] = "Unprocessable Entity";
52 [424] = "Failed Dependency";
53 -- The 425 status code is reserved for the WebDAV advanced collections expired proposal [RFC2817]
54 [426] = "Upgrade Required";
55 [428] = "Precondition Required";
56 [429] = "Too Many Requests";
57 [431] = "Request Header Fields Too Large";
59 [500] = "Internal Server Error";
60 [501] = "Not Implemented";
61 [502] = "Bad Gateway";
62 [503] = "Service Unavailable";
63 [504] = "Gateway Timeout";
64 [505] = "HTTP Version Not Supported";
65 [506] = "Variant Also Negotiates"; -- Experimental
66 [507] = "Insufficient Storage";
67 [508] = "Loop Detected";
68 [510] = "Not Extended";
69 [511] = "Network Authentication Required";
72 for k,v in pairs(response_codes) do response_codes[k] = k.." "..v; end
73 return setmetatable(response_codes, { __index = function(t, k) return k.." Unassigned"; end })