comparison 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
comparison
equal deleted inserted replaced
1612:8659123d2d37 1613:d7ec131d305a
851 if ($headers !~ /Transfer-Encoding: chunked/i) { 851 if ($headers !~ /Transfer-Encoding: chunked/i) {
852 return $body; 852 return $body;
853 } 853 }
854 854
855 my $content = ''; 855 my $content = '';
856 my $len = -1;
857
856 while ($body =~ /\G\x0d?\x0a?([0-9a-f]+)\x0d\x0a?/gcmsi) { 858 while ($body =~ /\G\x0d?\x0a?([0-9a-f]+)\x0d\x0a?/gcmsi) {
857 my $len = hex($1); 859 $len = hex($1);
858 $content .= substr($body, pos($body), $len); 860 $content .= substr($body, pos($body), $len);
859 pos($body) += $len; 861 pos($body) += $len;
862 }
863
864 if ($len != 0) {
865 $content .= '[no-last-chunk]';
860 } 866 }
861 867
862 return $content; 868 return $content;
863 } 869 }
864 870