xref: /PHP-7.3/sapi/cli/tests/bug65066_511.phpt (revision 782352c5)
1--TEST--
2Bug #65066 (Cli server not responsive when responding with 422 http status code): 511 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(511);');
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 511 Network Authentication Required
36Host: %s
37Date: %s
38Connection: close
39X-Powered-By: PHP/%s
40Content-type: text/html; charset=UTF-8
41