You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Roy Fielding <fi...@hyperreal.com> on 1997/05/29 06:23:14 UTC
cvs commit: apache/src CHANGES mod_include.c
fielding 97/05/28 21:23:13
Modified: src CHANGES mod_include.c
Log:
If Options Includes and USE_PERL_SSI is defined, allow #perl SSI to
invoke routines governed by mod_perl.
Submitted by: Rob Hartill
Reviewed by: Randy Terbush, Doug MacEachern, Roy Fielding
Revision Changes Path
1.282 +3 -0 apache/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.281
retrieving revision 1.282
diff -C3 -r1.281 -r1.282
*** CHANGES 1997/05/29 03:44:30 1.281
--- CHANGES 1997/05/29 04:23:11 1.282
***************
*** 1,5 ****
--- 1,8 ----
Changes with Apache 1.2
+ *) Added undocumented perl SSI mechanism for -DUSE_PERL_SSI and mod_perl.
+ [Rob Hartill]
+
*) Log correct status code if we timeout before receiving a request (408)
or if we received a request-line that was too long to process (414).
[Ed Korthof and Roy Fielding] PR#601
1.32 +46 -0 apache/src/mod_include.c
Index: mod_include.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_include.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C3 -r1.31 -r1.32
*** mod_include.c 1997/05/08 13:09:25 1.31
--- mod_include.c 1997/05/29 04:23:12 1.32
***************
*** 57,63 ****
--- 57,78 ----
* 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,71 ****
--- 81,87 ----
#include "http_log.h"
#include "http_main.h"
#include "util_script.h"
+ #endif
#define STARTING_SEQUENCE "<!--#"
#define ENDING_SEQUENCE "-->"
***************
*** 710,715 ****
--- 726,757 ----
}
}
}
+ #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,1679 ****
--- 1716,1725 ----
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",