summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-05-31 15:10:10 +0000
committerJonathan Kolb <jon@b0g.us>2010-05-31 15:10:10 +0000
commit1b92168d269e63365325475f5b1508a1618faa21 (patch)
tree1ac19d5e83f6b7ec8b4a7b9240f71182f9428a14
parent4bd8ede8d4d55d80aeaa4088977a79a54c927a6d (diff)
downloadnginx-0.8.39.tar.gz
Changes with nginx 0.8.39 31 May 2010v0.8.39
*) Bugfix: an inherited "alias" directive worked incorrectly in inclusive location. *) Bugfix: in "alias" with variables and "try_files" directives combination. *) Bugfix: listen unix domain and IPv6 sockets did not inherit while online upgrade. Thanks to Maxim Dounin.
-rw-r--r--CHANGES13
-rw-r--r--CHANGES.ru14
-rw-r--r--src/core/nginx.h4
-rw-r--r--src/core/ngx_connection.c6
-rw-r--r--src/core/ngx_times.c2
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/ngx_http_core_module.c38
-rw-r--r--src/http/ngx_http_core_module.h3
-rw-r--r--src/http/ngx_http_request.h1
9 files changed, 60 insertions, 23 deletions
diff --git a/CHANGES b/CHANGES
index 9580f2f7e..242adaacb 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,17 @@
+Changes with nginx 0.8.39 31 May 2010
+
+ *) Bugfix: an inherited "alias" directive worked incorrectly in
+ inclusive location.
+
+ *) Bugfix: in "alias" with variables and "try_files" directives
+ combination.
+
+ *) Bugfix: listen unix domain and IPv6 sockets did not inherit while
+ online upgrade.
+ Thanks to Maxim Dounin.
+
+
Changes with nginx 0.8.38 24 May 2010
*) Feature: the "proxy_no_cache" and "fastcgi_no_cache" directives.
diff --git a/CHANGES.ru b/CHANGES.ru
index 20c4cf2a5..4290699d6 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,16 @@
+Изменения в nginx 0.8.39 31.05.2010
+
+ *) Исправление: наследуемая директива alias неправильно работала во
+ вложенном location'е.
+
+ *) Исправление: в комбинации директив alias с переменными и try_files;
+
+ *) Исправление: listen unix domain и IPv6 сокеты не наследовались во
+ время обновления без перерыва.
+ Спасибо Максиму Дунину.
+
+
Изменения в nginx 0.8.38 24.05.2010
*) Добавление: директивы proxy_no_cache и fastcgi_no_cache.
@@ -312,7 +324,7 @@
*) Безопасность: теперь SSL/TLS renegotiation запрещён.
Спасибо Максиму Дунину.
- *) Исправление: listen unix domain сокет не наследовались во время
+ *) Исправление: listen unix domain сокет не наследовался во время
обновления без перерыва.
*) Исправление: параметр "unix:" в директиве set_real_ip_from не
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 784d55419..5069f2900 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,8 +8,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 8038
-#define NGINX_VERSION "0.8.38"
+#define nginx_version 8039
+#define NGINX_VERSION "0.8.39"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 1f6a19520..4a90b6120 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -96,14 +96,12 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
- /* AF_INET only */
-
- ls[i].sockaddr = ngx_palloc(cycle->pool, sizeof(struct sockaddr_in));
+ ls[i].sockaddr = ngx_palloc(cycle->pool, NGX_SOCKADDRLEN);
if (ls[i].sockaddr == NULL) {
return NGX_ERROR;
}
- ls[i].socklen = sizeof(struct sockaddr_in);
+ ls[i].socklen = NGX_SOCKADDRLEN;
if (getsockname(ls[i].fd, ls[i].sockaddr, &ls[i].socklen) == -1) {
ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno,
"getsockname() of the inherited "
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c
index d9f5aa28e..50501246a 100644
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -172,7 +172,6 @@ ngx_time_sigsafe_update(void)
u_char *p;
ngx_tm_t tm;
time_t sec;
- ngx_uint_t msec;
ngx_time_t *tp;
struct timeval tv;
@@ -183,7 +182,6 @@ ngx_time_sigsafe_update(void)
ngx_gettimeofday(&tv);
sec = tv.tv_sec;
- msec = tv.tv_usec / 1000;
tp = &cached_time[slot];
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index 3e173eb23..460ecb7e6 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.38';
+our $VERSION = '0.8.39';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 21ea7e9d2..af035cc03 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1152,7 +1152,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
tf = clcf->try_files;
- alias = clcf->alias ? clcf->name.len : 0;
+ alias = clcf->alias;
for ( ;; ) {
@@ -1222,8 +1222,9 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
tf++;
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "try to use file: \"%s\" \"%s\"", name, path.data);
+ ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "try to use %s: \"%s\" \"%s\"",
+ test_dir ? "dir" : "file", name, path.data);
if (tf->lengths == NULL && tf->name.len == 0) {
@@ -1281,6 +1282,13 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
if (!alias) {
r->uri = path;
+#if (NGX_PCRE)
+ } else if (clcf->regex) {
+ if (!test_dir) {
+ r->uri = path;
+ r->add_uri_to_alias = 1;
+ }
+#endif
} else {
r->uri.len = alias + path.len;
r->uri.data = ngx_pnalloc(r->pool, r->uri.len);
@@ -1748,7 +1756,7 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
- alias = clcf->alias ? clcf->name.len : 0;
+ alias = clcf->alias;
if (alias && !r->valid_location) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
@@ -1776,7 +1784,9 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
ngx_uint_t captures;
captures = alias && clcf->regex;
- reserved += captures ? 1 : r->uri.len - alias + 1;
+
+ reserved += captures ? r->add_uri_to_alias ? r->uri.len + 1 : 1
+ : r->uri.len - alias + 1;
#else
reserved += r->uri.len - alias + 1;
#endif
@@ -1797,8 +1807,12 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
#if (NGX_PCRE)
if (captures) {
- *last = '\0';
- return last;
+ if (!r->add_uri_to_alias) {
+ *last = '\0';
+ return last;
+ }
+
+ alias = 0;
}
#endif
}
@@ -2206,6 +2220,7 @@ ngx_http_internal_redirect(ngx_http_request_t *r,
#endif
r->internal = 1;
+ r->add_uri_to_alias = 0;
r->main->count++;
ngx_http_handler(r);
@@ -3589,16 +3604,15 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_http_core_loc_conf_t *clcf = conf;
ngx_str_t *value;
- ngx_uint_t alias, n;
+ ngx_int_t alias;
+ ngx_uint_t n;
ngx_http_script_compile_t sc;
alias = (cmd->name.len == sizeof("alias") - 1) ? 1 : 0;
if (clcf->root.data) {
- /* the (ngx_uint_t) cast is required by gcc 2.7.2.3 */
-
- if ((ngx_uint_t) clcf->alias == alias) {
+ if ((clcf->alias != 0) == alias) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"\"%V\" directive is duplicate",
&cmd->name);
@@ -3644,7 +3658,7 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_ERROR;
}
- clcf->alias = alias;
+ clcf->alias = alias ? clcf->name.len : 0;
clcf->root = value[1];
if (!alias && clcf->root.data[clcf->root.len - 1] == '/') {
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 631f39927..01a2fbe8b 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -289,7 +289,6 @@ struct ngx_http_core_loc_conf_s {
unsigned noregex:1;
unsigned auto_redirect:1;
- unsigned alias:1;
#if (NGX_HTTP_GZIP)
unsigned gzip_disable_msie6:2;
#endif
@@ -307,6 +306,8 @@ struct ngx_http_core_loc_conf_s {
ngx_http_handler_pt handler;
+ /* location name length for inclusive location with inherited alias */
+ size_t alias;
ngx_str_t root; /* root, alias */
ngx_str_t post_action;
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index f9622714c..0559b4650 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -437,6 +437,7 @@ struct ngx_http_request_s {
unsigned invalid_header:1;
+ unsigned add_uri_to_alias:1;
unsigned valid_location:1;
unsigned valid_unparsed_uri:1;
unsigned uri_changed:1;