cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 27 Sep 2012 13:07:39 +0200 (CEST)

On Mon, 24 Sep 2012, Bill Middlecamp wrote:

> I believe I may have found the problem. My end user has an FTP server that
> returns the following to the PWD command issued by libcurl immediately
> following login:
>
> 257 Current directory is: "<FTP user's home directory>"
>
> This does not conform to RFC 959, and libcurl doesn't recognize it.
>
> The following test describes what I'm trying to do. It works with conformant
> servers. Following the test code is the debug log of a conformant server. It
> seems that libcurl is doing what I need, but do you have any ideas for
> handling the non-conformant server in case I am forced to support it?

I can think of at least two ways to solve this from the client-side (that then
doesn't include the most obvious FIX THE SERVER):

  1 - we make the 257 response parser scan for the "opening" double quote and
      parse the file name from there. It would work on that particular case
      at least. Possibly it will fail on other offenders.

  2 - if we cannot detect the opening double quote, we can't get the entry path
      and we should make the connection accordingly and thus we cannot draw
      conclusions of where in the directory tree we are, like when re-using a
      connection

The first one would make this case work but possibly make other variations of
stupid servers fail in more spectacular ways, while the second approach makes
re-using connections hard if not impossible.

Either way we choose, we should write up a few test cases for these scenarios
to make sure we handle them gracefully.

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