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