diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2019-10-14 01:44:06 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2020-02-24 11:15:32 -0500 |
commit | a762402da55033a10b01f38272da445df50b7c01 (patch) | |
tree | 71f042052b82c033466cf63c5c546bc4fb9d4b0d /src/mod_alias.c | |
parent | 78cf61b15294accd087167939aba5b82584443bf (diff) | |
download | lighttpd-git-a762402da55033a10b01f38272da445df50b7c01.tar.gz |
[core] keep a->data[] sorted (REVERT)
This reverts commit 2260a8062ee599ecf28d9b52b981603fd2084aff.
original ordering of array elements is significant
e.g. in lighttpd.conf lists where first match to request is applied
Diffstat (limited to 'src/mod_alias.c')
-rw-r--r-- | src/mod_alias.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mod_alias.c b/src/mod_alias.c index fa928b92..7b817be4 100644 --- a/src/mod_alias.c +++ b/src/mod_alias.c @@ -99,9 +99,9 @@ SETDEFAULTS_FUNC(mod_alias_set_defaults) { size_t j, k; for (j = 0; j < a->used; j ++) { - const buffer *prefix = &a->data[j]->key; + const buffer *prefix = &a->data[a->sorted[j]]->key; for (k = j + 1; k < a->used; k ++) { - const buffer *key = &a->data[k]->key; + const buffer *key = &a->data[a->sorted[k]]->key; if (buffer_string_length(key) < buffer_string_length(prefix)) { break; @@ -110,7 +110,7 @@ SETDEFAULTS_FUNC(mod_alias_set_defaults) { break; } /* ok, they have same prefix. check position */ - if (a->data[j] < a->data[k]) { + if (a->sorted[j] < a->sorted[k]) { log_error_write(srv, __FILE__, __LINE__, "SBSBS", "url.alias: `", key, "' will never match as `", prefix, "' matched first"); return HANDLER_ERROR; |