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 57Date: %s 58Connection: close 59X-Powered-By: PHP/%s 60Content-type: text/html; charset=UTF-8 61 62string(8) "HTTP/1.1" 63HTTP/1.0 200 OK 64Host: %s 65Date: %s 66Connection: close 67X-Powered-By: PHP/%s 68Content-type: text/html; charset=UTF-8 69 70string(8) "HTTP/1.0" 71