Once again, a leaner cleaner way to implement our own X-Powered-By header ala PHP. (missing docs/tests)
Thoughts on concept ?
-------------------------------------------------------------------------------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
Index: src/modules/perl/modperl_callback.c
===================================================================
--- src/modules/perl/modperl_callback.c (revision 124421)
+++ src/modules/perl/modperl_callback.c (working copy)
@@ -139,6 +139,12 @@
return status;
}
+#define MP_POWERED_BY_SET \
+ if (!MpReqPOWERED_BY(rcfg)) { \
+ apr_table_set(r->headers_out, "X-Powered-By", MP_VERSION_STRING); \
+ MpReqPOWERED_BY_On(rcfg); \
+ }
+
int modperl_callback_run_handlers(int idx, int type,
request_rec *r, conn_rec *c,
server_rec *s,
@@ -208,6 +214,7 @@
switch (type) {
case MP_HANDLER_TYPE_PER_SRV:
+ MP_POWERED_BY_SET;
modperl_handler_make_args(aTHX_ &av_args,
"Apache::RequestRec", r, NULL);
@@ -218,6 +225,7 @@
break;
case MP_HANDLER_TYPE_PER_DIR:
+ MP_POWERED_BY_SET;
modperl_handler_make_args(aTHX_ &av_args,
"Apache::RequestRec", r, NULL);
Index: lib/ModPerl/Code.pm
===================================================================
--- lib/ModPerl/Code.pm (revision 124421)
+++ lib/ModPerl/Code.pm (working copy)
@@ -140,7 +140,8 @@
@hook_flags, 'UNSET'],
Dir => [qw(NONE PARSE_HEADERS SETUP_ENV MERGE_HANDLERS GLOBAL_REQUEST UNSET)],
Req => [qw(NONE SET_GLOBAL_REQUEST PARSE_HEADERS SETUP_ENV
- CLEANUP_REGISTERED PERL_SET_ENV_DIR PERL_SET_ENV_SRV)],
+ CLEANUP_REGISTERED PERL_SET_ENV_DIR PERL_SET_ENV_SRV
+ POWERED_BY)],
Interp => [qw(NONE IN_USE PUTBACK CLONED BASE)],
Handler => [qw(NONE PARSED METHOD OBJECT ANON AUTOLOAD DYNAMIC FAKE)],
);
signature.asc
Description: OpenPGP digital signature
