diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2009-05-18 13:14:22 +0000 |
|---|---|---|
| committer | Jonathan Kolb <jon@b0g.us> | 2009-05-18 13:14:22 +0000 |
| commit | 45ad903d1cdccb34f9b942c7bd7e992cdeff72f0 (patch) | |
| tree | 336c723fc6b39184da2412d788628bf9cc3933d0 /src/http/modules | |
| parent | b33b82d652ee370ddbad980326b9c167df743282 (diff) | |
| download | nginx-45ad903d1cdccb34f9b942c7bd7e992cdeff72f0.tar.gz | |
Changes with nginx 0.7.58 18 May 2009v0.7.58
*) Feature: a "listen" directive of the mail proxy module supports IPv6.
*) Feature: the "image_filter_jpeg_quality" directive.
*) Feature: the "client_body_in_single_buffer" directive.
*) Feature: the $request_body variable.
*) Bugfix: in ngx_http_autoindex_module in file name links having a ":"
symbol in the name.
*) Bugfix: "make upgrade" procedure did not work; the bug had appeared
in 0.7.53.
Thanks to Denis F. Latypoff.
Diffstat (limited to 'src/http/modules')
| -rw-r--r-- | src/http/modules/ngx_http_autoindex_module.c | 16 | ||||
| -rw-r--r-- | src/http/modules/ngx_http_image_filter_module.c | 20 | ||||
| -rw-r--r-- | src/http/modules/ngx_http_userid_filter_module.c | 7 | ||||
| -rw-r--r-- | src/http/modules/perl/nginx.pm | 2 |
4 files changed, 35 insertions, 10 deletions
diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c index c866c43a6..6215da21f 100644 --- a/src/http/modules/ngx_http_autoindex_module.c +++ b/src/http/modules/ngx_http_autoindex_module.c @@ -25,8 +25,11 @@ typedef struct { typedef struct { ngx_str_t name; size_t utf_len; - ngx_uint_t escape; - ngx_uint_t dir; + size_t escape; + + unsigned dir:1; + unsigned colon:1; + time_t mtime; off_t size; } ngx_http_autoindex_entry_t; @@ -338,6 +341,8 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) entry->utf_len = len; } + entry->colon = (ngx_strchr(entry->name.data, ':') != NULL); + entry->dir = ngx_de_is_dir(&dir); entry->mtime = ngx_de_mtime(&dir); entry->size = ngx_de_size(&dir); @@ -363,7 +368,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) + entry[i].name.len + entry[i].escape + 1 /* 1 is for "/" */ + sizeof("\">") - 1 - + entry[i].name.len - entry[i].utf_len + + entry[i].name.len - entry[i].utf_len + entry[i].colon * 2 + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof(">") - 2 + sizeof("</a>") - 1 + sizeof(" 28-Sep-1970 12:00 ") - 1 @@ -396,6 +401,11 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) for (i = 0; i < entries.nelts; i++) { b->last = ngx_cpymem(b->last, "<a href=\"", sizeof("<a href=\"") - 1); + if (entry[i].colon) { + *b->last++ = '.'; + *b->last++ = '/'; + } + if (entry[i].escape) { ngx_escape_uri(b->last, entry[i].name.data, entry[i].name.len, NGX_ESCAPE_HTML); diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c index fd20550d4..9d480620e 100644 --- a/src/http/modules/ngx_http_image_filter_module.c +++ b/src/http/modules/ngx_http_image_filter_module.c @@ -38,6 +38,7 @@ typedef struct { ngx_uint_t filter; ngx_uint_t width; ngx_uint_t height; + ngx_int_t jpeg_quality; size_t buffer_size; } ngx_http_image_filter_conf_t; @@ -98,6 +99,13 @@ static ngx_command_t ngx_http_image_filter_commands[] = { 0, NULL }, + { ngx_string("image_filter_jpeg_quality"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_image_filter_conf_t, jpeg_quality), + 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, @@ -886,15 +894,17 @@ static u_char * ngx_http_image_out(ngx_http_request_t *r, ngx_uint_t type, gdImagePtr img, int *size) { - char *failed; - u_char *out; + char *failed; + u_char *out; + ngx_http_image_filter_conf_t *conf; out = NULL; switch (type) { case NGX_HTTP_IMAGE_JPEG: - out = gdImageJpegPtr(img, size, /* default quality */ -1); + conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module); + out = gdImageJpegPtr(img, size, conf->jpeg_quality); failed = "gdImageJpegPtr() failed"; break; @@ -939,6 +949,7 @@ ngx_http_image_filter_create_conf(ngx_conf_t *cf) } conf->filter = NGX_CONF_UNSET_UINT; + conf->jpeg_quality = NGX_CONF_UNSET; conf->buffer_size = NGX_CONF_UNSET_SIZE; return conf; @@ -963,6 +974,9 @@ 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_size_value(conf->buffer_size, prev->buffer_size, 1 * 1024 * 1024); diff --git a/src/http/modules/ngx_http_userid_filter_module.c b/src/http/modules/ngx_http_userid_filter_module.c index 5ffb1d02b..3462f649c 100644 --- a/src/http/modules/ngx_http_userid_filter_module.c +++ b/src/http/modules/ngx_http_userid_filter_module.c @@ -390,12 +390,13 @@ ngx_http_userid_set_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx, } else { if (conf->service == NGX_CONF_UNSET) { - if (ngx_http_server_addr(r, NULL) != NGX_OK) { - return NGX_ERROR; - } c = r->connection; + if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) { + return NGX_ERROR; + } + switch (c->local_sockaddr->sa_family) { #if (NGX_HAVE_INET6) diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm index 6643c483c..f5d527641 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.7.57'; +our $VERSION = '0.7.58'; require XSLoader; XSLoader::load('nginx', $VERSION); |
