# HG changeset patch # User Sergey Kandaurov # Date 1631727131 -10800 # Node ID 41ca4b00c2d05d01484f9683df9ab73ed978f408 # Parent c9b4c0ef505954c2be97d48e4b4fb20ef71cdc0b Tests: added absolute_redirect and Location tests for HTTP/2. diff --git a/http_absolute_redirect.t b/h2_absolute_redirect.t copy from http_absolute_redirect.t copy to h2_absolute_redirect.t --- a/http_absolute_redirect.t +++ b/h2_absolute_redirect.t @@ -16,13 +16,14 @@ BEGIN { use FindBin; chdir($FindBin::Bin use lib 'lib'; use Test::Nginx; +use Test::Nginx::HTTP2; ############################################################################### select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/) +my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite/) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -38,7 +39,7 @@ http { absolute_redirect off; server { - listen 127.0.0.1:8080; + listen 127.0.0.1:8080 http2; server_name on; absolute_redirect on; @@ -74,7 +75,7 @@ http { } server { - listen 127.0.0.1:8080; + listen 127.0.0.1:8080 http2; server_name off; location / { } @@ -206,11 +207,13 @@ like(get('off', '/auto%20%22%23%25%3C%3E sub get { my ($host, $uri) = @_; - http(<new(); + my $sid = $s->new_stream({ host => $host, path => $uri }); + my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); + + my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; + return 'Location: ' . $frame->{headers}->{'location'}; } ###############################################################################