alain_desilets has asked for the wisdom of the Perl Monks concerning the following question:
Here is a piece of code that tries to download a url using LWP:
use strict; use warnings; use LWP::UserAgent; use IO::Socket::SSL; my $url = "https://www.gov.nu.ca/"; do { my $user_agent = LWP::UserAgent->new(ssl_opts => { verify_hostname + => 0, SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE, } ); $user_agent->agent('Mozilla/5.0'); my $request = HTTP::Request->new( GET => $url ); my $response = $user_agent->request($request); print "\n\ncontent:\n".$response->content; print "\n\ncode: ".$response->code."\n\nmessage: ".$response->mess +age; }
When I run it through my employer's VPN, it produces the following output:
content: ... etc... <TITLE>Untrusted SSL Server Certificate</TITLE> ... etc... code: 503 message: Service Unavailable
Which is strange, given that I disabled the SSL certificate checking in my ssl_opts. Yet, if I curl the same URL, again through the VPN, I get the page's content.
Even stranger, if I log out of my employer's VPN, then the above script does work and produce the content of the page. So it seems that the VPN is somehow overriding my ssl_opts, but then, why is it not doing the same with curl?
Any idea about what is going on?
Thx.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cannot disable SSL certificate checking when using VPN
by Corion (Patriarch) on Jan 08, 2019 at 13:39 UTC | |
by alain_desilets (Beadle) on Jan 09, 2019 at 20:16 UTC |