Interestingly, bing is the one which fails for me:
$ cat ssl.t
use strict;
use warnings;
use Test::More;
use LWP::UserAgent;
my @hostnames = (
'google.com',
'microsoft.com',
'bing.com'
);
plan tests => 1 + scalar @hostnames;
cmp_ok ($LWP::UserAgent::VERSION, '>=', 6.04, 'LWP is at least fairly
+recent');
my $ua = LWP::UserAgent->new;
for my $host (@hostnames) {
my $res = $ua->head ("https://$host/");
is ($res->code, '200', "$host returns 200")
}
$ prove -v ssl.t
ssl.t ..
1..4
ok 1 - LWP is at least fairly recent
ok 2 - google.com returns 200
ok 3 - microsoft.com returns 200
not ok 4 - bing.com returns 200
# Failed test 'bing.com returns 200'
# at ssl.t line 19.
# got: '405'
# expected: '200'
# Looks like you failed 1 test of 4.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/4 subtests
Test Summary Report
-------------------
ssl.t (Wstat: 256 Tests: 4 Failed: 1)
Failed test: 4
Non-zero exit status: 1
Files=1, Tests=4, 2 wallclock secs ( 0.04 usr 0.02 sys + 0.33 cusr
+ 0.02 csys = 0.41 CPU)
Result: FAIL
405 is "Method Not Allowed" so bing is just disallowing HEAD requests. I am unable to reproduce your errors and am interested to see your code which works in successfully retrieving a response to a HEAD from bing.com.
Addendum: here are the relevant version numbers:
- Perl: 5.16.3
- LWP: 6.15
- IO::Socket::SSL: 2.012
- Mozilla::CA: 20141217