libCurl

hi

I am trying to download a file that is more than 2GB size using libcurl.But this file is not getting downloaded and following message is coming.

libcurl: (36) Bad file size (-1973563510)
1.1 curl_easy_perform() failed: Couldn't resume download

All files those are less than 2GB size are downloading successfully.

Thanks
Ankit
Is your system 64 bit? Also what about your compiler? And the curl library? 2 GB is a limitation of 32 bit systems. Or possibly your file system has a limitation on a maximum file size.
https://en.wikipedia.org/wiki/2_GB_limit
https://en.wikipedia.org/wiki/Comparison_of_file_systems
Last edited on
That isn't the real limitation when it comes to disk file size. The 2GB limit has nothing to do with disk file limit. On NTFS, on that same page you listed, the maximum file size is 16 EiB. Even if you can only hold so much data in RAM, you can download in smaller segments at a time, transfer to disk, clear memory, then repeat.

What you're running into is CURLE_BAD_DOWNLOAD_RESUME which is documented here: https://curl.haxx.se/libcurl/c/libcurl-errors.html

I've weirdly never used CURL so I can't tell you what you're doing wrong without some code.
@NoXzema: It could be the real limitation since we do not know if the OP is running this program on a NTFS disk. For example imagine the OP was downloading files to a USB stick formatted with FAT16. Either the OP is not staging 2GB at a time if the RAM is limited, or the file system is unable to handle files growing beyond 2GB.
That error wouldn't be caused by that anyways. That's also an incredible amount of assumption and even if it was that, that's still not the 2GB limit problem you linked above.

EDIT: In addition to that, FAT32 has a 4gB file limit, not 2gB.
Last edited on
You made the assumption that the OP is using NTFS, and erroneously dismissed file system limitations based on that assumption. Curl could fail on a fat16 device past 2GB. I am trying not to make an assumption about the file system the OP is using and I did say FAT16 not 32...

I decided to do a bit of research and turned up this bit of documentation https://curl.haxx.se/libcurl/c/CURLOPT_MAXFILESIZE.html I now see this as the most likely source of the error. I found it when I was starting to write an example to run against a drive that I formatted to FAT16.
Last edited on
Topic archived. No new replies allowed.