From 11a1dc0e6739e733330819d1b7b42f386f13017d Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 6 Feb 2009 18:59:34 +0100 Subject: [PATCH] upgrade to 0.7.32 --- nginx/CHANGES | 14 +++++ nginx/CHANGES.ru | 14 +++++ nginx/src/core/nginx.h | 2 +- nginx/src/core/ngx_cycle.c | 4 ++ nginx/src/core/ngx_open_file_cache.c | 2 +- nginx/src/core/ngx_slab.c | 5 -- .../http/modules/ngx_http_fastcgi_module.c | 58 +++++++++++++------ nginx/src/http/modules/ngx_http_geo_module.c | 4 +- .../modules/ngx_http_gzip_filter_module.c | 18 +++--- nginx/src/http/modules/perl/nginx.pm | 2 +- nginx/src/http/ngx_http_core_module.c | 10 +++- nginx/src/http/ngx_http_core_module.h | 1 + nginx/src/http/ngx_http_upstream.c | 2 +- 13 files changed, 98 insertions(+), 38 deletions(-) diff --git a/nginx/CHANGES b/nginx/CHANGES index 8c98dcd..a0e3005 100644 --- a/nginx/CHANGES +++ b/nginx/CHANGES @@ -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/nginx/CHANGES.ru b/nginx/CHANGES.ru index 524319f..6dd3285 100644 --- a/nginx/CHANGES.ru +++ b/nginx/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/nginx/src/core/nginx.h b/nginx/src/core/nginx.h index b38a7b1..7ff13ca 100644 --- a/nginx/src/core/nginx.h +++ b/nginx/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/nginx/src/core/ngx_cycle.c b/nginx/src/core/ngx_cycle.c index cdebf56..aa0d9ce 100644 --- a/nginx/src/core/ngx_cycle.c +++ b/nginx/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/nginx/src/core/ngx_open_file_cache.c b/nginx/src/core/ngx_open_file_cache.c index f9c6a45..60a8368 100644 --- a/nginx/src/core/ngx_open_file_cache.c +++ b/nginx/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/nginx/src/core/ngx_slab.c b/nginx/src/core/ngx_slab.c index 233544b..412f428 100644 --- a/nginx/src/core/ngx_slab.c +++ b/nginx/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/nginx/src/http/modules/ngx_http_fastcgi_module.c b/nginx/src/http/modules/ngx_http_fastcgi_module.c index f3ea63a..45b6475 100644 --- a/nginx/src/http/modules/ngx_http_fastcgi_module.c +++ b/nginx/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/nginx/src/http/modules/ngx_http_geo_module.c b/nginx/src/http/modules/ngx_http_geo_module.c index 5535eb2..bd6499e 100644 --- a/nginx/src/http/modules/ngx_http_geo_module.c +++ b/nginx/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/nginx/src/http/modules/ngx_http_gzip_filter_module.c b/nginx/src/http/modules/ngx_http_gzip_filter_module.c index 217331d..9053499 100644 --- a/nginx/src/http/modules/ngx_http_gzip_filter_module.c +++ b/nginx/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/nginx/src/http/modules/perl/nginx.pm b/nginx/src/http/modules/perl/nginx.pm index 9117639..3b97cb8 100644 --- a/nginx/src/http/modules/perl/nginx.pm +++ b/nginx/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/nginx/src/http/ngx_http_core_module.c b/nginx/src/http/ngx_http_core_module.c index d44933c..c22e717 100644 --- a/nginx/src/http/ngx_http_core_module.c +++ b/nginx/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/nginx/src/http/ngx_http_core_module.h b/nginx/src/http/ngx_http_core_module.h index 5be8561..46acb2b 100644 --- a/nginx/src/http/ngx_http_core_module.h +++ b/nginx/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/nginx/src/http/ngx_http_upstream.c b/nginx/src/http/ngx_http_upstream.c index c6d3287..6ed7c8f 100644 --- a/nginx/src/http/ngx_http_upstream.c +++ b/nginx/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 -- 2.20.1