tech-userlevel archive

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

Re: libexec/httpd and unsorted directory index

Thor Lancelot Simon wrote:
> >     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)
> 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?

You can, but that's a cache, and a cache has to be maintained.  

Instead of embedding sorting knowledge in the daemon, why not popen(3)
another binary and let it do the whole job?  Pass it a directory name and
specify the format you want the output in.  The output could be an HTML
table, requiring almost nothing of the daemon.  

        -X _indexer_  This option invokes _indexer_ via 
        popen(3) to generate a directory index.when the 
        default file (normally index.html) is not present.
        _indexer_ is passed a directory name and should 
        produce a directory listing as an HTML table. 

The challenge then lies in writing _indexer_, roughly as hard as producing
index.html, but dynamically.  

Not a slippery slope, uses very few daemon resources (none if not used),
adds very little to the binary's footprint, and is highly customizeable. 
If you don't think it's secure -- I can't see why not  -- don't use it.  


Home | Main Index | Thread Index | Old Index