diff options
author | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 10:56:39 +0000 |
---|---|---|
committer | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 10:56:39 +0000 |
commit | 58964a492275ca9a59a0cd9c8155cb2491b4b909 (patch) | |
tree | c7b16876a5789463bbbb468ef4829c8129b3d718 /perl/s2.pl | |
parent | d02b48c63a58ea4367a0e905979f140b7d090f86 (diff) | |
download | openssl-58964a492275ca9a59a0cd9c8155cb2491b4b909.tar.gz |
Import of old SSLeay release: SSLeay 0.9.0b
Diffstat (limited to 'perl/s2.pl')
-rw-r--r-- | perl/s2.pl | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/perl/s2.pl b/perl/s2.pl new file mode 100644 index 0000000000..540ca7c817 --- /dev/null +++ b/perl/s2.pl @@ -0,0 +1,49 @@ +#!/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"; + } + ); + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; +$cbio=BIO->new("connect"); +$cbio->hostname($conn) || die $ssl->error(); + +$ssl=$ssl_ctx->new_ssl; +$sbio=BIO->new("ssl"); +$sbio->set_ssl($ssl); +$ssl->set_options("-connect_state"); + +$bio=BIO->new("buffer"); + +$sbio->push($cbio); +$bio->push($sbio); + +($bio->do_handshake() > 0) || die $bio->error(); + +(($ret=$bio->syswrite("GET / HTTP/1.0\r\n\r\n")) > 0) || die $ssl->error(); +$bio->flush() || die $bio->error(); + +$data=""; +while ($_=$bio->getline()) + { + if (/^Server:/) + { + print; + last; + } + } + +if ($bio->peek_error()) + { + print "There was an error:".$ssl->error(); + } +print "exit\n"; |