http_status_codes.h 2.8 KB

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