tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: libexec/httpd and unsorted directory index



On Mon, 7 Jan 2008, Thor Lancelot Simon wrote:

On Mon, Jan 07, 2008 at 10:52:23PM +0000, David Brownlee wrote:
On Mon, 7 Jan 2008, Jeremy C. Reed wrote:

httpd(8) provides -X for generating index.

src/libexec/httpd/dir-index-bozo.c uses opendir/readdir with no sorting.

Looking at long index like under the /pub/pkgsrc/... directories is a
little difficult because entries are not sorted alphabetically nor by
modification time.

Should it use glob or scandir with alphasort or other?

        If its going to sort it probably makes sense to provide the
        option of sort key, at least filename & mod asce/desc and
        possibly even size, eg "-k {path,size,mtime}". What to do
        for descending? '-k -size' (ick)

Really, it would be nice to avoid cat's camel's back here.

If you want the directory sorted (certainly if you want it sorted in a
non-default way), can't you just generate a directory index and put it
in index.html?

        I can understand reluctance to add complexity into what is
        intended to be a small and simple daemon. Maybe just fixed
        ascending alphasort would be a reasonable compomise (so no
        option to disable sort if -X is used)


--
                David/absolute       -- www.NetBSD.org: No hype required --



Home | Main Index | Thread Index | Old Index