From: Xinchen Hui Date: Wed, 10 Oct 2012 09:23:30 +0000 (+0800) Subject: Implemented FR #63242 (Default error page in PHP built-in web server uses outdated... X-Git-Tag: php-5.4.9RC1~21^2~10^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea441bd08dc1d9f5bd167f3f495321c5225909b6;p=php Implemented FR #63242 (Default error page in PHP built-in web server uses outdated html/css) --- diff --git a/NEWS b/NEWS index 5938d9841a..02fb131476 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ PHP NEWS ?? ??? 2012, PHP 5.4.8 - CLI server: + . Implemented FR #63242 (Default error page in PHP built-in web server uses + outdated html/css). (pascal.chevrel@free.fr) . Changed response to unknown HTTP method to 501 according to RFC. (Niklas Lindgren). . Support HTTP PATCH method. Patch by Niklas Lindgren, GitHub PR #190. diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 4d15db44af..5f263cb322 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -245,10 +245,10 @@ static php_cli_server_http_reponse_status_code_pair status_map[] = { }; static php_cli_server_http_reponse_status_code_pair template_map[] = { - { 400, "

%s

Your browser sent a request that this server could not understand.

" }, - { 404, "

%s

The requested resource %s was not found on this server.

" }, - { 500, "

%s

The server is temporarily unavailable.

" }, - { 501, "

%s

Request method not supported.

" } + { 400, "

%s

Your browser sent a request that this server could not understand.

" }, + { 404, "

%s

The requested resource %s was not found on this server.

" }, + { 500, "

%s

The server is temporarily unavailable.

" }, + { 501, "

%s

Request method not supported.

" } }; static php_cli_server_ext_mime_type_pair mime_type_map[] = { @@ -279,22 +279,10 @@ ZEND_DECLARE_MODULE_GLOBALS(cli_server); /* {{{ static char php_cli_server_css[] * copied from ext/standard/info.c */ -static const char php_cli_server_css[] = "\n"; +static const char php_cli_server_css[] = "\n"; /* }}} */ static void char_ptr_dtor_p(char **p) /* {{{ */ @@ -1757,7 +1745,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server escaped_request_uri = php_escape_html_entities_ex((unsigned char *)client->request.request_uri, client->request.request_uri_len, &escaped_request_uri_len, 0, ENT_QUOTES, NULL, 0 TSRMLS_CC); { - static const char prologue_template[] = "%d %s"; + static const char prologue_template[] = "%d %s"; php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(prologue_template) + 3 + strlen(status_string) + 1); if (!chunk) { goto fail; diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt index 18b7375b3f..570798a880 100644 --- a/sapi/cli/tests/php_cli_server_013.phpt +++ b/sapi/cli/tests/php_cli_server_013.phpt @@ -33,7 +33,7 @@ HEADER } } -echo preg_replace("/", $output), "\n"; +echo preg_replace("/", $output), "\n"; fclose($fp); @@ -55,7 +55,7 @@ HEADER } } -echo preg_replace("/", $output), "\n"; +echo preg_replace("/", $output), "\n"; fclose($fp); $output = ''; @@ -76,7 +76,7 @@ HEADER } } -echo preg_replace("/", $output), "\n"; +echo preg_replace("/", $output), "\n"; fclose($fp); ?> --EXPECTF-- @@ -87,22 +87,22 @@ Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: %d -404 Not Found -

Not Found

The requested resource / was not found on this server.

+404 Not Found +

Not Found

The requested resource / was not found on this server.

HTTP/1.1 404 Not Found Host: %s Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: %d -404 Not Found -

Not Found

The requested resource /main/style.css was not found on this server.

+404 Not Found +

Not Found

The requested resource /main/style.css was not found on this server.

HTTP/1.1 404 Not Found Host: %s Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: %d -404 Not Found -

Not Found

The requested resource /main/foo/bar was not found on this server.

+404 Not Found +

Not Found

The requested resource /main/foo/bar was not found on this server.

diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt index 2eca8706bb..f8a9905613 100644 --- a/sapi/cli/tests/php_cli_server_014.phpt +++ b/sapi/cli/tests/php_cli_server_014.phpt @@ -57,7 +57,7 @@ HEADER } } -echo preg_replace("/", $output), "\n"; +echo preg_replace("/", $output), "\n"; fclose($fp); ?> @@ -76,5 +76,5 @@ Connection: close Content-Type: %s Content-Length: %d -404 Not Found -

Not Found

The requested resource /main/no-exists.php was not found on this server.

+404 Not Found +

Not Found

The requested resource /main/no-exists.php was not found on this server.