From c9cf025fadfe043f0f2f679e10d1207d8a158bb6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:01:31 +0200 Subject: Adding debian version 2.4.57-2. Signed-off-by: Daniel Baumann --- debian/perl-framework/t/apache/byterange4.t | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 debian/perl-framework/t/apache/byterange4.t (limited to 'debian/perl-framework/t/apache/byterange4.t') diff --git a/debian/perl-framework/t/apache/byterange4.t b/debian/perl-framework/t/apache/byterange4.t new file mode 100644 index 0000000..73572d7 --- /dev/null +++ b/debian/perl-framework/t/apache/byterange4.t @@ -0,0 +1,52 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestRequest; +use Apache::TestUtil qw(t_write_file); + +# test byteranges if range boundaries are near bucket boundaries + +my $url = "/apache/chunked/byteranges.txt"; +my $file = Apache::Test::vars('serverroot') . "/htdocs$url"; + +my $content = ""; +$content .= sprintf("%04d", $_) for (1 .. 2000); +my $clen = length($content); + +# make mod_bucketeer create buckets of size 200 from our 4000 bytes +my $blen = 200; +my $B = chr(0x02); +my @buckets = ($content =~ /(.{1,$blen})/g); +my $file_content = join($B, @buckets); +t_write_file($file, $file_content); + + +my @range_boundaries = ( + 0, 1, 2, + $blen-2, $blen-1, $blen, $blen+1, + 3*$blen-2, 3*$blen-1, 3*$blen, 3*$blen+1, + $clen-$blen-2, $clen-$blen-1, $clen-$blen, $clen-$blen+1, + $clen-2, $clen-1, +); +my @test_cases; +for my $start (@range_boundaries) { + for my $end (@range_boundaries) { + push @test_cases, [$start, $end] unless ($end < $start); + } +} + +plan tests => scalar(@test_cases), need need_lwp, + need_module('mod_bucketeer'); + +foreach my $test (@test_cases) { + my ($start, $end) = @$test; + my $r = "$start-$end"; + print "range: $r\n"; + my $result = GET $url, "Range" => "bytes=$r"; + my $expect = substr($content, $start, $end - $start + 1); + my $got = $result->content; + print("rc " . $result->code . "\n"); + print("expect: '$expect'\ngot: '$got'\n"); + ok ($got eq $expect); +} -- cgit v1.2.3