Strawberry Perl and lwp - download and save doesn't work

748 views Asked by At

This code worked with ActiveState Perl 5.10, but with Strawberry Perl 5.14 it fails. It downloads and saves jpeg partially, only 4Kb or so from the beginning. And every time size of downloaded file differs. Response is always "200 OK". LWP version is 6.04

use 5.14.0;
use LWP::UserAgent;
use HTTP::Headers;

my $img = 'https://avoncontent6.com/assets/ru-ru/images/product/prod_5045704_1_613x613.jpg';

my $ua = new LWP::UserAgent;
my $hh = HTTP::Headers->new(
  'User-Agent' => 'Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20100101 Firefox/21.0',
  'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'Accept-Language' => 'en-us,en;q=0.7,ru;q=0.3',
  'Accept-Encoding' => 'gzip, deflate',
  'Connection' => 'keep-alive',
);
$ua->default_headers( $hh );
$ua->cookie_jar({});
$ua->timeout(20);

$ua->get($img, ':content_file' => "jpg/1.jpg");

Headers are:

HTTP/1.1 200 OK
Date: Tue, 03 Dec 2013 20:32:14 GMT
Accept-Ranges: bytes
ETag: "031dd727cfce1:0"
Server: Microsoft-IIS/8.0
Content-Length: 149607
Content-Type: image/jpeg
Last-Modified: Tue, 22 Oct 2013 13:08:46 GMT
Client-Aborted: die
Client-Date: Tue, 03 Dec 2013 20:32:15 GMT
Client-Peer: 162.13.51.77:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=EssentialSSL CA
Client-SSL-Cert-Subject: /OU=Domain Control Validated/OU=Free SSL/CN=avoncontent6.com
Client-SSL-Cipher: RC4-SHA
Client-SSL-Socket-Class: IO::Socket::SSL
X-Died: read failed: Inappropriate I/O control operation at D:/perl/perl/vendor/lib/LWP/Protocol/http.pm line 414.
X-Powered-By: ASP.NET
1

There are 1 answers

3
Sly On

Installed older version libwww-perl-5.837