From 3ca233ee5cc0e00fc0d854f779ba5c78cf6b0cba Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 28 Dec 2005 14:23:52 +0000 Subject: nginx-0.3.19-RELEASE import *) Feature: the "path" and "alias" directives support the variables. *) Change: now the "valid_referers" directive again checks the URI part. *) Bugfix: in SSI handling. --- src/core/nginx.h | 2 +- src/core/ngx_buf.h | 5 +++++ src/core/ngx_hash.c | 23 ++++++++++++----------- 3 files changed, 18 insertions(+), 12 deletions(-) (limited to 'src/core') diff --git a/src/core/nginx.h b/src/core/nginx.h index 511a7c9fb..a15f58e1a 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.3.18" +#define NGINX_VER "nginx/0.3.19" #define NGINX_VAR "NGINX" #define NGX_OLDPID_EXT ".oldbin" diff --git a/src/core/ngx_buf.h b/src/core/ngx_buf.h index 625db2a93..ec55ef3a0 100644 --- a/src/core/ngx_buf.h +++ b/src/core/ngx_buf.h @@ -105,10 +105,15 @@ typedef struct { #define ngx_buf_in_memory(b) (b->temporary || b->memory || b->mmap) #define ngx_buf_in_memory_only(b) (ngx_buf_in_memory(b) && !b->in_file) + #define ngx_buf_special(b) \ ((b->flush || b->last_buf || b->sync) \ && !ngx_buf_in_memory(b) && !b->in_file) +#define ngx_buf_sync_only(b) \ + (b->sync \ + && !ngx_buf_in_memory(b) && !b->in_file && !b->flush && !b->last_buf) + #define ngx_buf_size(b) \ (ngx_buf_in_memory(b) ? (off_t) (b->last - b->pos): \ (b->file_last - b->file_pos)) diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c index f43d67533..0a1d69d9b 100644 --- a/src/core/ngx_hash.c +++ b/src/core/ngx_hash.c @@ -129,13 +129,14 @@ ngx_hash_find_wildcard(ngx_hash_wildcard_t *hwc, u_char *name, size_t len) #define NGX_HASH_ELT_SIZE(name) \ - sizeof(void *) + ngx_align((name)->key.len + 1, sizeof(void *)) + (sizeof(void *) + ngx_align((name)->key.len + 1, sizeof(void *))) ngx_int_t ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts) { u_char *elts; - size_t *test, len; + size_t len; + u_short *test; ngx_uint_t i, n, key, size, start, bucket_size; ngx_hash_elt_t *elt, **buckets; @@ -151,14 +152,14 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts) if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *)) { ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0, - "could not build the %s hash, you should " + "could not build the %s, you should " "increase %s_bucket_size: %i", hinit->name, hinit->name, hinit->bucket_size); return NGX_ERROR; } } - test = ngx_alloc(hinit->max_size * sizeof(size_t), hinit->pool->log); + test = ngx_alloc(hinit->max_size * sizeof(u_short), hinit->pool->log); if (test == NULL) { return NGX_ERROR; } @@ -170,7 +171,7 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts) for (size = start; size < hinit->max_size; size++) { - ngx_memzero(test, size * sizeof(size_t)); + ngx_memzero(test, size * sizeof(u_short)); for (n = 0; n < nelts; n++) { if (names[n].key.data == NULL) { @@ -178,7 +179,7 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts) } key = names[n].key_hash % size; - test[key] += NGX_HASH_ELT_SIZE(&names[n]); + test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n])); #if 0 ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0, @@ -186,7 +187,7 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts) size, key, test[key], &names[n].key); #endif - if (test[key] > bucket_size) { + if (test[key] > (u_short) bucket_size) { goto next; } } @@ -199,7 +200,7 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts) } ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0, - "could not build the %s hash, you should increase " + "could not build the %s, you should increase " "either %s_max_size: %i or %s_bucket_size: %i", hinit->name, hinit->name, hinit->max_size, hinit->name, hinit->bucket_size); @@ -220,7 +221,7 @@ found: } key = names[n].key_hash % size; - test[key] += NGX_HASH_ELT_SIZE(&names[n]); + test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n])); } len = 0; @@ -230,7 +231,7 @@ found: continue; } - test[i] = ngx_align(test[i], ngx_cacheline_size); + test[i] = (u_short) (ngx_align(test[i], ngx_cacheline_size)); len += test[i]; } @@ -291,7 +292,7 @@ found: elt->name[i] = ngx_tolower(names[n].key.data[i]); } - test[key] += NGX_HASH_ELT_SIZE(&names[n]); + test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n])); } for (i = 0; i < size; i++) { -- cgit v1.2.3