Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
php_cli_server: ensure single date header is present
Currently the PHP Development Server appends a Date header in the response, despite already set from user code. Added a check condition before append the header, and a test file. Closes GH-12363.
- Loading branch information
1 parent
36a87e6
commit f6ac08c
Showing
3 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--TEST-- | ||
Ensure a single Date header is present | ||
--SKIPIF-- | ||
<?php | ||
include "skipif.inc"; | ||
?> | ||
--FILE-- | ||
<?php | ||
include "php_cli_server.inc"; | ||
php_cli_server_start(<<<'PHP' | ||
header('Date: Mon, 25 Mar 1985 00:20:00 GMT'); | ||
PHP | ||
); | ||
|
||
$host = PHP_CLI_SERVER_HOSTNAME; | ||
$fp = php_cli_server_connect(); | ||
|
||
if(fwrite($fp, <<<HEADER | ||
GET / HTTP/1.1 | ||
Host: {$host} | ||
HEADER | ||
)) { | ||
while (!feof($fp)) { | ||
echo fgets($fp); | ||
} | ||
} | ||
|
||
fclose($fp); | ||
?> | ||
--EXPECTF-- | ||
HTTP/1.1 200 OK | ||
Host: %s | ||
Connection: close | ||
X-Powered-By: %s | ||
Date: Mon, 25 Mar 1985 00:20:00 GMT | ||
Content-type: text/html; charset=UTF-8 | ||
|