cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to consistently CWD to HOME directory before using MKD command

From: Bill Middlecamp <wjm_at_usfamily.net>
Date: Fri, 21 Sep 2012 13:48:57 -0500 (CDT)

> On Thu, 20 Sep 2012, Daniel Stenberg wrote
>
>> On Thu, 20 Sep 2012, Bill Middlecamp wrote:
>>
>>> 1) The "foo/bar" portion of the path may or may not exist, so I use MULTICWD together with the upload of a temporary file to get libcurl to create those directories if needed. Then I DELE the temporary file with a POSTQUOTE command.
>>>
>>> 2) Next, I change to NOCWD, and expect that this will produce a CWD to the HOME directory.
>>
>> Oh. I can see how this messes up things. "NOCWD" kind of implies that you don't want to do CWD commands, but since you re-use a connection that already did libcurl will not act the way you'd like it to...
>>

It works with vsftpd and a 10-year old version of Pure FTP that I thought would give me a baseline for testing. But my end user has a server I cannot get that exhibits the problem.

>> Can I ask what the point is to alter the CURLOPT_FTP_FILEMETHOD method like that between requests?

It's fundamentally because libcurl will only create missing directories if MULTICWD is set. I switch back to NOCWD because it's very hard if not impossible for me to know where libcurl is in the directory hierarchy when I need to do a QUOTE command, and there would have to be some tricky path manipulation if I did.

>>
>> Anyway, I think we need to handle this somehow. I just can't think of the best possible fix right now. I think a good first step would be to write up a test case for the curl test suite that repeats the above scenario so that we have something to work with.
>>

I cannot write a test case because it depends on the server. I suspect that it has to do with the format of PWD output that comes right after login.

>>> How can I code this to work for all FTP servers?
>>
>> This problem isn't happening because of the FTP server, it does so because you tell it to NOCWD after libcurl has changed directory in a previous request.
>>

Note that I switched e-mail addresses to get rid of the legalese my company tacks on.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-09-21