Mercurial > hg > nginx-ranges
diff src/http/ngx_http_core_module.c @ 539:5f4de8cf0d9d
Merge with current.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 15 Sep 2009 03:43:40 +0400 |
parents | 0161f3197817 |
children | 4c5d2c627a6c |
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -104,6 +104,20 @@ static ngx_conf_enum_t ngx_http_core_re }; +#if (NGX_HAVE_FILE_AIO) + +static ngx_conf_enum_t ngx_http_core_aio[] = { + { ngx_string("off"), NGX_HTTP_AIO_OFF }, + { ngx_string("on"), NGX_HTTP_AIO_ON }, +#if (NGX_HAVE_AIO_SENDFILE) + { ngx_string("sendfile"), NGX_HTTP_AIO_SENDFILE }, +#endif + { ngx_null_string, 0 } +}; + +#endif + + static ngx_conf_enum_t ngx_http_core_satisfy[] = { { ngx_string("all"), NGX_HTTP_SATISFY_ALL }, { ngx_string("any"), NGX_HTTP_SATISFY_ANY }, @@ -383,6 +397,17 @@ static ngx_command_t ngx_http_core_comm offsetof(ngx_http_core_loc_conf_t, sendfile_max_chunk), NULL }, +#if (NGX_HAVE_FILE_AIO) + + { ngx_string("aio"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_enum_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_core_loc_conf_t, aio), + &ngx_http_core_aio }, + +#endif + { ngx_string("directio"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_http_core_directio, @@ -390,6 +415,13 @@ static ngx_command_t ngx_http_core_comm 0, NULL }, + { ngx_string("directio_alignment"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_off_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_core_loc_conf_t, directio_alignment), + NULL }, + { ngx_string("tcp_nopush"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, ngx_conf_set_flag_slot, @@ -885,6 +917,7 @@ ngx_http_core_find_config_phase(ngx_http "client intended to send too large body: %O bytes", r->headers_in.content_length_n); + (void) ngx_http_discard_request_body(r); ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE); return NGX_OK; } @@ -961,6 +994,7 @@ ngx_http_core_post_rewrite_phase(ngx_htt "rewrite or internal redirection cycle " "while processing \"%V\"", &r->uri); + r->main->count++; ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return NGX_OK; } @@ -1183,6 +1217,7 @@ ngx_http_core_try_files_phase(ngx_http_r (void) ngx_http_internal_redirect(r, &path, &args); } + ngx_http_finalize_request(r, NGX_DONE); return NGX_OK; } @@ -1260,10 +1295,6 @@ ngx_http_core_content_phase(ngx_http_req rc = ph->handler(r); - if (rc == NGX_DONE) { - return NGX_OK; - } - if (rc != NGX_DECLINED) { ngx_http_finalize_request(r, rc); return NGX_OK; @@ -1689,11 +1720,6 @@ ngx_http_output_filter(ngx_http_request_ rc = ngx_http_top_body_filter(r, in); if (rc == NGX_ERROR) { - - if (c->destroyed) { - return NGX_DONE; - } - /* NGX_ERROR may be returned by any filter */ c->error = 1; } @@ -2126,10 +2152,11 @@ ngx_http_subrequest(ngx_http_request_t * sr->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1; r->main->subrequests++; + r->main->count++; *psr = sr; - return ngx_http_post_request(sr); + return ngx_http_post_request(sr, NULL); } @@ -2146,6 +2173,7 @@ ngx_http_internal_redirect(ngx_http_requ "rewrite or internal redirection cycle " "while internal redirect to \"%V\"", uri); + r->main->count++; ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return NGX_DONE; } @@ -2178,6 +2206,7 @@ ngx_http_internal_redirect(ngx_http_requ #endif r->internal = 1; + r->main->count++; ngx_http_handler(r); @@ -2192,6 +2221,8 @@ ngx_http_named_location(ngx_http_request ngx_http_core_loc_conf_t **clcfp; ngx_http_core_main_conf_t *cmcf; + r->main->count++; + cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); if (cscf->named_locations) { @@ -2921,7 +2952,11 @@ ngx_http_core_create_loc_conf(ngx_conf_t lcf->internal = NGX_CONF_UNSET; lcf->sendfile = NGX_CONF_UNSET; lcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; +#if (NGX_HAVE_FILE_AIO) + lcf->aio = NGX_CONF_UNSET; +#endif lcf->directio = NGX_CONF_UNSET; + lcf->directio_alignment = NGX_CONF_UNSET; lcf->tcp_nopush = NGX_CONF_UNSET; lcf->tcp_nodelay = NGX_CONF_UNSET; lcf->send_timeout = NGX_CONF_UNSET_MSEC; @@ -3118,8 +3153,13 @@ ngx_http_core_merge_loc_conf(ngx_conf_t ngx_conf_merge_value(conf->sendfile, prev->sendfile, 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); +#endif ngx_conf_merge_off_value(conf->directio, prev->directio, NGX_MAX_OFF_T_VALUE); + ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment, + 512); ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0); ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1); @@ -3511,6 +3551,12 @@ ngx_http_core_server_name(ngx_conf_t *cf ngx_str_t err; u_char errstr[NGX_MAX_CONF_ERRSTR]; + if (value[i].len == 1) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "empty regex in server name \"%V\"", &value[i]); + return NGX_CONF_ERROR; + } + err.len = NGX_MAX_CONF_ERRSTR; err.data = errstr;