Esteemed monks,
I am running the following code on Linux to access https://google.co.uk via an internal proxy
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use MIME::Base64; use Data::Dumper; my $url='https://google.co.uk'; $ENV{'HTTP_PROXY'}="http://websense:8080"; $ENV{'HTTPS_PROXY'}="http://websense:8080"; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; $ENV{HTTP_DEBUG}=1; my $ua=LWP::UserAgent->new('env_proxy'=>1,ssl_opts=>{verify_hostname=> +0}); $ua->env_proxy(); my $result=$ua->get($url); print("\n $@");
I get the following error:
Can't connect to google.co.uk:443 (Bad hostname) LWP::Protocol::https::Socket: Bad hostname 'google.co.uk' at /usr/loca +l/perl/lib/site_perl/LWP/Protocol/http.pm line 47.
If I run this script by changing the URL to 'http', i.e. insecure URL, I get the results from google.co.uk. Whereas 'httpS' returns the above error.
I have looked at various internet forums and can't figure out how to fix this. I have also tried to fetch https://google.co.uk from 'curl' command using the proxy and that returns a result. This clearly indicates there is something in my Perl script that I need to do.
Can you help?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |