Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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 => 'https://api.flickr.com/services/rest', ); 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2019-05-19 22:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (122 votes). Check out past polls.

    Notices?