comparison src/http/modules/ngx_http_fastcgi_module.c @ 5947:d9025ea1f5a5

Upstream: simplified proxy_store and friends configuration code. This changes internal API related to handling of the "store" flag in ngx_http_upstream_conf_t. Previously, a non-null value of "store_lengths" was enough to enable store functionality with custom path. Now, the "store" flag is also required to be set. No functional changes.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 22 Dec 2014 12:58:56 +0300
parents e3b3b89d74e8
children f2ff0aa89126
comparison
equal deleted inserted replaced
5946:ee941e49bd88 5947:d9025ea1f5a5
2434 2434
2435 if (conf->upstream.store == NGX_CONF_UNSET) { 2435 if (conf->upstream.store == NGX_CONF_UNSET) {
2436 ngx_conf_merge_value(conf->upstream.store, 2436 ngx_conf_merge_value(conf->upstream.store,
2437 prev->upstream.store, 0); 2437 prev->upstream.store, 0);
2438 2438
2439 if (conf->upstream.store_lengths == NULL) { 2439 conf->upstream.store_lengths = prev->upstream.store_lengths;
2440 conf->upstream.store_lengths = prev->upstream.store_lengths; 2440 conf->upstream.store_values = prev->upstream.store_values;
2441 conf->upstream.store_values = prev->upstream.store_values;
2442 }
2443 } 2441 }
2444 2442
2445 ngx_conf_merge_uint_value(conf->upstream.store_access, 2443 ngx_conf_merge_uint_value(conf->upstream.store_access,
2446 prev->upstream.store_access, 0600); 2444 prev->upstream.store_access, 0600);
2447 2445
3204 ngx_http_fastcgi_loc_conf_t *flcf = conf; 3202 ngx_http_fastcgi_loc_conf_t *flcf = conf;
3205 3203
3206 ngx_str_t *value; 3204 ngx_str_t *value;
3207 ngx_http_script_compile_t sc; 3205 ngx_http_script_compile_t sc;
3208 3206
3209 if (flcf->upstream.store != NGX_CONF_UNSET 3207 if (flcf->upstream.store != NGX_CONF_UNSET) {
3210 || flcf->upstream.store_lengths)
3211 {
3212 return "is duplicate"; 3208 return "is duplicate";
3213 } 3209 }
3214 3210
3215 value = cf->args->elts; 3211 value = cf->args->elts;
3216 3212
3227 return "is incompatible with \"fastcgi_cache\""; 3223 return "is incompatible with \"fastcgi_cache\"";
3228 } 3224 }
3229 3225
3230 #endif 3226 #endif
3231 3227
3228 flcf->upstream.store = 1;
3229
3232 if (ngx_strcmp(value[1].data, "on") == 0) { 3230 if (ngx_strcmp(value[1].data, "on") == 0) {
3233 flcf->upstream.store = 1;
3234 return NGX_CONF_OK; 3231 return NGX_CONF_OK;
3235 } 3232 }
3236 3233
3237 /* include the terminating '\0' into script */ 3234 /* include the terminating '\0' into script */
3238 value[1].len++; 3235 value[1].len++;
3273 if (ngx_strcmp(value[1].data, "off") == 0) { 3270 if (ngx_strcmp(value[1].data, "off") == 0) {
3274 flcf->upstream.cache = NULL; 3271 flcf->upstream.cache = NULL;
3275 return NGX_CONF_OK; 3272 return NGX_CONF_OK;
3276 } 3273 }
3277 3274
3278 if (flcf->upstream.store > 0 || flcf->upstream.store_lengths) { 3275 if (flcf->upstream.store > 0) {
3279 return "is incompatible with \"fastcgi_store\""; 3276 return "is incompatible with \"fastcgi_store\"";
3280 } 3277 }
3281 3278
3282 flcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, 3279 flcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
3283 &ngx_http_fastcgi_module); 3280 &ngx_http_fastcgi_module);