cURL / Mailing Lists / curl-library / Single Mail

curl-library

failed to download binary file of actual size from source to destiantion

From: ankit singh <ankit.singh.sengar19_at_gmail.com>
Date: Wed, 18 May 2016 11:31:13 +0530

Hi ,

I tried to download binary file from remote location but the md5 / size of
downloaded file didn't match with file at remote location.

[root_at_bgl-ipl-2 repo]# ls -lrt xyz-file-xxxxx

-rwxrwxrwx 1 root root *21839057* May 17 12:04 xyz-file-xxxxx <<< Actual
size

[root_at_bgl-ipl-2 repo]#

+++++++++++++++++++

File downloaded ::

+++++++++++++++++++

#

# ls -lh

t-u--g--o- ln Owner Group Size Date Filename

total 42654

-rw------- 2 0 0 *21838848* May 18 11:29
temp_http_file_00655430

-rwxrwxrwx 2 0 0 0 May 18 11:29 temporary_file

#

I am using below curl APIs :

     curl_global_init(CURL_GLOBAL_DEFAULT);

      curl = curl_easy_init();

      if (curl) {

          fd = fopen(destination,"wb");

          curl_easy_setopt(curl, CURLOPT_URL, uri);

          /* Switch on full protocol/debug output while testing */

          curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);

          /* disable progress meter, set to 0L to enable and disable debug
output */

          curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);

         //curl_easy_setopt(curl, CURLOPT_PROTOCOLS,CURLPROTO_HTTP |
CURLPROTO_HTTPS);

          curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);

          curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);

          res = curl_easy_perform(curl);

          /* always cleanup */

          curl_easy_cleanup(curl);

          curl_global_cleanup()

     }

Please let me know if I am doing wrong here or is there any other APIs or
curl-option needs to be added.

Regards,
-Ankit

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-05-18