Mercurial > hg > nginx-quic
diff src/http/modules/ngx_http_uwsgi_module.c @ 5949:634da79665d3
Upstream: refactored proxy_cache and friends.
The configuration handling code has changed to look similar to the proxy_store
directive and friends. This simplifies adding variable support in the following
patch.
No functional changes.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Mon, 22 Dec 2014 12:59:02 +0300 |
parents | f2ff0aa89126 |
children | 610832763648 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_uwsgi_module.c +++ b/src/http/modules/ngx_http_uwsgi_module.c @@ -1354,7 +1354,7 @@ ngx_http_uwsgi_create_loc_conf(ngx_conf_ conf->upstream.pass_request_body = NGX_CONF_UNSET; #if (NGX_HTTP_CACHE) - conf->upstream.cache = NGX_CONF_UNSET_PTR; + conf->upstream.cache = NGX_CONF_UNSET; conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT; conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR; conf->upstream.no_cache = NGX_CONF_UNSET_PTR; @@ -1403,12 +1403,10 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t #if (NGX_HTTP_CACHE) if (conf->upstream.store > 0) { - conf->upstream.cache = NULL; + conf->upstream.cache = 0; } - if (conf->upstream.cache != NGX_CONF_UNSET_PTR - && conf->upstream.cache != NULL) - { + if (conf->upstream.cache > 0) { conf->upstream.store = 0; } @@ -1580,13 +1578,17 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t #if (NGX_HTTP_CACHE) - ngx_conf_merge_ptr_value(conf->upstream.cache, - prev->upstream.cache, NULL); - - if (conf->upstream.cache && conf->upstream.cache->data == NULL) { + if (conf->upstream.cache == NGX_CONF_UNSET) { + ngx_conf_merge_value(conf->upstream.cache, + prev->upstream.cache, 0); + + conf->upstream.cache_zone = prev->upstream.cache_zone; + } + + if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) { ngx_shm_zone_t *shm_zone; - shm_zone = conf->upstream.cache; + shm_zone = conf->upstream.cache_zone; ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "\"uwsgi_cache\" zone \"%V\" is unknown", @@ -2072,9 +2074,7 @@ ngx_http_uwsgi_store(ngx_conf_t *cf, ngx #if (NGX_HTTP_CACHE) - if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR - && uwcf->upstream.cache != NULL) - { + if (uwcf->upstream.cache > 0) { return "is incompatible with \"uwsgi_cache\""; } @@ -2118,12 +2118,12 @@ ngx_http_uwsgi_cache(ngx_conf_t *cf, ngx value = cf->args->elts; - if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR) { + if (uwcf->upstream.cache != NGX_CONF_UNSET) { return "is duplicate"; } if (ngx_strcmp(value[1].data, "off") == 0) { - uwcf->upstream.cache = NULL; + uwcf->upstream.cache = 0; return NGX_CONF_OK; } @@ -2131,9 +2131,11 @@ ngx_http_uwsgi_cache(ngx_conf_t *cf, ngx return "is incompatible with \"uwsgi_store\""; } - uwcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, - &ngx_http_uwsgi_module); - if (uwcf->upstream.cache == NULL) { + uwcf->upstream.cache = 1; + + uwcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_uwsgi_module); + if (uwcf->upstream.cache_zone == NULL) { return NGX_CONF_ERROR; }