Hi Monks, I'm trying to do a GET request with the following code:
my $mech = LWP::UserAgent->new(ssl_opts => { SSL_key_file => $key_path, SSL_passwd_cb => sub { return $pass; }, SSL_ca_file => $ca_path, SSL_cert_file => $crt_path, verify_hostname => 1, SSL_version => 'TLSv1' }); my $content = $mech->get($url); print Dumper($content);
But it fails. $content contains: (I replaced the url with <url> for readability)
$VAR1 = bless( { '_content' => 'Can\'t connect to <url>', '_rc' => 500, '_headers' => bless( { 'client-warning' => 'Internal +response', 'client-date' => 'Thu, 01 Aug +2019 09:57:43 GMT', 'content-type' => 'text/plain' }, 'HTTP::Headers' ), '_msg' => 'Can\'t connect to <url>', '_request' => bless( { '_content' => '', '_uri' => bless( do{\(my $o = +'<url>')}, 'URI::https' ), '_headers' => bless( { 'user-a +gent' => 'libwww-perl/6.04' }, 'HTTP: +:Headers' ), '_method' => 'GET' }, 'HTTP::Request' ) }, 'HTTP::Response' );
Versions of modules:
WWW::Mechanize: 1.71 LWP : 6.04
I also unset HTTP_PROXY and HTTPS_PROXY before running the script (The code contains a check for that).
I tried to search for the solution and found a lot of posts about it but small amount of answers (that didn't help).
Similar tool which is written in JS uses those same options and succeed in getting from the url.
Btw, I can connect to the url through chrome/mozila.
What could be the issue? Maybe I should some other module which supports SSL?
Thanks for all the help!

In reply to Performing a GET request with SSL by ovedpo15

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.