Commit 775f86cb authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Immanuel Gregoire fixed KNOWN_BUGS #44: --ftp-method nocwd did not handle

URLs ending with a slash properly (it should list the contents of that
directory). Test case 351 brought back and also test 1010 was added.
parent db1c92ce
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -6,6 +6,11 @@

                                  Changelog

Daniel S (24 September 2007)
- Immanuel Gregoire fixed KNOWN_BUGS #44: --ftp-method nocwd did not handle
  URLs ending with a slash properly (it should list the contents of that
  directory). Test case 351 brought back and also test 1010 was added.

Daniel S (21 September 2007)
- Mark Davies fixed Negotiate authentication over proxy, and also introduced
  the --proxy-negotiate command line option to allow a user to explicitly
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ This release includes the following bugfixes:
 o ldap builds with the MSVC makefiles
 o no HOME and no key given caused SSH auth failure
 o Negotiate authentication over proxy
 o --ftp-method nocwd on directory listings

This release includes the following known bugs:

+0 −3
Original line number Diff line number Diff line
@@ -17,9 +17,6 @@ may have been fixed since this was written!
  initial suggested function to use for randomizing the response:
    http://curl.haxx.se/mail/lib-2007-07/0178.html

44. --ftp-method nocwd does not handle URLs ending with a slash properly (it
  should list the contents of that directory). See test case 351.

43. There seems to be a problem when connecting to the Microsoft telnet server.
  http://curl.haxx.se/bug/view.cgi?id=1720605

+67 −6
Original line number Diff line number Diff line
@@ -1279,10 +1279,52 @@ static CURLcode ftp_state_post_listtype(struct connectdata *conn)
     way. It has turned out that the NLST list output is not the same on all
     servers either... */

  NBFTPSENDF(conn, "%s",
  /*
     if FTPFILE_NOCWD was specified, we are currently in
     the user's home directory, so we should add the path
     as argument for the LIST / NLST / or custom command.
     Whether the server will support this, is uncertain.

     The other ftp_filemethods will CWD into dir/dir/ first and
     then just do LIST (in that case: nothing to do here)
  */
  char *cmd,*lstArg,*slashPos;

  lstArg = NULL;
  if((data->set.ftp_filemethod == FTPFILE_NOCWD) &&
     data->reqdata.path &&
     data->reqdata.path[0] &&
     strchr(data->reqdata.path,'/')) {

    lstArg = strdup(data->reqdata.path);
    if(!lstArg)
      return CURLE_OUT_OF_MEMORY;

    /* Check if path does not end with /, as then we cut off the file part */
    if(lstArg[strlen(lstArg) - 1] != '/')  {

      /* chop off the file part if format is dir/dir/file */
      slashPos = strrchr(lstArg,'/');
      *(slashPos+1) = '\0';
    }
  }

  cmd = aprintf( "%s%s%s",
                 data->set.str[STRING_CUSTOMREQUEST]?
                 data->set.str[STRING_CUSTOMREQUEST]:
             (data->set.ftp_list_only?"NLST":"LIST"));
                 (data->set.ftp_list_only?"NLST":"LIST"),
                 lstArg? " ": "",
                 lstArg? lstArg: "" );

  if(!cmd)
    return CURLE_OUT_OF_MEMORY;

  NBFTPSENDF(conn, "%s",cmd);

  if(lstArg)
    free(lstArg);

  free(cmd);

  state(conn, FTP_LIST);

@@ -3036,7 +3078,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status,
    size_t flen = ftp->file?strlen(ftp->file):0; /* file is "raw" already */
    size_t dlen = strlen(path)-flen;
    if(!ftpc->cwdfail) {
      if(dlen) {
      if(dlen && (data->set.ftp_filemethod != FTPFILE_NOCWD)) {
        ftpc->prevpath = path;
        if(flen)
          /* if 'path' is not the whole string */
@@ -3695,7 +3737,26 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
  switch(data->set.ftp_filemethod) {
  case FTPFILE_NOCWD:
    /* fastest, but less standard-compliant */

    /*
      The best time to check whether the path is a file or directory is right
      here. so:

      the first condition in the if() right here, is there just in case
      someone decides to set path to NULL one day
   */
    if(data->reqdata.path &&
       data->reqdata.path[0] &&
       (data->reqdata.path[strlen(data->reqdata.path) - 1] != '/') )
      ftp->file = data->reqdata.path;  /* this is a full file path */
    else
      ftp->file = NULL;
      /*
        ftp->file is not used anywhere other than for operations on a file.
        In other words, never for directory operations.
        So we can safely set it to NULL here and use it as a
        argument in dir/file decisions.
      */
    break;

  case FTPFILE_SINGLECWD:
+1 −1
Original line number Diff line number Diff line
@@ -4,4 +4,4 @@
# per line.
# Lines starting with '#' letters are treated as comments.
#230
351
Loading