????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.217.55.199 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-- Bug #38802 (ignore_errors and max_redirects) --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 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar2\r\n\r\n1", "data://text/plain,HTTP/1.0 301 Moved Permanently\r\nLocation: http://127.0.0.1:12342/foo/bar3\r\n\r\n", "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar4\r\n\r\n3", "data://text/plain,HTTP/1.0 200 OK\r\n\r\ndone.", ); $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); $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)); http_server_kill($pid); } echo "-- Test: follow all redirections --\n"; do_test(array(), 4); echo "-- Test: fail after 2 redirections --\n"; do_test(array('max_redirects' => 2), 2); echo "-- Test: fail at first redirection --\n"; do_test(array('max_redirects' => 0), 1); echo "-- Test: fail at first redirection (2) --\n"; do_test(array('max_redirects' => 1), 1); echo "-- Test: return at first redirection --\n"; do_test(array('max_redirects' => 0, 'ignore_errors' => 1), 1); echo "-- Test: return at first redirection (2) --\n"; do_test(array('max_redirects' => 1, 'ignore_errors' => 1), 1); echo "-- Test: return at second redirection --\n"; do_test(array('max_redirects' => 2, 'ignore_errors' => 1), 2); ?> --EXPECTF-- -- Test: follow all redirections -- resource(%d) of type (stream) array(7) { [0]=> string(30) "HTTP/1.0 302 Moved Temporarily" [1]=> string(41) "Location: http://127.0.0.1:12342/foo/bar2" [2]=> string(30) "HTTP/1.0 301 Moved Permanently" [3]=> string(41) "Location: http://127.0.0.1:12342/foo/bar3" [4]=> string(30) "HTTP/1.0 302 Moved Temporarily" [5]=> string(41) "Location: http://127.0.0.1:12342/foo/bar4" [6]=> string(15) "HTTP/1.0 200 OK" } string(5) "done." string(%d) "GET /foo/bar HTTP/1.0 Host: 127.0.0.1:12342 Connection: close GET /foo/bar2 HTTP/1.0 Host: 127.0.0.1:12342 Connection: close GET /foo/bar3 HTTP/1.0 Host: 127.0.0.1:12342 Connection: close GET /foo/bar4 HTTP/1.0 Host: 127.0.0.1:12342 Connection: close " -- Test: fail after 2 redirections -- Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s bool(false) string(%d) "GET /foo/bar HTTP/1.0 Host: 127.0.0.1:12342 Connection: close GET /foo/bar2 HTTP/1.0 Host: 127.0.0.1:12342 Connection: close " -- Test: fail at first redirection -- Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s bool(false) string(%d) "GET /foo/bar HTTP/1.0 Host: 127.0.0.1:12342 Connection: close " -- Test: fail at first redirection (2) -- Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s bool(false) string(%d) "GET /foo/bar HTTP/1.0 Host: 127.0.0.1:12342 Connection: close " -- Test: return at first redirection -- resource(%d) of type (stream) array(2) { [0]=> string(30) "HTTP/1.0 302 Moved Temporarily" [1]=> string(41) "Location: http://127.0.0.1:12342/foo/bar2" } string(1) "1" string(%d) "GET /foo/bar HTTP/1.0 Host: 127.0.0.1:12342 Connection: close " -- Test: return at first redirection (2) -- resource(%d) of type (stream) array(2) { [0]=> string(30) "HTTP/1.0 302 Moved Temporarily" [1]=> string(41) "Location: http://127.0.0.1:12342/foo/bar2" } string(1) "1" string(%d) "GET /foo/bar HTTP/1.0 Host: 127.0.0.1:12342 Connection: close " -- Test: return at second redirection -- resource(%d) of type (stream) array(4) { [0]=> string(30) "HTTP/1.0 302 Moved Temporarily" [1]=> string(41) "Location: http://127.0.0.1:12342/foo/bar2" [2]=> string(30) "HTTP/1.0 301 Moved Permanently" [3]=> string(41) "Location: http://127.0.0.1:12342/foo/bar3" } string(0) "" string(%d) "GET /foo/bar HTTP/1.0 Host: 127.0.0.1:12342 Connection: close GET /foo/bar2 HTTP/1.0 Host: 127.0.0.1:12342 Connection: close "