|Welcome to the Monastery|
Downloading large Binary files from https protocol using WWW::Mechanize in Windows OSby sam_bakki (Pilgrim)
|on Apr 19, 2012 at 11:34 UTC||Need Help??|
I attempt to download large files (~20MB+ zip, pdf) from a website (collabnet teamforge) which is using https protocol. I wrote a perl script using WWW::Mechanize and tried to save the file using 'save_content' function like below.
This is just a code snip set only not running code.
This code works find in Linux machine with perl 5.8.8 but failes to download files properly in Windows OS. I tried to decode_content and realise that only first chunk of data came and immediately client (perl script) sends x-die header. That means, In windows Active perl 5.12.x , downloading large binary files via https is not working.
The underlying problem was , perl lwp can not deflate the gzip data because , lwp dies before getting all the chunk of the big file. I searched a lot in google but did not find right solution. Because this appears to be Windows only problem.Finally i made it working with using Crypt::SSLeay . By default in windows OS, LWP uses IO::Socket::SSL to handle https. which is not working for me. So i had to force LWP to use Net::SSL (provided by Crypt::SSLeay) using following code
That is it. Everything works fine after I added above code.