Avoided to add duplicate hash key in ngx_http_types_slot().

This commit is contained in:
Gu Feng 2014-09-17 22:52:02 +08:00
parent 840d205bac
commit bba2ce8aae

View File

@ -2005,7 +2005,7 @@ ngx_http_types_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { if (ngx_strcmp(value[i].data, type[n].key.data) == 0) {
ngx_conf_log_error(NGX_LOG_WARN, cf, 0, ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
"duplicate MIME type \"%V\"", &value[i]); "duplicate MIME type \"%V\"", &value[i]);
continue; goto next;
} }
} }
@ -2017,6 +2017,10 @@ ngx_http_types_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
type->key = value[i]; type->key = value[i];
type->key_hash = hash; type->key_hash = hash;
type->value = (void *) 4; type->value = (void *) 4;
next:
continue;
} }
return NGX_CONF_OK; return NGX_CONF_OK;