xref: /PHP-7.4/sapi/cli/tests/bug61679.phpt (revision 13274912)
1--TEST--
2Bug #61679 (Error on non-standard HTTP methods)
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start(<<<'PHP'
11echo "This should never echo";
12PHP
13);
14
15$host = PHP_CLI_SERVER_HOSTNAME;
16$fp = php_cli_server_connect();
17
18// Send a request with a fictitious request method,
19// I like smurfs, the smurf everything.
20if(fwrite($fp, <<<HEADER
21SMURF / HTTP/1.1
22Host: {$host}
23
24
25HEADER
26)) {
27    while (!feof($fp)) {
28        echo fgets($fp);
29        // Only echo the first line from the response,
30        // the rest is not interesting
31        break;
32    }
33}
34
35fclose($fp);
36?>
37--EXPECT--
38HTTP/1.1 501 Not Implemented
39