comparison src/http/ngx_http_request.c @ 2534:2749e4bf6af0

move r->virtual_names to ngx_http_core_srv_conf_t
author Igor Sysoev <igor@sysoev.ru>
date Tue, 24 Feb 2009 07:56:47 +0000
parents c843171d5dc2
children a6d6d762c554
comparison
equal deleted inserted replaced
2533:c843171d5dc2 2534:2749e4bf6af0
372 addr_conf = &addr[0].conf; 372 addr_conf = &addr[0].conf;
373 break; 373 break;
374 } 374 }
375 } 375 }
376 376
377 r->virtual_names = addr_conf->virtual_names;
378
379 /* the default server configuration for the address:port */ 377 /* the default server configuration for the address:port */
380 cscf = addr_conf->core_srv_conf; 378 cscf = addr_conf->core_srv_conf;
381 379
382 r->main_conf = cscf->ctx->main_conf; 380 r->main_conf = cscf->ctx->main_conf;
383 r->srv_conf = cscf->ctx->srv_conf; 381 r->srv_conf = cscf->ctx->srv_conf;
1612 static ngx_int_t 1610 static ngx_int_t
1613 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len) 1611 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
1614 { 1612 {
1615 u_char *server; 1613 u_char *server;
1616 ngx_uint_t hash; 1614 ngx_uint_t hash;
1615 ngx_http_virtual_names_t *vn;
1617 ngx_http_core_loc_conf_t *clcf; 1616 ngx_http_core_loc_conf_t *clcf;
1618 ngx_http_core_srv_conf_t *cscf; 1617 ngx_http_core_srv_conf_t *cscf;
1619 u_char buf[32]; 1618 u_char buf[32];
1620 1619
1621 if (r->virtual_names == NULL) { 1620 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
1621 vn = cscf->virtual_names;
1622
1623 if (vn == NULL) {
1622 return NGX_DECLINED; 1624 return NGX_DECLINED;
1623 } 1625 }
1624 1626
1625 if (len <= 32) { 1627 if (len <= 32) {
1626 server = buf; 1628 server = buf;
1632 } 1634 }
1633 } 1635 }
1634 1636
1635 hash = ngx_hash_strlow(server, host, len); 1637 hash = ngx_hash_strlow(server, host, len);
1636 1638
1637 cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len); 1639 cscf = ngx_hash_find_combined(&vn->names, hash, server, len);
1638 1640
1639 if (cscf) { 1641 if (cscf) {
1640 goto found; 1642 goto found;
1641 } 1643 }
1642 1644
1643 #if (NGX_PCRE) 1645 #if (NGX_PCRE)
1644 1646
1645 if (r->virtual_names->nregex) { 1647 if (vn->nregex) {
1646 ngx_int_t n; 1648 ngx_int_t n;
1647 ngx_uint_t i; 1649 ngx_uint_t i;
1648 ngx_str_t name; 1650 ngx_str_t name;
1649 ngx_http_server_name_t *sn; 1651 ngx_http_server_name_t *sn;
1650 1652
1651 name.len = len; 1653 name.len = len;
1652 name.data = server; 1654 name.data = server;
1653 1655
1654 sn = r->virtual_names->regex; 1656 sn = vn->regex;
1655 1657
1656 for (i = 0; i < r->virtual_names->nregex; i++) { 1658 for (i = 0; i < vn->nregex; i++) {
1657 1659
1658 n = ngx_regex_exec(sn[i].regex, &name, NULL, 0); 1660 n = ngx_regex_exec(sn[i].regex, &name, NULL, 0);
1659 1661
1660 if (n == NGX_REGEX_NO_MATCHED) { 1662 if (n == NGX_REGEX_NO_MATCHED) {
1661 continue; 1663 continue;