cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Fwd: Downloaded File (.pdf) Corrupt

From: Eric Belec <ericbel_2_at_hotmail.com>
Date: Tue, 10 Jan 2012 15:06:06 -0500

On 1/7/2012 4:39 PM, Dan Fandrich wrote:
> On Sat, Jan 07, 2012 at 03:11:28PM -0500, Eric Belec wrote:
>> libcurl (.net) with C# :
>>
>> I determined that 9 out of 10 times downloading my various pdf files will work.
>> The problem is the 1 of 10 times where the pdf returned was 22kb (and corrupt)
>> instead of a working pdf of size 40kb...
>>
>> Please let me know if there is an alternate way I can write my pdf out.. I've
>> spent so much time and I'm at the end of the ropes.. Any help would be
>> appreciated! Below is the key code areas..
>> public Int32 OnWriteFile(Byte[] buf, Int32 size, Int32 nmemb, Object
>> extraData)
>> {
>>
>> binaryWriter.Write(buf, 0, nmemb);
> This should be size * nmemb as well.
>
>> return size * nmemb;
>> }
> Are you sure the source PDF file isn't actually corrupt? Are you sure the
> server isn't actually corrupting it somehow? Can you download the file
> another way and tell? If you download the file from the same URL using
> another program, is it corrupt? In what way is it corrupt? Is it simply
> truncated? Are the non-truncated bytes correct? What do you see in the
> transfer with logging enabled? What is the value returned by
> easy.Perform()?
>
>>>> Dan
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
>
Hi,

The problem is solved. For anyone running into the same problem.. you
will need to decode any HTML code before you do a Libcurl.perform()
function with an html link. Seems obvious now but when pulling it off my
page via a Regex it wasn't.

Thank you for your help! What an amazing component!

Thanks,
Eric
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-10