curl-library
Re: FTP, mkdir and escaping invalid characters
Date: Mon, 25 Jan 2010 16:45:52 -0500
>> The CURLOPT for FTP_CREATE_MISSING_DIRS seems to work pretty well across
>> multiple platforms. The directories get created correctly, regardless of
>> whitespace and/or special characters. So there has to be some kind of string
>> sanitizing happening there, right? Maybe I could apply this same logic on my
>> custom MKD command strings? Could anyone point me in the right direction for
>> this code?
>
> No, it makes no "sanitizing" since there is no such thing needed really
> according to the FTP spec. MKD commands are issued the same way - with the
> path part being the same - as CWD commands are.
>
> If you enable CURLOPT_VERBOSE you can easily check that out yourself!
I turned on CURLOPT_VERBOSE and you're right. The MKD commands do not
escape spaces and everything works fine. So I isolated the code that
sends the quote commands and tried again:
struct curl_slist *headers = NULL;
char mkdir[] = "MKD folder with spaces";
headers = curl_slist_append(headers, mkdir);
curl_easy_setopt(handle, CURLOPT_QUOTE, headers);
result = curl_easy_perform(handle);
...works just fine. I guess the problem was elsewhere in my code.
Thanks
Nick
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-25