This code works fine for files less than 2GB ,but for files greater than gb It returns 200 code . But upload doesnt happen .
The master buffer entry observed is
(master_buffer = 0x0000000006cde170 "HTTP/1.1 200 OK Connection: close
Cache-Control: no-cache, no-store
task-id:OpaqueRef:ac7b2340-1d50-3830-793c-d8e56759ef1a
content-type: application/octet-stream")
Code:
FILE * hd_src ;
struct stat file_info;
char *restoreFile = new char[file.length() + 1];
strcpy(restoreFile,file.c_str());
stat(restoreFile , &file_info);
hd_src = fopen(restoreFile, "rb");
curl_global_init(CURL_GLOBAL_ALL);
CURL *curlHandle=NULL;
curlHandle=curl_easy_init();
curl_easy_setopt(curlHandle, CURLOPT_READFUNCTION, &XenServerBackup::read_callback);
curl_easy_setopt(curlHandle, CURLOPT_NOSIGNAL, true);
curl_easy_setopt(curlHandle, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(curlHandle, CURLOPT_BUFFERSIZE, MAX_BUF);
curl_easy_setopt(curlHandle, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curlHandle, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curlHandle,CURLOPT_HTTPAUTH,CURLAUTH_BASIC;
curl_easy_setopt(curlHandle, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(curlHandle, CURLOPT_URL, _urlPathName.c_str());
curl_easy_setopt(curlHandle, CURLOPT_VERBOSE, 0);
curl_easy_setopt(curlHandle, CURLOPT_USERPWD, authKey.c_str());
curl_easy_setopt(curlHandle, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curlHandle, CURLOPT_READDATA, hd_src);
curl_easy_setopt(curlHandle, CURLOPT_INFILESIZE_LARGE,(curl_off_t)file_info.st_size);
curl_easy_setopt(curlHandle, CURLOPT_LOW_SPEED_LIMIT, 1);
curl_easy_setopt(curlHandle, CURLOPT_LOW_SPEED_TIME, 5);
curl_easy_setopt(curlHandle, CURLOPT_IGNORE_CONTENT_LENGTH, 1);
int success = curl_easy_perform(curlHandle);
int error =0;
curl_easy_getinfo(curlHandle, CURLINFO_RESPONSE_CODE, &error);