diff lib/Test/Nginx.pm @ 1613:d7ec131d305a

Tests: reworked proxy_unfinished.t to use http_content(). This somewhat simplifies tests and makes it possible to better check for unexpected corruption of chunked responses, such as the one recently fixed in nginx-quic experimental branch.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 17 Nov 2020 17:39:11 +0300
parents 8659123d2d37
children a1874249496d
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -853,12 +853,18 @@ sub http_content {
 	}
 
 	my $content = '';
+	my $len = -1;
+
 	while ($body =~ /\G\x0d?\x0a?([0-9a-f]+)\x0d\x0a?/gcmsi) {
-		my $len = hex($1);
+		$len = hex($1);
 		$content .= substr($body, pos($body), $len);
 		pos($body) += $len;
 	}
 
+	if ($len != 0) {
+		$content .= '[no-last-chunk]';
+	}
+
 	return $content;
 }