1--TEST--
2SERVER_PROTOCOL header availability
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start('var_dump($_SERVER["SERVER_PROTOCOL"]);');
11
12list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
13$port = intval($port)?:80;
14
15$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
16if (!$fp) {
17  die("connect failed");
18}
19
20if(fwrite($fp, <<<HEADER
21GET / HTTP/1.1
22Host: {$host}
23
24
25HEADER
26)) {
27	while (!feof($fp)) {
28		echo fgets($fp);
29	}
30}
31
32fclose($fp);
33
34$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
35if (!$fp) {
36  die("connect failed");
37}
38
39
40if(fwrite($fp, <<<HEADER
41GET / HTTP/1.0
42Host: {$host}
43
44
45HEADER
46)) {
47	while (!feof($fp)) {
48		echo fgets($fp);
49	}
50}
51
52fclose($fp);
53?>
54--EXPECTF--
55HTTP/1.1 200 OK
56Host: %s
57Connection: close
58X-Powered-By: PHP/%s
59Content-type: text/html; charset=UTF-8
60
61string(8) "HTTP/1.1"
62HTTP/1.0 200 OK
63Host: %s
64Connection: close
65X-Powered-By: PHP/%s
66Content-type: text/html; charset=UTF-8
67
68string(8) "HTTP/1.0"
69