# HG changeset patch # User Sergey Kandaurov # Date 1443710634 -10800 # Node ID 3e034902ebe71107854a2baf0294ba28a0fea985 # Parent 22b06c04b37f174b69abef870e0765f726c84941 Tests: added HTTP/2 test with invalid PROXY protocol string. diff --git a/h2.t b/h2.t --- a/h2.t +++ b/h2.t @@ -32,7 +32,7 @@ plan(skip_all => 'IO::Socket::SSL too ol my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/) ->has(qw/limit_conn rewrite realip shmem/) - ->has_daemon('openssl')->plan(210); + ->has_daemon('openssl')->plan(212); # FreeBSD has a bug in not treating zero iovcnt as EINVAL @@ -1907,6 +1907,16 @@ is($frame->{headers}->{':status'}, 200, # some invalid cases below +# invalid PROXY protocol string + +$sess = new_session(8082, proxy => 'bogus'); +$sid = new_stream($sess, { path => '/pp' }); +$frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); + +($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; +ok($frame, 'invalid PROXY - GOAWAY frame'); +is($frame->{code}, 1, 'invalid PROXY - error code'); + # ensure that request header field value with newline doesn't get split # # 10.3. Intermediary Encapsulation Attacks