comparison src/http/ngx_http_core_module.c @ 1200:ff63527ea29c

limit minimal pool size
author Igor Sysoev <igor@sysoev.ru>
date Mon, 07 May 2007 09:20:42 +0000
parents 98317b0a0852
children 94774fc6620f
comparison
equal deleted inserted replaced
1199:98317b0a0852 1200:ff63527ea29c
68 void *conf); 68 void *conf);
69 static char *ngx_http_core_internal(ngx_conf_t *cf, ngx_command_t *cmd, 69 static char *ngx_http_core_internal(ngx_conf_t *cf, ngx_command_t *cmd,
70 void *conf); 70 void *conf);
71 71
72 static char *ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data); 72 static char *ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data);
73 static char *ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data);
73 74
74 static ngx_conf_post_t ngx_http_core_lowat_post = 75 static ngx_conf_post_t ngx_http_core_lowat_post =
75 { ngx_http_core_lowat_check }; 76 { ngx_http_core_lowat_check };
77
78 static ngx_conf_post_handler_pt ngx_http_core_pool_size_p =
79 ngx_http_core_pool_size;
76 80
77 static ngx_conf_deprecated_t ngx_conf_deprecated_optimize_host_names = { 81 static ngx_conf_deprecated_t ngx_conf_deprecated_optimize_host_names = {
78 ngx_conf_deprecated, "optimize_host_names", "optimize_server_names" 82 ngx_conf_deprecated, "optimize_host_names", "optimize_server_names"
79 }; 83 };
80 84
127 { ngx_string("connection_pool_size"), 131 { ngx_string("connection_pool_size"),
128 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, 132 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
129 ngx_conf_set_size_slot, 133 ngx_conf_set_size_slot,
130 NGX_HTTP_SRV_CONF_OFFSET, 134 NGX_HTTP_SRV_CONF_OFFSET,
131 offsetof(ngx_http_core_srv_conf_t, connection_pool_size), 135 offsetof(ngx_http_core_srv_conf_t, connection_pool_size),
132 NULL }, 136 &ngx_http_core_pool_size_p },
133 137
134 { ngx_string("request_pool_size"), 138 { ngx_string("request_pool_size"),
135 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, 139 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
136 ngx_conf_set_size_slot, 140 ngx_conf_set_size_slot,
137 NGX_HTTP_SRV_CONF_OFFSET, 141 NGX_HTTP_SRV_CONF_OFFSET,
138 offsetof(ngx_http_core_srv_conf_t, request_pool_size), 142 offsetof(ngx_http_core_srv_conf_t, request_pool_size),
139 NULL }, 143 &ngx_http_core_pool_size_p },
140 144
141 { ngx_string("client_header_timeout"), 145 { ngx_string("client_header_timeout"),
142 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, 146 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
143 ngx_conf_set_msec_slot, 147 ngx_conf_set_msec_slot,
144 NGX_HTTP_SRV_CONF_OFFSET, 148 NGX_HTTP_SRV_CONF_OFFSET,
3050 3054
3051 #endif 3055 #endif
3052 3056
3053 return NGX_CONF_OK; 3057 return NGX_CONF_OK;
3054 } 3058 }
3059
3060
3061 static char *
3062 ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data)
3063 {
3064 size_t *sp = data;
3065
3066 if (*sp < NGX_MIN_POOL_SIZE) {
3067 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3068 "pool must be no less than %uz", NGX_MIN_POOL_SIZE);
3069
3070 return NGX_CONF_ERROR;
3071 }
3072
3073 return NGX_CONF_OK;
3074 }