diff --git a/tests/Test-https-badcerts.px b/tests/Test-https-badcerts.px index 92da7b68..c9eeefc3 100755 --- a/tests/Test-https-badcerts.px +++ b/tests/Test-https-badcerts.px @@ -3,7 +3,8 @@ use strict; use warnings; use POSIX; - +use Socket; +use WgetFeature qw(https ssl/openssl); use SSLTest; ############################################################################### @@ -33,6 +34,14 @@ my $cdir = $ENV{'PWD'}; my $testhostname = "WgetTestingServer"; $ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; +my $addr = gethostbyname($testhostname) or + exit 77; +unless (inet_ntoa($addr) =~ "127.0.0.1") +{ + warn "Failed to resolve $testhostname"; + exit 77; +} + # Create certindex open CERTID, ">", "$cdir/certs/certindex" or warn "Cannot overwrite file $cdir/certs/certindex"; diff --git a/tests/Test-https-clientcert.px b/tests/Test-https-clientcert.px index 37ffda44..ad049f55 100755 --- a/tests/Test-https-clientcert.px +++ b/tests/Test-https-clientcert.px @@ -2,7 +2,8 @@ use strict; use warnings; - +use Socket; +use WgetFeature qw(https); use SSLTest; ############################################################################### @@ -32,6 +33,14 @@ my $cdir = $ENV{'PWD'}; my $testhostname = "WgetTestingServer"; $ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; +my $addr = gethostbyname($testhostname) or + exit 77; +unless (inet_ntoa($addr) =~ "127.0.0.1") +{ + warn "Failed to resolve $testhostname"; + exit 77; +} + # Create certindex open CERTID, ">", "$cdir/certs/certindex" or warn "Cannot overwrite file $cdir/certs/certindex"; diff --git a/tests/Test-https-crl.px b/tests/Test-https-crl.px index 99713d28..3f954cb0 100755 --- a/tests/Test-https-crl.px +++ b/tests/Test-https-crl.px @@ -2,7 +2,8 @@ use strict; use warnings; - +use Socket; +use WgetFeature qw(https); use SSLTest; ############################################################################### @@ -30,11 +31,15 @@ my $cdir = $ENV{'PWD'}; # HOSTALIASES env variable allows us to create hosts file alias. my $testhostname = "WgetTestingServer"; -my $testhostfile = "$cdir/wgethosts"; -open(my $fh, '>', $testhostfile); -print $fh "$testhostname 127.0.0.1\n"; -close $fh; -$ENV{'HOSTALIASES'} = "$cdir/wgethosts"; +$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; + +my $addr = gethostbyname($testhostname) or + exit 77; +unless (inet_ntoa($addr) =~ "127.0.0.1") +{ + warn "Failed to resolve $testhostname"; + exit 77; +} # Create certindex open CERTID, ">", "$cdir/certs/certindex" or diff --git a/tests/Test-https-pfs.px b/tests/Test-https-pfs.px index 2398db76..db6a7eda 100755 --- a/tests/Test-https-pfs.px +++ b/tests/Test-https-pfs.px @@ -2,6 +2,8 @@ use strict; use warnings; +use Socket; +use WgetFeature qw(https); use SSLTest; ############################################################################### @@ -30,6 +32,14 @@ my $cdir = $ENV{'PWD'}; my $testhostname = "WgetTestingServer"; $ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; +my $addr = gethostbyname($testhostname) or + exit 77; +unless (inet_ntoa($addr) =~ "127.0.0.1") +{ + warn "Failed to resolve $testhostname"; + exit 77; +} + my $port = 24443; my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=PFS". " --ca-certificate=$cdir/certs/test-ca-cert.pem". diff --git a/tests/Test-https-selfsigned.px b/tests/Test-https-selfsigned.px index b4710a76..53370ca7 100755 --- a/tests/Test-https-selfsigned.px +++ b/tests/Test-https-selfsigned.px @@ -2,7 +2,8 @@ use strict; use warnings; - +use Socket; +use WgetFeature qw(https); use SSLTest; ############################################################################### @@ -32,6 +33,14 @@ my $cdir = $ENV{'PWD'}; my $testhostname = "WgetTestingServer"; $ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; +my $addr = gethostbyname($testhostname) or + exit 77; +unless (inet_ntoa($addr) =~ "127.0.0.1") +{ + warn "Failed to resolve $testhostname"; + exit 77; +} + # Prepare self-signed certificates my $certfile="tmpsscert.pem"; my $keyfile="tmpsskey.pem"; diff --git a/tests/Test-https-tlsv1.px b/tests/Test-https-tlsv1.px index 55504cd4..44152385 100755 --- a/tests/Test-https-tlsv1.px +++ b/tests/Test-https-tlsv1.px @@ -2,7 +2,8 @@ use strict; use warnings; - +use Socket; +use WgetFeature qw(https); use SSLTest; ############################################################################### @@ -31,6 +32,14 @@ my $cdir = $ENV{'PWD'}; my $testhostname = "WgetTestingServer"; $ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; +my $addr = gethostbyname($testhostname) or + exit 77; +unless (inet_ntoa($addr) =~ "127.0.0.1") +{ + warn "Failed to resolve $testhostname"; + exit 77; +} + my $port = 28443; my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=TLSv1". " --ca-certificate=$cdir/certs/test-ca-cert.pem". diff --git a/tests/Test-https-tlsv1x.px b/tests/Test-https-tlsv1x.px index 3f968a77..7044cdd7 100755 --- a/tests/Test-https-tlsv1x.px +++ b/tests/Test-https-tlsv1x.px @@ -2,7 +2,8 @@ use strict; use warnings; - +use Socket; +use WgetFeature qw(https); use SSLTest; ############################################################################### @@ -31,6 +32,14 @@ my $cdir = $ENV{'PWD'}; my $testhostname = "WgetTestingServer"; $ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; +my $addr = gethostbyname($testhostname) or + exit 77; +unless (inet_ntoa($addr) =~ "127.0.0.1") +{ + warn "Failed to resolve $testhostname"; + exit 77; +} + my $port = 29443; my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=TLSv1_1". " --ca-certificate=$cdir/certs/test-ca-cert.pem". diff --git a/tests/Test-https-weboftrust.px b/tests/Test-https-weboftrust.px index 4e0c40c0..0f52a740 100755 --- a/tests/Test-https-weboftrust.px +++ b/tests/Test-https-weboftrust.px @@ -2,7 +2,8 @@ use strict; use warnings; - +use Socket; +use WgetFeature qw(https); use SSLTest; ############################################################################### @@ -32,6 +33,14 @@ my $cdir = $ENV{'PWD'}; my $testhostname = "WgetTestingServer"; $ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; +my $addr = gethostbyname($testhostname) or + exit 77; +unless (inet_ntoa($addr) =~ "127.0.0.1") +{ + warn "Failed to resolve $testhostname"; + exit 77; +} + # Create certindex open CERTID, ">", "$cdir/certs/certindex" or warn "Cannot overwrite file $cdir/certs/certindex";