I'm trying to send a "DIR" command on an ftp server with the fonction below:
void cpyFileInServeur(char *src, char *dest, char *filename, serveur server)
{
CURL *curl;
CURLcode res;
struct curl_slist *header = NULL;
char *userpwd = (char *)malloc(sizeof(char) * 100);
sprintf(userpwd, "%s:%s", server.user, server.passwd);
header = curl_slist_append(header, "dir");
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, server.url);
curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_QUOTE, header);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res != CURLE_OK)
{
printf ("Erreur === %d\n", res);
}
else
{
printf ("Success .... == %d\n", res);
}
}
curl_global_cleanup();
}
Error:
500 DIR not understood
QUOT command failed with 500
when I use the terminal, I get the same error. But if I use the command "pass", then it works
image below
Thanks for help.