Mercurial > hg > nginx
comparison 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 |
comparison
equal
deleted
inserted
replaced
5948:f2ff0aa89126 | 5949:634da79665d3 |
---|---|
1352 | 1352 |
1353 conf->upstream.pass_request_headers = NGX_CONF_UNSET; | 1353 conf->upstream.pass_request_headers = NGX_CONF_UNSET; |
1354 conf->upstream.pass_request_body = NGX_CONF_UNSET; | 1354 conf->upstream.pass_request_body = NGX_CONF_UNSET; |
1355 | 1355 |
1356 #if (NGX_HTTP_CACHE) | 1356 #if (NGX_HTTP_CACHE) |
1357 conf->upstream.cache = NGX_CONF_UNSET_PTR; | 1357 conf->upstream.cache = NGX_CONF_UNSET; |
1358 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT; | 1358 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT; |
1359 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR; | 1359 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR; |
1360 conf->upstream.no_cache = NGX_CONF_UNSET_PTR; | 1360 conf->upstream.no_cache = NGX_CONF_UNSET_PTR; |
1361 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; | 1361 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; |
1362 conf->upstream.cache_lock = NGX_CONF_UNSET; | 1362 conf->upstream.cache_lock = NGX_CONF_UNSET; |
1401 ngx_http_core_loc_conf_t *clcf; | 1401 ngx_http_core_loc_conf_t *clcf; |
1402 | 1402 |
1403 #if (NGX_HTTP_CACHE) | 1403 #if (NGX_HTTP_CACHE) |
1404 | 1404 |
1405 if (conf->upstream.store > 0) { | 1405 if (conf->upstream.store > 0) { |
1406 conf->upstream.cache = NULL; | 1406 conf->upstream.cache = 0; |
1407 } | 1407 } |
1408 | 1408 |
1409 if (conf->upstream.cache != NGX_CONF_UNSET_PTR | 1409 if (conf->upstream.cache > 0) { |
1410 && conf->upstream.cache != NULL) | |
1411 { | |
1412 conf->upstream.store = 0; | 1410 conf->upstream.store = 0; |
1413 } | 1411 } |
1414 | 1412 |
1415 #endif | 1413 #endif |
1416 | 1414 |
1578 return NGX_CONF_ERROR; | 1576 return NGX_CONF_ERROR; |
1579 } | 1577 } |
1580 | 1578 |
1581 #if (NGX_HTTP_CACHE) | 1579 #if (NGX_HTTP_CACHE) |
1582 | 1580 |
1583 ngx_conf_merge_ptr_value(conf->upstream.cache, | 1581 if (conf->upstream.cache == NGX_CONF_UNSET) { |
1584 prev->upstream.cache, NULL); | 1582 ngx_conf_merge_value(conf->upstream.cache, |
1585 | 1583 prev->upstream.cache, 0); |
1586 if (conf->upstream.cache && conf->upstream.cache->data == NULL) { | 1584 |
1585 conf->upstream.cache_zone = prev->upstream.cache_zone; | |
1586 } | |
1587 | |
1588 if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) { | |
1587 ngx_shm_zone_t *shm_zone; | 1589 ngx_shm_zone_t *shm_zone; |
1588 | 1590 |
1589 shm_zone = conf->upstream.cache; | 1591 shm_zone = conf->upstream.cache_zone; |
1590 | 1592 |
1591 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 1593 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
1592 "\"uwsgi_cache\" zone \"%V\" is unknown", | 1594 "\"uwsgi_cache\" zone \"%V\" is unknown", |
1593 &shm_zone->shm.name); | 1595 &shm_zone->shm.name); |
1594 | 1596 |
2070 return NGX_CONF_OK; | 2072 return NGX_CONF_OK; |
2071 } | 2073 } |
2072 | 2074 |
2073 #if (NGX_HTTP_CACHE) | 2075 #if (NGX_HTTP_CACHE) |
2074 | 2076 |
2075 if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR | 2077 if (uwcf->upstream.cache > 0) { |
2076 && uwcf->upstream.cache != NULL) | |
2077 { | |
2078 return "is incompatible with \"uwsgi_cache\""; | 2078 return "is incompatible with \"uwsgi_cache\""; |
2079 } | 2079 } |
2080 | 2080 |
2081 #endif | 2081 #endif |
2082 | 2082 |
2116 | 2116 |
2117 ngx_str_t *value; | 2117 ngx_str_t *value; |
2118 | 2118 |
2119 value = cf->args->elts; | 2119 value = cf->args->elts; |
2120 | 2120 |
2121 if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR) { | 2121 if (uwcf->upstream.cache != NGX_CONF_UNSET) { |
2122 return "is duplicate"; | 2122 return "is duplicate"; |
2123 } | 2123 } |
2124 | 2124 |
2125 if (ngx_strcmp(value[1].data, "off") == 0) { | 2125 if (ngx_strcmp(value[1].data, "off") == 0) { |
2126 uwcf->upstream.cache = NULL; | 2126 uwcf->upstream.cache = 0; |
2127 return NGX_CONF_OK; | 2127 return NGX_CONF_OK; |
2128 } | 2128 } |
2129 | 2129 |
2130 if (uwcf->upstream.store > 0) { | 2130 if (uwcf->upstream.store > 0) { |
2131 return "is incompatible with \"uwsgi_store\""; | 2131 return "is incompatible with \"uwsgi_store\""; |
2132 } | 2132 } |
2133 | 2133 |
2134 uwcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, | 2134 uwcf->upstream.cache = 1; |
2135 &ngx_http_uwsgi_module); | 2135 |
2136 if (uwcf->upstream.cache == NULL) { | 2136 uwcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0, |
2137 &ngx_http_uwsgi_module); | |
2138 if (uwcf->upstream.cache_zone == NULL) { | |
2137 return NGX_CONF_ERROR; | 2139 return NGX_CONF_ERROR; |
2138 } | 2140 } |
2139 | 2141 |
2140 return NGX_CONF_OK; | 2142 return NGX_CONF_OK; |
2141 } | 2143 } |