File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / sapi / cli / tests / php_cli_server_016.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:32:13 2013 UTC (10 years, 11 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

    1: --TEST--
    2: Bug #60591 (Memory leak when access a non-exists file)
    3: --DESCRIPTION--
    4: this is an indirect test for bug 60591, since mem leak is reproted in the server side
    5: and require php compiled with --enable-debug
    6: --SKIPIF--
    7: <?php
    8: include "skipif.inc"; 
    9: ?>
   10: --FILE--
   11: <?php
   12: include "php_cli_server.inc";
   13: php_cli_server_start(<<<'PHP'
   14: if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"]))
   15:         return false; // serve the requested resource as-is.
   16: else {
   17:         echo "here";
   18: }
   19: PHP
   20: );
   21: 
   22: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
   23: $port = intval($port)?:80;
   24: 
   25: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
   26: if (!$fp) {
   27:   die("connect failed");
   28: }
   29: 
   30: if(fwrite($fp, <<<HEADER
   31: POST /no-exists.jpg HTTP/1.1
   32: Host: {$host}
   33: 
   34: 
   35: HEADER
   36: )) {
   37: 	while (!feof($fp)) {
   38: 		echo fgets($fp);
   39:         break;
   40: 	}
   41: }
   42: 
   43: fclose($fp);
   44: ?>
   45: --EXPECTF--
   46: HTTP/1.1 404 Not Found

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