xref: /openbsd-src/usr.sbin/bgplgd/http.h (revision e76e7180ef44bd7168efdb5e33737f0b23c51e48)
1 /*	$OpenBSD: http.h,v 1.1 2022/06/28 16:11:30 claudio Exp $	*/
2 
3 /*
4  * Copyright (c) 2012 - 2015 Reyk Floeter <reyk@openbsd.org>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 struct http_error {
20 	int			 error_code;
21 	const char		*error_name;
22 };
23 
24 /*
25  * HTTP status codes based on IANA assignments (2014-06-11 version):
26  * https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
27  * plus legacy (306) and non-standard (420).
28  */
29 #define HTTP_ERRORS		{			\
30 	{ 100,	"Continue" },				\
31 	{ 101,	"Switching Protocols" },		\
32 	{ 102,	"Processing" },				\
33 	/* 103-199 unassigned */			\
34 	{ 200,	"OK" },					\
35 	{ 201,	"Created" },				\
36 	{ 202,	"Accepted" },				\
37 	{ 203,	"Non-Authoritative Information" },	\
38 	{ 204,	"No Content" },				\
39 	{ 205,	"Reset Content" },			\
40 	{ 206,	"Partial Content" },			\
41 	{ 207,	"Multi-Status" },			\
42 	{ 208,	"Already Reported" },			\
43 	/* 209-225 unassigned */			\
44 	{ 226,	"IM Used" },				\
45 	/* 227-299 unassigned */			\
46 	{ 300,	"Multiple Choices" },			\
47 	{ 301,	"Moved Permanently" },			\
48 	{ 302,	"Found" },				\
49 	{ 303,	"See Other" },				\
50 	{ 304,	"Not Modified" },			\
51 	{ 305,	"Use Proxy" },				\
52 	{ 306,	"Switch Proxy" },			\
53 	{ 307,	"Temporary Redirect" },			\
54 	{ 308,	"Permanent Redirect" },			\
55 	/* 309-399 unassigned */			\
56 	{ 400,	"Bad Request" },			\
57 	{ 401,	"Unauthorized" },			\
58 	{ 402,	"Payment Required" },			\
59 	{ 403,	"Forbidden" },				\
60 	{ 404,	"Not Found" },				\
61 	{ 405,	"Method Not Allowed" },			\
62 	{ 406,	"Not Acceptable" },			\
63 	{ 407,	"Proxy Authentication Required" },	\
64 	{ 408,	"Request Timeout" },			\
65 	{ 409,	"Conflict" },				\
66 	{ 410,	"Gone" },				\
67 	{ 411,	"Length Required" },			\
68 	{ 412,	"Precondition Failed" },		\
69 	{ 413,	"Payload Too Large" },			\
70 	{ 414,	"URI Too Long" },			\
71 	{ 415,	"Unsupported Media Type" },		\
72 	{ 416,	"Range Not Satisfiable" },		\
73 	{ 417,	"Expectation Failed" },			\
74 	{ 418,	"I'm a teapot" },			\
75 	/* 419-421 unassigned */			\
76 	{ 420,	"Enhance Your Calm" },			\
77 	{ 422,	"Unprocessable Entity" },		\
78 	{ 423,	"Locked" },				\
79 	{ 424,	"Failed Dependency" },			\
80 	/* 425 unassigned */				\
81 	{ 426,	"Upgrade Required" },			\
82 	/* 427 unassigned */				\
83 	{ 428,	"Precondition Required" },		\
84 	{ 429,	"Too Many Requests" },			\
85 	/* 430 unassigned */				\
86 	{ 431,	"Request Header Fields Too Large" },	\
87 	/* 432-450 unassigned */			\
88 	{ 451,	"Unavailable For Legal Reasons" },	\
89 	/* 452-499 unassigned */			\
90 	{ 500,	"Internal Server Error" },		\
91 	{ 501,	"Not Implemented" },			\
92 	{ 502,	"Bad Gateway" },			\
93 	{ 503,	"Service Unavailable" },		\
94 	{ 504,	"Gateway Timeout" },			\
95 	{ 505,	"HTTP Version Not Supported" },		\
96 	{ 506,	"Variant Also Negotiates" },		\
97 	{ 507,	"Insufficient Storage" },		\
98 	{ 508,	"Loop Detected" },			\
99 	/* 509 unassigned */				\
100 	{ 510,	"Not Extended" },			\
101 	{ 511,	"Network Authentication Required" },	\
102 	/* 512-599 unassigned */			\
103 	{ 0,	NULL }					\
104 }
105