xref: /PHP-7.1/sapi/cli/tests/bug66606_2.phpt (revision 7af945e2)
1--TEST--
2Bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE) - POST request
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('var_dump($_SERVER["CONTENT_TYPE"], $_SERVER["CONTENT_LENGTH"])');
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
23POST /index.php HTTP/1.1
24Host: {$host}
25Content-Type: application/x-www-form-urlencoded
26Content-Length: 3
27
28a=b
29HEADER
30)) {
31	while (!feof($fp)) {
32		echo fgets($fp);
33	}
34}
35
36fclose($fp);
37?>
38--EXPECTF--
39HTTP/1.1 200 OK
40Host: %s
41Date: %s
42Connection: close
43X-Powered-By: PHP/%s
44Content-type: text/html; charset=UTF-8
45
46string(33) "application/x-www-form-urlencoded"
47string(1) "3"
48