Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: LWP not working with HTTPS protocol

by Khen1950fx (Canon)
on May 03, 2015 at 04:00 UTC ( #1125483=note: print w/replies, xml ) Need Help??

in reply to LWP not working with HTTPS protocol (SOLVED)

Just FYI, I've noticed that the first test of LWP::Protocol::https fails because sometimes, when it tries to connect to the Apache Software Foundation, it connects ok; sometimes, it can't make a connection. For example, I installed it on 5.8.8 with no problems. A couple of hours later, I tried it on 5.16.0, but it couldn't connect. It seems the site is up and down frequently.

The modules are installed, so they should just work. I think that LWP needs to be told to do https, at least in this situation:
#!/usr/bin/perl -l use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 }, protocols_allowed => ['https'], ); my $req = HTTP::Request->new( GET => '', ); my $res = $ua->request($req); print $res->code;

Replies are listed 'Best First'.
Re^2: LWP not working with HTTPS protocol
by noxxi (Pilgrim) on May 03, 2015 at 12:45 UTC
    Please don't disable hostname validation, at least not with any code used in production. This makes you vulnerable to man-in-the-middle attacks.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1125483]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2021-10-22 07:42 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (85 votes). Check out past polls.