Browse Source

checked | to 'else' (merged [316])

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@524 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.2
Jan Kneschke 17 years ago
parent
commit
d56f19c7d1
  1. 4
      doc/configuration.txt
  2. 13
      src/configfile.c
  3. 2
      src/configparser.y
  4. 6
      tests/condition.conf

4
doc/configuration.txt

@ -75,8 +75,8 @@ Most options can be configured conditionally by using the following syntax
... nesting: match only when parent match
}
}
| <field> <operator> <value> {
... else if
else <field> <operator> <value> {
... the "else if" block
}
where <field> is one of one of the following:

13
src/configfile.c

@ -654,12 +654,6 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer *
}
break;
case '|':
t->offset++;
tid = TK_OR;
buffer_copy_string(token, "|");
break;
case '{':
t->offset++;
@ -753,6 +747,8 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer *
if (strcmp(token->ptr, "include") == 0) {
tid = TK_INCLUDE;
} else if (strcmp(token->ptr, "else") == 0) {
tid = TK_ELSE;
} else {
tid = TK_LKEY;
}
@ -775,9 +771,10 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer *
if (tid) {
*token_id = tid;
#if 0
log_error_write(srv, __FILE__, __LINE__, "sbsdsdb",
log_error_write(srv, __FILE__, __LINE__, "sbsdsdbdd",
"file:", t->file,
"line:", t->line, "pos:", t->line_pos, token);
"line:", t->line, "pos:", t->line_pos,
token, token->used - 1, tid);
#endif
return 1;

2
src/configparser.y

@ -268,7 +268,7 @@ aelement(A) ::= STRING(B) ARRAY_ASSIGN expression(C). {
eols ::= EOL.
eols ::= .
condlines(A) ::= condlines(B) eols OR condline(C). {
condlines(A) ::= condlines(B) eols ELSE condline(C). {
assert(B->context_ndx < C->context_ndx);
C->prev = B;
B->next = C;

6
tests/condition.conf

@ -33,13 +33,13 @@ $HTTP["host"] == "www.example.org" {
server.name = "www.example.org"
url.redirect = ("^" => "/match_1")
}
| $HTTP["host"] == "test1.example.org" {
else $HTTP["host"] == "test1.example.org" {
server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/"
server.name = "test1.example.org"
url.redirect = ("^" => "/match_2")
}
# comments
| $HTTP["host"] == "test2.example.org" {
else $HTTP["host"] == "test2.example.org" {
server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/"
server.name = "test2.example.org"
url.redirect = ("^" => "/match_3")
@ -47,7 +47,7 @@ $HTTP["host"] == "www.example.org" {
# comments
| $HTTP["host"] == "test3.example.org" {
else $HTTP["host"] == "test3.example.org" {
server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/"
server.name = "test3.example.org"
url.redirect = ("^" => "/match_4")

Loading…
Cancel
Save