rusacarr has asked for the wisdom of the Perl Monks concerning the following question:
I've been writing several scripts to use OpenSSL/LWP/Crypt_SSLeay to POST requests to remote websites to upload and download files. All has been going well until my latest script to a new server. I have been having problems downloading files from this server where the SSL request does not receive a response for 10 minutes, then errors out with this:
Error while sending the Request to https://<i>hostname</i> -- 500 read failed: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
I have Googled a few forums and discovered that some believe this is due to a handshakeing issue in SSL and can be resolved under OpenSSL via a SSL_OP_TLS_ROLLBACK_BUG option flag.
My question is, "Can anybody help me understand what the real problem is, and how I can set an OpenSSL flag when I'm using an LWP->UserAgent/HTTP->Request setup to handle the transfers?"
I've read that this appears to be an issue where the server and client first agree on a higher SSL version number, then the client sends a latter request to the server with a lower version number, due to a bad response from the server. Under strict SSL validation, this is not allowed. Yet I've seen no mention of this topic on PerlMonks, so I wonder if I'm doing something wrong. I can post the code, but snippits would be better since it's fairly big. (automating EDI file transfers)
I'm running Win2k
ActivePerl v.5.8.0 for MSWin32-x86-multi-thread.
OpenSSL v.0.9.7b
Crypt-SSLeay v.0.51
LWP 5.68
Server response header says the server is:
Server: Microsoft-IIS/5.0 Server: WebSphere Application Server/5.0
Thanks.
Here's snippets of the simplified code:
use strict; # of course. use warnings; use Carp; use LWP::UserAgent; use LWP::Debug qw(+); use HTTP::Request; .... $ua = LWP::UserAgent->new(timeout => 90); $ua->agent("ediscript/0.5 "); # Establish a memory resident, temporary cookie jar (database) to ho +ld any used cookies. $ua->cookie_jar({}); .... ### Code to construct XML content string my $res = sendRequest($dnldContent, $dnldURL) print $res; .... sub sendRequest { my $reqXML = shift || return undef; my $reqURL = shift || return undef; my $req = HTTP::Request->new(POST => $reqURL); $req->content_type('text/xml'); $req->content($reqXML); my $res = $ua->request($req); croak "Error while sending the Request to ", $res->request->uri, " + -- ", $res->status_line, "\n" unless $res->is_success; return $res->content; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SSL Transfer error 'wrong version number'
by idsfa (Vicar) on Oct 10, 2003 at 04:04 UTC | |
by rusacarr (Acolyte) on Oct 10, 2003 at 13:36 UTC | |
by idsfa (Vicar) on Oct 10, 2003 at 18:02 UTC |