xref: /PHP-5.4/sapi/cli/tests/bug65066_422.phpt (revision 283f56af)
1--TEST--
2Bug #65066 (Cli server not responsive when responding with 422 http status code): 422 status code
3--INI--
4allow_url_fopen=1
5--SKIPIF--
6<?php
7include "skipif.inc";
8?>
9--FILE--
10<?php
11include "php_cli_server.inc";
12php_cli_server_start('http_response_code(422);');
13
14list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
15$port = intval($port)?:80;
16
17$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
18if (!$fp) {
19  die("connect failed");
20}
21
22if(fwrite($fp, <<<HEADER
23GET / HTTP/1.1
24Host: {$host}
25
26
27HEADER
28)) {
29	while (!feof($fp)) {
30		echo fgets($fp);
31	}
32}
33?>
34--EXPECTF--
35HTTP/1.1 422 Unknown Status Code
36Host: %s
37Connection: close
38X-Powered-By: PHP/%s
39Content-type: text/html
40