#!/usr/bin/env perl use strict; use warnings; # Skip this test rather than fail it when the module isn't installed if (!eval {require IO::Socket::SSL;1;}) { print STDERR "This test needs the perl module \"IO::Socket::SSL\".\n"; print STDERR "Install e.g. on Debian with 'apt-get install libio-socket-ssl-perl'\n"; print STDERR " or if using cpanminus 'cpanm IO::Socket::SSL' could be used to install it.\n"; exit 77; # skip } use SSLTest; ############################################################################### # code, msg, headers, content my %urls = ( '/somefile.txt' => { code => "200", msg => "Dontcare", headers => { "Content-type" => "text/plain", }, content => "blabla", }, ); # Skip the test if openssl is not available my $ossl = `openssl version`; unless ($ossl =~ m/OpenSSL 1/) { exit 77; } my $cdir = $ENV{'PWD'}; # HOSTALIASES env variable allows us to create hosts file alias. my $testhostname = "WgetTestingServer"; $ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; my $port = 24443; my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=PFS". " --ca-certificate=$cdir/certs/test-ca-cert.pem". " https://$testhostname:$port/somefile.txt"; my $expected_error_code = 0; my %existing_files = ( ); my %expected_downloaded_files = ( 'somefile.txt' => { content => "blabla", }, ); my $sslsock = SSLTest->new(cmdline => $cmdline, input => \%urls, errcode => $expected_error_code, existing => \%existing_files, output => \%expected_downloaded_files, sslport => $port); exit $sslsock->run(); # vim: et ts=4 sw=4