Re: stripping trailing '/' for FTP (was: Symantec LiveUpdate..)

From: Marc van Selm <marc.van.selm@dont-contact.us>
Date: Mon, 13 Oct 1997 08:21:19 +0100

At 12:22 PM 10/10/97 -0400, you wrote:
>> >I'm not sure why ftpget strips the leading slash off, this seems very
>> >much like a bug to me. Any ftp requests where the remote ftp server
>> >doesn't set the CWD to '/', will inexplicitly fail.
>>
>> This is a compiler-time option (as far as I know) and you could decide not
>> to enable it.
>
>Do you know how?

mmm, I must admit its not very documented. I found it while browsing thought
the source a while ago.

> Looking at cleanup_path() in ftpget.c, I don't see
>any "#ifdef" type option.

It happens on a higher level. In file url.c you'll find:

request_t *
urlParse(method_t method, char *url)
{
 ... deleted ...

#ifdef REMOVE_FTP_TRAILING_SLASHES
    /* remove trailing slashes from FTP URLs */
    if (protocol == PROTO_FTP) {
        t = urlpath + strlen(urlpath);
        while (t > urlpath && *(--t) == '/')
            *t = '\0';
    }
#endif
    request = get_free_request_t();
    request->method = method;

 ... etc etc ...

For ftp this pice of code removes the trailing slash from the URL and this
is passed to ftpget.

Marc

---------------------------------------------------------------------
Marc van Selm
NATO C3 Agency
Communication Systems Division, A-Branch
E-Mail: marc.van.selm@nc3a.nato.int
---------------------------------------------------------------------
Private: selm@cistron.nl, selm@het.net, http://www.cistron.nl/~selm
Received on Sun Oct 12 1997 - 23:21:50 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:37:16 MST