comparison h2.t @ 852:e0d6ba59968f

Tests: added HTTP/2 proxy test with logging request headers.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 09 Feb 2016 14:24:47 +0300
parents 2b1d0f6c9d41
children b5c8739961c9
comparison
equal deleted inserted replaced
851:940757cf34f5 852:e0d6ba59968f
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(314); 35 ->has_daemon('openssl')->plan(316);
36 36
37 # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL 37 # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL
38 38
39 $t->todo_alerts(); 39 $t->todo_alerts();
40 40
1935 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); 1935 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1936 1936
1937 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; 1937 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1938 is($frame->{headers}->{':status'}, 413, 1938 is($frame->{headers}->{':status'}, 413,
1939 'request body without content-length many pad - limited'); 1939 'request body without content-length many pad - limited');
1940
1941 # proxied request with logging pristine request header field (e.g., referer)
1942
1943 $sess = new_session();
1944 $sid = new_stream($sess, { headers => [
1945 { name => ':method', value => 'GET' },
1946 { name => ':scheme', value => 'http' },
1947 { name => ':path', value => '/proxy2/' },
1948 { name => ':authority', value => 'localhost' },
1949 { name => 'referer', value => 'foo' }]});
1950 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1951
1952 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1953 is($frame->{headers}->{':status'}, 200, 'proxy with logging request headers');
1954
1955 $sid = new_stream($sess);
1956 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
1957
1958 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
1959 ok($frame->{headers}, 'proxy with logging request headers - next');
1940 1960
1941 # initial window size, client side 1961 # initial window size, client side
1942 1962
1943 # 6.9.2. Initial Flow-Control Window Size 1963 # 6.9.2. Initial Flow-Control Window Size
1944 # When an HTTP/2 connection is first established, new streams are 1964 # When an HTTP/2 connection is first established, new streams are