comparison h2.t @ 727:3e034902ebe7

Tests: added HTTP/2 test with invalid PROXY protocol string.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 01 Oct 2015 17:43:54 +0300
parents 4322541b80ed
children 61800918f647
comparison
equal deleted inserted replaced
726:22b06c04b37f 727:3e034902ebe7
30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); }; 30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); };
31 plan(skip_all => 'IO::Socket::SSL too old') if $@; 31 plan(skip_all => 'IO::Socket::SSL too old') if $@;
32 32
33 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/) 33 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/)
34 ->has(qw/limit_conn rewrite realip shmem/) 34 ->has(qw/limit_conn rewrite realip shmem/)
35 ->has_daemon('openssl')->plan(210); 35 ->has_daemon('openssl')->plan(212);
36 36
37 # FreeBSD has a bug in not treating zero iovcnt as EINVAL 37 # FreeBSD has a bug in not treating zero iovcnt as EINVAL
38 38
39 $t->todo_alerts() unless $^O eq 'freebsd'; 39 $t->todo_alerts() unless $^O eq 'freebsd';
40 40
1904 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames; 1904 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames;
1905 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 3'); 1905 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 3');
1906 1906
1907 1907
1908 # some invalid cases below 1908 # some invalid cases below
1909
1910 # invalid PROXY protocol string
1911
1912 $sess = new_session(8082, proxy => 'bogus');
1913 $sid = new_stream($sess, { path => '/pp' });
1914 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1915
1916 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
1917 ok($frame, 'invalid PROXY - GOAWAY frame');
1918 is($frame->{code}, 1, 'invalid PROXY - error code');
1909 1919
1910 # ensure that request header field value with newline doesn't get split 1920 # ensure that request header field value with newline doesn't get split
1911 # 1921 #
1912 # 10.3. Intermediary Encapsulation Attacks 1922 # 10.3. Intermediary Encapsulation Attacks
1913 # Any request or response that contains a character not permitted 1923 # Any request or response that contains a character not permitted