diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-01-26 14:41:41 +0000 |
---|---|---|
committer | Jonathan Kolb <jon@b0g.us> | 2009-01-26 14:41:41 +0000 |
commit | 8c8f282115306674d70fa7a7bbc4f375d8300679 (patch) | |
tree | 6be6f36b6222329f4b1d684a97e450357add3872 | |
parent | a1ff67ef62e23acd419d67c6991a23d402fd333c (diff) | |
download | nginx-8c8f282115306674d70fa7a7bbc4f375d8300679.tar.gz |
Changes with nginx 0.7.32 26 Jan 2009v0.7.32
*) Feature: now a directory existence testing can be set explicitly in
the "try_files" directive.
*) Bugfix: fastcgi_store stored files not always.
*) Bugfix: in geo ranges.
*) Bugfix: in shared memory allocations if nginx was built without
debugging.
Thanks to Andrey Kvasov.
-rw-r--r-- | CHANGES | 14 | ||||
-rw-r--r-- | CHANGES.ru | 14 | ||||
-rw-r--r-- | src/core/nginx.h | 2 | ||||
-rw-r--r-- | src/core/ngx_cycle.c | 4 | ||||
-rw-r--r-- | src/core/ngx_open_file_cache.c | 2 | ||||
-rw-r--r-- | src/core/ngx_slab.c | 5 | ||||
-rw-r--r-- | src/http/modules/ngx_http_fastcgi_module.c | 58 | ||||
-rw-r--r-- | src/http/modules/ngx_http_geo_module.c | 4 | ||||
-rw-r--r-- | src/http/modules/ngx_http_gzip_filter_module.c | 18 | ||||
-rw-r--r-- | src/http/modules/perl/nginx.pm | 2 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.c | 10 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.h | 1 | ||||
-rw-r--r-- | src/http/ngx_http_upstream.c | 2 |
13 files changed, 98 insertions, 38 deletions
@@ -1,4 +1,18 @@ +Changes with nginx 0.7.32 26 Jan 2009 + + *) Feature: now a directory existence testing can be set explicitly in + the "try_files" directive. + + *) Bugfix: fastcgi_store stored files not always. + + *) Bugfix: in geo ranges. + + *) Bugfix: in shared memory allocations if nginx was built without + debugging. + Thanks to Andrey Kvasov. + + Changes with nginx 0.7.31 19 Jan 2009 *) Change: now the "try_files" directive tests files only and ignores diff --git a/CHANGES.ru b/CHANGES.ru index 524319f1f..6dd328552 100644 --- a/CHANGES.ru +++ b/CHANGES.ru @@ -1,4 +1,18 @@ +Изменения в nginx 0.7.32 26.01.2009 + + *) Добавление: теперь в директиве try_files можно явно указать проверку + каталога. + + *) Исправление: fastcgi_store не всегда сохранял файлы. + + *) Исправление: в гео-диапазонах. + + *) Исправление: ошибки выделения больших блоков в разделяемой памяти, + если nginx был собран без отладки. + Спасибо Андрею Квасову. + + Изменения в nginx 0.7.31 19.01.2009 *) Изменение: теперь директива try_files проверяет только файлы, diff --git a/src/core/nginx.h b/src/core/nginx.h index b38a7b146..7ff13ca12 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VERSION "0.7.31" +#define NGINX_VERSION "0.7.32" #define NGINX_VER "nginx/" NGINX_VERSION #define NGINX_VAR "NGINX" diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index cdebf5645..aa0d9ce7e 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -394,6 +394,10 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) cycle->log = cycle->new_log; pool->log = cycle->new_log; + if (cycle->log->log_level == 0) { + cycle->log->log_level = NGX_LOG_ERR; + } + /* create shared memory */ diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c index f9c6a459a..60a8368be 100644 --- a/src/core/ngx_open_file_cache.c +++ b/src/core/ngx_open_file_cache.c @@ -457,7 +457,7 @@ ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, ngx_log_t *log) goto failed; } - if (of->is_dir) { + if (ngx_is_dir(&fi)) { goto done; } } diff --git a/src/core/ngx_slab.c b/src/core/ngx_slab.c index 233544b22..412f42879 100644 --- a/src/core/ngx_slab.c +++ b/src/core/ngx_slab.c @@ -661,11 +661,8 @@ ngx_slab_alloc_pages(ngx_slab_pool_t *pool, ngx_uint_t pages) } page->slab = pages | NGX_SLAB_PAGE_START; - -#if (NGX_DEBUG) page->next = NULL; page->prev = NGX_SLAB_PAGE; -#endif if (--pages == 0) { return page; @@ -673,10 +670,8 @@ ngx_slab_alloc_pages(ngx_slab_pool_t *pool, ngx_uint_t pages) for (p = page + 1; pages; pages--) { p->slab = NGX_SLAB_PAGE_BUSY; -#if (NGX_DEBUG) p->next = NULL; p->prev = NGX_SLAB_PAGE; -#endif p++; } diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c index f3ea63a74..45b647505 100644 --- a/src/http/modules/ngx_http_fastcgi_module.c +++ b/src/http/modules/ngx_http_fastcgi_module.c @@ -135,8 +135,8 @@ static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_fastcgi_path_info_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); -static ngx_int_t ngx_http_fastcgi_split(ngx_http_request_t *r, - ngx_http_fastcgi_ctx_t *f, ngx_http_fastcgi_loc_conf_t *flcf); +static ngx_http_fastcgi_ctx_t *ngx_http_fastcgi_split(ngx_http_request_t *r, + ngx_http_fastcgi_loc_conf_t *flcf); static char *ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); @@ -2111,10 +2111,11 @@ ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, ngx_http_fastcgi_ctx_t *f; ngx_http_fastcgi_loc_conf_t *flcf; - f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module); flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); - if (ngx_http_fastcgi_split(r, f, flcf) != NGX_OK) { + f = ngx_http_fastcgi_split(r, flcf); + + if (f == NULL) { return NGX_ERROR; } @@ -2151,10 +2152,11 @@ ngx_http_fastcgi_path_info_variable(ngx_http_request_t *r, ngx_http_fastcgi_ctx_t *f; ngx_http_fastcgi_loc_conf_t *flcf; - f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module); flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); - if (ngx_http_fastcgi_split(r, f, flcf) != NGX_OK) { + f = ngx_http_fastcgi_split(r, flcf); + + if (f == NULL) { return NGX_ERROR; } @@ -2168,35 +2170,46 @@ ngx_http_fastcgi_path_info_variable(ngx_http_request_t *r, } -static ngx_int_t -ngx_http_fastcgi_split(ngx_http_request_t *r, ngx_http_fastcgi_ctx_t *f, - ngx_http_fastcgi_loc_conf_t *flcf) +static ngx_http_fastcgi_ctx_t * +ngx_http_fastcgi_split(ngx_http_request_t *r, ngx_http_fastcgi_loc_conf_t *flcf) { + ngx_http_fastcgi_ctx_t *f; #if (NGX_PCRE) - ngx_int_t n; - int captures[(1 + 2) * 3]; + ngx_int_t n; + int captures[(1 + 2) * 3]; + + f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module); + + if (f == NULL) { + f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t)); + if (f == NULL) { + return NULL; + } + + ngx_http_set_ctx(r, f, ngx_http_fastcgi_module); + } if (f->script_name.len) { - return NGX_OK; + return f; } if (flcf->split_regex == NULL) { f->script_name = r->uri; - return NGX_OK; + return f; } n = ngx_regex_exec(flcf->split_regex, &r->uri, captures, (1 + 2) * 3); if (n == NGX_REGEX_NO_MATCHED) { f->script_name = r->uri; - return NGX_OK; + return f; } if (n < 0) { ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, ngx_regex_exec_n " failed: %d on \"%V\" using \"%V\"", n, &r->uri, &flcf->split_name); - return NGX_ERROR; + return NULL; } /* match */ @@ -2207,13 +2220,24 @@ ngx_http_fastcgi_split(ngx_http_request_t *r, ngx_http_fastcgi_ctx_t *f, f->path_info.len = captures[5] - captures[4]; f->path_info.data = r->uri.data + f->script_name.len; - return NGX_OK; + return f; #else + f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module); + + if (f == NULL) { + f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t)); + if (f == NULL) { + return NULL; + } + + ngx_http_set_ctx(r, f, ngx_http_fastcgi_module); + } + f->script_name = r->uri; - return NGX_OK; + return f; #endif } diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c index 5535eb299..bd6499ec7 100644 --- a/src/http/modules/ngx_http_geo_module.c +++ b/src/http/modules/ngx_http_geo_module.c @@ -636,8 +636,8 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, range = a->elts; - ngx_memcpy(&range[i + 2], &range[i + 1], - (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); + ngx_memcpy(&range[i + 1], &range[i], + (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t)); range[i + 1].start = (u_short) (e + 1); diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c index 217331d80..905349933 100644 --- a/src/http/modules/ngx_http_gzip_filter_module.c +++ b/src/http/modules/ngx_http_gzip_filter_module.c @@ -302,18 +302,18 @@ ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in) if (ctx->buffering) { if (in) { - switch (ngx_http_gzip_filter_copy_recycled(ctx, in)) { + switch (ngx_http_gzip_filter_copy_recycled(ctx, in)) { - case NGX_OK: - return NGX_OK; + case NGX_OK: + return NGX_OK; - case NGX_DONE: - in = NULL; - break; + case NGX_DONE: + in = NULL; + break; - default: /* NGX_ERROR */ - goto failed; - } + default: /* NGX_ERROR */ + goto failed; + } } else { ctx->buffering = 0; diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm index 9117639c4..3b97cb81e 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.31'; +our $VERSION = '0.7.32'; 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 d44933ca3..c22e71776 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1038,6 +1038,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r, ssize_t reserve, allocated; u_char *p, *name; ngx_str_t path; + ngx_uint_t test_dir; ngx_http_try_file_t *tf; ngx_open_file_info_t of; ngx_http_script_code_pt code; @@ -1133,6 +1134,8 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r, } } + test_dir = tf->test_dir; + tf++; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, @@ -1172,7 +1175,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r, continue; } - if (!of.is_file) { + if (of.is_dir && !test_dir) { continue; } @@ -3853,6 +3856,11 @@ ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) tf[i].name = value[i + 1]; + if (tf[i].name.data[tf[i].name.len - 1] == '/') { + tf[i].test_dir = 1; + tf[i].name.len--; + } + n = ngx_http_script_variables_count(&tf[i].name); if (n) { diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h index 5be856123..46acb2b4f 100644 --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -245,6 +245,7 @@ typedef struct { ngx_array_t *lengths; ngx_array_t *values; ngx_str_t name; + ngx_uint_t test_dir; /* unsigned test_dir:1; */ } ngx_http_try_file_t; diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index c6d32877c..6ed7c8f1c 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2217,7 +2217,7 @@ ngx_http_upstream_process_request(ngx_http_request_t *r) tf = u->pipe->temp_file; - if (p->upstream_eof) { + if (p->upstream_eof || p->upstream_done) { if (u->headers_in.status_n == NGX_HTTP_OK && (u->headers_in.content_length_n == -1 |