evaluate maximum captures size on configuration phase

This commit is contained in:
Igor Sysoev 2009-11-16 19:11:38 +00:00
parent df3c5d435c
commit 726741e0bd
2 changed files with 5 additions and 1 deletions

View File

@ -2759,6 +2759,10 @@ ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf)
cmcf->variables_hash_bucket_size =
ngx_align(cmcf->variables_hash_bucket_size, ngx_cacheline_size);
if (cmcf->ncaptures) {
cmcf->ncaptures = (cmcf->ncaptures + 1) * 3;
}
return NGX_CONF_OK;
}

View File

@ -1759,7 +1759,7 @@ ngx_http_regex_exec(ngx_http_request_t *r, ngx_http_regex_t *re, ngx_str_t *s)
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
if (re->ncaptures) {
len = (cmcf->ncaptures + 1) * 3;
len = cmcf->ncaptures;
if (r->captures == NULL) {
r->captures = ngx_palloc(r->pool, len * sizeof(int));