diff src/http/ngx_http_request.c @ 478:f2c6a7373274 NGINX_0_7_51

nginx 0.7.51 *) Feature: the "try_files" directive supports a response code in the fallback parameter. *) Feature: now any response code can be used in the "return" directive. *) Bugfix: the "error_page" directive made an external redirect without query string; the bug had appeared in 0.7.44. *) Bugfix: if servers listened on several defined explicitly addresses, then virtual servers might not work; the bug had appeared in 0.7.39.
author Igor Sysoev <http://sysoev.ru>
date Sun, 12 Apr 2009 00:00:00 +0400
parents 09f0ef15d544
children 392c16f2d858
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -372,6 +372,8 @@ ngx_http_init_request(ngx_event_t *rev)
         }
     }
 
+    r->virtual_names = addr_conf->virtual_names;
+
     /* the default server configuration for the address:port */
     cscf = addr_conf->core_srv_conf;
 
@@ -1609,15 +1611,11 @@ ngx_http_find_virtual_server(ngx_http_re
 {
     u_char                    *server;
     ngx_uint_t                 hash;
-    ngx_http_virtual_names_t  *vn;
     ngx_http_core_loc_conf_t  *clcf;
     ngx_http_core_srv_conf_t  *cscf;
     u_char                     buf[32];
 
-    cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
-    vn = cscf->virtual_names;
-
-    if (vn == NULL) {
+    if (r->virtual_names == NULL) {
         return NGX_DECLINED;
     }
 
@@ -1633,7 +1631,7 @@ ngx_http_find_virtual_server(ngx_http_re
 
     hash = ngx_hash_strlow(server, host, len);
 
-    cscf = ngx_hash_find_combined(&vn->names, hash, server, len);
+    cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len);
 
     if (cscf) {
         goto found;
@@ -1641,7 +1639,7 @@ ngx_http_find_virtual_server(ngx_http_re
 
 #if (NGX_PCRE)
 
-    if (vn->nregex) {
+    if (r->virtual_names->nregex) {
         size_t                   ncaptures;
         ngx_int_t                n;
         ngx_uint_t               i;
@@ -1653,9 +1651,9 @@ ngx_http_find_virtual_server(ngx_http_re
 
         ncaptures = 0;
 
-        sn = vn->regex;
-
-        for (i = 0; i < vn->nregex; i++) {
+        sn = r->virtual_names->regex;
+
+        for (i = 0; i < r->virtual_names->nregex; i++) {
 
             if (sn[i].captures && r->captures == NULL) {