Reputation: 1086
The below code produces an error on Windows 7 Pro, it reads 5-8K bytes of the web page, then terminates:
use strict;
use LWP::UserAgent;
my $url = 'https://www.flickr.com/photos/71475421@N02/26176178323/';
my $ua = LWP::UserAgent->new;
my $res = $ua->get($url);
print $res->headers->as_string;
The error is:
X-Died: read failed: A non-blocking socket operation could not be
completed immediately. at C:/Perl/lib/LWP/Protocol/http.pm line 467.
OS: Win 7 Pro (64bit)
Perl: 5.20.1 (32bit)
LWP: 6.08
LWP-Protocols-https: 6.06
Any ideas why is it not working, and how it can be fixed?
Thanks.
Upvotes: 1
Views: 558
Reputation: 1086
ActivePerl itself (with its outdated LWP package) seems to be the culprit.
Switched to Strawberry Perl and it works like charm.
Dumping ActivePerl...
Upvotes: 0
Reputation: 123260
This problem is probably due to checking only against EAGAIN and not EWOULDBLOCK. These error codes are both the same on most UNIX but are different on Windows. I recommend to use a newer version of LWP (at least version 6.09) because there it explicitly deals with this issue and checks for both conditions.
Upvotes: 1