Project

General

Profile

Actions

Bug #1924

closed

Nested arrays in configuration files?

Added by jannewmarch almost 14 years ago. Updated over 13 years ago.

Status:
Invalid
Priority:
Normal
Category:
-
Target version:
-
ASK QUESTIONS IN Forums:

Description

For files of various types I want to be able to perform substitutions on them such as "&" => "&". The configuration syntax I have come with is e.g.

subst = (".java" => ("&" => "<", "<" => "<"),
#substitutions for other file types...)

But the config parser complains about "the key of an array can only be a string or a integer, variable". The syntax description says VALUE = ... array... and array = "(" ... value ... ")" where lower-case "value" is not defined.

Is there any way to get arrays of arrays, or other nested structures?

Actions #1

Updated by jannewmarch almost 14 years ago

substitutions should be e.g. "&" => "&amp;" - they showed ok in preview but not in posting

Actions #2

Updated by stbuehler almost 14 years ago

  • Status changed from New to Invalid

Missing ")".

Actions #3

Updated by jannewmarch almost 14 years ago

  • Status changed from Invalid to Reopened

Sorry, the example I gave was short-circuited and not syntactically correct. Here is one that is (with naive values to avoid HTML markup messes):

$HTTP["url"] =~ ".xml" {
        ssi.substitute = (".java" => ("a" => "b",
                                      "c" => "d" 
                                     )
                          ,
                          ".c"    => ("e" => "f")
                         )
}

Running lighttpd -t -f /etc/lighttpd/lighttpd.conf:

Syntax OK

Running lighttpd -D -f /etc/lighttpd/lighttpd.conf :

2009-03-04 18:10:26 (configfile-glue.c:62) the key of an array can only be a string or a integer, variable: ssi.substitute type: 3
2009-03-04 18:10:26 (server.c:1462) Configuration of plugins failed. Going down.

Actions #4

Updated by jannewmarch almost 14 years ago

Forgot to say which version of lighttpd I was using: development version from the CVS trunk for 1.5 (svn checkout svn://svn.lighttpd.net/lighttpd/trunk/). Happened on a build from last week and also on the one downloaded today (March 4), revision 2407. When I tried on a 1.4.21 version the error did not occur. I haven't got my code to the stage where I could check if it built the nested arrays okay, though.

Actions #5

Updated by stbuehler over 13 years ago

  • Status changed from Reopened to Invalid

You have to parse the array manually, see mod_fastcgi:

        { "fastcgi.server",              NULL, T_CONFIG_LOCAL, T_CONFIG_SCOPE_CONNECTION },       /* 0 */

        if (NULL != (du = array_get_element(ca, "fastcgi.server"))) {
[...]
Actions

Also available in: Atom