cURL / Mailing Lists / curl-library / Single Mail

curl-library

ftp upload with absolute paths

From: Sam Deane <sam_at_elegantchaos.com>
Date: Wed, 10 Apr 2013 15:37:28 +0100

Hi,

I think I've found a bug in the FTP support.

The problem happens in the following circumstances:
- uploading a file
- using authentication
- the user's home directory is not the same as the server's root directory
- the upload path is absolute
- the upload path includes no subdirectories

So, for example, I upload to ftp://sam:pass@example.com//test.txt

Sam's home is: /Users/sam/

The ftp server is configured so that the whole file system is visible, so the root really is /.

I'd expect this file to be uploaded to /test.txt (assuming that sam has write permission)

What actually happens is that it is uploaded to /Users/sam/test.txt.

Is this a known bug?

A workaround is to use /%2F instead of //, but the documentation for CURLOPT_URL (http://curl.haxx.se/libcurl/c/curl_easy_setopt.html) gives examples of absolute paths using // instead of /%2F, which implies that it ought to work. And we'd rather not require a special case to massage our URLs if we can avoid it.

I've enclosed a small test program which illustrates the problem - assuming that you point it at a suitable test server of course.

sam deane / @samdeane | elegantchaos.com / @elegantchaoscom | mac and ios software development

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

Received on 2013-04-10