net/http/codes.lua

Thu, 25 Dec 2014 10:48:06 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 25 Dec 2014 10:48:06 +0000
changeset 0
d363a6692a10
permissions
-rw-r--r--

Initial commit. Tortoises are fun.

0
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 local response_codes = {
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 -- Source: http://www.iana.org/assignments/http-status-codes
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 -- s/^\(\d*\)\s*\(.*\S\)\s*\[RFC.*\]\s*$/^I["\1"] = "\2";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 [100] = "Continue";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 [101] = "Switching Protocols";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 [102] = "Processing";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 [200] = "OK";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 [201] = "Created";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 [202] = "Accepted";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 [203] = "Non-Authoritative Information";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 [204] = "No Content";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 [205] = "Reset Content";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 [206] = "Partial Content";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 [207] = "Multi-Status";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 [208] = "Already Reported";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18 [226] = "IM Used";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 [300] = "Multiple Choices";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 [301] = "Moved Permanently";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22 [302] = "Found";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 [303] = "See Other";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
24 [304] = "Not Modified";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25 [305] = "Use Proxy";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26 -- The 306 status code was used in a previous version of [RFC2616], is no longer used, and the code is reserved.
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27 [307] = "Temporary Redirect";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
28
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
29 [400] = "Bad Request";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30 [401] = "Unauthorized";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
31 [402] = "Payment Required";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
32 [403] = "Forbidden";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
33 [404] = "Not Found";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
34 [405] = "Method Not Allowed";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
35 [406] = "Not Acceptable";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
36 [407] = "Proxy Authentication Required";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
37 [408] = "Request Timeout";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
38 [409] = "Conflict";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
39 [410] = "Gone";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
40 [411] = "Length Required";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
41 [412] = "Precondition Failed";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
42 [413] = "Request Entity Too Large";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
43 [414] = "Request-URI Too Long";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
44 [415] = "Unsupported Media Type";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
45 [416] = "Requested Range Not Satisfiable";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
46 [417] = "Expectation Failed";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
47 [418] = "I'm a teapot";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
48 [422] = "Unprocessable Entity";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
49 [423] = "Locked";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
50 [424] = "Failed Dependency";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
51 -- The 425 status code is reserved for the WebDAV advanced collections expired proposal [RFC2817]
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
52 [426] = "Upgrade Required";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
53
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
54 [500] = "Internal Server Error";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
55 [501] = "Not Implemented";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
56 [502] = "Bad Gateway";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
57 [503] = "Service Unavailable";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
58 [504] = "Gateway Timeout";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
59 [505] = "HTTP Version Not Supported";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
60 [506] = "Variant Also Negotiates"; -- Experimental
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
61 [507] = "Insufficient Storage";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
62 [508] = "Loop Detected";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
63 [510] = "Not Extended";
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
64 };
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
65
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
66 for k,v in pairs(response_codes) do response_codes[k] = k.." "..v; end
d363a6692a10 Initial commit. Tortoises are fun.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
67 return setmetatable(response_codes, { __index = function(t, k) return k.." Unassigned"; end })

mercurial