xref: /PHP-8.0/sapi/cli/tests/bug70470.phpt (revision 13274912)
1--TEST--
2Bug #70470 (Built-in server truncates headers spanning over TCP packets)
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start("var_dump(getAllheaders());");
11
12$fp = php_cli_server_connect();
13
14fwrite($fp, "GET / HTTP/1.1\r\n");
15fwrite($fp, "Host: " . PHP_CLI_SERVER_HOSTNAME . "\r\n");
16fwrite($fp, "Content");
17fflush($fp);
18usleep(200000);
19fwrite($fp, "-Type: text/html; charset=UTF-8\r\n");
20fwrite($fp, "Connection: clo");
21fflush($fp);
22usleep(200000);
23fwrite($fp, "se\r\n\r\n");
24while (!feof($fp)) {
25    echo fgets($fp);
26}
27fclose($fp);
28?>
29--EXPECTF--
30HTTP/1.1 200 OK
31%a
32array(3) {
33  ["Host"]=>
34  string(9) "localhost"
35  ["Content-Type"]=>
36  string(24) "text/html; charset=UTF-8"
37  ["Connection"]=>
38  string(5) "close"
39}
40