xref: /PHP-7.3/sapi/cli/tests/bug65633.phpt (revision f33c7b3e)
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
40Date: %s
41Connection: close
42X-Powered-By: %s
43Content-type: text/html; charset=UTF-8
44
45array(1) {
46  ["foo"]=>
47  string(3) "bar"
48}
49string(3) "bar"
50