Package: lighttpd
Version: 1.4.76-1
Severity: important
Tags: sid patch
control: affects -1 src:zlib-ng
User: zlib...@tracker.debian.org
Usertags: zlib-ng-ftbfs

lighttpd's testsuite fails if zlib-ng is used because it compares
against the exact size of the compressed content. The patch attached
updates it to ensure the compressed content is at least half of the
input.

Sebastian
From: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
Date: Fri, 29 Nov 2024 15:55:13 +0100
Subject: [PATCH] tests: Don't test for exact compress zlib size.

If zlibg-ng instead of zlib is used then the testsuite fails because the
resulting compressed content has a different size.

Alter the test and expect that the compressed content is at least half
of the input.

Signed-off-by: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
---
 tests/LightyTest.pm | 12 ++++++++++++
 tests/request.t     |  9 +++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm
index 2bf1aed63148d..613938dafe86b 100644
--- a/tests/LightyTest.pm
+++ b/tests/LightyTest.pm
@@ -460,6 +460,7 @@ sub handle_http {
 			(my $k = $_) =~ tr/[A-Z]/[a-z]/;
 
 			my $verify_value = 1;
+			my $verify_less_than = 0;
 			my $key_inverted = 0;
 
 			if (substr($k, 0, 1) eq '+') {
@@ -470,6 +471,10 @@ sub handle_http {
 				$k = substr($k, 1);
 				$key_inverted = 1;
 				$verify_value = 0; ## skip the value check
+			} elsif (substr($k, 0, 1) eq '<') {
+				## the value must be less then
+				$k = substr($k, 1);
+				$verify_less_than = 1;
 			}
 
 			if ($key_inverted) {
@@ -492,6 +497,13 @@ sub handle_http {
 							$href->{$_}, $resp_hdr{$k}, $1));
 						return -1;
 					}
+				} elsif ($verify_less_than) {
+					if ($resp_hdr{$k} >= $href->{$_}) {
+						diag(sprintf(
+							"\nresponse-header failed: expected '%s' less than '%s'",
+							$href->{$_}, $resp_hdr{$k}));
+						return -1;
+					}
 				} elsif ($href->{$_} ne $resp_hdr{$k}) {
 					diag(sprintf(
 						"\nresponse-header failed: expected '%s', got '%s'",
diff --git a/tests/request.t b/tests/request.t
index f4b4e88aae3d1..f9302131f0463 100755
--- a/tests/request.t
+++ b/tests/request.t
@@ -1411,7 +1411,8 @@ Accept-Encoding: deflate
 Host: deflate.example.org
 EOF
  );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1294', '+Content-Encoding' => '' } ];
+# The compressed content should be at least half of the original content.
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '<Content-Length' => '2174', '+Content-Encoding' => '' } ];
 ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set');
 
 $t->{REQUEST}  = ( <<EOF
@@ -1420,7 +1421,7 @@ Accept-Encoding: deflate
 Host: deflate-cache.example.org
 EOF
  );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1294', '+Content-Encoding' => '' } ];
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '<Content-Length' => '2174', '+Content-Encoding' => '' } ];
 ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set');
 
 $t->{REQUEST}  = ( <<EOF
@@ -1429,7 +1430,7 @@ Accept-Encoding: gzip
 Host: deflate.example.org
 EOF
  );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ];
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '<Content-Length' => '2174', '+Content-Encoding' => '' } ];
 ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set');
 
 $t->{REQUEST}  = ( <<EOF
@@ -1438,7 +1439,7 @@ Accept-Encoding: gzip
 Host: deflate-cache.example.org
 EOF
  );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ];
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '<Content-Length' => '2174', '+Content-Encoding' => '' } ];
 ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set');
 
 
-- 
2.45.2

Reply via email to