how to get filesize and filetime with libcurl on Sftp. Here is my code:
public RequestFileInfo(const String:filename[])
{
new Handle:curl = curl_easy_init();
if(curl != INVALID_HANDLE)
{
CURL_DEFAULT_OPT(curl);
curl_easy_setopt_string(curl, CURLOPT_URL, filename);
curl_easy_setopt_string(curl, CURLOPT_USERPWD, sFtpUserPassword);
curl_easy_setopt_int(curl, CURLOPT_NOBODY, 1);
curl_easy_setopt_int(curl, CURLOPT_FILETIME, 1);
curl_easy_perform_thread(curl, onComplete, 1);
}
}
I request this information for 32 files (for loop) and got this error for the first 16 files:
1 FAIL - Failed initialization
and this result for the others:
filetime = -1
filesize = 0.000000
Here is my code for results:
new filetime = 0;
res = curl_easy_getinfo_int(hndl, CURLINFO_FILETIME, filetime);
if(CURLE_OK != res) {
//TODO error
}
new Float:filesize = 0.0;
res = curl_easy_getinfo_int(hndl, CURLINFO_CONTENT_LEN_DOWNLOAD, filesize);
if(CURLE_OK != res) {
//TODO error
}
But all this works fine with ftp server.