xref: /PHP-7.4/main/http_status_codes.h (revision 92ac598a)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) The PHP Group                                          |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Author: Andrea Faulds     <ajf@ajf.me>                               |
16    +----------------------------------------------------------------------+
17 */
18 
19 #ifndef HTTP_STATUS_CODES_H
20 #define HTTP_STATUS_CODES_H
21 
22 typedef struct _http_response_status_code_pair {
23 	const int code;
24 	const char *str;
25 } http_response_status_code_pair;
26 
27 static const http_response_status_code_pair http_status_map[] = {
28 	{ 100, "Continue" },
29 	{ 101, "Switching Protocols" },
30 	{ 200, "OK" },
31 	{ 201, "Created" },
32 	{ 202, "Accepted" },
33 	{ 203, "Non-Authoritative Information" },
34 	{ 204, "No Content" },
35 	{ 205, "Reset Content" },
36 	{ 206, "Partial Content" },
37 	{ 300, "Multiple Choices" },
38 	{ 301, "Moved Permanently" },
39 	{ 302, "Found" },
40 	{ 303, "See Other" },
41 	{ 304, "Not Modified" },
42 	{ 305, "Use Proxy" },
43 	{ 307, "Temporary Redirect" },
44 	{ 308, "Permanent Redirect" },
45 	{ 400, "Bad Request" },
46 	{ 401, "Unauthorized" },
47 	{ 402, "Payment Required" },
48 	{ 403, "Forbidden" },
49 	{ 404, "Not Found" },
50 	{ 405, "Method Not Allowed" },
51 	{ 406, "Not Acceptable" },
52 	{ 407, "Proxy Authentication Required" },
53 	{ 408, "Request Timeout" },
54 	{ 409, "Conflict" },
55 	{ 410, "Gone" },
56 	{ 411, "Length Required" },
57 	{ 412, "Precondition Failed" },
58 	{ 413, "Request Entity Too Large" },
59 	{ 414, "Request-URI Too Long" },
60 	{ 415, "Unsupported Media Type" },
61 	{ 416, "Requested Range Not Satisfiable" },
62 	{ 417, "Expectation Failed" },
63 	{ 426, "Upgrade Required" },
64 	{ 428, "Precondition Required" },
65 	{ 429, "Too Many Requests" },
66 	{ 431, "Request Header Fields Too Large" },
67 	{ 451, "Unavailable For Legal Reasons"},
68 	{ 500, "Internal Server Error" },
69 	{ 501, "Not Implemented" },
70 	{ 502, "Bad Gateway" },
71 	{ 503, "Service Unavailable" },
72 	{ 504, "Gateway Timeout" },
73 	{ 505, "HTTP Version Not Supported" },
74 	{ 506, "Variant Also Negotiates" },
75 	{ 511, "Network Authentication Required" },
76 	/* to allow search with while() loop */
77 	{ 0, NULL }
78 };
79 
80 static const size_t http_status_map_len = (sizeof(http_status_map) / sizeof(http_response_status_code_pair)) - 1;
81 
82 #endif /* HTTP_STATUS_CODES_H */
83