http://qs321.pair.com?node_id=1126436

dcsastry has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I have a vexing problem with Perl LWP and accessing an internal company HTTPS site.

I was having lots of problems getting an SSL handshake to work, and I finally got around that.

Then I was having problems with credentials not working, and I finally got around that.

Now I am having some kind of internal issue with HTTP. It seems like the SSL handshake is done, but I cannot pull data from the website after that. I just get this 500 internal error on the client side.

I am not sure what I can do to debug this issue - any ideas for things I need to look at? Thanks!

Here is the code I used (edited for posting)

use LWP::UserAgent; use LWP::Protocol::https; use HTTP::Request; use HTTP::Cookies; $IO::Socket::SSL::DEBUG=3; our $ua = LWP::UserAgent->new(keep_alive=>1); $ua->agent("Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11 +.0) like Gecko"); $ua->ssl_opts(SSL_ca_file => 'C:\OpenSSL-Win32\cert\companyx Root CA B +ase64.cer'); $ua->ssl_opts(verify_hostname=>1); $ua->cookie_jar(HTTP::Cookies->new(file => "$ENV{HOME}/.cookies.txt")) +; $ENV{http_proxy} = ''; our $host = "cdis.companyx.com:9283"; our $url1 = "https://$host/cdis/default.asp"; $ua->credentials("$host",'', "AMR\\username", 'password'); $ua->timeout(10); my $response1 = $ua->get($url1); if ($response1->is_success) { print $response1->content; } else { print "Error: " . $response1->status_line . "\n"; print $response1->headers()->as_string(), "\n"; print $response1->content; } exit(0);

Here is the output

DEBUG: .../IO/Socket/SSL.pm:2633: new ctx 62187576 DEBUG: .../IO/Socket/SSL.pm:549: socket not yet connected DEBUG: .../IO/Socket/SSL.pm:551: socket connected DEBUG: .../IO/Socket/SSL.pm:573: ssl handshake not started DEBUG: .../IO/Socket/SSL.pm:606: using SNI with hostname cdis.companyx +.com DEBUG: .../IO/Socket/SSL.pm:641: request OCSP stapling DEBUG: .../IO/Socket/SSL.pm:660: set socket to non-blocking to enforce + timeout=10 DEBUG: .../IO/Socket/SSL.pm:676: Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/SSL.pm:686: ssl handshake in progress DEBUG: .../IO/Socket/SSL.pm:696: waiting for fd to become ready: SSL w +ants a read first DEBUG: .../IO/Socket/SSL.pm:716: socket ready, retrying connect DEBUG: .../IO/Socket/SSL.pm:2536: did not get stapled OCSP response DEBUG: .../IO/Socket/SSL.pm:2489: ok=1 cert=62234208 DEBUG: .../IO/Socket/SSL.pm:2489: ok=1 cert=62234544 DEBUG: .../IO/Socket/SSL.pm:2489: ok=1 cert=62234432 DEBUG: .../IO/Socket/SSL.pm:2489: ok=1 cert=62234320 DEBUG: .../IO/Socket/SSL.pm:1581: scheme=www cert=62234320 DEBUG: .../IO/Socket/SSL.pm:1591: identity=cdis.companyx.com cn=cdis.c +ompanyx.com alt=2 fm1seagwebpd01.amr.corp.companyx.com 2 fm1seagwebpd +02.amr.corp.companyx.com 2 fm1seagwebpd03.amr.corp.companyx.com 2 cdi +sprod-node1.companyx.com 2 cdisprod-node2.companyx.com 2 cdisprod-nod +e3.companyx.com 2 cdis.companyx.com DEBUG: .../IO/Socket/SSL.pm:676: Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/SSL.pm:686: ssl handshake in progress DEBUG: .../IO/Socket/SSL.pm:696: waiting for fd to become ready: SSL w +ants a read first DEBUG: .../IO/Socket/SSL.pm:716: socket ready, retrying connect DEBUG: .../IO/Socket/SSL.pm:676: Net::SSLeay::connect -> 1 DEBUG: .../IO/Socket/SSL.pm:731: ssl handshake done DEBUG: .../IO/Socket/SSL.pm:2666: free ctx 62187576 open=62187576 DEBUG: .../IO/Socket/SSL.pm:2671: free ctx 62187576 callback DEBUG: .../IO/Socket/SSL.pm:2678: OK free ctx 62187576 Error: 500 Status read failed: Unknown error Content-Type: text/plain Client-Date: Tue, 12 May 2015 15:19:46 GMT Client-Warning: Internal response Status read failed: Unknown error at C:/Perl/site/lib/Net/HTTP/Methods +.pm line 276.