258 User Guide Integrated Lights-Out
Net::SSLeay::connect($ssl) and
die_if_ssl_error("ERROR: ssl connect");
print STDERR 'SSL Connected ';
print 'Using Cipher: ' .
Net::SSLeay::get_cipher($ssl) if $debug;
print STDERR "\n\n";
# usage: sendscript(host, script)
sub sendscript($$)
{
$ssl = openSSLconnection($host);
# write header
$n = Net::SSLeay::ssl_write_all($ssl, $script);
$reply = "";
return $ssl;
}
Sending the XML Header and Script Body
After the connection is established, the first line of script sent must be an XML
document header, which tells the device's HTTPS Web server that the following
content is an XML script. The header must match the header used in the example
exactly. After the header has been completely sent, the remainder of the script
can be sent. In this example, the script is sent all at once. For example:
# sends the xmlscript script to host, returns reply
my $host = shift;
my $script = shift;
my ($ssl, $reply, $lastreply, $res, $n);
$n = Net::SSLeay::ssl_write_all($ssl, '<?xml
version="1.0"?>'."\r\n");
rint "Wrote $n\n" if $debug;
# write script
READLOOP:
print "Wrote $n\n$script\n" if $debug;
$lastreply = "";
while(1)
{