diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:01:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:01:31 +0000 |
commit | c9cf025fadfe043f0f2f679e10d1207d8a158bb6 (patch) | |
tree | 3a94effe0bdc0a6814d8134f4ed840d7cc6b6f19 /debian/perl-framework/t/apache/maxranges.t | |
parent | Adding upstream version 2.4.57. (diff) | |
download | apache2-c9cf025fadfe043f0f2f679e10d1207d8a158bb6.tar.xz apache2-c9cf025fadfe043f0f2f679e10d1207d8a158bb6.zip |
Adding debian version 2.4.57-2.debian/2.4.57-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | debian/perl-framework/t/apache/maxranges.t | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/debian/perl-framework/t/apache/maxranges.t b/debian/perl-framework/t/apache/maxranges.t new file mode 100644 index 0000000..015a474 --- /dev/null +++ b/debian/perl-framework/t/apache/maxranges.t @@ -0,0 +1,70 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestRequest; +use Apache::TestUtil qw(t_write_file); + +# test multi-byterange-requests with overlaps (merges) + +my $url = "/apache/chunked/byteranges.txt"; +my $file = Apache::Test::vars('serverroot') . "/htdocs$url"; + +my $content = ""; +$content .= sprintf("%04d", $_) for (1 .. 2000); +t_write_file($file, $content); +my $clen = length($content); + + +my $medrange = ""; +my $longrange = ""; +my $i; + +for (0 .. 50) { + $longrange .= "0-1,3-4,0-1,3-4,"; + if ($_ % 2) { + $medrange .= "0-1,3-4,0-1,3-4,"; + } +} + +my @test_cases = ( + { url => "/maxranges/default/byteranges.txt" , h => "0-100", status => "206"}, + { url => "/maxranges/default/byteranges.txt" , h => $medrange, status => "206"}, + { url => "/maxranges/default/byteranges.txt" , h => $longrange, status => "200"}, + + { url => "/maxranges/default-explicit/byteranges.txt" , h => "0-100", status => "206"}, + { url => "/maxranges/default-explicit/byteranges.txt" , h => $medrange, status => "206"}, + { url => "/maxranges/default-explicit/byteranges.txt" , h => $longrange, status => "200"}, + + { url => "/maxranges/none/byteranges.txt" , h => "0-100", status => "200"}, + { url => "/maxranges/none/byteranges.txt" , h => "$medrange", status => "200"}, + { url => "/maxranges/none/byteranges.txt" , h => "$longrange", status => "200"}, + + { url => "/maxranges/1/merge/none/byteranges.txt" , h => "0-100", status => "200"}, + { url => "/maxranges/1/merge/none/byteranges.txt" , h => "$medrange", status => "200"}, + { url => "/maxranges/1/merge/none/byteranges.txt" , h => "$longrange", status => "200"}, + + { url => "/maxranges/1/byteranges.txt" , h => "0-100", status => "206"}, + { url => "/maxranges/1/byteranges.txt" , h => "0-100,200-300", status => "200"}, + { url => "/maxranges/2/byteranges.txt" , h => "0-100,200-300", status => "206"}, + { url => "/maxranges/2/byteranges.txt" , h => "0-100,200-300,400-500", status => "200"}, + { url => "/maxranges/unlimited/byteranges.txt" , h => "0-100", status => "206"}, + { url => "/maxranges/unlimited/byteranges.txt" , h => "$medrange", status => "206"}, + { url => "/maxranges/unlimited/byteranges.txt" , h => "$longrange", status => "206"}, + +); +plan tests => scalar(@test_cases), need need_lwp, need_min_apache_version('2.3.15') || need_min_apache_version('2.2.21'), + need_module('mod_alias'); + + +foreach my $test (@test_cases) { + my $result = GET $test->{"url"}, "Range" => "bytes=" . $test->{"h"} ; + my $boundary; + my $ctype = $result->header("Content-Type"); + if ($test->{"status"} ne $result->code()) { + print "Wrong status code: " . $result->code() ."\n"; + ok(0); + next; + } + ok (1); +} |