Browse Source

[mod_ssi] enhance support for ssi vars

Try ssi_vars if ssi_cgi_env does not have a matching var name.
Allow var names to also include digits after the initial letter or underscore.

From: fbrosson <fbrosson@users.noreply.github.com>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3069 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/heads/lighttpd-1.4.x
fbrosson 6 years ago
committed by Stefan Bühler
parent
commit
d8e028e069
  1. 1
      NEWS
  2. 5
      src/mod_ssi.c
  3. 4
      src/mod_ssi_expr.c

1
NEWS

@ -4,6 +4,7 @@ NEWS
====
- 1.4.40
* [mod_ssi] enhance support for ssi vars (thx fbrosson)
- 1.4.39 - 2016-01-02
* [core] fix memset_s call (fixes #2698)

5
src/mod_ssi.c

@ -457,9 +457,10 @@ static int process_ssi_stmt(server *srv, connection *con, plugin_data *p, const
}
default: {
data_string *ds;
/* check if it is a cgi-var */
/* check if it is a cgi-var or a ssi-var */
if (NULL != (ds = (data_string *)array_get_element(p->ssi_cgi_env, var_val))) {
if (NULL != (ds = (data_string *)array_get_element(p->ssi_cgi_env, var_val)) ||
NULL != (ds = (data_string *)array_get_element(p->ssi_vars, var_val))) {
chunkqueue_append_mem(con->write_queue, CONST_BUF_LEN(ds->value));
} else {
chunkqueue_append_mem(con->write_queue, CONST_STR_LEN("(none)"));

4
src/mod_ssi_expr.c

@ -207,7 +207,9 @@ static int ssi_expr_tokenizer(server *srv, connection *con, plugin_data *p,
buffer_copy_string_len(token, t->input + t->offset + 2, i-3);
} else {
for (i = 1; isalpha(t->input[t->offset + i]) || t->input[t->offset + i] == '_'; i++);
for (i = 1; isalpha(t->input[t->offset + i]) ||
t->input[t->offset + i] == '_' ||
((i > 1) && isdigit(t->input[t->offset + i])); i++);
buffer_copy_string_len(token, t->input + t->offset + 1, i-1);
}

Loading…
Cancel
Save