xref: /PHP-7.0/sapi/cli/tests/emptyheader.phpt (revision cd9d90f4)
1--TEST--
2Correctly handle split and empty header
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 = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errmsg, 0.5);
13
14if (!$fp) {
15	die("connect failed: " . $errmsg);
16}
17
18fwrite($fp, "GET / HTTP/1.1\r\nUser-Agent\r\nAccept: */*\r\nReferer:\r\nHi\r\n\r\n");
19fflush($fp);
20while (!feof($fp)) {
21	echo fgets($fp);
22}
23fclose($fp);
24?>
25--EXPECTF--
26HTTP/1.1 200 OK
27%a
28array(3) {
29  ["User-AgentAccept"]=>
30  string(3) "*/*"
31  ["Referer"]=>
32  string(0) ""
33  ["Hi"]=>
34  string(0) ""
35}
36