Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Socket problems and SSL

by shotgunefx (Parson)
on Jul 10, 2001 at 02:58 UTC ( #95197=perlquestion: print w/ replies, xml ) Need Help??
shotgunefx has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to use LWP to connect to a https url and have run into a problem.

Whenever trying to contact any SSL server other than the one on the same machine, the SSL negotiation fails with:

500 SSL negotiation failed:; Resource temporarily unavailable at /usr/local/lib/perl5/site_perl/5.6.0/sparc64-linux/Net/SSL.pm line 138.

The machine in question is not using a proxy and 443 is not being blocked by the firewall which I verified by telneting to various known web servers at 443 from the machine in question.

I tested it against another server here and the request never even hits the server so this leads me to believe there is a problem on the socket level. The machine in question is a sparc running linux and it wouldn't be the first time I have encountered a problem with LWP. (After upgrading last year to a newer rev of LWP, all LWP::Simple::get()'s (and only get) would mysteriously fail unless you prepended a space to the url. !?! The newest version of LWP does not have this problem, btw)

I've gone through the various modules socket modules used by LWP to troubleshoot but I must admit, it's beyond me.

I guess my question is this, when specifying an Internet style socket, are requests that are addressed to the originating machine handled any differently internally than requests that are addressed to a different IP?

If anyone has a suggestion as to where to start looking for the problem or any suggestions, your help would be very appreciated.
#!/usr/bin/perl use LWP; use LWP::Debug qw(+); use LWP::UserAgent; use LWP::Protocol::https; my $connect = new LWP::UserAgent; my $request = new HTTP::Request 'GET', 'https://www.thawte.com'; my $response = $connect->request($request); print $response; print $response->content; print $response->as_string;
OUTPUTS
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::simple_request: GET https://www.thawte.com/
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::UserAgent::request: Simple response: Internal Server Error
HTTP::Response=HASH(0x38994c)500 (Internal Server Error)
SSL negotiation failed:; Resource temporarily unavailable at /usr/local/lib/perl5/site_perl/5.6.0/sparc64-linux/Net/SSL.pm line 138.
Client-Date: Tue, 10 Jul 2001 02:50:11 GMT


-Lee

"To be civilized is to deny one's nature."

Comment on Socket problems and SSL
Download Code
Re: Socket problems and SSL
by cleen (Pilgrim) on Jul 10, 2001 at 04:59 UTC
    " I guess my question is this, when specifying an Internet style socket, are requests that are addressed to the originating machine handled any differently internally than requests that are addressed to a different IP? "

    Nope, even loopback is a psuedo device, so sending to that will not make a difference. I dont think were dealing with a code problem persay, or a socket problem, nor is it an operating system problem, in my thinking it is an arcitecture issue, as I am typing this I am compiling all the needed modules to debug further into this on a sparc processor (for it seeminly runs just fine using x86).

    It turns out it worked fine on my sparc (OpenBSD sparc SUNW,SPARCstation-5, MB86907 @ 170 MHz, on-chip FPU), and after looking at the acctuall SSL.pm, it might be an issue with your installation of SSL, try grabbing a brand spanking new copy of ssl, recompile your https against it, and same with Net::SSL, make sure both the server and the program are reading from the same page.

    Ill post more as I dig more into it and try to recreate the error, btw: what web server are you running?
      Thanks for testing it.

      I'm running Apache 1.3.9

      I've tried using both openssl-9.6 and openssl-9.6a

      I've reinstalled dozens of times (Tried to even go back to earlier versions of everything, all with the exact same results.)

      What I'm actually trying to do is use SOAP::Lite to communicate with a service via SSL. (It worked fine over HTTP) When it started failing mysteriously, I decided to try it with lwp, etc and they all have the same results.

      One thing I have noticed is that when install Net::SSLeay, it is able to contact all test sites which makes me think the problem is somewhere inbetween IO::Socket::INET and IO::Socket::SSL. I have a feeling that it's some wrong define or constant in one of the headers or some other obscure glitch. It's hard for me to know where to begin with all the oo inheritence.

      Through adding warnings, etc to Net::SSL I can tell that it does try and negotiate versions 3,23 and 2 yet all fail. The site I am trying to connect to is using 23 and I am able to communicate with it using a linux/intel box with the same versions of LWP,Net::SSLeay, etc installed.

      Thanks,
      -Lee

      "To be civilized is to deny one's nature."
Re: Socket problems and SSL
by cLive ;-) (Parson) on Jul 10, 2001 at 09:37 UTC
    I think this node is what you are looking for.

    cLive ;-)

      Thanks, but Crypt::SSLeay is already installed and appears(?) to be working.

      -Lee

      "To be civilized is to deny one's nature."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://95197]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2014-09-21 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (167 votes), past polls