tests: Support custom arguments to test HTTP server

This makes it easier to debug complicated bugs like #791.  For
example, you can pass `port => 12345` to make it easier to use
Wireshark to capture packets.
This commit is contained in:
Richard Hansen 2025-01-10 20:15:52 -05:00
parent 41170b9c08
commit b733187da2

View file

@ -133,9 +133,8 @@ our $other_ca_file = "$certdir/other-ca-cert.pem";
my %daemons; my %daemons;
sub httpd { sub httpd {
my ($ipv, $ssl) = @_; my $ipv = shift // '';
$ipv //= ''; my $ssl = !!shift;
$ssl = !!$ssl;
return undef if !$httpd_supported; return undef if !$httpd_supported;
return undef if $ipv eq '6' && !$httpd_ipv6_supported; return undef if $ipv eq '6' && !$httpd_ipv6_supported;
return undef if $ssl && !$httpd_ssl_supported; return undef if $ssl && !$httpd_ssl_supported;
@ -153,6 +152,7 @@ sub httpd {
(SSL_cert_file => "$certdir/dummy-server-cert.pem", (SSL_cert_file => "$certdir/dummy-server-cert.pem",
SSL_key_file => "$certdir/dummy-server-key.pem") x $ssl, SSL_key_file => "$certdir/dummy-server-key.pem") x $ssl,
}, },
@_,
); );
} }
return $daemons{$ipv}{$ssl}; return $daemons{$ipv}{$ssl};