# HG changeset patch # User Igor Sysoev # Date 1259527172 0 # Node ID 75b96847351acba927aa134e6cacd6ffd45cf129 # Parent 568a854383f9364070db3af1423c67af9337e128 fix server_name regex named captures given by "?P<...>" diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -3507,16 +3507,16 @@ ngx_http_core_server_name(ngx_conf_t *cf sn->server = cscf; sn->name = value[i]; - ngx_strlow(sn->name.data, sn->name.data, sn->name.len); - if (value[i].data[0] != '~') { + ngx_strlow(sn->name.data, sn->name.data, sn->name.len); continue; } #if (NGX_PCRE) { - ngx_regex_compile_t rc; - u_char errstr[NGX_MAX_CONF_ERRSTR]; + u_char *p; + ngx_regex_compile_t rc; + u_char errstr[NGX_MAX_CONF_ERRSTR]; if (value[i].len == 1) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, @@ -3533,6 +3533,13 @@ ngx_http_core_server_name(ngx_conf_t *cf rc.err.len = NGX_MAX_CONF_ERRSTR; rc.err.data = errstr; + for (p = value[i].data; p < value[i].data + value[i].len; p++) { + if (*p >= 'A' && *p <= 'Z') { + rc.options = NGX_REGEX_CASELESS; + break; + } + } + sn->regex = ngx_http_regex_compile(cf, &rc); if (sn->regex == NULL) { return NGX_CONF_ERROR;