xref: /PHP-7.4/sapi/cli/tests/bug66830.phpt (revision 13274912)
1--TEST--
2Bug #66830 (Empty header causes PHP built-in web server to hang)
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start(<<<'PHP'
11header(' ');
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
35Date: %s
36Connection: close
37X-Powered-By: %s
38Content-type: text/html; charset=UTF-8
39