File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / sapi / cli / tests / php_cli_server_010.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:35 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

    1: --TEST--
    2: Bug #60180 ($_SERVER["PHP_SELF"] incorrect)
    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["PHP_SELF"], $_SERVER["SCRIPT_NAME"], $_SERVER["PATH_INFO"], $_SERVER["QUERY_STRING"]);', TRUE);
   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 /foo/bar?foo=bar 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 /index.php/foo/bar/?foo=bar 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: ?>
   55: --EXPECTF--
   56: HTTP/1.1 200 OK
   57: Host: %s
   58: Connection: close
   59: X-Powered-By: PHP/%s
   60: Content-type: text/html
   61: 
   62: string(18) "/index.php/foo/bar"
   63: string(10) "/index.php"
   64: string(8) "/foo/bar"
   65: string(7) "foo=bar"
   66: HTTP/1.0 200 OK
   67: Host: %s
   68: Connection: close
   69: X-Powered-By: PHP/%s
   70: Content-type: text/html
   71: 
   72: string(19) "/index.php/foo/bar/"
   73: string(10) "/index.php"
   74: string(9) "/foo/bar/"
   75: string(7) "foo=bar"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>