Software /
code /
prosody
Comparison
net/http/codes.lua @ 9167:7ed130d3676c
net.http.codes: Regenerate from IANA registry with tool
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 11 Aug 2018 17:22:26 +0200 |
parent | 7572:f549587b8c06 |
child | 9170:47ffce31ffe4 |
comparison
equal
deleted
inserted
replaced
9166:cce55767004a | 9167:7ed130d3676c |
---|---|
1 | 1 |
2 local response_codes = { | 2 local response_codes = { |
3 -- Source: http://www.iana.org/assignments/http-status-codes | 3 -- Source: http://www.iana.org/assignments/http-status-codes |
4 -- s/^\(\d*\)\s*\(.*\S\)\s*\[RFC.*\]\s*$/^I["\1"] = "\2"; | 4 |
5 [100] = "Continue"; | 5 [100] = "Continue"; -- RFC7231, Section 6.2.1 |
6 [101] = "Switching Protocols"; | 6 [101] = "Switching Protocols"; -- RFC7231, Section 6.2.2 |
7 [102] = "Processing"; | 7 [102] = "Processing"; |
8 [103] = "Early Hints"; | |
9 -- [104-199] = "Unassigned"; | |
8 | 10 |
9 [200] = "OK"; | 11 [200] = "OK"; -- RFC7231, Section 6.3.1 |
10 [201] = "Created"; | 12 [201] = "Created"; -- RFC7231, Section 6.3.2 |
11 [202] = "Accepted"; | 13 [202] = "Accepted"; -- RFC7231, Section 6.3.3 |
12 [203] = "Non-Authoritative Information"; | 14 [203] = "Non-Authoritative Information"; -- RFC7231, Section 6.3.4 |
13 [204] = "No Content"; | 15 [204] = "No Content"; -- RFC7231, Section 6.3.5 |
14 [205] = "Reset Content"; | 16 [205] = "Reset Content"; -- RFC7231, Section 6.3.6 |
15 [206] = "Partial Content"; | 17 [206] = "Partial Content"; -- RFC7233, Section 4.1 |
16 [207] = "Multi-Status"; | 18 [207] = "Multi-Status"; |
17 [208] = "Already Reported"; | 19 [208] = "Already Reported"; |
20 -- [209-225] = "Unassigned"; | |
18 [226] = "IM Used"; | 21 [226] = "IM Used"; |
22 -- [227-299] = "Unassigned"; | |
19 | 23 |
20 [300] = "Multiple Choices"; | 24 [300] = "Multiple Choices"; -- RFC7231, Section 6.4.1 |
21 [301] = "Moved Permanently"; | 25 [301] = "Moved Permanently"; -- RFC7231, Section 6.4.2 |
22 [302] = "Found"; | 26 [302] = "Found"; -- RFC7231, Section 6.4.3 |
23 [303] = "See Other"; | 27 [303] = "See Other"; -- RFC7231, Section 6.4.4 |
24 [304] = "Not Modified"; | 28 [304] = "Not Modified"; -- RFC7232, Section 4.1 |
25 [305] = "Use Proxy"; | 29 [305] = "Use Proxy"; -- RFC7231, Section 6.4.5 |
26 -- The 306 status code was used in a previous version of [RFC2616], is no longer used, and the code is reserved. | 30 -- [306] = "(Unused)"; -- RFC7231, Section 6.4.6 |
27 [307] = "Temporary Redirect"; | 31 [307] = "Temporary Redirect"; -- RFC7231, Section 6.4.7 |
28 [308] = "Permanent Redirect"; | 32 [308] = "Permanent Redirect"; |
33 -- [309-399] = "Unassigned"; | |
29 | 34 |
30 [400] = "Bad Request"; | 35 [400] = "Bad Request"; -- RFC7231, Section 6.5.1 |
31 [401] = "Unauthorized"; | 36 [401] = "Unauthorized"; -- RFC7235, Section 3.1 |
32 [402] = "Payment Required"; | 37 [402] = "Payment Required"; -- RFC7231, Section 6.5.2 |
33 [403] = "Forbidden"; | 38 [403] = "Forbidden"; -- RFC7231, Section 6.5.3 |
34 [404] = "Not Found"; | 39 [404] = "Not Found"; -- RFC7231, Section 6.5.4 |
35 [405] = "Method Not Allowed"; | 40 [405] = "Method Not Allowed"; -- RFC7231, Section 6.5.5 |
36 [406] = "Not Acceptable"; | 41 [406] = "Not Acceptable"; -- RFC7231, Section 6.5.6 |
37 [407] = "Proxy Authentication Required"; | 42 [407] = "Proxy Authentication Required"; -- RFC7235, Section 3.2 |
38 [408] = "Request Timeout"; | 43 [408] = "Request Timeout"; -- RFC7231, Section 6.5.7 |
39 [409] = "Conflict"; | 44 [409] = "Conflict"; -- RFC7231, Section 6.5.8 |
40 [410] = "Gone"; | 45 [410] = "Gone"; -- RFC7231, Section 6.5.9 |
41 [411] = "Length Required"; | 46 [411] = "Length Required"; -- RFC7231, Section 6.5.10 |
42 [412] = "Precondition Failed"; | 47 [412] = "Precondition Failed"; -- RFC7232, Section 4.2 |
43 [413] = "Payload Too Large"; | 48 [413] = "Payload Too Large"; -- RFC7231, Section 6.5.11 |
44 [414] = "URI Too Long"; | 49 [414] = "URI Too Long"; -- RFC7231, Section 6.5.12 |
45 [415] = "Unsupported Media Type"; | 50 [415] = "Unsupported Media Type"; -- RFC7231, Section 6.5.13 |
46 [416] = "Range Not Satisfiable"; | 51 [416] = "Range Not Satisfiable"; -- RFC7233, Section 4.4 |
47 [417] = "Expectation Failed"; | 52 [417] = "Expectation Failed"; -- RFC7231, Section 6.5.14 |
48 [418] = "I'm a teapot"; | 53 [418] = "I'm a teapot"; -- RFC2324, Section 2.3.2 |
49 [421] = "Misdirected Request"; | 54 -- [418-420] = "Unassigned"; |
55 [421] = "Misdirected Request"; -- RFC7540, Section 9.1.2 | |
50 [422] = "Unprocessable Entity"; | 56 [422] = "Unprocessable Entity"; |
51 [423] = "Locked"; | 57 [423] = "Locked"; |
52 [424] = "Failed Dependency"; | 58 [424] = "Failed Dependency"; |
53 -- The 425 status code is reserved for the WebDAV advanced collections expired proposal [RFC2817] | 59 [425] = "Too Early"; |
54 [426] = "Upgrade Required"; | 60 [426] = "Upgrade Required"; -- RFC7231, Section 6.5.15 |
61 -- [427] = "Unassigned"; | |
55 [428] = "Precondition Required"; | 62 [428] = "Precondition Required"; |
56 [429] = "Too Many Requests"; | 63 [429] = "Too Many Requests"; |
64 -- [430] = "Unassigned"; | |
57 [431] = "Request Header Fields Too Large"; | 65 [431] = "Request Header Fields Too Large"; |
66 -- [432-450] = "Unassigned"; | |
58 [451] = "Unavailable For Legal Reasons"; | 67 [451] = "Unavailable For Legal Reasons"; |
68 -- [452-499] = "Unassigned"; | |
59 | 69 |
60 [500] = "Internal Server Error"; | 70 [500] = "Internal Server Error"; -- RFC7231, Section 6.6.1 |
61 [501] = "Not Implemented"; | 71 [501] = "Not Implemented"; -- RFC7231, Section 6.6.2 |
62 [502] = "Bad Gateway"; | 72 [502] = "Bad Gateway"; -- RFC7231, Section 6.6.3 |
63 [503] = "Service Unavailable"; | 73 [503] = "Service Unavailable"; -- RFC7231, Section 6.6.4 |
64 [504] = "Gateway Timeout"; | 74 [504] = "Gateway Timeout"; -- RFC7231, Section 6.6.5 |
65 [505] = "HTTP Version Not Supported"; | 75 [505] = "HTTP Version Not Supported"; -- RFC7231, Section 6.6.6 |
66 [506] = "Variant Also Negotiates"; -- Experimental | 76 [506] = "Variant Also Negotiates"; |
67 [507] = "Insufficient Storage"; | 77 [507] = "Insufficient Storage"; |
68 [508] = "Loop Detected"; | 78 [508] = "Loop Detected"; |
79 -- [509] = "Unassigned"; | |
69 [510] = "Not Extended"; | 80 [510] = "Not Extended"; |
70 [511] = "Network Authentication Required"; | 81 [511] = "Network Authentication Required"; |
82 -- [512-599] = "Unassigned"; | |
71 }; | 83 }; |
72 | 84 |
73 for k,v in pairs(response_codes) do response_codes[k] = k.." "..v; end | 85 for k,v in pairs(response_codes) do response_codes[k] = k.." "..v; end |
74 return setmetatable(response_codes, { __index = function(_, k) return k.." Unassigned"; end }) | 86 return setmetatable(response_codes, { __index = function(_, k) return k.." Unassigned"; end }) |