use strict;
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;
+ }
+}
+
use HTTP::Daemon;
use HTTP::Request;
-use IO::Socket::SSL 'debug4';
+use IO::Socket::SSL;
+
+my $SOCKET = HTTP::Daemon->new (LocalAddr => 'localhost',
+ ReuseAddr => 1) or die "Cannot create server!!!";
sub get_request {
my $conn = shift;
sub do_server {
my $alrm = alarm 10;
- my $s = HTTP::Daemon->new (LocalAddr => 'localhost',
- LocalPort => '8080',
- ReuseAddr => 1) or die "Cannot create server!!!";
+ my $s = $SOCKET;
my $conn;
my $rqst;
my $rspn;
'Content-Type' => 'text/plain',
'Connection' => 'close',
], "foobarbaz\n");
+ $rspn->protocol('HTTP/1.0');
+ print "=====\n";
+ print $rspn->as_string;
+ print "\n=====\n";
print $conn $rspn->as_string;
}
$conn->close;
. " --password=Dodgson -e https_proxy=localhost:{{port}}"
. " --no-check-certificate"
. " https://no.such.domain/needs-auth.txt";
+$cmdline =~ s/{{port}}/$SOCKET->sockport()/e;
my $code = system($cmdline);
+system ('rm -f needs-auth.txt');
warn "Got code: $code\n" if $code;
kill ('TERM', $pid);
-exit $code;
+exit ($code >> 8);