1--TEST--
2Bug #55747 (request headers missed in $_SERVER)
3--INI--
4allow_url_fopen=1
5--SKIPIF--
6<?php
7include "skipif.inc";
8?>
9--FILE--
10<?php
11include "php_cli_server.inc";
12php_cli_server_start('foreach($_SERVER as $k=>$v) { if (!strncmp($k, "HTTP", 4)) var_dump( $k . ":" . $v); }');
13
14list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
15$port = intval($port)?:80;
16
17$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
18if (!$fp) {
19  die("connect failed");
20}
21
22if(fwrite($fp, <<<HEADER
23GET / HTTP/1.1
24Host:{$host}
25User-Agent:dummy
26Custom:foo
27Referer:http://www.php.net/
28
29
30HEADER
31)) {
32	while (!feof($fp)) {
33		echo fgets($fp);
34	}
35}
36
37?>
38--EXPECTF--
39HTTP/1.1 200 OK
40Host: %s
41Connection: close
42X-Powered-By: PHP/%s
43Content-type: text/html; charset=UTF-8
44
45string(19) "HTTP_HOST:localhost"
46string(21) "HTTP_USER_AGENT:dummy"
47string(15) "HTTP_CUSTOM:foo"
48string(32) "HTTP_REFERER:http://www.php.net/"
49