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