summaryrefslogtreecommitdiff
path: root/src/mod_alias.c
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-08-09 06:42:33 +0000
committerJan Kneschke <jan@kneschke.de>2005-08-09 06:42:33 +0000
commit75c3a8393a06bcdbf7d9bbfc627728619ae93261 (patch)
treeeabea4f43f18d4bbcc5de838cb9186a3dc906397 /src/mod_alias.c
parent360aba360f5bb6c8db7f98717d67c08448b7a111 (diff)
downloadlighttpd-git-75c3a8393a06bcdbf7d9bbfc627728619ae93261.tar.gz
added include_shell option to configfiles (merged the rest of the trunk changesets)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@530 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/mod_alias.c')
-rw-r--r--src/mod_alias.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mod_alias.c b/src/mod_alias.c
index e4869493..4d898922 100644
--- a/src/mod_alias.c
+++ b/src/mod_alias.c
@@ -1,6 +1,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <stdio.h>
#include "base.h"
#include "log.h"
@@ -86,6 +87,31 @@ SETDEFAULTS_FUNC(mod_alias_set_defaults) {
if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) {
return HANDLER_ERROR;
}
+ if (s->alias->used >= 2) {
+ const array *a = s->alias;
+ size_t j, k;
+
+ for (j = 0; j < a->used; j ++) {
+ const buffer *prefix = a->data[a->sorted[j]]->key;
+ for (k = j + 1; k < a->used; k ++) {
+ const buffer *key = a->data[a->sorted[k]]->key;
+
+ if (key->used < prefix->used) {
+ break;
+ }
+ if (memcmp(key->ptr, prefix->ptr, prefix->used - 1) != 0) {
+ break;
+ }
+ /* ok, they have same prefix. check position */
+ if (a->sorted[j] < a->sorted[k]) {
+ fprintf(stderr, "url.alias: `%s' will never match as `%s' matched first\n",
+ key->ptr,
+ prefix->ptr);
+ return HANDLER_ERROR;
+ }
+ }
+ }
+ }
}
return HANDLER_GO_ON;