Annotation of embedaddon/php/ext/standard/tests/http/bug61548.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #61548 (content-type must appear at the end of headers)
        !             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($header) {
        !            12:     $options = [
        !            13:         'http' => [
        !            14:                        'method' => 'POST',
        !            15:                        'header' => $header,
        !            16:             'follow_location' => true,
        !            17:         ],
        !            18:     ];
        !            19: 
        !            20:     $ctx = stream_context_create($options);
        !            21: 
        !            22:     $responses = [
        !            23:                "data://text/plain,HTTP/1.1 201\r\nLocation: /foo\r\n\r\n",
        !            24:                "data://text/plain,HTTP/1.1 200\r\nConnection: close\r\n\r\n",
        !            25:        ];
        !            26:     $pid = http_server('tcp://127.0.0.1:12342', $responses, $output);
        !            27: 
        !            28:     $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $ctx);
        !            29:     fseek($output, 0, SEEK_SET);
        !            30:     echo stream_get_contents($output);
        !            31: 
        !            32:     http_server_kill($pid);
        !            33: }
        !            34: 
        !            35: do_test("First:1\nSecond:2\nContent-type: text/plain");
        !            36: do_test("First:1\nSecond:2\nContent-type: text/plain\n");
        !            37: do_test("First:1\nSecond:2\nContent-type: text/plain\nThird:");
        !            38: do_test("First:1\nContent-type:text/plain\nSecond:2");
        !            39: do_test("First:1\nContent-type:text/plain\nSecond:2\n");
        !            40: do_test("First:1\nContent-type:text/plain\nSecond:2\nThird:");
        !            41: 
        !            42: ?>
        !            43: Done
        !            44: --EXPECT--
        !            45: POST / HTTP/1.0
        !            46: Host: 127.0.0.1:12342
        !            47: First:1
        !            48: Second:2
        !            49: Content-type: text/plain
        !            50: 
        !            51: GET /foo HTTP/1.0
        !            52: Host: 127.0.0.1:12342
        !            53: First:1
        !            54: Second:2
        !            55: 
        !            56: 
        !            57: POST / HTTP/1.0
        !            58: Host: 127.0.0.1:12342
        !            59: First:1
        !            60: Second:2
        !            61: Content-type: text/plain
        !            62: 
        !            63: GET /foo HTTP/1.0
        !            64: Host: 127.0.0.1:12342
        !            65: First:1
        !            66: Second:2
        !            67: 
        !            68: 
        !            69: POST / HTTP/1.0
        !            70: Host: 127.0.0.1:12342
        !            71: First:1
        !            72: Second:2
        !            73: Content-type: text/plain
        !            74: Third:
        !            75: 
        !            76: GET /foo HTTP/1.0
        !            77: Host: 127.0.0.1:12342
        !            78: First:1
        !            79: Second:2
        !            80: Third:
        !            81: 
        !            82: POST / HTTP/1.0
        !            83: Host: 127.0.0.1:12342
        !            84: First:1
        !            85: Content-type:text/plain
        !            86: Second:2
        !            87: 
        !            88: GET /foo HTTP/1.0
        !            89: Host: 127.0.0.1:12342
        !            90: First:1
        !            91: Second:2
        !            92: 
        !            93: POST / HTTP/1.0
        !            94: Host: 127.0.0.1:12342
        !            95: First:1
        !            96: Content-type:text/plain
        !            97: Second:2
        !            98: 
        !            99: GET /foo HTTP/1.0
        !           100: Host: 127.0.0.1:12342
        !           101: First:1
        !           102: Second:2
        !           103: 
        !           104: POST / HTTP/1.0
        !           105: Host: 127.0.0.1:12342
        !           106: First:1
        !           107: Content-type:text/plain
        !           108: Second:2
        !           109: Third:
        !           110: 
        !           111: GET /foo HTTP/1.0
        !           112: Host: 127.0.0.1:12342
        !           113: First:1
        !           114: Second:2
        !           115: Third:
        !           116: 
        !           117: Done
        !           118: 

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