diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-25 04:41:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-25 04:41:28 +0000 |
commit | 2eeb62e38ae17a3523ad3cd81c3de9f20f9e7742 (patch) | |
tree | fe91033d4712f6d836006b998525656b9dd193b8 /debian/perl-framework/t/modules/brotli.t | |
parent | Merging upstream version 2.4.59. (diff) | |
download | apache2-2eeb62e38ae17a3523ad3cd81c3de9f20f9e7742.tar.xz apache2-2eeb62e38ae17a3523ad3cd81c3de9f20f9e7742.zip |
Adding debian version 2.4.59-1~deb10u1.debian/2.4.59-1_deb10u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/perl-framework/t/modules/brotli.t')
-rw-r--r-- | debian/perl-framework/t/modules/brotli.t | 109 |
1 files changed, 73 insertions, 36 deletions
diff --git a/debian/perl-framework/t/modules/brotli.t b/debian/perl-framework/t/modules/brotli.t index fcbed74..0f9dc13 100644 --- a/debian/perl-framework/t/modules/brotli.t +++ b/debian/perl-framework/t/modules/brotli.t @@ -5,49 +5,86 @@ use Apache::Test; use Apache::TestUtil; use Apache::TestRequest; -plan tests => 10, need_module 'brotli', need_module 'alias'; +my @qvalue = ( + [ '' , 1], + [ ' ' , 1], + [ ';' , 1], + [';q=' , 1], + [';q=0' , 0], + [';q=0.' , 0], + [';q=0.0' , 0], + [';q=0.00' , 0], + [';q=0.000' , 0], + [';q=0.0000' , 1], # invalid qvalue format +); + +plan tests => (6 * scalar @qvalue) + 4, need_module 'brotli', need_module 'alias'; my $r; -# GET request against the location with Brotli. -$r = GET("/only_brotli/index.html", "Accept-Encoding" => "br"); -ok t_cmp($r->code, 200); -ok t_cmp($r->header("Content-Encoding"), "br", "response Content-Encoding is OK"); -if (!defined($r->header("Content-Length"))) { - t_debug "Content-Length was expected"; - ok 0; -} -if (!defined($r->header("ETag"))) { - t_debug "ETag field was expected"; - ok 0; -} +foreach my $q (@qvalue) { + # GET request against the location with Brotli. + print "qvalue: " . $q->[0] . "\n"; + $r = GET("/only_brotli/index.html", "Accept-Encoding" => "br" . $q->[0]); + ok t_cmp($r->code, 200); + if ($q->[1] == 1) { + ok t_cmp($r->header("Content-Encoding"), "br", "response Content-Encoding is OK"); + } + else { + ok t_cmp($r->header("Content-Encoding"), undef, "response without Content-Encoding is OK"); + } + + if (!defined($r->header("Content-Length"))) { + t_debug "Content-Length was expected"; + ok 0; + } + if (!defined($r->header("ETag"))) { + t_debug "ETag field was expected"; + ok 0; + } -# GET request for a zero-length file. -$r = GET("/only_brotli/zero.txt", "Accept-Encoding" => "br"); -ok t_cmp($r->code, 200); -ok t_cmp($r->header("Content-Encoding"), "br", "response Content-Encoding is OK"); -if (!defined($r->header("Content-Length"))) { - t_debug "Content-Length was expected"; - ok 0; -} -if (!defined($r->header("ETag"))) { - t_debug "ETag field was expected"; - ok 0; -} + # GET request for a zero-length file. + print "qvalue: " . $q->[0] . "\n"; + $r = GET("/only_brotli/zero.txt", "Accept-Encoding" => "br" . $q->[0]); + ok t_cmp($r->code, 200); + if ($q->[1] == 1) { + ok t_cmp($r->header("Content-Encoding"), "br", "response Content-Encoding is OK"); + } + else { + ok t_cmp($r->header("Content-Encoding"), undef, "response without Content-Encoding is OK"); + } -# HEAD request against the location with Brotli. -$r = HEAD("/only_brotli/index.html", "Accept-Encoding" => "br"); -ok t_cmp($r->code, 200); -ok t_cmp($r->header("Content-Encoding"), "br", "response Content-Encoding is OK"); -if (!defined($r->header("Content-Length"))) { - t_debug "Content-Length was expected"; - ok 0; -} -if (!defined($r->header("ETag"))) { - t_debug "ETag field was expected"; - ok 0; + if (!defined($r->header("Content-Length"))) { + t_debug "Content-Length was expected"; + ok 0; + } + if (!defined($r->header("ETag"))) { + t_debug "ETag field was expected"; + ok 0; + } + + # HEAD request against the location with Brotli. + print "qvalue: " . $q->[0] . "\n"; + $r = HEAD("/only_brotli/index.html", "Accept-Encoding" => "br" . $q->[0]); + ok t_cmp($r->code, 200); + if ($q->[1] == 1) { + ok t_cmp($r->header("Content-Encoding"), "br", "response Content-Encoding is OK"); + } + else { + ok t_cmp($r->header("Content-Encoding"), undef, "response without Content-Encoding is OK"); + } + + if (!defined($r->header("Content-Length"))) { + t_debug "Content-Length was expected"; + ok 0; + } + if (!defined($r->header("ETag"))) { + t_debug "ETag field was expected"; + ok 0; + } } + if (have_module('deflate')) { # GET request against the location with fallback to deflate (test that # Brotli is chosen due to the order in SetOutputFilter). |