Mercurial > hg > nginx-tests
comparison lib/Test/Nginx/HTTP2.pm @ 911:2668f30181eb
Tests: HTTP/2 server frames logging.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 20 Apr 2016 17:39:01 +0300 |
parents | 48d277065309 |
children | f9ab0aa6e14e |
comparison
equal
deleted
inserted
replaced
910:49579dd88e3f | 911:2668f30181eb |
---|---|
21 | 21 |
22 use Test::More qw//; | 22 use Test::More qw//; |
23 use IO::Select; | 23 use IO::Select; |
24 use IO::Socket; | 24 use IO::Socket; |
25 use Socket qw/ CRLF /; | 25 use Socket qw/ CRLF /; |
26 use Data::Dumper; | |
26 | 27 |
27 use Test::Nginx; | 28 use Test::Nginx; |
28 | 29 |
29 my %cframe = ( | 30 my %cframe = ( |
30 0 => { name => 'DATA', value => \&data }, | 31 0 => { name => 'DATA', value => \&data }, |
263 my ($sess, %extra) = @_; | 264 my ($sess, %extra) = @_; |
264 my (@got); | 265 my (@got); |
265 my $s = $sess->{socket}; | 266 my $s = $sess->{socket}; |
266 my $buf = ''; | 267 my $buf = ''; |
267 | 268 |
269 local $Data::Dumper::Terse = 1; | |
270 | |
268 while (1) { | 271 while (1) { |
269 $buf = raw_read($s, $buf, 9); | 272 $buf = raw_read($s, $buf, 9); |
270 last if length $buf < 9; | 273 last if length $buf < 9; |
271 | 274 |
272 my $length = unpack_length($buf); | 275 my $length = unpack_length($buf); |
287 $frame->{length} = $length; | 290 $frame->{length} = $length; |
288 $frame->{type} = $cframe{$type}{name}; | 291 $frame->{type} = $cframe{$type}{name}; |
289 $frame->{flags} = $flags; | 292 $frame->{flags} = $flags; |
290 $frame->{sid} = $stream; | 293 $frame->{sid} = $stream; |
291 push @got, $frame; | 294 push @got, $frame; |
295 | |
296 Test::Nginx::log_core('||', $_) for split "\n", Dumper $frame; | |
292 | 297 |
293 $buf = substr($buf, $length); | 298 $buf = substr($buf, $length); |
294 | 299 |
295 last unless $extra{all} && test_fin($got[-1], $extra{all}); | 300 last unless $extra{all} && test_fin($got[-1], $extra{all}); |
296 }; | 301 }; |