From b733187da2c12daed0f369768f30d4131c360f17 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 10 Jan 2025 20:15:52 -0500 Subject: [PATCH] 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. --- t/lib/ddclient/t/HTTPD.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/lib/ddclient/t/HTTPD.pm b/t/lib/ddclient/t/HTTPD.pm index 997e451..3c14ac1 100644 --- a/t/lib/ddclient/t/HTTPD.pm +++ b/t/lib/ddclient/t/HTTPD.pm @@ -133,9 +133,8 @@ our $other_ca_file = "$certdir/other-ca-cert.pem"; my %daemons; sub httpd { - my ($ipv, $ssl) = @_; - $ipv //= ''; - $ssl = !!$ssl; + my $ipv = shift // ''; + my $ssl = !!shift; return undef if !$httpd_supported; return undef if $ipv eq '6' && !$httpd_ipv6_supported; return undef if $ssl && !$httpd_ssl_supported; @@ -153,6 +152,7 @@ sub httpd { (SSL_cert_file => "$certdir/dummy-server-cert.pem", SSL_key_file => "$certdir/dummy-server-key.pem") x $ssl, }, + @_, ); } return $daemons{$ipv}{$ssl};