X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=tests%2FTest-proxied-https-auth.px;h=2b37f32b2feff30bac3be449244e765635bdcc11;hp=182c9dbfa60f95e9fcaaecbdcd19bbe3db0e6915;hb=d763f8bf6d6e13ce006ffab616cc8a77e747a633;hpb=c98aeb0cc3f98a5cb7f3b4986a175d355e6c239c diff --git a/tests/Test-proxied-https-auth.px b/tests/Test-proxied-https-auth.px index 182c9dbf..2b37f32b 100755 --- a/tests/Test-proxied-https-auth.px +++ b/tests/Test-proxied-https-auth.px @@ -1,8 +1,28 @@ #!/usr/bin/perl -use warnings; + use strict; +use warnings; use WgetTest; # For $WGETPATH. + +my $cert_path; +my $key_path; + +if (@ARGV) { + my $top_srcdir = shift @ARGV; + $key_path = "$top_srcdir/tests/certs/server-key.pem"; + $cert_path = "$top_srcdir/tests/certs/server-cert.pem"; +} + +# Have we even built an HTTPS-supporting Wget? +{ + my @version_lines = `${WgetTest::WGETPATH} --version`; + unless (grep /\+(openssl|gnutls)/, @version_lines) { + print "Not running test: Wget under test doesn't support HTTPS.\n"; + exit 0; + } +} + use HTTP::Daemon; use HTTP::Request; use IO::Socket::SSL; @@ -44,8 +64,16 @@ sub do_server { $rspn = HTTP::Response->new(200, 'OK'); $conn->send_response($rspn); - $conn = IO::Socket::SSL->new_from_fd($conn->fileno, SSL_server => 1, - SSL_passwd_cb => sub { return "Hello"; }) + my %options = ( + SSL_server => 1, + SSL_passwd_cb => sub { return "Hello"; }); + + $options{SSL_cert_file} = $cert_path if ($cert_path); + $options{SSL_key_file} = $key_path if ($key_path); + + my @options = %options; + + $conn = IO::Socket::SSL->new_from_fd($conn->fileno, @options) or die "Couldn't initiate SSL"; $rqst = &get_request($conn)