1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef HTTP_STATUS_CODES_H
22 #define HTTP_STATUS_CODES_H
23
24 typedef struct _http_response_status_code_pair {
25 const int code;
26 const char *str;
27 } http_response_status_code_pair;
28
29 static http_response_status_code_pair http_status_map[] = {
30 { 100, "Continue" },
31 { 101, "Switching Protocols" },
32 { 200, "OK" },
33 { 201, "Created" },
34 { 202, "Accepted" },
35 { 203, "Non-Authoritative Information" },
36 { 204, "No Content" },
37 { 205, "Reset Content" },
38 { 206, "Partial Content" },
39 { 300, "Multiple Choices" },
40 { 301, "Moved Permanently" },
41 { 302, "Found" },
42 { 303, "See Other" },
43 { 304, "Not Modified" },
44 { 305, "Use Proxy" },
45 { 307, "Temporary Redirect" },
46 { 308, "Permanent Redirect" },
47 { 400, "Bad Request" },
48 { 401, "Unauthorized" },
49 { 402, "Payment Required" },
50 { 403, "Forbidden" },
51 { 404, "Not Found" },
52 { 405, "Method Not Allowed" },
53 { 406, "Not Acceptable" },
54 { 407, "Proxy Authentication Required" },
55 { 408, "Request Timeout" },
56 { 409, "Conflict" },
57 { 410, "Gone" },
58 { 411, "Length Required" },
59 { 412, "Precondition Failed" },
60 { 413, "Request Entity Too Large" },
61 { 414, "Request-URI Too Long" },
62 { 415, "Unsupported Media Type" },
63 { 416, "Requested Range Not Satisfiable" },
64 { 417, "Expectation Failed" },
65 { 426, "Upgrade Required" },
66 { 428, "Precondition Required" },
67 { 429, "Too Many Requests" },
68 { 431, "Request Header Fields Too Large" },
69 { 451, "Unavailable For Legal Reasons"},
70 { 500, "Internal Server Error" },
71 { 501, "Not Implemented" },
72 { 502, "Bad Gateway" },
73 { 503, "Service Unavailable" },
74 { 504, "Gateway Timeout" },
75 { 505, "HTTP Version Not Supported" },
76 { 506, "Variant Also Negotiates" },
77 { 511, "Network Authentication Required" },
78
79 { 0, NULL }
80 };
81
82 static const size_t http_status_map_len = (sizeof(http_status_map) / sizeof(http_response_status_code_pair)) - 1;
83
84 #endif