summaryrefslogtreecommitdiff
path: root/src/http/modules
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-09-22 14:35:27 +0000
committerJonathan Kolb <jon@b0g.us>2009-09-22 14:35:27 +0000
commitc1f184e9ab685444d26023e6203754de36c83860 (patch)
tree73711889263a06745578f6dd5a5dae27a68805d8 /src/http/modules
parent07651bee2c67cb8fe4a8d5e40880ac05b6db6dc2 (diff)
downloadnginx-c1f184e9ab685444d26023e6203754de36c83860.tar.gz
Changes with nginx 0.8.16 22 Sep 2009v0.8.16
*) Feature: the "image_filter_transparency" directive. *) Bugfix: "addition_types" directive was incorrectly named "addtion_types". *) Bugfix: resolver cache poisoning. Thanks to Matthew Dempsky. *) Bugfix: memory leak in resolver. Thanks to Matthew Dempsky. *) Bugfix: invalid request line in $request variable was written in access_log only if error_log was set to "info" or "debug" level. *) Bugfix: in PNG alpha-channel support in the ngx_http_image_filter_module. *) Bugfix: nginx always added "Vary: Accept-Encoding" response header line, if both "gzip_static" and "gzip_vary" were on. *) Bugfix: in UTF-8 encoding support by "try_files" directive in nginx/Windows. *) Bugfix: in "post_action" directive usage; the bug had appeared in 0.8.11. Thanks to Igor Artemiev.
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_addition_filter_module.c2
-rw-r--r--src/http/modules/ngx_http_gzip_static_module.c11
-rw-r--r--src/http/modules/ngx_http_image_filter_module.c65
-rw-r--r--src/http/modules/ngx_http_ssl_module.c7
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/modules/perl/ngx_http_perl_module.c5
6 files changed, 72 insertions, 20 deletions
diff --git a/src/http/modules/ngx_http_addition_filter_module.c b/src/http/modules/ngx_http_addition_filter_module.c
index 4076c5374..c78361c66 100644
--- a/src/http/modules/ngx_http_addition_filter_module.c
+++ b/src/http/modules/ngx_http_addition_filter_module.c
@@ -45,7 +45,7 @@ static ngx_command_t ngx_http_addition_commands[] = {
offsetof(ngx_http_addition_conf_t, after_body),
NULL },
- { ngx_string("addtion_types"),
+ { ngx_string("addition_types"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
ngx_http_types_slot,
NGX_HTTP_LOC_CONF_OFFSET,
diff --git a/src/http/modules/ngx_http_gzip_static_module.c b/src/http/modules/ngx_http_gzip_static_module.c
index 19e412841..8080d9cb0 100644
--- a/src/http/modules/ngx_http_gzip_static_module.c
+++ b/src/http/modules/ngx_http_gzip_static_module.c
@@ -95,7 +95,13 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
gzcf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_static_module);
- if (!gzcf->enable || ngx_http_gzip_ok(r) != NGX_OK) {
+ if (!gzcf->enable) {
+ return NGX_DECLINED;
+ }
+
+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+ if (clcf->gzip_vary && ngx_http_gzip_ok(r) != NGX_OK) {
return NGX_DECLINED;
}
@@ -116,8 +122,6 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0,
"http filename: \"%s\"", path.data);
- clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
ngx_memzero(&of, sizeof(ngx_open_file_info_t));
of.directio = clcf->directio;
@@ -138,6 +142,7 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
case NGX_ENOTDIR:
case NGX_ENAMETOOLONG:
+ r->gzip = 0;
return NGX_DECLINED;
case NGX_EACCES:
diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c
index 653cc791b..9a4dafe05 100644
--- a/src/http/modules/ngx_http_image_filter_module.c
+++ b/src/http/modules/ngx_http_image_filter_module.c
@@ -40,6 +40,8 @@ typedef struct {
ngx_uint_t height;
ngx_int_t jpeg_quality;
+ ngx_flag_t transparency;
+
ngx_http_complex_value_t *wcv;
ngx_http_complex_value_t *hcv;
@@ -115,6 +117,13 @@ static ngx_command_t ngx_http_image_filter_commands[] = {
offsetof(ngx_http_image_filter_conf_t, jpeg_quality),
NULL },
+ { ngx_string("image_filter_transparency"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_image_filter_conf_t, transparency),
+ NULL },
+
{ ngx_string("image_filter_buffer"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot,
@@ -678,8 +687,9 @@ ngx_http_image_size(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
static ngx_buf_t *
ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
{
- int sx, sy, dx, dy, ox, oy,
- colors, transparent, red, green, blue, size;
+ int sx, sy, dx, dy, ox, oy, size,
+ colors, palette, transparent,
+ red, green, blue;
u_char *out;
ngx_buf_t *b;
ngx_uint_t resize;
@@ -706,18 +716,30 @@ ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
}
colors = gdImageColorsTotal(src);
- transparent = gdImageGetTransparent(src);
- if (transparent != -1 && colors) {
- red = gdImageRed(src, transparent);
- green = gdImageGreen(src, transparent);
- blue = gdImageBlue(src, transparent);
- gdImageColorTransparent(src, -1);
+ if (colors && conf->transparency) {
+ transparent = gdImageGetTransparent(src);
- } else {
- red = 0; green = 0; blue = 0;
+ if (transparent != -1) {
+ palette = colors;
+ red = gdImageRed(src, transparent);
+ green = gdImageGreen(src, transparent);
+ blue = gdImageBlue(src, transparent);
+
+ goto transparent;
+ }
}
+ palette = 0;
+ transparent = -1;
+ red = 0;
+ green = 0;
+ blue = 0;
+
+transparent:
+
+ gdImageColorTransparent(src, -1);
+
dx = sx;
dy = sy;
@@ -762,14 +784,23 @@ ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
}
if (resize) {
- dst = ngx_http_image_new(r, dx, dy, colors);
+ dst = ngx_http_image_new(r, dx, dy, palette);
if (dst == NULL) {
gdImageDestroy(src);
return NULL;
}
+ if (colors == 0) {
+ gdImageSaveAlpha(dst, 1);
+ gdImageAlphaBlending(dst, 0);
+ }
+
gdImageCopyResampled(dst, src, 0, 0, 0, 0, dx, dy, sx, sy);
+ if (colors) {
+ gdImageTrueColorToPalette(dst, 1, 256);
+ }
+
gdImageDestroy(src);
} else {
@@ -810,8 +841,17 @@ ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
"image crop: %d x %d @ %d x %d",
dx, dy, ox, oy);
+ if (colors == 0) {
+ gdImageSaveAlpha(dst, 1);
+ gdImageAlphaBlending(dst, 0);
+ }
+
gdImageCopy(dst, src, 0, 0, ox, oy, dx - ox, dy - oy);
+ if (colors) {
+ gdImageTrueColorToPalette(dst, 1, 256);
+ }
+
gdImageDestroy(src);
}
}
@@ -1021,6 +1061,7 @@ ngx_http_image_filter_create_conf(ngx_conf_t *cf)
conf->filter = NGX_CONF_UNSET_UINT;
conf->jpeg_quality = NGX_CONF_UNSET;
+ conf->transparency = NGX_CONF_UNSET;
conf->buffer_size = NGX_CONF_UNSET_SIZE;
return conf;
@@ -1050,6 +1091,8 @@ ngx_http_image_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)
/* 75 is libjpeg default quality */
ngx_conf_merge_value(conf->jpeg_quality, prev->jpeg_quality, 75);
+ ngx_conf_merge_value(conf->transparency, prev->transparency, 1);
+
ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size,
1 * 1024 * 1024);
diff --git a/src/http/modules/ngx_http_ssl_module.c b/src/http/modules/ngx_http_ssl_module.c
index 42854b479..7729b760e 100644
--- a/src/http/modules/ngx_http_ssl_module.c
+++ b/src/http/modules/ngx_http_ssl_module.c
@@ -406,9 +406,10 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_http_ssl_servername)
== 0)
{
- ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0,
- "SSL_CTX_set_tlsext_servername_callback() failed");
- return NGX_CONF_ERROR;
+ ngx_log_error(NGX_LOG_WARN, cf->log, 0,
+ "nginx was build with SNI support, however, now it is linked "
+ "dynamically to an OpenSSL library which has no tlsext support, "
+ "therefore SNI is not available");
}
#endif
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index f6378445c..7044a5f11 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -47,7 +47,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '0.8.15';
+our $VERSION = '0.8.16';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c
index 634801ece..41372ce2d 100644
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -761,7 +761,10 @@ ngx_http_perl_eval_anon_sub(pTHX_ ngx_str_t *handler, SV **sv)
}
}
- if (ngx_strncmp(p, "sub ", 4) == 0 || ngx_strncmp(p, "use ", 4) == 0) {
+ if (ngx_strncmp(p, "sub ", 4) == 0
+ || ngx_strncmp(p, "sub{", 4) == 0
+ || ngx_strncmp(p, "use ", 4) == 0)
+ {
*sv = eval_pv((char *) p, FALSE);
/* eval_pv() does not set ERRSV on failure */