comparison src/http/ngx_http_core_module.c @ 3219:81b8416054b0

fix r3218: Initially building lists of ports, addresses, and server names had been placed at final configuration stage, because complete set of the "listen"s and the "server_names" were required for this operation. r3218 broke it, because the "listen"s go usually first in configuration, and cscf->server_names is empty at this stage, therefore no virtual names were configured. Now server configurations are stored in array for each address:port to configure virtual names. Also regex captures flag is moved from server names to core server configuration.
author Igor Sysoev <igor@sysoev.ru>
date Wed, 21 Oct 2009 16:27:48 +0000
parents a22bf524a456
children cdcd9e29c589
comparison
equal deleted inserted replaced
3218:022a7662b4ed 3219:81b8416054b0
2874 return NGX_CONF_ERROR; 2874 return NGX_CONF_ERROR;
2875 } 2875 }
2876 2876
2877 #if (NGX_PCRE) 2877 #if (NGX_PCRE)
2878 sn->regex = NULL; 2878 sn->regex = NULL;
2879 sn->captures = 0;
2880 #endif 2879 #endif
2881 sn->core_srv_conf = conf; 2880 sn->core_srv_conf = conf;
2882 sn->name.len = conf->server_name.len; 2881 sn->name.len = conf->server_name.len;
2883 sn->name.data = conf->server_name.data; 2882 sn->name.data = conf->server_name.data;
2884 } 2883 }
3527 return NGX_CONF_ERROR; 3526 return NGX_CONF_ERROR;
3528 } 3527 }
3529 3528
3530 #if (NGX_PCRE) 3529 #if (NGX_PCRE)
3531 sn->regex = NULL; 3530 sn->regex = NULL;
3532 sn->captures = 0;
3533 #endif 3531 #endif
3534 sn->core_srv_conf = cscf; 3532 sn->core_srv_conf = cscf;
3535 sn->name = value[i]; 3533 sn->name = value[i];
3534
3535 ngx_strlow(sn->name.data, sn->name.data, sn->name.len);
3536 3536
3537 if (value[i].data[0] != '~') { 3537 if (value[i].data[0] != '~') {
3538 continue; 3538 continue;
3539 } 3539 }
3540 3540
3560 if (sn->regex == NULL) { 3560 if (sn->regex == NULL) {
3561 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data); 3561 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data);
3562 return NGX_CONF_ERROR; 3562 return NGX_CONF_ERROR;
3563 } 3563 }
3564 3564
3565 sn->captures = (ngx_regex_capture_count(sn->regex) > 0);
3566 sn->name = value[i]; 3565 sn->name = value[i];
3566 cscf->captures = (ngx_regex_capture_count(sn->regex) > 0);
3567 } 3567 }
3568 #else 3568 #else
3569 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3569 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3570 "the using of the regex \"%V\" " 3570 "the using of the regex \"%V\" "
3571 "requires PCRE library", &value[i]); 3571 "requires PCRE library", &value[i]);