1998-12-21 18:56:39 +08:00
|
|
|
#!/usr/local/bin/perl
|
|
|
|
|
|
|
|
use ExtUtils::testlib;
|
|
|
|
|
|
|
|
use SSLeay;
|
|
|
|
|
|
|
|
$cmd=<<"EOF";
|
1998-12-21 19:00:56 +08:00
|
|
|
GET / HTTP/1.0
|
1998-12-21 18:56:39 +08:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
$conn="localhost:4433";
|
|
|
|
$conn=$ARGV[0] if $#ARGV >= 0;
|
|
|
|
$bio=SSLeay::BIO::new("connect");
|
1998-12-21 19:00:56 +08:00
|
|
|
#$bio->set_callback(sub {print STDERR SSLeay::BIO::number_read($_[0])."\n"; $_[$#_] });
|
|
|
|
#$bio->set_callback(sub {print STDERR "$#_:".$_[0].":$_[1]:$_[2]:$_[3]:$_[4]:\n"; $_[$#_] });
|
1998-12-21 18:56:39 +08:00
|
|
|
$bio->hostname($conn) || die $ssl->error();
|
|
|
|
|
|
|
|
|
|
|
|
(($ret=$bio->do_handshake()) > 0) || die $bio->error();
|
|
|
|
|
|
|
|
(($ret=$bio->syswrite($cmd)) > 0) || die $bio->error();
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
$ret=$bio->sysread($buf,10240);
|
|
|
|
last if ($ret <= 0);
|
|
|
|
print $buf;
|
|
|
|
}
|
|
|
|
|