# HG changeset patch # User Sergey Kandaurov # Date 1685410540 -14400 # Node ID 26252394dd588c046aeb8dcc49ba1b5443da1a02 # Parent 38f1fd9ca3e64a3fd56f20356013b799a41b53a0 Tests: updated HTTP/2 tests with invalid connection preface. HTTP/1.x 400 is now expected instead of HTTP/2 GOAWAY due to HTTP/2 auto-detection fallback to HTTP/1.x. diff --git a/h2.t b/h2.t --- a/h2.t +++ b/h2.t @@ -26,7 +26,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/) - ->plan(144); + ->plan(142); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -1017,20 +1017,14 @@ is($frame->{headers}->{':status'}, 200, # invalid connection preface -$s = Test::Nginx::HTTP2->new(port(8080), preface => 'x' x 16, pure => 1); -$frames = $s->read(all => [{ type => 'GOAWAY' }]); - -($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; -ok($frame, 'invalid preface - GOAWAY frame'); -is($frame->{code}, 1, 'invalid preface - error code'); +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.25.1'); -my $preface = 'PRI * HTTP/2.0' . CRLF . CRLF . 'x' x 8; -$s = Test::Nginx::HTTP2->new(port(8080), preface => $preface, pure => 1); -$frames = $s->read(all => [{ type => 'GOAWAY' }]); +like(http('x' x 16), qr/400 Bad Request/, 'invalid preface'); +like(http('PRI * HTTP/2.0' . CRLF . CRLF . 'x' x 8), qr/400 Bad Request/, + 'invalid preface 2'); -($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; -ok($frame, 'invalid preface 2 - GOAWAY frame'); -is($frame->{code}, 1, 'invalid preface 2 - error code'); +} # GOAWAY on SYN_STREAM with even StreamID