curl-library
Resumed uploads getting timedout
Date: Mon, 18 Jun 2012 16:42:32 +0400
Hi,
I am trying to upload a 4.5GB file and once the file is uploaded till 3.5GB
I am canceling the upload. And then next upload I am issuing again, asking
curl to resume from the next byte.
Using:
curl_easy_setopt(curl_easy_handle_, CURLOPT_RESUME_FROM_LARGE, startRange);
(here start range is 3.5 + 1byte)
curl_easy_setopt( curl_easy_handle_, CURLOPT_APPEND, 1L );
curl_easy_setopt(curl_easy_handle_, CURLOPT_LOW_SPEED_LIMIT, 1);
curl_easy_setopt(curl_easy_handle_, CURLOPT_LOW_SPEED_TIME,30);
I am using the curl default read callback, but I have my own seekfunction,
which is as below:
int SeekCallback(void *userp, curl_off_t offset, int origin)
{
FILE *fp = (FILE*) userp;
int code = 2; //In all failure cases we shall let curl to do the proper
seeking
if(fp)
{
fflush(fp);
#if defined(WIN32)
__int64 offSet = (__int64) (offset);
code = _fseeki64(fp, offSet, origin);
#else
off_t offSet = (off_t) offset;
code = fseeko(fp, offSet, origin);
#endif
fflush(fp);
if(code == 0)
return 0;
}
return 2; //In all failure cases we shall let curl to do the proper
seeking
}
Problem:
------------
The issue here is, I see that the resumed upload is getting timed out with
error code 28 (CURLE_OPERATION_TIMEDOUT). I could see all the headers are
getting set properly, like the Content-Length and Content-Range.
At the same time, I do not see the above timeout, if I cancel the upload of
a 4.5GB file when 500Mb is uploaded and then resume it from 500Mb + 1th
byte.The Cancel/Resume works fine sometimes till 1Gb, but when I try to
resume a big file which was uploaded till 1.5Gb or more than 1.5Gb, the
timeout happens all the time. The issue starts showing up only for large
file resumes. If I do not set the LOW SPEED TIME at all, the upload
resumes properly all the time even for large files resumed from 3.5GB. The
time difference I see between the time a PUT request was issued and the
time data packets are sent to server in this case is more than 90 seconds.
So obviously if I enable a LOW SPEED TIME to 30 seconds, operation will get
timeout.
But I am not able to figure out, why curl is taking close to 90 seconds to
send out data (the default read callback), though Seekcall back is able to
seek to the proper location from where the read callback has to read from.
Please let me know, what is going wrong or rather what I am doing wrong.
Curl Version: 7-24
Os: Ubuntu 64 bit Linux
Thanks,
-Sandeep
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-06-18