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

In reply to Revising Net::FTP, and URI::ftp by EvanCarroll

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.