Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_proxy_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 |
---|---|
2626 | 2626 |
2627 if (conf->upstream.store == NGX_CONF_UNSET) { | 2627 if (conf->upstream.store == NGX_CONF_UNSET) { |
2628 ngx_conf_merge_value(conf->upstream.store, | 2628 ngx_conf_merge_value(conf->upstream.store, |
2629 prev->upstream.store, 0); | 2629 prev->upstream.store, 0); |
2630 | 2630 |
2631 if (conf->upstream.store_lengths == NULL) { | 2631 conf->upstream.store_lengths = prev->upstream.store_lengths; |
2632 conf->upstream.store_lengths = prev->upstream.store_lengths; | 2632 conf->upstream.store_values = prev->upstream.store_values; |
2633 conf->upstream.store_values = prev->upstream.store_values; | |
2634 } | |
2635 } | 2633 } |
2636 | 2634 |
2637 ngx_conf_merge_uint_value(conf->upstream.store_access, | 2635 ngx_conf_merge_uint_value(conf->upstream.store_access, |
2638 prev->upstream.store_access, 0600); | 2636 prev->upstream.store_access, 0600); |
2639 | 2637 |
3792 ngx_http_proxy_loc_conf_t *plcf = conf; | 3790 ngx_http_proxy_loc_conf_t *plcf = conf; |
3793 | 3791 |
3794 ngx_str_t *value; | 3792 ngx_str_t *value; |
3795 ngx_http_script_compile_t sc; | 3793 ngx_http_script_compile_t sc; |
3796 | 3794 |
3797 if (plcf->upstream.store != NGX_CONF_UNSET | 3795 if (plcf->upstream.store != NGX_CONF_UNSET) { |
3798 || plcf->upstream.store_lengths) | |
3799 { | |
3800 return "is duplicate"; | 3796 return "is duplicate"; |
3801 } | 3797 } |
3802 | 3798 |
3803 value = cf->args->elts; | 3799 value = cf->args->elts; |
3804 | 3800 |
3815 return "is incompatible with \"proxy_cache\""; | 3811 return "is incompatible with \"proxy_cache\""; |
3816 } | 3812 } |
3817 | 3813 |
3818 #endif | 3814 #endif |
3819 | 3815 |
3816 plcf->upstream.store = 1; | |
3817 | |
3820 if (ngx_strcmp(value[1].data, "on") == 0) { | 3818 if (ngx_strcmp(value[1].data, "on") == 0) { |
3821 plcf->upstream.store = 1; | |
3822 return NGX_CONF_OK; | 3819 return NGX_CONF_OK; |
3823 } | 3820 } |
3824 | 3821 |
3825 /* include the terminating '\0' into script */ | 3822 /* include the terminating '\0' into script */ |
3826 value[1].len++; | 3823 value[1].len++; |
3861 if (ngx_strcmp(value[1].data, "off") == 0) { | 3858 if (ngx_strcmp(value[1].data, "off") == 0) { |
3862 plcf->upstream.cache = NULL; | 3859 plcf->upstream.cache = NULL; |
3863 return NGX_CONF_OK; | 3860 return NGX_CONF_OK; |
3864 } | 3861 } |
3865 | 3862 |
3866 if (plcf->upstream.store > 0 || plcf->upstream.store_lengths) { | 3863 if (plcf->upstream.store > 0) { |
3867 return "is incompatible with \"proxy_store\""; | 3864 return "is incompatible with \"proxy_store\""; |
3868 } | 3865 } |
3869 | 3866 |
3870 plcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, | 3867 plcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, |
3871 &ngx_http_proxy_module); | 3868 &ngx_http_proxy_module); |