> On 21 Apr 2022, at 02:37, Maxim Dounin <mdounin@mdounin.ru> wrote:
>
> Hello!
>
> Tests for the multiple headers handling patch series.
>
What do you think about extending the tests
for ngx_http_link_multi_headers() ?
Searching for previous headers is a novel routine
so it might make sense to improve its coverage.
Something like this:
# HG changeset patch
# User Sergey Kandaurov <pluknet@nginx.com>
# Date 1654038532 -14400
# Wed Jun 01 03:08:52 2022 +0400
# Node ID 3c2a768ef7e3eff6c943e0fa4dd10c9ec487c973
# Parent 83ec649296126965883e0d65c92ecd99f5397dc7
Tests: added fastcgi tests for catched bugs in combining headers.
This improves coverage in a search for previous headers.
diff --git a/fastcgi_header_params.t b/fastcgi_header_params.t
--- a/fastcgi_header_params.t
+++ b/fastcgi_header_params.t
@@ -25,7 +25,7 @@ eval { require FCGI; };
plan(skip_all => 'FCGI not installed') if $@;
plan(skip_all => 'win32') if $^O eq 'MSWin32';
-my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(4)
+my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(5)
->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
@@ -58,6 +58,8 @@ EOF
like(http_get_headers('/'), qr/SEE-THIS/,
'fastcgi request with many ignored headers');
+like(http_get_headers('/', diff => 1), qr/SEE-THIS/,
+ 'fastcgi request with many different headers');
TODO: {
local $TODO = 'not yet' unless $t->has_version('1.23.0');
@@ -94,7 +96,7 @@ like($r, qr/X-Foo: foo, bar, bazz/,
sub http_get_headers {
my ($url, %extra) = @_;
- return http(<<EOF, %extra);
+ my $r = <<EOF;
GET $url HTTP/1.0
Host: localhost
X-Blah: ignored header
@@ -116,8 +118,12 @@ X-Blah: ignored header
X-Blah: ignored header
X-Blah: ignored header
X-Blah: ignored header
+X-Blah: ignored header
EOF
+ my $n = 0;
+ $r =~ s/(?<=Blah)(?=:)/$n++/ge if $extra{diff};
+ return http($r);
}
###############################################################################
--
Sergey Kandaurov
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org