in reply to Re: Error 500 in LWP
in thread Error 500 in LWP

You're right. My code returns 500,500,405 for Bing. But if I change code:
use strict; use warnings; use LWP::UserAgent; my @hostnames = ( 'google.com', 'microsoft.com', 'bing.com' ); my $ua = LWP::UserAgent->new; for my $host (@hostnames) { # my $res = $ua->head ("https://$host/"); my $res = $ua->get ("http://$host/"); print $res->code . "\n"; }
it returns: 200,500,200

Replies are listed 'Best First'.
Re^3: Error 500 in LWP
by Corion (Patriarch) on Aug 17, 2017 at 12:27 UTC
    500 Can not connect to domen: 443 (connect: Network is unreachable); Client-Warning: Internal response

    Your requests never go outside of your local network if at all. Maybe you need to use a proxy like your browser does, or you have two routes and the name resolution ping-pongs between a working network route and some other network route.

    Maybe the name resolution itself is wonky for some domain names.

Re^3: Error 500 in LWP
by hippo (Archbishop) on Aug 17, 2017 at 12:42 UTC

    When I make the same 2 changes which you make (https to http and head to get) then all my tests pass. If you are unable to make an HTTP connection to http://microsoft.com/ then that has to be a question for your local network administrator.

      Thanks for all, I am go to the administrator ;)
      With the local network all right, the command is executed and save file. But script LWP with error, there dump:
      # perl ssl.pl $VAR1 = bless( { '_content' => '500 Can\'t connect to www.microsoft.c +om:443 (connect: Network is unreachable) ', '_rc' => 500, '_headers' => bless( { 'client-warning' => 'Internal + response', 'client-date' => 'Fri, 18 Aug + 2017 08:51:50 GMT', 'content-type' => 'text/plain +' }, 'HTTP::Headers' ), '_msg' => 'Can\'t connect to www.microsoft.com:443 ( +connect: Network is unreachable)', '_request' => bless( { '_content' => '', '_uri' => bless( do{\(my $o = + 'https://www.microsoft.com/uk-ua/')}, 'URI::https' ), '_headers' => bless( { 'user-agent' => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit +/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36' }, 'HTTP +::Headers' ), '_method' => 'GET' }, 'HTTP::Request' ) }, 'HTTP::Response' );
        https://www.microsoft.com/uk-ua/

        So, I see you have changed the target URL again. I wonder why. Anyway, here, on CentOS 6 is the script which works absolutely perfectly for me:

        use strict; use warnings; use Test::More tests => 1; use LWP::UserAgent; use Data::Dumper; my $ua = LWP::UserAgent->new; my $res = $ua->get ('https://www.microsoft.com/uk-ua/'); is ($res->code, 200, 'Download succeeded'); diag (qq# LWP: $LWP::VERSION IO::Socket::SSL: $IO::Socket::SSL::VERSION#);

        Which gives:

        $ perl sslms.pl 1..1 ok 1 - Download succeeded # # LWP: 5.833 # IO::Socket::SSL: 1.31