blob: 419402f12b566e47d62bf048c6f84792b54adf6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/local/bin/perl
use ExtUtils::testlib;
use SSLeay;
$ssl_ctx=SSL::CTX->new("SSLv3");
$ssl_ctx->set_options("-info_callback" =>
sub {
print STDERR $_[0]->state()."\n";
}
);
$ssl_ctx->use_PrivateKey_file("server.pem");
$conn="localhost:4433";
$conn=$ARGV[0] if $#ARGV >= 0;
$bio=BIO->new("connect");
$bio->hostname($conn) || die $ssl->error();
$ssl=$ssl_ctx->new_ssl;
$ssl->set_bio($bio);
(($ret=$ssl->connect()) > 0) || die $ssl->error();
(($ret=$ssl->write("GET / HTTP/1.0\r\n\r\n")) > 0) || die $ssl->error();
while (1)
{
$ret=$ssl->read($buf,10240);
last if ($ret <= 0);
print $buf;
}
|