Browse Source
Implemented FR #65917 (getallheaders() is not supported by the built-in...)
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 UPGRADINGpull/528/head
5 changed files with 134 additions and 2 deletions
-
4NEWS
-
3UPGRADING
-
4sapi/cgi/cgi_main.c
-
79sapi/cli/php_cli_server.c
-
46sapi/cli/tests/php_cli_server_019.phpt
@ -0,0 +1,46 @@ |
|||
--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" |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue