xref: /PHP-8.2/sapi/cli/tests/gh12363.phpt (revision f6ac08c6)
1--TEST--
2Ensure a single Date header is present
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start(<<<'PHP'
11header('Date: Mon, 25 Mar 1985 00:20:00 GMT');
12PHP
13);
14
15$host = PHP_CLI_SERVER_HOSTNAME;
16$fp = php_cli_server_connect();
17
18if(fwrite($fp, <<<HEADER
19GET / HTTP/1.1
20Host: {$host}
21
22
23HEADER
24)) {
25    while (!feof($fp)) {
26        echo fgets($fp);
27    }
28}
29
30fclose($fp);
31?>
32--EXPECTF--
33HTTP/1.1 200 OK
34Host: %s
35Connection: close
36X-Powered-By: %s
37Date: Mon, 25 Mar 1985 00:20:00 GMT
38Content-type: text/html; charset=UTF-8
39
40