Annotation of embedaddon/php/ext/standard/tests/http/bug48929.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #48929 (duplicate \r\n sent after last header line)
                      3: --INI--
                      4: allow_url_fopen=1
                      5: --SKIPIF--
                      6: <?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
                      7: --FILE--
                      8: <?php
                      9: require 'server.inc';
                     10: 
                     11: function do_test($context_options) {
                     12: 
                     13:        $context = stream_context_create(array('http' => $context_options));
                     14: 
                     15:        $responses = array(
                     16:                "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
                     17:        );
                     18: 
                     19:        $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
                     20: 
                     21:        foreach($responses as $r) {
                     22: 
                     23:                $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context);
                     24: 
                     25:                fseek($output, 0, SEEK_SET);
                     26:                var_dump(stream_get_contents($output));
                     27:                fseek($output, 0, SEEK_SET);
                     28:        }
                     29: 
                     30:        http_server_kill($pid);
                     31: }
                     32: 
                     33: echo "-- Test: requests with 'header' as array --\n";
                     34: 
                     35: do_test(array('header' => array('X-Foo: bar', 'Content-Type: text/plain'), 'method' => 'POST', 'content' => 'ohai'));
                     36: 
                     37: echo "-- Test: requests with 'header' as string --\n";
                     38: 
                     39: do_test(array('header' => "X-Foo: bar\r\nContent-Type: text/plain", 'method' => 'POST', 'content' => 'ohai'));
                     40: 
                     41: ?>
                     42: --EXPECT--
                     43: -- Test: requests with 'header' as array --
                     44: string(103) "POST / HTTP/1.0
                     45: Host: 127.0.0.1:12342
                     46: Content-Length: 4
                     47: X-Foo: bar
                     48: Content-Type: text/plain
                     49: 
                     50: ohai"
                     51: -- Test: requests with 'header' as string --
                     52: string(103) "POST / HTTP/1.0
                     53: Host: 127.0.0.1:12342
                     54: Content-Length: 4
                     55: X-Foo: bar
                     56: Content-Type: text/plain
                     57: 
                     58: ohai"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>