diff options
| author | Andrea Faulds <ajf@ajf.me> | 2014-12-15 01:30:58 +0000 |
|---|---|---|
| committer | Andrea Faulds <ajf@ajf.me> | 2014-12-15 01:30:58 +0000 |
| commit | 7950429626f02afe77a45da6236f3eec84b49eff (patch) | |
| tree | 4ea5b72e8fde9ec9edd35c70b1e25ae8d332a1bd /sapi/cli/php_cli_server.c | |
| parent | 9c18ad3ac9103bc0a6c7b7ab8938fd7272095652 (diff) | |
| download | php-git-7950429626f02afe77a45da6236f3eec84b49eff.tar.gz | |
Revert HTTP status codes merger
This reverts commits 65768edcf3ef27a21a07e5e994bfd9ca1cabfa94, 627b350f31be83eb1d5ac5fad692256dcfaf1281 and 9c18ad3ac9103bc0a6c7b7ab8938fd7272095652.
Diffstat (limited to 'sapi/cli/php_cli_server.c')
| -rw-r--r-- | sapi/cli/php_cli_server.c | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 35eab85227..a0a9052f8a 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -68,7 +68,6 @@ #include "zend_hash.h" #include "zend_modules.h" #include "fopen_wrappers.h" -#include "http_status_codes.h" #include "zend_compile.h" #include "zend_execute.h" @@ -204,6 +203,55 @@ typedef struct php_cli_server_http_response_status_code_pair { const char *str; } php_cli_server_http_response_status_code_pair; +static php_cli_server_http_response_status_code_pair status_map[] = { + { 100, "Continue" }, + { 101, "Switching Protocols" }, + { 200, "OK" }, + { 201, "Created" }, + { 202, "Accepted" }, + { 203, "Non-Authoritative Information" }, + { 204, "No Content" }, + { 205, "Reset Content" }, + { 206, "Partial Content" }, + { 300, "Multiple Choices" }, + { 301, "Moved Permanently" }, + { 302, "Found" }, + { 303, "See Other" }, + { 304, "Not Modified" }, + { 305, "Use Proxy" }, + { 307, "Temporary Redirect" }, + { 308, "Permanent Redirect" }, + { 400, "Bad Request" }, + { 401, "Unauthorized" }, + { 402, "Payment Required" }, + { 403, "Forbidden" }, + { 404, "Not Found" }, + { 405, "Method Not Allowed" }, + { 406, "Not Acceptable" }, + { 407, "Proxy Authentication Required" }, + { 408, "Request Timeout" }, + { 409, "Conflict" }, + { 410, "Gone" }, + { 411, "Length Required" }, + { 412, "Precondition Failed" }, + { 413, "Request Entity Too Large" }, + { 414, "Request-URI Too Long" }, + { 415, "Unsupported Media Type" }, + { 416, "Requested Range Not Satisfiable" }, + { 417, "Expectation Failed" }, + { 426, "Upgrade Required" }, + { 428, "Precondition Required" }, + { 429, "Too Many Requests" }, + { 431, "Request Header Fields Too Large" }, + { 500, "Internal Server Error" }, + { 501, "Not Implemented" }, + { 502, "Bad Gateway" }, + { 503, "Service Unavailable" }, + { 504, "Gateway Timeout" }, + { 505, "HTTP Version Not Supported" }, + { 511, "Network Authentication Required" }, +}; + static php_cli_server_http_response_status_code_pair template_map[] = { { 400, "<h1>%s</h1><p>Your browser sent a request that this server could not understand.</p>" }, { 404, "<h1>%s</h1><p>The requested resource <code class=\"url\">%s</code> was not found on this server.</p>" }, @@ -276,8 +324,8 @@ static char *get_last_error() /* {{{ */ static int status_comp(const void *a, const void *b) /* {{{ */ { - const http_response_status_code_pair *pa = (const http_response_status_code_pair *) a; - const http_response_status_code_pair *pb = (const http_response_status_code_pair *) b; + const php_cli_server_http_response_status_code_pair *pa = (const php_cli_server_http_response_status_code_pair *) a; + const php_cli_server_http_response_status_code_pair *pb = (const php_cli_server_http_response_status_code_pair *) b; if (pa->code < pb->code) { return -1; @@ -290,12 +338,12 @@ static int status_comp(const void *a, const void *b) /* {{{ */ static const char *get_status_string(int code) /* {{{ */ { - http_response_status_code_pair needle, *result = NULL; + php_cli_server_http_response_status_code_pair needle, *result = NULL; needle.code = code; needle.str = NULL; - result = bsearch(&needle, http_status_map, sizeof(http_status_map) / sizeof(needle), sizeof(needle), status_comp); + result = bsearch(&needle, status_map, sizeof(status_map) / sizeof(needle), sizeof(needle), status_comp); if (result) { return result->str; |
