Mercurial > hg > nginx-quic
diff src/http/ngx_http.c @ 3372:6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 30 Nov 2009 13:15:10 +0000 |
parents | 77db9440d970 |
children | 4e15548b29d4 |
line wrap: on
line diff
--- a/src/http/ngx_http.c +++ b/src/http/ngx_http.c @@ -1854,6 +1854,10 @@ ngx_http_types_slot(ngx_conf_t *cf, ngx_ types = (ngx_array_t **) (p + cmd->offset); + if (*types == (void *) -1) { + return NGX_CONF_OK; + } + default_type = cmd->post; if (*types == NULL) { @@ -1879,6 +1883,11 @@ ngx_http_types_slot(ngx_conf_t *cf, ngx_ for (i = 1; i < cf->args->nelts; i++) { + if (value[i].len == 1 && value[i].data[0] == '*') { + *types = (void *) -1; + return NGX_CONF_OK; + } + hash = ngx_hash_strlow(value[i].data, value[i].data, value[i].len); value[i].data[value[i].len] = '\0'; @@ -1907,13 +1916,17 @@ ngx_http_types_slot(ngx_conf_t *cf, ngx_ char * -ngx_http_merge_types(ngx_conf_t *cf, ngx_array_t *keys, ngx_hash_t *types_hash, - ngx_array_t *prev_keys, ngx_hash_t *prev_types_hash, +ngx_http_merge_types(ngx_conf_t *cf, ngx_array_t **keys, ngx_hash_t *types_hash, + ngx_array_t **prev_keys, ngx_hash_t *prev_types_hash, ngx_str_t *default_types) { ngx_hash_init_t hash; - if (keys) { + if (*keys) { + + if (*keys == (void *) -1) { + return NGX_CONF_OK; + } hash.hash = types_hash; hash.key = NULL; @@ -1923,7 +1936,7 @@ ngx_http_merge_types(ngx_conf_t *cf, ngx hash.pool = cf->pool; hash.temp_pool = NULL; - if (ngx_hash_init(&hash, keys->elts, keys->nelts) != NGX_OK) { + if (ngx_hash_init(&hash, (*keys)->elts, (*keys)->nelts) != NGX_OK) { return NGX_CONF_ERROR; } @@ -1932,13 +1945,17 @@ ngx_http_merge_types(ngx_conf_t *cf, ngx if (prev_types_hash->buckets == NULL) { - if (prev_keys == NULL) { + if (*prev_keys == NULL) { - if (ngx_http_set_default_types(cf, &prev_keys, default_types) + if (ngx_http_set_default_types(cf, prev_keys, default_types) != NGX_OK) { return NGX_CONF_ERROR; } + + } else if (*prev_keys == (void *) -1) { + *keys = *prev_keys; + return NGX_CONF_OK; } hash.hash = prev_types_hash; @@ -1949,7 +1966,9 @@ ngx_http_merge_types(ngx_conf_t *cf, ngx hash.pool = cf->pool; hash.temp_pool = NULL; - if (ngx_hash_init(&hash, prev_keys->elts, prev_keys->nelts) != NGX_OK) { + if (ngx_hash_init(&hash, (*prev_keys)->elts, (*prev_keys)->nelts) + != NGX_OK) + { return NGX_CONF_ERROR; } }