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
44Date: %s
45Connection: close
46X-Powered-By: %s
47Bar-Foo: Foo
48Content-type: text/html; charset=UTF-8
49
50array(2) {
51  ["Host"]=>
52  string(9) "localhost"
53  ["Foo-Bar"]=>
54  string(3) "Bar"
55}
56array(2) {
57  ["Host"]=>
58  string(9) "localhost"
59  ["Foo-Bar"]=>
60  string(3) "Bar"
61}
62array(3) {
63  ["X-Powered-By"]=>
64  string(%d) "P%s"
65  ["Bar-Foo"]=>
66  string(3) "Foo"
67  ["Content-type"]=>
68  string(24) "text/html; charset=UTF-8"
69}
70