X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=tests%2FTest-proxied-https-auth.px;h=1de535786321ed379ddc78f57a80f53e710b490e;hp=4e3fb206dcdf8645a1815beead355aa3ce565c32;hb=320cfdcb658e8d6556ae9dfd902c2db1db866a6b;hpb=1b4ed7dcb7bdad277a9ee2c5a42b6e70854db802 diff --git a/tests/Test-proxied-https-auth.px b/tests/Test-proxied-https-auth.px index 4e3fb206..1de53578 100755 --- a/tests/Test-proxied-https-auth.px +++ b/tests/Test-proxied-https-auth.px @@ -1,17 +1,18 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; +use WgetFeature qw(https); use WgetTest; # For $WGETPATH. -# 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; - } +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"; } use HTTP::Daemon; @@ -55,8 +56,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)