Skip to content

Add X-Powered-By header to builtin 404 page #13092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,7 @@ static zend_result php_cli_server_send_error_page(php_cli_server *server, php_cl
goto fail;
}
append_essential_headers(&buffer, client, 1, NULL);
smart_str_appends_ex(&buffer, SAPI_PHP_VERSION_HEADER "\r\n", 1);
smart_str_appends_ex(&buffer, "Content-Type: text/html; charset=UTF-8\r\n", 1);
smart_str_appends_ex(&buffer, "Content-Length: ", 1);
smart_str_append_unsigned_ex(&buffer, php_cli_server_buffer_size(&client->content_sender.buffer), 1);
Expand Down
6 changes: 6 additions & 0 deletions sapi/cli/tests/php_cli_server_013.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ HTTP/1.1 404 Not Found
Host: %s
Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-Type: text/html; charset=UTF-8
Content-Length: %d

Expand All @@ -136,6 +137,7 @@ HTTP/1.1 404 Not Found
Host: %s
Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-Type: text/html; charset=UTF-8
Content-Length: %d

Expand All @@ -145,6 +147,7 @@ HTTP/1.1 404 Not Found
Host: %s
Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-Type: text/html; charset=UTF-8
Content-Length: %d

Expand All @@ -153,6 +156,7 @@ HTTP/1.1 405 Method Not Allowed
Host: %s
Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-Type: text/html; charset=UTF-8
Content-Length: %d
Allow: GET, HEAD, POST
Expand All @@ -163,6 +167,7 @@ HTTP/1.1 405 Method Not Allowed
Host: %s
Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-Type: text/html; charset=UTF-8
Content-Length: %d
Allow: GET, HEAD, POST
Expand All @@ -173,6 +178,7 @@ HTTP/1.1 405 Method Not Allowed
Host: %s
Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-Type: text/html; charset=UTF-8
Content-Length: %d
Allow: GET, HEAD, POST
Expand Down
1 change: 1 addition & 0 deletions sapi/cli/tests/php_cli_server_014.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ HTTP/1.1 404 Not Found
Host: %s
Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-Type: %s
Content-Length: %d

Expand Down