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