diff options
author | Igor Sysoev <igor@sysoev.ru> | 2011-02-21 09:44:08 +0000 |
---|---|---|
committer | Jonathan Kolb <jon@b0g.us> | 2011-02-21 09:44:08 +0000 |
commit | 88f3a051fd196735cdf47a67ddc14cf298cbfe63 (patch) | |
tree | 75152dc461e0b9a5f567451970ddf2abf324b988 | |
parent | e52b136dd7a6ad34b361b8b48eef7cbaa48282ca (diff) | |
download | nginx-88f3a051fd196735cdf47a67ddc14cf298cbfe63.tar.gz |
Changes with nginx 0.9.5 21 Feb 2011v0.9.5
*) Change: now nginx uses a default listen backlog value -1 on
Linux.
Thanks to Andrei Nigmatulin.
*) Feature: the "utf8" parameter of "geoip_country" and "geoip_city"
directives.
Thanks to Denis F. Latypoff.
*) Bugfix: in a default "proxy_redirect" directive if "proxy_pass"
directive has no URI part.
Thanks to Maxim Dounin.
*) Bugfix: an "error_page" directive did not work with nonstandard
error codes; the bug had appeared in 0.8.53.
Thanks to Maxim Dounin.
-rw-r--r-- | CHANGES | 19 | ||||
-rw-r--r-- | CHANGES.ru | 19 | ||||
-rw-r--r-- | conf/mime.types | 2 | ||||
-rw-r--r-- | src/core/nginx.h | 4 | ||||
-rw-r--r-- | src/core/ngx_inet.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_geoip_module.c | 26 | ||||
-rw-r--r-- | src/http/modules/ngx_http_proxy_module.c | 34 | ||||
-rw-r--r-- | src/http/modules/perl/nginx.pm | 2 | ||||
-rw-r--r-- | src/http/ngx_http_special_response.c | 9 | ||||
-rw-r--r-- | src/os/unix/ngx_files.c | 2 | ||||
-rw-r--r-- | src/os/unix/ngx_linux_config.h | 2 |
11 files changed, 107 insertions, 14 deletions
@@ -1,4 +1,23 @@ +Changes with nginx 0.9.5 21 Feb 2011 + + *) Change: now nginx uses a default listen backlog value -1 on + Linux. + Thanks to Andrei Nigmatulin. + + *) Feature: the "utf8" parameter of "geoip_country" and "geoip_city" + directives. + Thanks to Denis F. Latypoff. + + *) Bugfix: in a default "proxy_redirect" directive if "proxy_pass" + directive has no URI part. + Thanks to Maxim Dounin. + + *) Bugfix: an "error_page" directive did not work with nonstandard + error codes; the bug had appeared in 0.8.53. + Thanks to Maxim Dounin. + + Changes with nginx 0.9.4 21 Jan 2011 *) Feature: the "server_name" directive supports the $hostname variable. diff --git a/CHANGES.ru b/CHANGES.ru index 7450934e8..fb60efbc2 100644 --- a/CHANGES.ru +++ b/CHANGES.ru @@ -1,4 +1,23 @@ +Изменения в nginx 0.9.5 21.02.2011 + + *) Изменение: теперь по умолчанию nginx использует значение -1 для + listen backlog на Linux. + Спасибо Андрею Нигматулину. + + *) Добавление: параметр utf8 в директивах geoip_country и + geoip_city. + Спасибо Денису Латыпову. + + *) Исправление: исправление в умолчательной директиве proxy_redirect, + если в директиве proxy_pass не был описан URI. + Спасибо Максиму Дунину. + + *) Исправление: директива error_page не работала с нестандартными + кодами ошибок; ошибка появилась в 0.8.53. + Спасибо Максиму Дунину. + + Изменения в nginx 0.9.4 21.01.2011 *) Добавление: директива server_name поддерживает переменную $hostname. diff --git a/conf/mime.types b/conf/mime.types index b64f2277a..f750acd7b 100644 --- a/conf/mime.types +++ b/conf/mime.types @@ -32,7 +32,6 @@ types { application/vnd.ms-excel xls; application/vnd.ms-powerpoint ppt; application/vnd.wap.wmlc wmlc; - application/vnd.wap.xhtml+xml xhtml; application/vnd.google-earth.kml+xml kml; application/vnd.google-earth.kmz kmz; application/x-7z-compressed 7z; @@ -50,6 +49,7 @@ types { application/x-tcl tcl tk; application/x-x509-ca-cert der pem crt; application/x-xpinstall xpi; + application/xhtml+xml xhtml; application/zip zip; application/octet-stream bin exe dll; diff --git a/src/core/nginx.h b/src/core/nginx.h index a3583d062..beb82ed0d 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,8 +8,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 9004 -#define NGINX_VERSION "0.9.4" +#define nginx_version 9005 +#define NGINX_VERSION "0.9.5" #define NGINX_VER "nginx/" NGINX_VERSION #define NGINX_VAR "NGINX" diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index 91c7ef081..7440c280e 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -943,7 +943,7 @@ ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u) u->naddrs = i; - for (i = 0; h->h_addr_list[i] != NULL; i++) { + for (i = 0; i < u->naddrs; i++) { sin = ngx_pcalloc(pool, sizeof(struct sockaddr_in)); if (sin == NULL) { diff --git a/src/http/modules/ngx_http_geoip_module.c b/src/http/modules/ngx_http_geoip_module.c index 592314c84..34140a198 100644 --- a/src/http/modules/ngx_http_geoip_module.c +++ b/src/http/modules/ngx_http_geoip_module.c @@ -50,14 +50,14 @@ static void ngx_http_geoip_cleanup(void *data); static ngx_command_t ngx_http_geoip_commands[] = { { ngx_string("geoip_country"), - NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, + NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE12, ngx_http_geoip_country, NGX_HTTP_MAIN_CONF_OFFSET, 0, NULL }, { ngx_string("geoip_city"), - NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, + NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE12, ngx_http_geoip_city, NGX_HTTP_MAIN_CONF_OFFSET, 0, @@ -446,6 +446,17 @@ ngx_http_geoip_country(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } + if (cf->args->nelts == 3) { + if (ngx_strcmp(value[2].data, "utf8") == 0) { + GeoIP_set_charset (gcf->country, GEOIP_CHARSET_UTF8); + + } else { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid parameter \"%V\"", &value[2]); + return NGX_CONF_ERROR; + } + } + switch (gcf->country->databaseType) { case GEOIP_COUNTRY_EDITION: @@ -485,6 +496,17 @@ ngx_http_geoip_city(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } + if (cf->args->nelts == 3) { + if (ngx_strcmp(value[2].data, "utf8") == 0) { + GeoIP_set_charset (gcf->city, GEOIP_CHARSET_UTF8); + + } else { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid parameter \"%V\"", &value[2]); + return NGX_CONF_ERROR; + } + } + switch (gcf->city->databaseType) { case GEOIP_CITY_EDITION_REV0: diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index 325a1a00b..214fe6a26 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -1717,6 +1717,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) ngx_http_proxy_loc_conf_t *prev = parent; ngx_http_proxy_loc_conf_t *conf = child; + u_char *p; size_t size; ngx_keyval_t *s; ngx_hash_init_t hash; @@ -1975,13 +1976,25 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) } pr->handler = ngx_http_proxy_rewrite_redirect_text; - pr->redirect = conf->url; if (conf->vars.uri.len) { + pr->redirect = conf->url; pr->replacement.text = conf->location; } else { - ngx_str_null(&pr->replacement.text); + pr->redirect.len = conf->url.len + sizeof("/") - 1; + + p = ngx_pnalloc(cf->pool, pr->redirect.len); + if (p == NULL) { + return NGX_CONF_ERROR; + } + + pr->redirect.data = p; + + p = ngx_cpymem(p, conf->url.data, conf->url.len); + *p = '/'; + + ngx_str_set(&pr->replacement.text, "/"); } } } @@ -2456,6 +2469,7 @@ ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_proxy_loc_conf_t *plcf = conf; + u_char *p; ngx_str_t *value; ngx_array_t *vars_lengths, *vars_values; ngx_http_script_compile_t sc; @@ -2518,13 +2532,25 @@ ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } pr->handler = ngx_http_proxy_rewrite_redirect_text; - pr->redirect = plcf->url; if (plcf->vars.uri.len) { + pr->redirect = plcf->url; pr->replacement.text = plcf->location; } else { - ngx_str_null(&pr->replacement.text); + pr->redirect.len = plcf->url.len + sizeof("/") - 1; + + p = ngx_pnalloc(cf->pool, pr->redirect.len); + if (p == NULL) { + return NGX_CONF_ERROR; + } + + pr->redirect.data = p; + + p = ngx_cpymem(p, plcf->url.data, plcf->url.len); + *p = '/'; + + ngx_str_set(&pr->replacement.text, "/"); } return NGX_CONF_OK; diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm index 422ae658f..7d0bff569 100644 --- a/src/http/modules/perl/nginx.pm +++ b/src/http/modules/perl/nginx.pm @@ -48,7 +48,7 @@ our @EXPORT = qw( HTTP_INSUFFICIENT_STORAGE ); -our $VERSION = '0.9.4'; +our $VERSION = '0.9.5'; require XSLoader; XSLoader::load('nginx', $VERSION); diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c index ed87fd068..0f08d987e 100644 --- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c @@ -570,7 +570,14 @@ ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page) return NGX_ERROR; } - r->err_status = overwrite > 0 ? overwrite : NGX_HTTP_MOVED_TEMPORARILY; + if (overwrite >= NGX_HTTP_MOVED_PERMANENTLY + && overwrite <= NGX_HTTP_SEE_OTHER) + { + r->err_status = overwrite; + + } else { + r->err_status = NGX_HTTP_MOVED_TEMPORARILY; + } location->hash = 1; ngx_str_set(&location->key, "Location"); diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c index c50e2014b..89ab8d6bc 100644 --- a/src/os/unix/ngx_files.c +++ b/src/os/unix/ngx_files.c @@ -245,7 +245,7 @@ ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s) { struct timeval tv[2]; - tv[0].tv_sec = s; + tv[0].tv_sec = ngx_time(); tv[0].tv_usec = 0; tv[1].tv_sec = s; tv[1].tv_usec = 0; diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h index cf45e54a1..556651c8e 100644 --- a/src/os/unix/ngx_linux_config.h +++ b/src/os/unix/ngx_linux_config.h @@ -88,7 +88,7 @@ typedef struct iocb ngx_aiocb_t; #endif -#define NGX_LISTEN_BACKLOG 511 +#define NGX_LISTEN_BACKLOG -1 #if defined TCP_DEFER_ACCEPT && !defined NGX_HAVE_DEFERRED_ACCEPT |