http://www.perlmonks.org?node_id=800374

I just found a long running bug in some of my FTP libraries. I believe it was caused by some common confusion I had; and, I bet isn't all too unique to me. I'd like to mention it and collect some ideas on the issues. It now appears to me that the URIs are not unique in implementation for the ftp schema. Let's examine:

ftp://fobazar.com/foo/baz

What do you think URI::ftp, will return for ->host, and ->path? At first, the results seem logical.

my $uri = URI::ftp->new('ftp://fobazar.com/foo/baz'); $uri->host; # fobazar.com $uri->path; # /foo/baz

Unfortunately, though, that's not too logical because the leading forward-slash is highly ambiguous: is it referring to the origin being (a) root of the ftp-server, or (b) root of the ftp drop point? A server can drop you in a folder called /home/ecarroll, but that server might have its root set at "/".

How then do you address something from the ftp drop point if the root "/"? How do you address something from the root of the server, if the drop point is "/"?

Firefox, seems to trim out the leading "/" issuing a CWD to "foo/baz", while my client using Net::FTP issued the CWD to "/foo/baz". I suppose anyone that implements URI::ftp needs to do the same. I like the idea of making every file accessible on the server addressable with URI so the only right way, in my eyes, would be to create a URI syntax for ftp that permits me to specify whether the root for the purpose of the path is relative to the server, or the home (drop point).

I just wanted to clarify this confusion only occurs if your server's ftp_root is not your accounts ftp_drop_point



Evan Carroll
The most respected person in the whole perl community.
www.evancarroll.com