xref: /PHP-7.0/sapi/cli/tests/bug65633.phpt (revision cbd108ab)
1--TEST--
2Bug #65633 (built-in server treat some http headers as case-sensitive)
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start(<<<'PHP'
11var_dump($_COOKIE, $_SERVER['HTTP_FOO']);
12PHP
13);
14
15list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
16$port = intval($port)?:80;
17
18$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
19if (!$fp) {
20  die("connect failed");
21}
22
23if(fwrite($fp, <<<HEADER
24GET / HTTP/1.1
25cookie: foo=bar
26foo: bar
27
28
29HEADER
30)) {
31    while (!feof($fp)) {
32        echo fgets($fp);
33    }
34}
35
36fclose($fp);
37?>
38--EXPECTF--
39HTTP/1.1 200 OK
40Connection: close
41X-Powered-By: %s
42Content-type: text/html; charset=UTF-8
43
44array(1) {
45  ["foo"]=>
46  string(3) "bar"
47}
48string(3) "bar"
49