[nginx] svn commit: r5053 - in branches/stable-1.2: . src/http/modules
mdounin at mdounin.ru
mdounin at mdounin.ru
Mon Feb 11 13:59:09 UTC 2013
Author: mdounin
Date: 2013-02-11 13:59:08 +0000 (Mon, 11 Feb 2013)
New Revision: 5053
URL: http://trac.nginx.org/nginx/changeset/5053/nginx
Log:
Merge of r4979, r4982: image filter configuration inheritance.
*) Image filter: configuration inheritance fixes.
The image_filter_jpeg_quality, image_filter_sharpen and
"image_filter rotate" were inherited incorrectly if a directive
with variables was defined, and then redefined to a literal value,
i.e. in configurations like
image_filter_jpeg_quality $arg_q;
location / {
image_filter_jpeg_quality 50;
}
Patch by Ian Babrou, with minor changes.
*) Image filter: fixed image_filter rotate inheritance.
Configurations like
location /i/ {
image_filter resize 200 200;
image_filter rotate 180;
location /i/foo/ {
image_filter resize 200 200;
}
}
resulted in rotation incorrectly applied in the location /i/foo,
without any way to clear it. Fix is to handle conf->angle/conf->acv
consistently with other filter variables and do not try to inherit
them if there are transformations defined for current location.
Modified:
branches/stable-1.2/
branches/stable-1.2/src/http/modules/ngx_http_image_filter_module.c
Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2 2013-02-11 13:52:13 UTC (rev 5052)
+++ branches/stable-1.2 2013-02-11 13:59:08 UTC (rev 5053)
Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4925,4933-4934,4939,4944-4949,4961-4969,4973-4974,4976-4978,4980-4981,4983-4984,4990,4993-4994,4997,5000,5011
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4741,4754,4756-4771,4775,4777-4780,4782-4785,4795,4811-4820,4822-4824,4828-4835,4840-4844,4865-4872,4885-4887,4890-4896,4913-4925,4933-4934,4939,4944-4949,4961-4969,4973-4974,4976-4984,4990,4993-4994,4997,5000,5011
\ No newline at end of property
Modified: branches/stable-1.2/src/http/modules/ngx_http_image_filter_module.c
===================================================================
--- branches/stable-1.2/src/http/modules/ngx_http_image_filter_module.c 2013-02-11 13:52:13 UTC (rev 5052)
+++ branches/stable-1.2/src/http/modules/ngx_http_image_filter_module.c 2013-02-11 13:59:08 UTC (rev 5053)
@@ -1169,10 +1169,22 @@
return NULL;
}
+ /*
+ * set by ngx_pcalloc():
+ *
+ * conf->width = 0;
+ * conf->height = 0;
+ * conf->angle = 0;
+ * conf->wcv = NULL;
+ * conf->hcv = NULL;
+ * conf->acv = NULL;
+ * conf->jqcv = NULL;
+ * conf->shcv = NULL;
+ */
+
conf->filter = NGX_CONF_UNSET_UINT;
conf->jpeg_quality = NGX_CONF_UNSET_UINT;
conf->sharpen = NGX_CONF_UNSET_UINT;
- conf->angle = NGX_CONF_UNSET_UINT;
conf->transparency = NGX_CONF_UNSET;
conf->buffer_size = NGX_CONF_UNSET_SIZE;
@@ -1195,29 +1207,31 @@
conf->filter = prev->filter;
conf->width = prev->width;
conf->height = prev->height;
+ conf->angle = prev->angle;
conf->wcv = prev->wcv;
conf->hcv = prev->hcv;
+ conf->acv = prev->acv;
}
}
- /* 75 is libjpeg default quality */
- ngx_conf_merge_uint_value(conf->jpeg_quality, prev->jpeg_quality, 75);
+ if (conf->jpeg_quality == NGX_CONF_UNSET_UINT) {
- if (conf->jqcv == NULL) {
- conf->jqcv = prev->jqcv;
+ /* 75 is libjpeg default quality */
+ ngx_conf_merge_uint_value(conf->jpeg_quality, prev->jpeg_quality, 75);
+
+ if (conf->jqcv == NULL) {
+ conf->jqcv = prev->jqcv;
+ }
}
- ngx_conf_merge_uint_value(conf->sharpen, prev->sharpen, 0);
+ if (conf->sharpen == NGX_CONF_UNSET_UINT) {
+ ngx_conf_merge_uint_value(conf->sharpen, prev->sharpen, 0);
- if (conf->shcv == NULL) {
- conf->shcv = prev->shcv;
+ if (conf->shcv == NULL) {
+ conf->shcv = prev->shcv;
+ }
}
- ngx_conf_merge_uint_value(conf->angle, prev->angle, 0);
- if (conf->acv == NULL) {
- conf->acv = prev->acv;
- }
-
ngx_conf_merge_value(conf->transparency, prev->transparency, 1);
ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size,
More information about the nginx-devel
mailing list