cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: A little problem!

From: Alessandro Rasulo <emthesis_at_tiscali.it>
Date: Tue, 20 Jan 2004 16:46:51 +0100

I'm sorry!!!
I found the bug!!

I've opened the output file with:

        f = fopen(localFile.CStr(), "w");

instead of:

        f = fopen(localFile.CStr(), "wb");


I'M SORRY!!!




At 16.34 20/01/2004, you wrote:

Hi cURL developers
(excuse me for my terrible english)

I wroten a little program under WinXP that downloads a file from my site via http, all works fine, there is only a little problem:

In the downloaded file all "\n" char are converted into "\r\n", not only in text files but also in binaries (zip/rar).
I tryed to disable CURLOPT_CRLF, but with no success..

        CURL *ch = curl_easy_init();

        // BEHAVIOR OPTIONS
        curl_easy_setopt(ch, CURLOPT_VERBOSE, true);
        curl_easy_setopt(ch, CURLOPT_HEADER, true);
        curl_easy_setopt(ch, CURLOPT_NOPROGRESS, false);
        // CALLBACK OPTIONS
        curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, write_callback);
        curl_easy_setopt(ch, CURLOPT_WRITEDATA, f);
        curl_easy_setopt(ch, CURLOPT_PROGRESSFUNCTION, progress_callback);
        curl_easy_setopt(ch, CURLOPT_DEBUGFUNCTION, debug_callback);
        // ERROR OPTIONS
        curl_easy_setopt(ch, CURLOPT_ERRORBUFFER, error_text);
        // NETWORK OPTIONS
        curl_easy_setopt(ch, CURLOPT_URL, remoteFile.CStr());   
        // PROTOCOL OPTIONS
        curl_easy_setopt(ch, CURLOPT_TRANSFERTEXT, 0);
        curl_easy_setopt(ch, CURLOPT_CRLF, 0);
        
        // download
        int result = curl_easy_perform(ch);

        curl_easy_cleanup(ch);


the write function callback do only this:

size_t write_callback(void *buffer, size_t size, size_t numelems, void *stream)
{
        return fwrite(buffer, size, numelems, (FILE *)stream);
}

Someone can help me??? Thanks

Ps. I've tryed also downloading file with FTP, but with same result...


Alessandro Rasulo
Emthesis Development s.n.c.
www.emthesis.com | rasulo@emthesis.com
------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn


Alessandro Rasulo
Emthesis Development s.n.c.
www.emthesis.com | rasulo@emthesis.com
------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn Received on 2004-01-20