diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
commit | c21c3b0befeb46a51b6bf3758ffa30813bea0ff0 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /web/server/h2o/libh2o/misc/p5-net-fastcgi/t/020_protocol/005_record_length.t | |
parent | Adding upstream version 1.43.2. (diff) | |
download | netdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.tar.xz netdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.zip |
Adding upstream version 1.44.3.upstream/1.44.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | web/server/h2o/libh2o/misc/p5-net-fastcgi/t/020_protocol/005_record_length.t | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/misc/p5-net-fastcgi/t/020_protocol/005_record_length.t b/web/server/h2o/libh2o/misc/p5-net-fastcgi/t/020_protocol/005_record_length.t new file mode 100644 index 000000000..1d2381980 --- /dev/null +++ b/web/server/h2o/libh2o/misc/p5-net-fastcgi/t/020_protocol/005_record_length.t @@ -0,0 +1,44 @@ +#!perl + +use strict; +use warnings; + +use lib 't/lib', 'lib'; +use myconfig; + +use Test::More tests => 18; +use Test::Exception; + +BEGIN { + use_ok('Net::FastCGI::Constant', qw[:all]); + use_ok('Net::FastCGI::Protocol', qw[ build_header + build_record + get_record_length ]); +} + + +is get_record_length(undef), 0, 'get_record_length(undef)'; + +{ + for my $len (0..7) { + is get_record_length("\x00" x $len), 0, qq<get_record_length("\\x00" x $len)>; + } +} + +{ + for my $len (8, 16, 32, 64) { + my $record = build_record(0, 0, "\x00" x $len); + is get_record_length($record), FCGI_HEADER_LEN + $len; + } +} + +{ + my $header = build_header(0, 0, 8192, 250); + is get_record_length($header), FCGI_HEADER_LEN + 8192 + 250; +} + +# get_record_length(octets) +for (0, 2) { + throws_ok { get_record_length((1) x $_) } qr/^Usage: /; +} + |