I have a question about create or delete directory with libcurl on sftp

I use the libcurl command 'mkdir' or 'rmdir' , it will list the directory 
before the operation .so I set the NOBODY 1L to prevent from listing .
But when I 'mkdir' or 'rmdir' twice,the second NOBODY seem to be not work , 
when I execute the second operation,
it always list the directory.



this is my code:


int create_out_dir(CURL *curl){
printf("============================\n");
CURLcode result;
         curl_easy_reset(curl);
        curl_easy_setopt(curl, CURLOPT_URL, 
"sftp://ogsapp:[email protected]:22/ogsapp/dcs/liuyw/";);
        curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, 0);
        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
        curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
        struct curl_slist *headerlist = NULL;
        headerlist = curl_slist_append(headerlist, "mkdir 
/ogsapp/dcs/liuyw/testoutdir/");
        headerlist = curl_slist_append(headerlist, "mkdir 
/ogsapp/dcs/liuyw/testoutdir/testindir/");
        curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
        curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_PASSWORD);
        result = curl_easy_perform(curl);
        curl_slist_free_all(headerlist);
        printf("make testoutdir dir                     %d\n",result);
        return result;
}


int rm_out_dir(CURL *curl){
printf("============================\n");
CURLcode result;
         curl_easy_reset(curl);
        curl_easy_setopt(curl, CURLOPT_URL, 
"sftp://ogsapp:[email protected]:22/ogsapp/";);
        curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, 0);
        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
        curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
        struct curl_slist *headerlist = NULL;
        headerlist = curl_slist_append(headerlist, "rmdir 
/ogsapp/dcs/liuyw/testoutdir/testindir/");
        headerlist = curl_slist_append(headerlist, "rmdir 
/ogsapp/dcs/liuyw/testoutdir/");
        curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
        curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_PASSWORD);
        result = curl_easy_perform(curl);
        curl_slist_free_all(headerlist);
        printf("make testoutdir dir                     %d\n",result);
        return result;
}


int main(){
CURL *curl;
curl_global_init(CURL_GLOBAL_DEFAULT);
        curl = curl_easy_init();
        create_out_dir(curl);
        rm_out_dir(curl);
return 0;



}



I call the create_out_dir() at first, then I call the rm_out_dir(), but the 
second function always list directory whether the nobody is set or not. I think 
it maybe the handle is re_use.How can I solve this problem?Thanks!





------------------ ???????? ------------------
??????: "Fabian Frank";<[email protected]>;
????????: 2014??2??18??(??????) ????12:17
??????: "libcurl development"<[email protected]>; 

????: Re: mkdir or rmdir operation with libcurl on sftp



On Sun, Feb 16, 2014 at 7:05 PM, ?????? <[email protected]> wrote: But when I 
'mkdir' or 'rmdir' twice,the second NOBODY seem to be not work , when I execute 
the second operation,
 Would it be possible to share some code that exposes this bug, so we can 
reproduce it?


Regards,
Fabian
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to