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;
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;
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;
return NGX_ERROR;
}
- if (step != st_msec && !sec) {
+ if (step != st_msec && !is_sec) {
scale *= 1000;
max /= 1000;
}
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++;
{ 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),
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),
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) {
"content type: \"%V\", "
"old content type: \"%V\"",
&value[i], content_type, old);
- continue;
+ goto next;
}
}
type->key = value[i];
type->key_hash = hash;
type->value = content_type;
+
+ next:
+ continue;
}
return NGX_CONF_OK;
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
*/
}
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;
}
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);
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);