mirror of
https://github.com/nginx/nginx.git
synced 2026-06-08 16:34:32 -04:00
Merge cd71cac812 into 475732a3f9
This commit is contained in:
commit
5659834d1e
1 changed files with 31 additions and 3 deletions
|
|
@ -458,15 +458,13 @@ ngx_http_index_init(ngx_conf_t *cf)
|
|||
}
|
||||
|
||||
|
||||
/* TODO: warn about duplicate indices */
|
||||
|
||||
static char *
|
||||
ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_http_index_loc_conf_t *ilcf = conf;
|
||||
|
||||
ngx_str_t *value;
|
||||
ngx_uint_t i, n;
|
||||
ngx_uint_t i, j, n;
|
||||
ngx_http_index_t *index;
|
||||
ngx_http_script_compile_t sc;
|
||||
|
||||
|
|
@ -494,6 +492,36 @@ ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
if (ilcf->indices->nelts) {
|
||||
ngx_http_index_t *old;
|
||||
size_t len;
|
||||
|
||||
old = ilcf->indices->elts;
|
||||
|
||||
for (j = 0; j < ilcf->indices->nelts; j++) {
|
||||
|
||||
if (old[j].lengths || old[j].values) {
|
||||
continue;
|
||||
}
|
||||
|
||||
len = old[j].name.len;
|
||||
|
||||
if (old[j].name.data[0] != '/') {
|
||||
len--;
|
||||
}
|
||||
|
||||
if (len == value[i].len
|
||||
&& ngx_strncmp(old[j].name.data, value[i].data, len) == 0)
|
||||
{
|
||||
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
||||
"duplicate index \"%V\" in \"index\" "
|
||||
"directive",
|
||||
&value[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index = ngx_array_push(ilcf->indices);
|
||||
if (index == NULL) {
|
||||
return NGX_CONF_ERROR;
|
||||
|
|
|
|||
Loading…
Reference in a new issue