#
# a test client for testing Net::SSL's behavior (aspa@hip.fi).
#
# $Id: test1.pl,v 1.1 1999/05/27 08:38:37 aspa Exp aspa $.
#

use Net::SSL;

my $v_mode = &Net::SSLeay::VERIFY_NONE;
#my $v_mode = &Net::SSLeay::VERIFY_PEER;

my $sock = Net::SSL->new( PeerAddr => 'www.verisign.com',
			  PeerPort => '443',
			  Proto    => 'tcp',
			  SSL_verify_mode => $v_mode,
			  );
if(!$sock) {
    print STDERR "unable to create a Net::SSL object.\n";
    exit(0);
}


$rq = "fuufaa GET /\n\n";

# try the syswrite-interface with an offset.
$sock->write("$rq", 100, 7);

my $buf = "";
my ($cnt, $r) = (0, 0);

# these test the sysread interface (test count and offset).
while ( ($r = $sock->read($buf, 1, $cnt)) && ($cnt < 154) ) {
    $cnt += $r;
}
print "read bytes: cnt = '$cnt'\n";

while ( ($r = $sock->read($buf, 1, $cnt)) ) {
    $cnt += $r;
}
print "status: r = $r\n";

$sock->close;

print "got: buf: '$buf'.\n";

print STDERR "\nsock: '$sock'.\n";
