At 10:52 am +0000 14/3/02, Ben Rubinstein wrote: >This is half suggestion for improvement, half request for information. > >Tring to walk a directory tree over FTP using Rev; obviously can get the >listing of a folder by getting a URL ending in "/". The one needs to parse >the listing; the first character of each line will tell you if it's a >directory or not, the last part of the line is the filename. > >But how reliable is the format? Looking at one example, it seems as if one >could say that the filename would start at the 9th word on each line. It >also looked as if one could say that the filename started at the 52nd >character on each line. But looking at the RFC (959), in the section on >LIST it states > Since the information on a file may vary widely from system > to system, this information may be hard to use automatically > in a program, but may be quite useful to a human user. > >It then goes on to document the solution to this problem, NLST: > This command is intended to return information that can be > used by a program to further process the files automatically. > >So the suggestion for improvement would be for the FTP library to have some >mode that returns an NLST listing instead of a LIST listing. > >However.... watching the actual traffic while I used a couple of different >FTP programs to browse servers showed that they both used LIST rather than >NLST to get their data. That suggests that there is a reliable way to parse >the LIST output. > >Is RFC959 just wrong? Has there been some subsequent standard that defines >the format in which an FTP server will respond to a LIST request? Is there >something which is defined to be reliable - or do we just infer (9th word, >52nd column) and hope for the best? > >Any info gratefully received.
I don't think a standard has been defined, but the convention seems to be to return the listing in standard Unix style, at least on all the ftp servers I've checked with, including those on Windows. (I've no idea about Classic Mac OS ftp servers.) As you note, the popular ftp clients seem to rely on this. One problem with using NLST is that it makes no distinction between files and directories. You'll have to parse out the file extensions, assuming all the files have one. RFC959 is still the "standard". However, there have been a couple of RFCs that kind of formalize some commonly used commands not included in 959. (SIZE is the one that comes to mind.) I don't have the references handy, I'm afraid. Cheers Dave Cragg _______________________________________________ improve-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/improve-revolution
