cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Problem with special chars in ftp passwords

From: Bill Mercer <bmerc_at_nccer.org>
Date: Wed, 13 Oct 2004 17:52:10 -0400

Try encoding the ? before sending it, see if that takes care of the
problem.

Re your first question, the FTP RFC just says an FTP password should be
a Telnet string, which basically means a 7-bit character, so yes, "?" is
legit in an FTP password. But submitting a password as part of a URL
means you have to deal with the restrictions on URLs as well.

>From RFC1738:
' The user name (and password), if present, are followed by a
  commercial at-sign "@". Within the user and password field, any ":",
  "@", or "/" must be encoded. '

So again, theoretically, ? should be ok. BUT...
The question mark is NOT legit in the path field of a URL, so that's
probably where this is coming from. Properly parsing all possible FTP
URLs would be a colossal pain, so I'm not surprised by this. I suspect
lots of programs will have trouble with question marks in the
user/password fields.

Re your second question... probably, I dunno.

Cheers,

Bill Mercer - National Center for Construction Education and Research
3600 NW 43rd St
Gainesville, Florida 32606
http://www.nccer.org
Phone 352-334-0911 Fax 352-334-0932
=============================================

>>> eric.vergnaud_at_jlynx.com 10/13/04 04:24PM >>>
Hi,

When I try to connect on windows using an url like the following:

ftp://user:pass?word@ftp.mydomain.com

Curl fails with a "could not resolve host name" error.

Strangely enough, it works on MacOS X (but I can't trace it, because
libcurl
is compiled with gcc, when I'm using CodeWarrior.

Please note the '?' character in the password. In url.c, there is the
following test:

 if ( 2 > sscanf(data->change.url,"%64[^\n:]:\\%[^\n/?]%[^\n]",
        conn->protostr,
        conn->namebuffer,
        conn->path)

In the case of the above url, this call splits the url wrongly:

 conn->protostr is "ftp"
 conn->hostname is "user:pass"
 conn->path is "word_at_ftp.mydomain.com"

Very frankly, I'm not a world champion as far as sscanf is concerned,
so I
could do with some advice:

 - is it legal to use '?' in ftp passwords ?
 - shouldn't the above test be skipped when protocol is ftp or ftps ?

Im dying for an answer.

-------------------------------
Eric VERGNAUD - JLynx Software
Cutting-edge technologies and
services for software companies
web: http://www.jlynx.com
-------------------------------

                                       
Received on 2004-10-13