<commit_before>use strict;
use warnings;
use File::Temp qw(tempdir);
use Net::EmptyPort qw(check_port empty_port);
use Test::More;
use t::Util;

plan skip_all => "could not find openssl"
    unless prog_exists("openssl");

my $tempdir = tempdir(CLEANUP => 1);

spawn_and_connect("file", "New");
spawn_and_connect("file", "Reused");
spawn_and_connect("file", "Reused");
spawn_and_connect("off", "New");

done_testing;

sub spawn_and_connect {
    my ($mode, $expected) = @_;
    my $server = spawn_h2o(<< "EOT");
ssl-session-resumption:
  mode: off
ssl-session-ticket:
  mode: $mode
  file: @{[ ASSETS_DIR ]}/session_tickets.yaml
hosts:
  default:
    paths:<commit_msg>limit to openssl 1.0.2 or above to avoid issues<commit_after>use strict;
use warnings;
use File::Temp qw(tempdir);
use Net::EmptyPort qw(check_port empty_port);
use Test::More;
use t::Util;

plan skip_all => "could not find openssl"
    unless prog_exists("openssl");
plan skip_all => "openssl 1.0.2 or above is required"
    unless `openssl version` =~ /^OpenSSL 1\.(?:0\.[2-9][^0-9]|[1-9])/s;

my $tempdir = tempdir(CLEANUP => 1);

spawn_and_connect("file", "New");
spawn_and_connect("file", "Reused");
spawn_and_connect("file", "Reused");
spawn_and_connect("off", "New");

done_testing;

sub spawn_and_connect {
    my ($mode, $expected) = @_;
    my $server = spawn_h2o(<< "EOT");
ssl-session-resumption:
  mode: off
ssl-session-ticket:
  mode: $mode
  file: @{[ ASSETS_DIR ]}/session_tickets.yaml
hosts:
  default:
    paths:
{'fraction_non_alphanumeric': 0.16744496330887257, 'fraction_numerical': 0.01200800533689126, 'mean_word_length': 5.2761506276150625, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7208565', 'n_tokens_mistral': 585, 'n_tokens_neox': 562, 'n_words': 134}