diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 4e1c67282..563032d2c 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -90,6 +90,8 @@ static char *ngx_http_disable_symlinks(ngx_conf_t *cf, ngx_command_t *cmd, static char *ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data); static char *ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data); +static char *ngx_http_core_client_body_buffer_size(ngx_conf_t *cf, void *post, + void *data); static ngx_conf_post_t ngx_http_core_lowat_post = { ngx_http_core_lowat_check }; @@ -97,6 +99,9 @@ static ngx_conf_post_t ngx_http_core_lowat_post = static ngx_conf_post_handler_pt ngx_http_core_pool_size_p = ngx_http_core_pool_size; +static ngx_conf_post_t ngx_http_core_client_body_buffer_size_post = + { ngx_http_core_client_body_buffer_size }; + static ngx_conf_enum_t ngx_http_core_request_body_in_file[] = { { ngx_string("off"), NGX_HTTP_REQUEST_BODY_FILE_OFF }, @@ -364,7 +369,7 @@ static ngx_command_t ngx_http_core_commands[] = { ngx_conf_set_size_slot, NGX_HTTP_LOC_CONF_OFFSET, offsetof(ngx_http_core_loc_conf_t, client_body_buffer_size), - NULL }, + &ngx_http_core_client_body_buffer_size_post }, { ngx_string("client_body_timeout"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, @@ -5460,3 +5465,19 @@ ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data) return NGX_CONF_OK; } + + +static char * +ngx_http_core_client_body_buffer_size(ngx_conf_t *cf, void *post, void *data) +{ + size_t *sp = data; + + if (*sp == 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "the client body buffer size cannot be zero"); + + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +}