mirror of
https://github.com/php/php-src.git
synced 2024-09-23 02:47:26 +00:00
5146d9f8ac
The stream handler assumed all HTTP headers contained exactly one space, but the standard says there may be zero or more. Should fix Bug #47021, and any other edge cases caused by a web server sending unusual spacing, e.g. the MIME type discovered from Content-Type: can no longer contain leading whitespace. We strip trailing whitespace from the headers added into $http_response_header as well.
38 lines
665 B
PHP
38 lines
665 B
PHP
--TEST--
|
|
$http_reponse_header (whitespace-only "header")
|
|
--SKIPIF--
|
|
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:22350'); ?>
|
|
--INI--
|
|
allow_url_fopen=1
|
|
allow_url_include=1
|
|
--FILE--
|
|
<?php
|
|
require 'server.inc';
|
|
|
|
$responses = array(
|
|
"data://text/plain,HTTP/1.0 200 Ok\r\n \r\n\r\nBody",
|
|
);
|
|
|
|
$pid = http_server("tcp://127.0.0.1:22350", $responses, $output);
|
|
|
|
function test() {
|
|
$f = file_get_contents('http://127.0.0.1:22350/');
|
|
var_dump($f);
|
|
var_dump($http_response_header);
|
|
}
|
|
test();
|
|
|
|
http_server_kill($pid);
|
|
?>
|
|
==DONE==
|
|
--EXPECT--
|
|
string(4) "Body"
|
|
array(2) {
|
|
[0]=>
|
|
string(15) "HTTP/1.0 200 Ok"
|
|
[1]=>
|
|
string(0) ""
|
|
}
|
|
==DONE==
|
|
|