net/http/codes.lua
author Kim Alvefur <zash@zash.se>
Thu, 28 Mar 2024 15:26:57 +0100
changeset 13472 98806cac64c3
parent 12552 5133d6e48686
permissions -rw-r--r--
MUC: Switch to official XEP-0317 namespace for Hats (including compat) (thanks nicoco)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
     4
12552
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
     5
	[100] = "Continue"; -- RFC9110, Section 15.2.1
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
     6
	[101] = "Switching Protocols"; -- RFC9110, Section 15.2.2
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
     7
	[102] = "Processing";
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
     8
	[103] = "Early Hints";
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
     9
	-- [104-199] = "Unassigned";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    10
12552
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    11
	[200] = "OK"; -- RFC9110, Section 15.3.1
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    12
	[201] = "Created"; -- RFC9110, Section 15.3.2
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    13
	[202] = "Accepted"; -- RFC9110, Section 15.3.3
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    14
	[203] = "Non-Authoritative Information"; -- RFC9110, Section 15.3.4
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    15
	[204] = "No Content"; -- RFC9110, Section 15.3.5
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    16
	[205] = "Reset Content"; -- RFC9110, Section 15.3.6
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    17
	[206] = "Partial Content"; -- RFC9110, Section 15.3.7
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    18
	[207] = "Multi-Status";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    19
	[208] = "Already Reported";
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    20
	-- [209-225] = "Unassigned";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    21
	[226] = "IM Used";
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    22
	-- [227-299] = "Unassigned";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    23
12552
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    24
	[300] = "Multiple Choices"; -- RFC9110, Section 15.4.1
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    25
	[301] = "Moved Permanently"; -- RFC9110, Section 15.4.2
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    26
	[302] = "Found"; -- RFC9110, Section 15.4.3
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    27
	[303] = "See Other"; -- RFC9110, Section 15.4.4
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    28
	[304] = "Not Modified"; -- RFC9110, Section 15.4.5
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    29
	[305] = "Use Proxy"; -- RFC9110, Section 15.4.6
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    30
	-- [306] = "(Unused)"; -- RFC9110, Section 15.4.7
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    31
	[307] = "Temporary Redirect"; -- RFC9110, Section 15.4.8
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    32
	[308] = "Permanent Redirect"; -- RFC9110, Section 15.4.9
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    33
	-- [309-399] = "Unassigned";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    34
12552
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    35
	[400] = "Bad Request"; -- RFC9110, Section 15.5.1
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    36
	[401] = "Unauthorized"; -- RFC9110, Section 15.5.2
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    37
	[402] = "Payment Required"; -- RFC9110, Section 15.5.3
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    38
	[403] = "Forbidden"; -- RFC9110, Section 15.5.4
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    39
	[404] = "Not Found"; -- RFC9110, Section 15.5.5
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    40
	[405] = "Method Not Allowed"; -- RFC9110, Section 15.5.6
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    41
	[406] = "Not Acceptable"; -- RFC9110, Section 15.5.7
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    42
	[407] = "Proxy Authentication Required"; -- RFC9110, Section 15.5.8
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    43
	[408] = "Request Timeout"; -- RFC9110, Section 15.5.9
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    44
	[409] = "Conflict"; -- RFC9110, Section 15.5.10
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    45
	[410] = "Gone"; -- RFC9110, Section 15.5.11
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    46
	[411] = "Length Required"; -- RFC9110, Section 15.5.12
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    47
	[412] = "Precondition Failed"; -- RFC9110, Section 15.5.13
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    48
	[413] = "Content Too Large"; -- RFC9110, Section 15.5.14
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    49
	[414] = "URI Too Long"; -- RFC9110, Section 15.5.15
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    50
	[415] = "Unsupported Media Type"; -- RFC9110, Section 15.5.16
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    51
	[416] = "Range Not Satisfiable"; -- RFC9110, Section 15.5.17
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    52
	[417] = "Expectation Failed"; -- RFC9110, Section 15.5.18
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    53
	[418] = "I'm a teapot"; -- RFC2324, Section 2.3.2
9173
47ffce31ffe4 net.http.codes: "Correct" range of unassigned codes (thanks pep.)
Kim Alvefur <zash@zash.se>
parents: 9170
diff changeset
    54
	-- [419-420] = "Unassigned";
12552
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    55
	[421] = "Misdirected Request"; -- RFC9110, Section 15.5.20
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    56
	[422] = "Unprocessable Content"; -- RFC9110, Section 15.5.21
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    57
	[423] = "Locked";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    58
	[424] = "Failed Dependency";
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    59
	[425] = "Too Early";
12552
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    60
	[426] = "Upgrade Required"; -- RFC9110, Section 15.5.22
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    61
	-- [427] = "Unassigned";
6697
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
    62
	[428] = "Precondition Required";
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
    63
	[429] = "Too Many Requests";
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    64
	-- [430] = "Unassigned";
6697
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
    65
	[431] = "Request Header Fields Too Large";
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    66
	-- [432-450] = "Unassigned";
7575
f549587b8c06 net.http.codes: Add HTTP status code 451 Unavailable For Legal Reasons from RFC 7725
Kim Alvefur <zash@zash.se>
parents: 7574
diff changeset
    67
	[451] = "Unavailable For Legal Reasons";
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    68
	-- [452-499] = "Unassigned";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    69
12552
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    70
	[500] = "Internal Server Error"; -- RFC9110, Section 15.6.1
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    71
	[501] = "Not Implemented"; -- RFC9110, Section 15.6.2
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    72
	[502] = "Bad Gateway"; -- RFC9110, Section 15.6.3
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    73
	[503] = "Service Unavailable"; -- RFC9110, Section 15.6.4
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    74
	[504] = "Gateway Timeout"; -- RFC9110, Section 15.6.5
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    75
	[505] = "HTTP Version Not Supported"; -- RFC9110, Section 15.6.6
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    76
	[506] = "Variant Also Negotiates";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    77
	[507] = "Insufficient Storage";
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    78
	[508] = "Loop Detected";
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    79
	-- [509] = "Unassigned";
12552
5133d6e48686 net.http.codes: Refresh from registry, many refs now point to RFC9110
Kim Alvefur <zash@zash.se>
parents: 10374
diff changeset
    80
	[510] = "Not Extended"; -- (OBSOLETED)
6697
fc45dc6d604c net.http.codes: Update from registry
Kim Alvefur <zash@zash.se>
parents: 4723
diff changeset
    81
	[511] = "Network Authentication Required";
9170
7ed130d3676c net.http.codes: Regenerate from IANA registry with tool
Kim Alvefur <zash@zash.se>
parents: 7575
diff changeset
    82
	-- [512-599] = "Unassigned";
4631
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    83
};
fc5d3b053454 net.http.{server|codes|parser}: Initial commit.
Waqas Hussain <waqas20@gmail.com>
parents:
diff changeset
    84
10374
78bda7932f17 net.http.codes: Avoid implicit number -> string coercion
Kim Alvefur <zash@zash.se>
parents: 9173
diff changeset
    85
for k,v in pairs(response_codes) do response_codes[k] = ("%03d %s"):format(k, v); end
7574
e8efb5cf0877 net.http.codes: Remove used argument
Kim Alvefur <zash@zash.se>
parents: 6697
diff changeset
    86
return setmetatable(response_codes, { __index = function(_, k) return k.." Unassigned"; end })