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";
29 [400] = "Bad Request";
30 [401] = "Unauthorized";
31 [402] = "Payment Required";
34 [405] = "Method Not Allowed";
35 [406] = "Not Acceptable";
36 [407] = "Proxy Authentication Required";
37 [408] = "Request Timeout";
40 [411] = "Length Required";
41 [412] = "Precondition Failed";
42 [413] = "Request Entity Too Large";
43 [414] = "Request-URI Too Long";
44 [415] = "Unsupported Media Type";
45 [416] = "Requested Range Not Satisfiable";
46 [417] = "Expectation Failed";
47 [418] = "I'm a teapot";
48 [422] = "Unprocessable Entity";
50 [424] = "Failed Dependency";
51 -- The 425 status code is reserved for the WebDAV advanced collections expired proposal [RFC2817]
52 [426] = "Upgrade Required";
54 [500] = "Internal Server Error";
55 [501] = "Not Implemented";
56 [502] = "Bad Gateway";
57 [503] = "Service Unavailable";
58 [504] = "Gateway Timeout";
59 [505] = "HTTP Version Not Supported";
60 [506] = "Variant Also Negotiates"; -- Experimental
61 [507] = "Insufficient Storage";
62 [508] = "Loop Detected";
63 [510] = "Not Extended";
66 for k,v in pairs(response_codes) do response_codes[k] = k.." "..v; end
67 return setmetatable(response_codes, { __index = function(t, k) return k.." Unassigned"; end })