Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Time out SSL request?

Reply
Thread Tools

Time out SSL request?

 
 
Michael Capone
Guest
Posts: n/a
 
      12-19-2003
Hi folks,

I'm using perl (actually, mod_perl environment on RH 8.0) to connect
to an external SSL server. I feed it an XML request and get a
response back. The problem is, the server is flaky, and I'd like to
be able to timeout / break if I haven't gotten a response in X
seconds. (Note that the server may connect, but simply not send a
response, i.e., it's too busy.)

I don't really understand filehandles and setting timeouts in unix /
perl. The code below was lifted from the Net::SSLeay readme and
worked, and I never questioned it further.

Could someone show me how to modify the code below to add my timeout?
Note that I'm also completely open to other methods of connecting to
an SSL server; the Net::SSLeay method seemed to be the quickest to
implement, and I have no idea if there's a better way out there.

Thanks!

Michael

#!/usr/local/bin/perl -w

use strict;
use Net::SSLeay::Handle qw/shutdown/;

my ($request, $response) ;

local *F;
my $FH = *F;

$request = <<ENDXML;
<?xml version="1.0"?>
<Request>
<UserId>user1</UserId>
<Password>pass1</Password>
</Request>
ENDXML

my ($host, $port) = ("www.some.server", 443);
tie(*SSL, "Net::SSLeay::Handle", $host, $port);

print SSL "POST /xmlapps/blah HTTP/1.0\n";
print SSL "Content-type: application/x-www-form-urlencoded\n";
print SSL "Content-length: " . length($request) . "\n\n";
print SSL $request;

shutdown(\*SSL, 1);

$response .= $_ while (<SSL>);
close SSL;
print $response;
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is time.time() < time.time() always true? flamesrock Python 8 11-24-2006 06:51 AM
SSL with backend SSL on CSS 11500 Olivier PELERIN Cisco 0 08-30-2004 08:30 PM
How to imbed non-SSL links within SSL pages without using code CW ASP .Net 2 05-02-2004 01:40 PM
From non-ssl area to ssl ara with a virtual href path? 620 ASP .Net 2 01-06-2004 09:58 PM
Time out SSL request? Michael Capone Perl Misc 2 12-31-2003 04:52 AM



Advertisments