]> granicus.if.org Git - apache/commitdiff
new directive SSIUndefinedEcho.
authorIan Holsman <ianh@apache.org>
Fri, 8 Mar 2002 04:14:26 +0000 (04:14 +0000)
committerIan Holsman <ianh@apache.org>
Fri, 8 Mar 2002 04:14:26 +0000 (04:14 +0000)
this allows webadmins to change the default '(none)' to something
a bit more presentable (eg <!-- undef -->)
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

CHANGES
docs/manual/mod/mod_include.xml
modules/filters/mod_include.c

diff --git a/CHANGES b/CHANGES
index 91e051da379086d03a1aeaca910ec5723bd77030..30e848a5ff5d6e8adf5bf0ae9c78c31281582118 100644 (file)
--- 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
index 5bcfab5e2fcdf000741ddf901c71f9b06f8c5dfb..022c0880b43bee18d7e2638089453ac93548571d 100644 (file)
@@ -573,6 +573,23 @@ include command.</description>
     <seealso>See also: <directive>SSIStartTag</directive>.</seealso>
 </usage>
 </directivesynopsis>
+<directivesynopsis>
+<name>SSIUndefinedEcho</name>
+<description>Changes the string that mod_include displays when
+a variable isn't set.</description>
+<syntax>SSIUndefinedEcho <em>tag</em></syntax>
+<default>SSIUndefinedEcho &quot;&lt;-- undef --&gt;&quot;</default>
+<contextlist><context>server config</context>
+<context>virtual host</context></contextlist>
+<override>FileInfo</override>
+<compatibility>Available in version 2.0.34 and later.
+</compatibility>
+
+<usage>
+    <p>This directive changes the string that mod_include displays
+    when a variable is not set and &quot;echoed&quot; 
+</usage>
+</directivesynopsis>
 
 <directivesynopsis>
 <name>SSIErrorMsg</name>
index 0416073d1ba4804d046d3324735054f7c807c322..48b73de8cbc5603c2aed6f7123545086e9862d87 100644 (file)
@@ -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}
 };