This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
To: modperl@apache.org
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: from the "quick hacks" department... x-bit controls
mod_cgi
Date: 11 Apr 2001 20:22:38 -0700
In an .htaccess, I place:
Options +ExecCGI
PerlFixupHandler "sub { -f $_[0]->filename and -x _ and $_[0]->handler(q{cgi-script}) }"
Now any executable file in this directory (or below) is processed with
mod_cgi. Any non-executable file is processed with whatever the MIME
engine came up with before.
OK, too cool to not pass on. :)
===
To: "Randal L. Schwartz" <merlyn@stonehenge.com>
From: Tim Bunce <Tim.Bunce@ig.co.uk>
Subject: Re: from the "quick hacks" department... x-bit
controls mod_cgi
Date: Thu, 12 Apr 2001 16:13:44 +0100
On Wed, Apr 11, 2001 at 08:22:38PM -0700, Randal L. Schwartz wrote:
>
> In an .htaccess, I place:
>
> Options +ExecCGI
> PerlFixupHandler "sub { -f $_[0]->filename and -x _ and $_[0]->handler(q{cgi-script}) }"
>
> Now any executable file in this directory (or below) is processed with
> mod_cgi. Any non-executable file is processed with whatever the MIME
> engine came up with before.
>
> OK, too cool to not pass on. :)
Except that I think you'll find that string is being recompiled for
each request - slow and leaks memory. The principle is good though :)
===
To: Tim Bunce <Tim.Bunce@ig.co.uk>
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: from the "quick hacks" department... x-bit
controls mod_cgi
Date: 12 Apr 2001 08:26:53 -0700
>>>>> "Tim" == Tim Bunce <Tim.Bunce@ig.co.uk> writes:
Tim> On Wed, Apr 11, 2001 at 08:22:38PM -0700, Randal L. Schwartz wrote:
>>
>> In an .htaccess, I place:
>>
>> Options +ExecCGI
>> PerlFixupHandler "sub { -f $_[0]->filename and -x _ and $_[0]->handler(q{cgi-script}) }"
>>
>> Now any executable file in this directory (or below) is processed with
>> mod_cgi. Any non-executable file is processed with whatever the MIME
>> engine came up with before.
>>
>> OK, too cool to not pass on. :)
Tim> Except that I think you'll find that string is being recompiled for
Tim> each request - slow and leaks memory. The principle is good though :)
Well, then, untested:
.htaccess:
PerlFixupHandler Stonehenge::XBitCGI
Options +ExecCGI
$INC/Stonehenge/XBitCGI.pm
sub Stonehenge::XBitCGI::handler {
-f $_[0]->filename and -x _ and $_[0]->handler(q{cgi-script});
return -1;
}
Better? :)
===
To: "'merlyn@stonehenge.com'" <merlyn@stonehenge.com>
From: Geoffrey Young <gyoung@laserlink.net>
Subject: RE: from the "quick hacks" department... x-bit
controls mod_cgi
Date: Thu, 12 Apr 2001 11:41:02 -0400
> -----Original Message-----
> From: merlyn@stonehenge.com [mailto:merlyn@stonehenge.com]
> Sent: Thursday, April 12, 2001 11:27 AM
> To: Tim Bunce
> Cc: modperl@apache.org
> Subject: Re: from the "quick hacks" department... x-bit
> controls mod_cgi
>
>
> >>>>> "Tim" == Tim Bunce <Tim.Bunce@ig.co.uk> writes:
>
> Tim> On Wed, Apr 11, 2001 at 08:22:38PM -0700, Randal L.
> Schwartz wrote:
> >>
> >> In an .htaccess, I place:
> >>
> >> Options +ExecCGI
> >> PerlFixupHandler "sub { -f $_[0]->filename and -x _ and
> $_[0]->handler(q{cgi-script}) }"
> >>
> >> Now any executable file in this directory (or below) is
> processed with
> >> mod_cgi. Any non-executable file is processed with
> whatever the MIME
> >> engine came up with before.
> >>
> >> OK, too cool to not pass on. :)
>
> Tim> Except that I think you'll find that string is being
> recompiled for
> Tim> each request - slow and leaks memory. The principle is
> good though :)
>
> Well, then, untested:
>
> ..htaccess:
>
> PerlFixupHandler Stonehenge::XBitCGI
> Options +ExecCGI
>
> $INC/Stonehenge/XBitCGI.pm
>
> sub Stonehenge::XBitCGI::handler {
> -f $_[0]->filename and -x _ and $_[0]->handler(q{cgi-script});
> return -1;
> }
>
> Better? :)
s/finfo/filename/
;)
===
> s/finfo/filename/
>
whoops - that should be reversed, of course *blush*
>
> --Geoff
>
===