File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / sapi / cli / tests / bug61679.phpt
Revision 1.1.1.1 (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 #61679 (Error on non-standard HTTP methods)
    3: --SKIPIF--
    4: <?php
    5: include "skipif.inc";
    6: ?>
    7: --FILE--
    8: <?php
    9: include "php_cli_server.inc";
   10: php_cli_server_start(<<<'PHP'
   11: echo "This should never echo";
   12: PHP
   13: );
   14: 
   15: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
   16: $port = intval($port)?:80;
   17: 
   18: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
   19: if (!$fp) {
   20:   die("connect failed");
   21: }
   22: 
   23: // Send a request with a fictitious request method,
   24: // I like smurfs, the smurf everything.
   25: if(fwrite($fp, <<<HEADER
   26: SMURF / HTTP/1.1
   27: Host: {$host}
   28: 
   29: 
   30: HEADER
   31: )) {
   32:     while (!feof($fp)) {
   33:         echo fgets($fp);
   34:         // Only echo the first line from the response,
   35:         // the rest is not interesting
   36:         break;
   37:     }
   38: }
   39: 
   40: fclose($fp);
   41: ?>
   42: --EXPECTF--
   43: HTTP/1.1 501 Not Implemented

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