Annotate

net/http/codes.lua @ 9091:519dea077d20

util.dataforms: Allow passing dynamically generated options as values (fixes traceback) This is awkward but there’s currently no better way to do this, short of dynamically generating the entire form each time
author Kim Alvefur <zash@zash.se>
date Fri, 03 Aug 2018 22:05:40 +0200
parent 7572:f549587b8c06
child 9167:7ed130d3676c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
1
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
2 local response_codes = {
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
3 -- Source: http://www.iana.org/assignments/http-status-codes
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
4 -- s/^\(\d*\)\s*\(.*\S\)\s*\[RFC.*\]\s*$/^I["\1"] = "\2";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
5 [100] = "Continue";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
6 [101] = "Switching Protocols";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
7 [102] = "Processing";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
8
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
9 [200] = "OK";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
10 [201] = "Created";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
11 [202] = "Accepted";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
12 [203] = "Non-Authoritative Information";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
13 [204] = "No Content";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
14 [205] = "Reset Content";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
15 [206] = "Partial Content";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
16 [207] = "Multi-Status";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
17 [208] = "Already Reported";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
18 [226] = "IM Used";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
19
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
20 [300] = "Multiple Choices";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
21 [301] = "Moved Permanently";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
22 [302] = "Found";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
23 [303] = "See Other";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
24 [304] = "Not Modified";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
25 [305] = "Use Proxy";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@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.
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
27 [307] = "Temporary Redirect";
6694
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
28 [308] = "Permanent Redirect";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
29
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
30 [400] = "Bad Request";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
31 [401] = "Unauthorized";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
32 [402] = "Payment Required";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
33 [403] = "Forbidden";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
34 [404] = "Not Found";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
35 [405] = "Method Not Allowed";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
36 [406] = "Not Acceptable";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
37 [407] = "Proxy Authentication Required";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
38 [408] = "Request Timeout";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
39 [409] = "Conflict";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
40 [410] = "Gone";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
41 [411] = "Length Required";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
42 [412] = "Precondition Failed";
6694
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
43 [413] = "Payload Too Large";
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
44 [414] = "URI Too Long";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
45 [415] = "Unsupported Media Type";
6694
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
46 [416] = "Range Not Satisfiable";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
47 [417] = "Expectation Failed";
4723
198b11ed196a net.http.codes: Add missing 418 status code
Matthew Wild <mwild1@gmail.com>
parents: 4631
diff changeset
48 [418] = "I'm a teapot";
6694
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
49 [421] = "Misdirected Request";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
50 [422] = "Unprocessable Entity";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
51 [423] = "Locked";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
52 [424] = "Failed Dependency";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
53 -- The 425 status code is reserved for the WebDAV advanced collections expired proposal [RFC2817]
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
54 [426] = "Upgrade Required";
6694
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
55 [428] = "Precondition Required";
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
56 [429] = "Too Many Requests";
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
57 [431] = "Request Header Fields Too Large";
7572
f549587b8c06 net.http.codes: Add HTTP status code 451 Unavailable For Legal Reasons from RFC 7725
Kim Alvefur <zash@zash.se>
parents: 7571
diff changeset
58 [451] = "Unavailable For Legal Reasons";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
59
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
60 [500] = "Internal Server Error";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
61 [501] = "Not Implemented";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
62 [502] = "Bad Gateway";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
63 [503] = "Service Unavailable";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
64 [504] = "Gateway Timeout";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
65 [505] = "HTTP Version Not Supported";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
66 [506] = "Variant Also Negotiates"; -- Experimental
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
67 [507] = "Insufficient Storage";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
68 [508] = "Loop Detected";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
69 [510] = "Not Extended";
6694
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
70 [511] = "Network Authentication Required";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
71 };
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
72
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
73 for k,v in pairs(response_codes) do response_codes[k] = k.." "..v; end
7571
e8efb5cf0877 net.http.codes: Remove used argument
Kim Alvefur <zash@zash.se>
parents: 6694
diff changeset
74 return setmetatable(response_codes, { __index = function(_, k) return k.." Unassigned"; end })