File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / sapi / cli / tests / bug65066_422.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 08:02:45 2013 UTC (10 years, 9 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, HEAD
v 5.4.20

    1: --TEST--
    2: Bug #65066 (Cli server not responsive when responding with 422 http status code): 422 status code
    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('http_response_code(422);');
   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: 
   26: 
   27: HEADER
   28: )) {
   29: 	while (!feof($fp)) {
   30: 		echo fgets($fp);
   31: 	}
   32: }
   33: ?>
   34: --EXPECTF--
   35: HTTP/1.1 422 Unknown Status Code
   36: Host: %s
   37: Connection: close
   38: X-Powered-By: PHP/%s
   39: Content-type: text/html

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