1--TEST--
2Implement Req #65917 (getallheaders() is not supported by the built-in web server)
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start(<<<'PHP'
11header('Bar-Foo: Foo');
12var_dump(getallheaders());
13var_dump(apache_request_headers());
14var_dump(apache_response_headers());
15PHP
16);
17
18list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
19$port = intval($port)?:80;
20
21$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
22if (!$fp) {
23  die("connect failed");
24}
25
26if(fwrite($fp, <<<HEADER
27GET / HTTP/1.1
28Host: {$host}
29Foo-Bar: Bar
30
31
32HEADER
33)) {
34    while (!feof($fp)) {
35        echo fgets($fp);
36    }
37}
38
39fclose($fp);
40?>
41--EXPECTF--
42HTTP/1.1 200 OK
43Host: %s
44Connection: close
45X-Powered-By: %s
46Bar-Foo: Foo
47Content-type: text/html; charset=UTF-8
48
49array(2) {
50  ["Host"]=>
51  string(9) "localhost"
52  ["Foo-Bar"]=>
53  string(3) "Bar"
54}
55array(2) {
56  ["Host"]=>
57  string(9) "localhost"
58  ["Foo-Bar"]=>
59  string(3) "Bar"
60}
61array(3) {
62  ["X-Powered-By"]=>
63  string(%d) "P%s"
64  ["Bar-Foo"]=>
65  string(3) "Foo"
66  ["Content-type"]=>
67  string(24) "text/html; charset=UTF-8"
68}
69