1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/sapi/cli/tests/php_cli_server_019.phpt
Andrea Faulds aee271ec0d Implemented FR #65917 (getallheaders() is not supported by the built-in...)
- Implemented apache_request_headers() and getallheaders() alias in CLI server
- Implemented apache_response_headers() in CLI server using FastCGI code

Conflicts:
	NEWS
	UPGRADING
2013-11-12 20:27:34 +00:00

47 lines
857 B
PHP

--TEST--
Implement Req #65917 (getallheaders() is not supported by the built-in web server)
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
include "php_cli_server.inc";
php_cli_server_start(<<<'PHP'
header('Content-Type: text/plain');
var_dump(getallheaders());
var_dump(apache_request_headers());
var_dump(apache_response_headers());
PHP
);
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Foo-Bar: bar\r\n"
)
);
$context = stream_context_create($opts);
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS, false, $context);
?>
--EXPECTF--
array(2) {
["Host"]=>
string(%s) "%s:%s"
["Foo-Bar"]=>
string(3) "bar"
}
array(2) {
["Host"]=>
string(%s) "%s:%s"
["Foo-Bar"]=>
string(3) "bar"
}
array(2) {
["X-Powered-By"]=>
string(%s) "PHP/%s"
["Content-Type"]=>
string(10) "text/plain"
}