Hi All,

I tried on libcurl version 7.19.3

The below code is working perfectly fine in Windows. The problem is
only in Mac (I tried on 10.5.6).
When I enabled verbose and checked the console, it is actually trying
to login as
USER anonymous
PASS [email protected]

int main()
{

string filePath = "/abcd.txt";

curl_global_init(CURL_GLOBAL_ALL);
CURL* handle = curl_easy_init();

curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(handle, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(handle, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L);
curl_easy_setopt(handle, CURLOPT_PORT, 21);

//URL and Login Information
curl_easy_setopt(handle, CUROPT_URL, "ftp://.../abcd.txt";);
curl_easy_setopt(handle, CURLOPT_USERNAME, "username");
  //PROBLEM
curl_easy_setopt(handle, CURLOPT_PASSWORD, "password");
 //PROBLEM

//Set File Size
struct stat fileInfo;
stat(filePath.c_str(), &fileInfo);
curl_easy_setopt(handle, CURLOPT_INFILESIZE_LARGE,
(curl_off_t)fileInfo.st_size);

FILE* fp = fopen(filePath.c_str() ,"rb");
curl_easy_setopt(handle, CURLOPT_READDATA, fp);
CURLcode err = curl_easy_perform(handle);
fclose(fp);

curl_easy_cleanup(handle);
curl_global_cleanup();

}


Instead of CURLOPT_USERNAME and CURLOPT_PASSWORD when I changed it to
curl_easy_setopt(handle, CURLOPT_USERPWD, "username:password");
it worked

This also worked
curl_easy_setopt(handle, CUROPT_URL, "ftp://username:passw...@.../abcd.txt";);


But what to do if password or username itself is having a semi colon(:) in it.

Is this a bug in libcurl or am I doing something wrong?


Thanks,
Ravi.

Reply via email to