File: byterange8.t

package info (click to toggle)
apache2 2.4.66-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 59,884 kB
  • sloc: ansic: 212,340; python: 13,830; perl: 11,307; sh: 7,266; php: 1,320; javascript: 1,314; awk: 749; makefile: 715; lex: 374; yacc: 161; xml: 2
file content (39 lines) | stat: -rw-r--r-- 935 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::TestRequest;
use Apache::TestUtil;

my $url = "/apache/chunked/byteranges.txt";
my $file = Apache::Test::vars('serverroot') . "/htdocs$url";

my $content = "";
$content .= sprintf("%04d", $_) for (1 .. 100);
t_write_file($file, $content);
my $real_clen = length($content);

#
# test cases for PR 69831
#

my @space = (" ", "\t");
my @tc;

for (my $k = 0; $k < 2; $k++) {
    for (my $i = 0; $i < 3; $i++) {
        for (my $j = 0 ; $j < 3; $j++) {
            $tc[ $k * 9 + $i * 3 + $j ] = "1-2" . $space[$k] x $i . "," .
                                           $space[$k] x $j . "3-4";
        }
    }
}

plan tests => scalar(@tc),
              need need_lwp, need_min_apache_version('2.5.1');

foreach my $range (@tc) {
    print "Sending '$range', expecting 206\n";
    my $result = GET $url, "Range" => "bytes=$range";
    ok t_cmp($result->code, 206);
}