????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.55 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/http/ |
Upload File : |
--TEST--
http:// and ignore_errors
--INI--
allow_url_fopen=1
--SKIPIF--
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
--FILE--
<?php
require 'server.inc';
function do_test($context_options) {
$context = stream_context_create(array('http' => $context_options));
$responses = array(
"data://text/plain,HTTP/1.0 200 Ok\r\nX-Foo: bar\r\n\r\n1",
"data://text/plain,HTTP/1.0 404 Not found\r\nX-bar: baz\r\n\r\n2",
);
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
foreach($responses as $r) {
$fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context);
var_dump($fd);
if ($fd) {
$meta_data = stream_get_meta_data($fd);
var_dump($meta_data['wrapper_data']);
var_dump(stream_get_contents($fd));
}
fseek($output, 0, SEEK_SET);
var_dump(stream_get_contents($output));
fseek($output, 0, SEEK_SET);
}
http_server_kill($pid);
}
echo "-- Test: requests without ignore_errors --\n";
do_test(array());
echo "-- Test: requests with ignore_errors --\n";
do_test(array('ignore_errors' => true));
echo "-- Test: requests with ignore_errors (2) --\n";
do_test(array('ignore_errors' => 1));
?>
--EXPECTF--
-- Test: requests without ignore_errors --
resource(%d) of type (stream)
array(2) {
[0]=>
string(15) "HTTP/1.0 200 Ok"
[1]=>
string(10) "X-Foo: bar"
}
string(1) "1"
string(%d) "GET /foo/bar HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
"
Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: HTTP request failed! HTTP/1.0 404 Not found
in %s on line %d
bool(false)
string(%d) "GET /foo/bar HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
"
-- Test: requests with ignore_errors --
resource(%d) of type (stream)
array(2) {
[0]=>
string(15) "HTTP/1.0 200 Ok"
[1]=>
string(10) "X-Foo: bar"
}
string(1) "1"
string(%d) "GET /foo/bar HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
"
resource(%d) of type (stream)
array(2) {
[0]=>
string(22) "HTTP/1.0 404 Not found"
[1]=>
string(10) "X-bar: baz"
}
string(1) "2"
string(%d) "GET /foo/bar HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
"
-- Test: requests with ignore_errors (2) --
resource(%d) of type (stream)
array(2) {
[0]=>
string(15) "HTTP/1.0 200 Ok"
[1]=>
string(10) "X-Foo: bar"
}
string(1) "1"
string(%d) "GET /foo/bar HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
"
resource(%d) of type (stream)
array(2) {
[0]=>
string(22) "HTTP/1.0 404 Not found"
[1]=>
string(10) "X-bar: baz"
}
string(1) "2"
string(%d) "GET /foo/bar HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
"