]>
Commit | Line | Data |
---|---|---|
58964a49 RE |
1 | #!/usr/local/bin/perl |
2 | ||
3 | use ExtUtils::testlib; | |
4 | ||
5 | use SSLeay; | |
6 | ||
7 | $ssl_ctx=SSL::CTX->new("SSLv3"); | |
8 | ||
9 | #$ssl_ctx->set_options("-info_callback" => | |
10 | # sub { | |
11 | # print STDOUT $_[0]->state()."\n"; | |
12 | # } | |
13 | # ); | |
14 | ||
15 | # create a ssl bio | |
16 | $bssl=BIO->new("ssl"); | |
17 | $bssl->set_ssl($ssl_ctx->new_ssl()) || die $bssl->error(); | |
18 | $bssl->get_ssl->set_options("-connect_state") || die $ssl->error(); | |
19 | ||
20 | $bssl->set_callback(sub { printf "XXXXXXXXXXXXXXXXXXXXXX %d %s\n",$_[1],$_[0]->type; }); | |
21 | ||
22 | # create connect bio | |
23 | $host="localhost:4433"; | |
24 | $host=$ARGV[0] if $#ARGV >= 0; | |
25 | $bio=BIO->new("connect"); | |
26 | $bio->hostname($host) || die $bio->error(); | |
27 | ||
28 | # push it in | |
29 | $bssl->push($bio); | |
30 | ||
31 | (($ret=$bssl->write("GET / HTTP/1.0\r\n\r\n")) > 0) || die $bssl->error(); | |
32 | ||
33 | while (1) | |
34 | { | |
35 | $ret=$bssl->read($buf,10240); | |
36 | last if ($ret <= 0); | |
37 | print $buf; | |
38 | } | |
39 | ||
40 |