You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@zyzzyva.com> on 1997/05/27 18:35:49 UTC
Re: [STATUS] Mon May 26 21:01:36 EDT 1997
+1 on this patch. I would like to see us do everything we can to
work with the mod_perl project. It truely makes Apache unique and
opens a world of possibilities.
> On Mon, 26 May 1997, Ed Korthof wrote:
>
> > > * RobH's [PATCH]: request for harmless mod_include.c patch (try 2)
> > > <Pi...@localhost.imdb.com>
> > > Status: +1 RobH
> > > +0 Roy [I've never seen a harmless part of mod_include]
> > > (It should also be USE_PERL_SSI, not USE_PERL)
> >
> > If you still want this in, Rob, could you resend it? I accidentally
> > deleted it; I'd be willing to take a look at it & test it out, though.
>
> Here it is (attached). Doug, note the 'USE_PERL_SSI' as recommended by Roy.
>
> Ed, you'll need the latest mod_perl and something like:
> EXTRA_CFLAGS= -I./ -I/usr/local/lib/perl5/i386-freebsd/5.003/CORE -DUSE_PERL_SSI
>
> replace 'i386-freebsd' to match your system.
>
> The latest mod_perl is at:
>
> http://www.osf.org/~dougm/apache/src/dev/
>
> if that dir is empty, try the next level up.
>
>
> I'm using this patch on my live servers so it's had a damn good testing.
> It's far more efficient than 'virtual include' because the perl is called
> directly and immediately without the need for subrequests.
>
> BTW, Doug's added mod_perl processing of config files too. You should
> see the tricks you can do with Perl code in srm.conf ! :-)
>
>
> --
> Rob Hartill Internet Movie Database (Ltd)
> http://www.moviedatabase.com/ .. a site for sore eyes.
>
> ===========================================================================
>
> Index: mod_include.c
> ===================================================================
> RCS file: /imdb/cvs/apache/src/mod_include.c,v
> retrieving revision 1.10
> diff -u -r1.10 mod_include.c
> --- mod_include.c 1997/05/11 20:40:26 1.10
> +++ mod_include.c 1997/05/27 15:06:14
> @@ -57,7 +57,22 @@
> * incorporated into the Apache module framework by rst.
> *
> */
> +/*
> + * sub key may be anything a Perl*Handler can be:
> + * subroutine name, package name (defaults to package::handler),
> + * Class->method call or anoymous sub {}
> + *
> + * Child <!--#perl sub="sub {print $$}" --> accessed
> + * <!--#perl sub="sub {print ++$Access::Cnt }" --> times. <br>
> + *
> + * <!--#perl arg="one" sub="mymod::includer" -->
> + *
> + * -Doug MacEachern
> + */
>
> +#ifdef USE_PERL_SSI
> +#include "modules/perl/mod_perl.h"
> +#else
> #include "httpd.h"
> #include "http_config.h"
> #include "http_request.h"
> @@ -66,6 +81,7 @@
> #include "http_log.h"
> #include "http_main.h"
> #include "util_script.h"
> +#endif
>
> #define STARTING_SEQUENCE "<!--#"
> #define ENDING_SEQUENCE "-->"
> @@ -710,6 +726,32 @@
> }
> }
> }
> +#ifdef USE_PERL_SSI
> +int handle_perl (FILE *in, request_rec *r, char *error) {
> + char tag[MAX_STRING_LEN];
> + char *tag_val;
> + SV *sub = Nullsv;
> + AV *av = newAV();
> +
> + if (!(allow_options (r) & OPT_INCLUDES)) {
> + log_printf(r->server,
> + "httpd: #perl SSI disallowed by IncludesNoExec in %s", r->filename);
> + return DECLINED;
> + }
> + while(1) {
> + if(!(tag_val = get_tag (r->pool, in, tag, MAX_STRING_LEN, 1)))
> + break;
> + if(strnEQ(tag, "sub", 3))
> + sub = newSVpv(tag_val,0);
> + else if(strnEQ(tag, "arg", 3))
> + av_push(av, newSVpv(tag_val,0));
> + else if(strnEQ(tag,"done", 4))
> + break;
> + }
> + perl_call_handler(sub, r, av);
> + return OK;
> +}
> +#endif
>
> /* error and tf must point to a string with room for at
> * least MAX_STRING_LEN characters
> @@ -1674,6 +1716,10 @@
> ret=handle_flastmod(f, r, error, timefmt);
> else if(!strcmp(directive,"printenv"))
> ret=handle_printenv(f, r, error);
> +#ifdef USE_PERL_SSI
> + else if(!strcmp(directive,"perl"))
> + ret=handle_perl(f, r, error);
> +#endif
> else {
> log_printf(r->server,
> "httpd: unknown directive %s in parsed doc %s",
>
>
>