diff options
author | fenner <fenner@FreeBSD.org> | 1997-10-08 18:43:53 +0000 |
---|---|---|
committer | fenner <fenner@FreeBSD.org> | 1997-10-08 18:43:53 +0000 |
commit | fd51ab9ae16a97bb60114d8cb076964fe279d7e9 (patch) | |
tree | 0485ad7ed513a9c8ad3963779be9adcb46202ae6 /usr.bin/fetch | |
parent | 967f29d3c48aa668ad337c4e9022a3720fc3b01e (diff) | |
download | FreeBSD-src-fd51ab9ae16a97bb60114d8cb076964fe279d7e9.zip FreeBSD-src-fd51ab9ae16a97bb60114d8cb076964fe279d7e9.tar.gz |
Interpret multiple slashes as a single slash in ftp: URL's. This
is contrary to RFC1738, which specifies that empty elements between
slashes really mean to send a CWD command with an empty argument.
Most FTP servers consider this an error, so strict RFC compliance
is advisable in this case.
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r-- | usr.bin/fetch/ftp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/fetch/ftp.c b/usr.bin/fetch/ftp.c index 0972505..362d1c9 100644 --- a/usr.bin/fetch/ftp.c +++ b/usr.bin/fetch/ftp.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ftp.c,v 1.7 1997/05/31 14:45:41 ache Exp $ + * $Id: ftp.c,v 1.8 1997/10/06 01:09:56 fenner Exp $ */ #include <sys/types.h> @@ -173,7 +173,17 @@ ftp_parse(struct fetch_state *fs, const char *uri) dp = ftps->ftp_remote_dirs; while ((s = strchr(s, '/')) != 0) { *s++ = '\0'; - *dp++ = percent_decode(r); + /* + * Skip double-slashes. According to RFC1738, + * double-slashes mean "send 'CWD '", which is + * a syntax error to most FTP servers. Instead, + * we just pretend that multiple slashes are a + * single slash. + */ + if (*r == '\0') + ftps->ftp_remote_ndirs--; + else + *dp++ = percent_decode(r); r = s; } } else { |