bug65066_511.phpt 713 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Bug #65066 (Cli server not responsive when responding with 422 http status code): 511 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(511);');
  13. list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
  14. $port = intval($port)?:80;
  15. $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
  16. if (!$fp) {
  17. die("connect failed");
  18. }
  19. if(fwrite($fp, <<<HEADER
  20. GET / HTTP/1.1
  21. Host: {$host}
  22. HEADER
  23. )) {
  24. while (!feof($fp)) {
  25. echo fgets($fp);
  26. }
  27. }
  28. ?>
  29. --EXPECTF--
  30. HTTP/1.1 511 Network Authentication Required
  31. Host: %s
  32. Connection: close
  33. X-Powered-By: PHP/%s
  34. Content-type: text/html; charset=UTF-8