Annotation of embedaddon/php/sapi/cli/tests/php_cli_server_004.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #55747 (request headers missed in $_SERVER)
! 3: --INI--
! 4: allow_url_fopen=1
! 5: --SKIPIF--
! 6: <?php
! 7: include "skipif.inc";
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: include "php_cli_server.inc";
! 12: php_cli_server_start('foreach($_SERVER as $k=>$v) { if (!strncmp($k, "HTTP", 4)) var_dump( $k . ":" . $v); }');
! 13:
! 14: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
! 15: $port = intval($port)?:80;
! 16:
! 17: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
! 18: if (!$fp) {
! 19: die("connect failed");
! 20: }
! 21:
! 22: if(fwrite($fp, <<<HEADER
! 23: GET / HTTP/1.1
! 24: Host:{$host}
! 25: User-Agent:dummy
! 26: Custom:foo
! 27: Referer:http://www.php.net/
! 28:
! 29:
! 30: HEADER
! 31: )) {
! 32: while (!feof($fp)) {
! 33: echo fgets($fp);
! 34: }
! 35: }
! 36:
! 37: ?>
! 38: --EXPECTF--
! 39: HTTP/1.1 200 OK
! 40: Host: %s
! 41: Connection: close
! 42: X-Powered-By: PHP/%s
! 43: Content-type: text/html
! 44:
! 45: string(19) "HTTP_HOST:localhost"
! 46: string(21) "HTTP_USER_AGENT:dummy"
! 47: string(15) "HTTP_CUSTOM:foo"
! 48: string(32) "HTTP_REFERER:http://www.php.net/"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>