Skip to content

Commit

Permalink
Changes with nginx 1.1.16 29 Feb 2012
Browse files Browse the repository at this point in the history
*) Change: the simultaneous subrequest limit has been raised to 200.

*) Feature: the "from" parameter of the "disable_symlinks" directive.

*) Feature: the "return" and "error_page" directives can be used to
return 307 redirections.

*) Bugfix: a segmentation fault might occur in a worker process if the
"resolver" directive was used and there was no "error_log" directive
specified at global level.
Thanks to Roman Arutyunyan.

*) Bugfix: a segmentation fault might occur in a worker process if the
"proxy_http_version 1.1" or "fastcgi_keep_conn on" directives were
used.

*) Bugfix: memory leaks.
Thanks to Lanshun Zhou.

*) Bugfix: in the "disable_symlinks" directive.

*) Bugfix: on ZFS filesystem disk cache size might be calculated
incorrectly; the bug had appeared in 1.0.1.

*) Bugfix: nginx could not be built by the icc 12.1 compiler.

*) Bugfix: nginx could not be built by gcc on Solaris; the bug had
appeared in 1.1.15.
  • Loading branch information
NGINX team authored and kolbyjack committed Feb 29, 2012
1 parent 616d163 commit 55ebd60
Show file tree
Hide file tree
Showing 43 changed files with 540 additions and 294 deletions.
32 changes: 32 additions & 0 deletions CHANGES
@@ -1,4 +1,36 @@

Changes with nginx 1.1.16 29 Feb 2012

*) Change: the simultaneous subrequest limit has been raised to 200.

*) Feature: the "from" parameter of the "disable_symlinks" directive.

*) Feature: the "return" and "error_page" directives can be used to
return 307 redirections.

*) Bugfix: a segmentation fault might occur in a worker process if the
"resolver" directive was used and there was no "error_log" directive
specified at global level.
Thanks to Roman Arutyunyan.

*) Bugfix: a segmentation fault might occur in a worker process if the
"proxy_http_version 1.1" or "fastcgi_keep_conn on" directives were
used.

*) Bugfix: memory leaks.
Thanks to Lanshun Zhou.

*) Bugfix: in the "disable_symlinks" directive.

*) Bugfix: on ZFS filesystem disk cache size might be calculated
incorrectly; the bug had appeared in 1.0.1.

*) Bugfix: nginx could not be built by the icc 12.1 compiler.

*) Bugfix: nginx could not be built by gcc on Solaris; the bug had
appeared in 1.1.15.


Changes with nginx 1.1.15 15 Feb 2012

*) Feature: the "disable_symlinks" directive.
Expand Down
33 changes: 33 additions & 0 deletions CHANGES.ru
@@ -1,4 +1,37 @@

Изменения в nginx 1.1.16 29.02.2012

*) Изменение: ограничение на количество одновременных подзапросов
поднято до 200.

*) Добавление: параметр from в директиве disable_symlinks.

*) Добавление: директивы return и error_page теперь могут использоваться
для возврата перенаправлений с кодом 307.

*) Исправление: в рабочем процессе мог произойти segmentation fault,
если использовалась директива resolver и на глобальном уровне не была
задана директива error_log.
Спасибо Роману Арутюняну.

*) Исправление: в рабочем процессе мог произойти segmentation fault,
если использовались директивы "proxy_http_version 1.1" или
"fastcgi_keep_conn on".

*) Исправление: утечек памяти.
Спасибо Lanshun Zhou.

*) Исправление: в директиве disable_symlinks.

*) Исправление: при использовании ZFS размер кэша на диске мог считаться
некорректно; ошибка появилась в 1.0.1.

*) Исправление: nginx не собирался компилятором icc 12.1.

*) Исправление: nginx не собирался gcc на Solaris; ошибка появилась в
1.1.15.


Изменения в nginx 1.1.15 15.02.2012

*) Добавление: директива disable_symlinks.
Expand Down
10 changes: 5 additions & 5 deletions auto/cc/name
Expand Up @@ -63,16 +63,16 @@ if [ "$CC" = bcc32 ]; then
NGX_CC_NAME=bcc
echo " + using Borland C++ compiler"

else
if `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then
NGX_CC_NAME=gcc
echo " + using GNU C compiler"

else
if `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then
NGX_CC_NAME=icc
echo " + using Intel C++ compiler"

else
if `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then
NGX_CC_NAME=gcc
echo " + using GNU C compiler"

else
if `$CC -V 2>&1 | grep 'Sun C' >/dev/null 2>&1`; then
NGX_CC_NAME=sunc
Expand Down
4 changes: 2 additions & 2 deletions src/core/nginx.h
Expand Up @@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_


#define nginx_version 1001015
#define NGINX_VERSION "1.1.15"
#define nginx_version 1001016
#define NGINX_VERSION "1.1.16"
#define NGINX_VER "nginx/" NGINX_VERSION

#define NGINX_VAR "NGINX"
Expand Down
116 changes: 61 additions & 55 deletions src/core/ngx_open_file_cache.c
Expand Up @@ -229,6 +229,7 @@ ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name,
&& now - file->created < of->valid
#if (NGX_HAVE_OPENAT)
&& of->disable_symlinks == file->disable_symlinks
&& of->disable_symlinks_from == file->disable_symlinks_from
#endif
))
{
Expand Down Expand Up @@ -395,6 +396,7 @@ ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name,
file->err = of->err;
#if (NGX_HAVE_OPENAT)
file->disable_symlinks = of->disable_symlinks;
file->disable_symlinks_from = of->disable_symlinks_from;
#endif

if (of->err == 0) {
Expand Down Expand Up @@ -504,8 +506,8 @@ ngx_openat_file_owner(ngx_fd_t at_fd, const u_char *name,

fd = ngx_openat_file(at_fd, name, mode, create, access);

if (fd == NGX_FILE_ERROR) {
return NGX_FILE_ERROR;
if (fd == NGX_INVALID_FILE) {
return NGX_INVALID_FILE;
}

if (ngx_file_at_info(at_fd, name, &atfi, AT_SYMLINK_NOFOLLOW)
Expand Down Expand Up @@ -565,7 +567,6 @@ ngx_open_file_wrapper(ngx_str_t *name, ngx_open_file_info_t *of,
u_char *p, *cp, *end;
ngx_fd_t at_fd;
ngx_str_t at_name;
ngx_file_info_t fi;

if (of->disable_symlinks == NGX_DISABLE_SYMLINKS_OFF) {
fd = ngx_open_file(name->data, mode, create, access);
Expand All @@ -582,22 +583,45 @@ ngx_open_file_wrapper(ngx_str_t *name, ngx_open_file_info_t *of,
p = name->data;
end = p + name->len;

at_fd = AT_FDCWD;
at_name = *name;

if (p[0] == '/') {
at_fd = ngx_openat_file(at_fd, "/",
NGX_FILE_RDONLY|NGX_FILE_NONBLOCK,
NGX_FILE_OPEN, 0);
if (of->disable_symlinks_from) {

cp = p + of->disable_symlinks_from;

*cp = '\0';

if (at_fd == NGX_FILE_ERROR) {
at_fd = ngx_open_file(p, NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,
NGX_FILE_OPEN, 0);

*cp = '/';

if (at_fd == NGX_INVALID_FILE) {
of->err = ngx_errno;
of->failed = ngx_open_file_n;
return NGX_INVALID_FILE;
}

at_name.len = of->disable_symlinks_from;
p = cp + 1;

} else if (*p == '/') {

at_fd = ngx_open_file("/",
NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,
NGX_FILE_OPEN, 0);

if (at_fd == NGX_INVALID_FILE) {
of->err = ngx_errno;
of->failed = ngx_openat_file_n;
return NGX_FILE_ERROR;
return NGX_INVALID_FILE;
}

at_name.len = 1;
p++;

} else {
at_fd = NGX_AT_FDCWD;
}

for ( ;; ) {
Expand All @@ -615,12 +639,12 @@ ngx_open_file_wrapper(ngx_str_t *name, ngx_open_file_info_t *of,

if (of->disable_symlinks == NGX_DISABLE_SYMLINKS_NOTOWNER) {
fd = ngx_openat_file_owner(at_fd, p,
NGX_FILE_RDONLY|NGX_FILE_NONBLOCK,
NGX_FILE_SEARCH|NGX_FILE_NONBLOCK,
NGX_FILE_OPEN, 0, log);

} else {
fd = ngx_openat_file(at_fd, p,
NGX_FILE_RDONLY|NGX_FILE_NONBLOCK|NGX_FILE_NOFOLLOW,
NGX_FILE_SEARCH|NGX_FILE_NONBLOCK|NGX_FILE_NOFOLLOW,
NGX_FILE_OPEN, 0);
}

Expand All @@ -632,67 +656,54 @@ ngx_open_file_wrapper(ngx_str_t *name, ngx_open_file_info_t *of,
goto failed;
}

if (at_fd != AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) {
if (at_fd != NGX_AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
ngx_close_file_n " \"%V\" failed", at_name);
ngx_close_file_n " \"%V\" failed", &at_name);
}

p = cp + 1;
at_fd = fd;
at_name.len = cp - at_name.data;
}

if (p == end && at_fd != AT_FDCWD) {
if (p == end) {

/*
* If pathname ends with a trailing slash, check if last path
* component is a directory; if not, fail with ENOTDIR as per
* POSIX.
*
* We use separate check instead of O_DIRECTORY in the loop above,
* as O_DIRECTORY doesn't work on FreeBSD 8.
* If pathname ends with a trailing slash, assume the last path
* component is a directory and reopen it with requested flags;
* if not, fail with ENOTDIR as per POSIX.
*
* Note this returns already opened file descriptor, with different
* mode/create/access. This is believed to be safe as we don't
* use this codepath to create directories.
* We cannot rely on O_DIRECTORY in the loop above to check
* that the last path component is a directory because
* O_DIRECTORY doesn't work on FreeBSD 8. Fortunately, by
* reopening a directory, we don't depend on it at all.
*/

if (ngx_fd_info(at_fd, &fi) == NGX_FILE_ERROR) {
of->err = ngx_errno;
of->failed = ngx_fd_info_n;
fd = NGX_INVALID_FILE;

goto failed;
}

if (ngx_is_dir(&fi)) {
return at_fd;
}

of->err = ENOTDIR;
of->failed = ngx_openat_file_n;
fd = NGX_INVALID_FILE;

goto failed;
fd = ngx_openat_file(at_fd, ".", mode, create, access);
goto done;
}

if (of->disable_symlinks == NGX_DISABLE_SYMLINKS_NOTOWNER) {
if (of->disable_symlinks == NGX_DISABLE_SYMLINKS_NOTOWNER
&& !(create & (NGX_FILE_CREATE_OR_OPEN|NGX_FILE_TRUNCATE)))
{
fd = ngx_openat_file_owner(at_fd, p, mode, create, access, log);

} else {
fd = ngx_openat_file(at_fd, p, mode|NGX_FILE_NOFOLLOW, create, access);
}

done:

if (fd == NGX_INVALID_FILE) {
of->err = ngx_errno;
of->failed = ngx_openat_file_n;
}

failed:

if (at_fd != AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) {
if (at_fd != NGX_AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
ngx_close_file_n " \"%V\" failed", at_name);
ngx_close_file_n " \"%V\" failed", &at_name);
}

return fd;
Expand Down Expand Up @@ -1131,20 +1142,15 @@ ngx_open_file_lookup(ngx_open_file_cache_t *cache, ngx_str_t *name,

/* hash == node->key */

do {
file = (ngx_cached_open_file_t *) node;

rc = ngx_strcmp(name->data, file->name);
file = (ngx_cached_open_file_t *) node;

if (rc == 0) {
return file;
}
rc = ngx_strcmp(name->data, file->name);

node = (rc < 0) ? node->left : node->right;

} while (node != sentinel && hash == node->key);
if (rc == 0) {
return file;
}

break;
node = (rc < 0) ? node->left : node->right;
}

return NULL;
Expand Down
2 changes: 2 additions & 0 deletions src/core/ngx_open_file_cache.h
Expand Up @@ -33,6 +33,7 @@ typedef struct {
ngx_uint_t min_uses;

#if (NGX_HAVE_OPENAT)
size_t disable_symlinks_from;
unsigned disable_symlinks:2;
#endif

Expand Down Expand Up @@ -69,6 +70,7 @@ struct ngx_cached_open_file_s {
uint32_t uses;

#if (NGX_HAVE_OPENAT)
size_t disable_symlinks_from;
unsigned disable_symlinks:2;
#endif

Expand Down
28 changes: 12 additions & 16 deletions src/core/ngx_resolver.c
Expand Up @@ -189,11 +189,6 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
uc->sockaddr = u.addrs->sockaddr;
uc->socklen = u.addrs->socklen;
uc->server = u.addrs->name;

uc->log = cf->cycle->new_log;
uc->log.handler = ngx_resolver_log_error;
uc->log.data = uc;
uc->log.action = "resolving";
}

return r;
Expand Down Expand Up @@ -876,6 +871,12 @@ ngx_resolver_send_query(ngx_resolver_t *r, ngx_resolver_node_t *rn)
}

if (uc->connection == NULL) {

uc->log = *r->log;
uc->log.handler = ngx_resolver_log_error;
uc->log.data = uc;
uc->log.action = "resolving";

if (ngx_udp_connect(uc) != NGX_OK) {
return NGX_ERROR;
}
Expand Down Expand Up @@ -1688,20 +1689,15 @@ ngx_resolver_lookup_name(ngx_resolver_t *r, ngx_str_t *name, uint32_t hash)

/* hash == node->key */

do {
rn = (ngx_resolver_node_t *) node;

rc = ngx_memn2cmp(name->data, rn->name, name->len, rn->nlen);
rn = (ngx_resolver_node_t *) node;

if (rc == 0) {
return rn;
}
rc = ngx_memn2cmp(name->data, rn->name, name->len, rn->nlen);

node = (rc < 0) ? node->left : node->right;

} while (node != sentinel && hash == node->key);
if (rc == 0) {
return rn;
}

break;
node = (rc < 0) ? node->left : node->right;
}

/* not found */
Expand Down

0 comments on commit 55ebd60

Please sign in to comment.