[nginx] svn commit: r4979 - trunk/src/http/modules

mdounin at mdounin.ru mdounin at mdounin.ru
Thu Dec 20 19:04:29 UTC 2012


Author: mdounin
Date: 2012-12-20 19:04:28 +0000 (Thu, 20 Dec 2012)
New Revision: 4979
URL: http://trac.nginx.org/nginx/changeset/4979/nginx

Log:
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.


Modified:
   trunk/src/http/modules/ngx_http_image_filter_module.c

Modified: trunk/src/http/modules/ngx_http_image_filter_module.c
===================================================================
--- trunk/src/http/modules/ngx_http_image_filter_module.c	2012-12-20 15:34:37 UTC (rev 4978)
+++ trunk/src/http/modules/ngx_http_image_filter_module.c	2012-12-20 19:04:28 UTC (rev 4979)
@@ -1200,22 +1200,30 @@
         }
     }
 
-    /* 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;
+    if (conf->angle == NGX_CONF_UNSET_UINT) {
+        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);



More information about the nginx-devel mailing list