From: Ian Holsman Date: Fri, 8 Mar 2002 04:14:26 +0000 (+0000) Subject: new directive SSIUndefinedEcho. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0ecb9042a39654ad9b266309610e6b1dea1c927;p=apache new directive SSIUndefinedEcho. this allows webadmins to change the default '(none)' to something a bit more presentable (eg ) PR: Obtained from: Rex (the hack he had to fix this was so ugly I was forced to do this) Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93788 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 91e051da37..30e848a5ff 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.34-dev + *) New Directive SSIUndefinedEcho. to change the '(none)' echoed + for a undefined variable. [Ian Holsman] + *) Proxy HTTP and CONNECT: Keep trying other addresses from the DNS when we can't get a socket in the specified address family. We may have gotten back an IPv6 address first and yet our system is not diff --git a/docs/manual/mod/mod_include.xml b/docs/manual/mod/mod_include.xml index 5bcfab5e2f..022c0880b4 100644 --- a/docs/manual/mod/mod_include.xml +++ b/docs/manual/mod/mod_include.xml @@ -573,6 +573,23 @@ include command. See also: SSIStartTag. + +SSIUndefinedEcho +Changes the string that mod_include displays when +a variable isn't set. +SSIUndefinedEcho tag +SSIUndefinedEcho "<-- undef -->" +server config +virtual host +FileInfo +Available in version 2.0.34 and later. + + + +

This directive changes the string that mod_include displays + when a variable is not set and "echoed" + + SSIErrorMsg diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 0416073d1b..48b73de8cb 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -122,6 +122,8 @@ typedef struct { char *default_end_tag; int start_tag_len; bndm_t start_seq_pat; + char *undefinedEcho; + int undefinedEchoLen; } include_server_config; #ifdef XBITHACK @@ -1350,8 +1352,12 @@ static int handle_echo(include_ctx_t *ctx, apr_bucket_brigade **bb, r->pool); } else { - tmp_buck = apr_bucket_immortal_create("(none)", - sizeof("(none)")-1); + include_server_config *sconf= + ap_get_module_config(r->server->module_config, + &include_module); + tmp_buck = apr_bucket_pool_create(sconf->undefinedEcho, + sconf->undefinedEchoLen, + r->pool); } APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck); if (*inserted_head == NULL) { @@ -3209,6 +3215,8 @@ static void *create_includes_server_config(apr_pool_t*p, server_rec *server) bndm_compile(&result->start_seq_pat, result->default_start_tag, result->start_tag_len); + result->undefinedEcho = apr_pstrdup(p,"(none)"); + result->undefinedEchoLen = strlen( result->undefinedEcho); return result; } static const char *set_xbithack(cmd_parms *cmd, void *xbp, const char *arg) @@ -3371,6 +3379,16 @@ static const char *set_default_start_tag(cmd_parms *cmd, void *mconfig, const ch return NULL; } +static const char *set_undefined_echo(cmd_parms *cmd, void *mconfig, const char *msg) +{ + include_server_config *conf; + conf = ap_get_module_config(cmd->server->module_config, &include_module); + conf->undefinedEcho = apr_pstrdup(cmd->pool, msg); + conf->undefinedEchoLen = strlen(msg); + + return NULL; +} + static const char *set_default_end_tag(cmd_parms *cmd, void *mconfig, const char *msg) { @@ -3403,6 +3421,8 @@ static const command_rec includes_cmds[] = "SSI Start String Tag"), AP_INIT_TAKE1("SSIEndTag", set_default_end_tag, NULL, RSRC_CONF, "SSI End String Tag"), + AP_INIT_TAKE1("SSIUndefinedEcho", set_undefined_echo, NULL, RSRC_CONF, + "SSI Start String Tag"), {NULL} };