cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: FTP, mkdir and escaping invalid characters

From: Nick Jensen <nickrjensen_at_gmail.com>
Date: Mon, 25 Jan 2010 14:53:19 -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?

Nick

On Mon, Jan 25, 2010 at 1:51 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Mon, 25 Jan 2010, Nick Jensen wrote:
>
> I am using libcurl to create directories on a FTP server by using
>> CURLOPT_QUOTE and sending a list of MKD commands. Everything works fine, but
>> my quote commands fail if the directory name has an invalid character in it
>> such as a space or a symbol. Does curl have an escape function for this. I
>> noticed there is curl_easy_escape() which will URL encode a string but that
>> isn't what I need here.
>>
>
> FTP doesn't say anything about "invalid characters". A "pathname" can
> consist of a range of characters where each character is "any of the 128
> ASCII characters except <CR> and <LF>".
>
> Thus, ':' and ' ' (space) are both perfectly legitimate characters in a
> path name when given as argument to a FTP command.
>
> Server implementations of various kinds may disagree though, and I am aware
> that some servers require escaped spaces for them to work (like '\ ') and
> some I believe support them quoted ("file name with spaces"). But that's
> beyond what the spec says and AFAIK, there is not even a "common" or "well
> established" pratice in that area.
>
> --
>
> / daniel.haxx.se
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-25