1use strict; 2use warnings; 3use Net::EmptyPort qw(check_port empty_port); 4use Test::More; 5use t::Util; 6 7plan skip_all => 'nghttp not found' 8 unless prog_exists('nghttp'); 9 10my $upstream_port = empty_port(); 11 12my $upstream = spawn_server( 13 argv => [ qw(plackup -s Starlet --keepalive-timeout 100 --access-log /dev/null --listen), $upstream_port, ASSETS_DIR . "/upstream.psgi" ], 14 is_ready => sub { 15 check_port($upstream_port); 16 }, 17); 18 19 20my $server = spawn_h2o(<< "EOT"); 21http2-max-concurrent-requests-per-connection: 12 22hosts: 23 default: 24 paths: 25 "/": 26 proxy.reverse.url: http://127.0.0.1:$upstream_port 27EOT 28 29my $huge_file_size = 20 * 1024; 30my $huge_file = create_data_file($huge_file_size); 31 32my $doit = sub { 33 my ($proto, $port) = @_; 34 my $posts = 100; 35 my $cmd = "h2load -N 5s -m $posts -n $posts -d $huge_file $proto://127.0.0.1:$port/echo 2>&1"; 36 print($cmd); 37 my $out = `$cmd`; 38 like $out, qr{status codes: $posts 2xx}, "No error on exit"; 39}; 40 41subtest 'https' => sub { 42 plan skip_all => 'OpenSSL does not support protocol negotiation; it is too old' 43 unless openssl_can_negotiate(); 44 $doit->('https', $server->{tls_port}); 45}; 46done_testing(); 47