[Top][All Lists]

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

Re: [Gnu-arch-users] Tlacontrib contribution: Alternative to .listing fi

From: Jan Hudec
Subject: Re: [Gnu-arch-users] Tlacontrib contribution: Alternative to .listing files
Date: Wed, 22 Sep 2004 13:58:56 +0200
User-agent: Mutt/1.5.6+20040818i

On Wed, Sep 22, 2004 at 13:36:02 +0200, Johannes Berg wrote:
> > Few days ago it was suggested, that to avoid problems with stale
> > .listing files, the archive could be accessed via a cgi script, that
> > would create them on the fly and just cat everything else. So, here is
> > such a script:
> Cool. Does this work with multiple archives, that is, can I put it into a
> directory where multiple archives reside and then tell arch to access the
> archives as
> http://uri-to-archives/address@hidden/
> ?

Yes, you can. It really does equivaltent of:

if expr $query_string : '.*\.listing$'; then
    ls ${query_string%.listing}
    cat ${query_string}

but it's in C, so it is faster and more secure.

> [can't test right now]
> Also, couldn't one mod_rewrite all URLs to the script?

Yes, you can mod_rewrie. IIRC mod_rewrite just creates a new URI with
which the whole processing is restarted as if it was the one originaly
provided. So the script won't know.

However, it would be more interesting to AddHandler and/or SetHandler.
It would mean to change the logic to look in PATH_INFO first and only if
it's not defined to look in QUERY_STRING. That would allow you to say:

<LocationMatch "http://uri-to-archives/.*/.listing";>
    SetHandler arch.cgi

I am not sure how this would deal with /../, perhaps it has to be fixed
in the regexp. But it would save the CGI execution overhead for files.

It's not as simple as I wrote above, though. I'd have to look in the
apache manual how exactly it works and find out what exactly the CGI
gets. With that information it should be easy to enhance it to be
useable either way (the environment is different in each case so it
simple to distinguish).

                                                 Jan 'Bulb' Hudec 

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]