Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4242 - in branches/stable-1.0: . src/core src/http src/http/modules

November 01, 2011 07:22AM
Author: is
Date: 2011-11-01 11:19:58 +0000 (Tue, 01 Nov 2011)
New Revision: 4242

Modified:
branches/stable-1.0/
branches/stable-1.0/src/core/ngx_parse.c
branches/stable-1.0/src/core/ngx_parse.h
branches/stable-1.0/src/http/modules/ngx_http_referer_module.c
branches/stable-1.0/src/http/ngx_http_core_module.c
branches/stable-1.0/src/http/ngx_http_special_response.c
Log:
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:

Miscellaneous fixes:

*) Fix of names of the referer hash size directives introduced in r3940.

*) Cosmetics: replaced NGX_CONF_TAKE1 to NGX_CONF_FLAG for "sendfile"
and "chunked_transfer_encoding" directives, to be in line with all
directives taking a boolean argument. Both flags will ensure that
a directive takes one argument.

*) Improved ngx_parse_time() code readability.

*) Preallocating exact number of default MIME types entries.

*) Stylistic change in checking the boolean expression.

*) Replaced magic constants representing default values of some directives
with appropriate #define's.

*) Fixed grammar in a comment.

*) Fixed two minor bugs in "types" parsing code.



Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:3960-3974,3977-3987,3991-3996,3998,4003-4007,4010-4012,4015-4016,4018,4023,4025-4027,4035-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4131,4135-4137,4154,4156-4157,4192
+ /trunk:3960-3974,3977-3987,3991-3996,3998,4003-4007,4009-4012,4015-4016,4018,4023,4025-4027,4035-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4131,4133,4135-4137,4154,4156-4157,4184,4192,4201-4205

Modified: branches/stable-1.0/src/core/ngx_parse.c
===================================================================
--- branches/stable-1.0/src/core/ngx_parse.c 2011-11-01 11:06:31 UTC (rev 4241)
+++ branches/stable-1.0/src/core/ngx_parse.c 2011-11-01 11:19:58 UTC (rev 4242)
@@ -93,7 +93,7 @@


ngx_int_t
-ngx_parse_time(ngx_str_t *line, ngx_uint_t sec)
+ngx_parse_time(ngx_str_t *line, ngx_uint_t is_sec)
{
u_char *p, *last;
ngx_int_t value, total, scale;
@@ -114,8 +114,8 @@
valid = 0;
value = 0;
total = 0;
- step = sec ? st_start : st_month;
- scale = sec ? 1 : 1000;
+ step = is_sec ? st_start : st_month;
+ scale = is_sec ? 1 : 1000;

p = line->data;
last = p + line->len;
@@ -135,81 +135,81 @@
return NGX_ERROR;
}
step = st_year;
- max = 68;
+ max = NGX_MAX_INT32_VALUE / (60 * 60 * 24 * 365);
scale = 60 * 60 * 24 * 365;
break;

case 'M':
- if (step > st_year) {
+ if (step >= st_month) {
return NGX_ERROR;
}
step = st_month;
- max = 828;
+ max = NGX_MAX_INT32_VALUE / (60 * 60 * 24 * 30);
scale = 60 * 60 * 24 * 30;
break;

case 'w':
- if (step > st_month) {
+ if (step >= st_week) {
return NGX_ERROR;
}
step = st_week;
- max = 3550;
+ max = NGX_MAX_INT32_VALUE / (60 * 60 * 24 * 7);
scale = 60 * 60 * 24 * 7;
break;

case 'd':
- if (step > st_week) {
+ if (step >= st_day) {
return NGX_ERROR;
}
step = st_day;
- max = 24855;
+ max = NGX_MAX_INT32_VALUE / (60 * 60 * 24);
scale = 60 * 60 * 24;
break;

case 'h':
- if (step > st_day) {
+ if (step >= st_hour) {
return NGX_ERROR;
}
step = st_hour;
- max = 596523;
+ max = NGX_MAX_INT32_VALUE / (60 * 60);
scale = 60 * 60;
break;

case 'm':
if (*p == 's') {
- if (sec || step > st_sec) {
+ if (is_sec || step >= st_msec) {
return NGX_ERROR;
}
p++;
step = st_msec;
- max = 2147483647;
+ max = NGX_MAX_INT32_VALUE;
scale = 1;
break;
}

- if (step > st_hour) {
+ if (step >= st_min) {
return NGX_ERROR;
}
step = st_min;
- max = 35791394;
+ max = NGX_MAX_INT32_VALUE / 60;
scale = 60;
break;

case 's':
- if (step > st_min) {
+ if (step >= st_sec) {
return NGX_ERROR;
}
step = st_sec;
- max = 2147483647;
+ max = NGX_MAX_INT32_VALUE;
scale = 1;
break;

case ' ':
- if (step > st_min) {
+ if (step >= st_sec) {
return NGX_ERROR;
}
step = st_last;
- max = 2147483647;
+ max = NGX_MAX_INT32_VALUE;
scale = 1;
break;

@@ -217,7 +217,7 @@
return NGX_ERROR;
}

- if (step != st_msec && !sec) {
+ if (step != st_msec && !is_sec) {
scale *= 1000;
max /= 1000;
}
@@ -228,12 +228,12 @@

total += value * scale;

- if ((ngx_uint_t) total > 2147483647) {
+ if ((ngx_uint_t) total > NGX_MAX_INT32_VALUE) {
return NGX_ERROR;
}

value = 0;
- scale = sec ? 1 : 1000;
+ scale = is_sec ? 1 : 1000;

while (p < last && *p == ' ') {
p++;

Modified: branches/stable-1.0/src/core/ngx_parse.h
===================================================================
--- branches/stable-1.0/src/core/ngx_parse.h 2011-11-01 11:06:31 UTC (rev 4241)
+++ branches/stable-1.0/src/core/ngx_parse.h 2011-11-01 11:19:58 UTC (rev 4242)
@@ -17,7 +17,7 @@

ssize_t ngx_parse_size(ngx_str_t *line);
off_t ngx_parse_offset(ngx_str_t *line);
-ngx_int_t ngx_parse_time(ngx_str_t *line, ngx_uint_t sec);
+ngx_int_t ngx_parse_time(ngx_str_t *line, ngx_uint_t is_sec);


#endif /* _NGX_PARSE_H_INCLUDED_ */

Modified: branches/stable-1.0/src/http/modules/ngx_http_referer_module.c
===================================================================
--- branches/stable-1.0/src/http/modules/ngx_http_referer_module.c 2011-11-01 11:06:31 UTC (rev 4241)
+++ branches/stable-1.0/src/http/modules/ngx_http_referer_module.c 2011-11-01 11:19:58 UTC (rev 4242)
@@ -309,7 +309,7 @@
hash.key = ngx_hash_key_lc;
hash.max_size = conf->referer_hash_max_size;
hash.bucket_size = conf->referer_hash_bucket_size;
- hash.name = "referers_hash";
+ hash.name = "referer_hash";
hash.pool = cf->pool;

if (conf->keys->keys.nelts) {

Modified: branches/stable-1.0/src/http/ngx_http_core_module.c
===================================================================
--- branches/stable-1.0/src/http/ngx_http_core_module.c 2011-11-01 11:06:31 UTC (rev 4241)
+++ branches/stable-1.0/src/http/ngx_http_core_module.c 2011-11-01 11:19:58 UTC (rev 4242)
@@ -402,7 +402,7 @@

{ ngx_string("sendfile"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
- |NGX_CONF_TAKE1,
+ |NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_core_loc_conf_t, sendfile),
@@ -639,7 +639,7 @@
NULL },

{ ngx_string("chunked_transfer_encoding"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_core_loc_conf_t, chunked_transfer_encoding),
@@ -2995,6 +2995,12 @@
value = cf->args->elts;

if (ngx_strcmp(value[0].data, "include") == 0) {
+ if (cf->args->nelts != 2) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid number of arguments"
+ " in \"include\" directive");
+ return NGX_CONF_ERROR;
+ }
file = value[1];

if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
@@ -3028,7 +3034,7 @@
"content type: \"%V\", "
"old content type: \"%V\"",
&value[i], content_type, old);
- continue;
+ goto next;
}
}

@@ -3041,6 +3047,9 @@
type->key = value[i];
type->key_hash = hash;
type->value = content_type;
+
+ next:
+ continue;
}

return NGX_CONF_OK;
@@ -3374,7 +3383,7 @@
ngx_cacheline_size);

/*
- * the special handling the "types" directive in the "http" section
+ * the special handling of the "types" directive in the "http" section
* to inherit the http's conf->types_hash to all servers
*/

@@ -3401,7 +3410,7 @@
}

if (conf->types == NULL) {
- conf->types = ngx_array_create(cf->pool, 4, sizeof(ngx_hash_key_t));
+ conf->types = ngx_array_create(cf->pool, 3, sizeof(ngx_hash_key_t));
if (conf->types == NULL) {
return NGX_CONF_ERROR;
}
@@ -3468,9 +3477,10 @@
ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,
NGX_HTTP_IMS_EXACT);
ngx_conf_merge_uint_value(conf->max_ranges, prev->max_ranges,
- 0x7fffffff);
+ NGX_MAX_INT32_VALUE);
ngx_conf_merge_uint_value(conf->client_body_in_file_only,
- prev->client_body_in_file_only, 0);
+ prev->client_body_in_file_only,
+ NGX_HTTP_REQUEST_BODY_FILE_OFF);
ngx_conf_merge_value(conf->client_body_in_single_buffer,
prev->client_body_in_single_buffer, 0);
ngx_conf_merge_value(conf->internal, prev->internal, 0);
@@ -3478,11 +3488,11 @@
ngx_conf_merge_size_value(conf->sendfile_max_chunk,
prev->sendfile_max_chunk, 0);
#if (NGX_HAVE_FILE_AIO)
- ngx_conf_merge_value(conf->aio, prev->aio, 0);
+ ngx_conf_merge_value(conf->aio, prev->aio, NGX_HTTP_AIO_OFF);
#endif
ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0);
ngx_conf_merge_off_value(conf->directio, prev->directio,
- NGX_MAX_OFF_T_VALUE);
+ NGX_OPEN_FILE_DIRECTIO_OFF);
ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment,
512);
ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0);

Modified: branches/stable-1.0/src/http/ngx_http_special_response.c
===================================================================
--- branches/stable-1.0/src/http/ngx_http_special_response.c 2011-11-01 11:06:31 UTC (rev 4241)
+++ branches/stable-1.0/src/http/ngx_http_special_response.c 2011-11-01 11:19:58 UTC (rev 4242)
@@ -375,7 +375,7 @@
}
}

- if (r->lingering_close == 1) {
+ if (r->lingering_close) {
switch (error) {
case NGX_HTTP_BAD_REQUEST:
case NGX_HTTP_TO_HTTPS:

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4242 - in branches/stable-1.0: . src/core src/http src/http/modules

Igor Sysoev 1795 November 01, 2011 07:22AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 293
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready