implement global context

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@956 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.11
Xuefer 18 years ago
parent 1d97323652
commit bf67fb1413

@ -162,6 +162,37 @@ Example
}
}
Global context
=========================
::
global {
...
}
You don't need it in the main configuration file. But you might have
difficulty setting server wide configuration inside a included-file from
conditionals.
Example
-------
::
in lighttpd.conf:
server.modules = ()
$HTTP["host"] == "www.example.org" {
include "incl-php.conf"
}
in incl-php.conf:
global {
server.modules += ("mod_fastcgi")
static-file.exclude-extensions += (".php")
}
fastcgi.server = "..."
Options
=======

@ -731,6 +731,8 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer *
tid = TK_INCLUDE;
} else if (strcmp(token->ptr, "include_shell") == 0) {
tid = TK_INCLUDE_SHELL;
} else if (strcmp(token->ptr, "global") == 0) {
tid = TK_GLOBAL;
} else if (strcmp(token->ptr, "else") == 0) {
tid = TK_ELSE;
} else {

@ -130,6 +130,7 @@ input ::= metalines.
metalines ::= metalines metaline.
metalines ::= .
metaline ::= varline.
metaline ::= global.
metaline ::= condlines(A) EOL. { A = NULL; }
metaline ::= include.
metaline ::= include_shell.
@ -315,6 +316,24 @@ aelement(A) ::= stringop(B) ARRAY_ASSIGN expression(C). {
eols ::= EOL.
eols ::= .
globalstart ::= GLOBAL. {
data_config *dc;
dc = (data_config *)array_get_element(ctx->srv->config_context, "global");
assert(dc);
configparser_push(ctx, dc, 0);
}
global(A) ::= globalstart LCURLY metalines RCURLY. {
data_config *cur;
cur = ctx->current;
configparser_pop(ctx);
assert(cur && ctx->current);
A = cur;
}
condlines(A) ::= condlines(B) eols ELSE condline(C). {
assert(B->context_ndx < C->context_ndx);
C->prev = B;

Loading…
Cancel
Save