]> git.kaiwu.me - nginx.git/commitdiff
backout r2535: virtual names is a property of address:port pair,
authorIgor Sysoev <igor@sysoev.ru>
Thu, 9 Apr 2009 13:56:16 +0000 (13:56 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 9 Apr 2009 13:56:16 +0000 (13:56 +0000)
but is not a property of server configuration

src/http/ngx_http.c
src/http/ngx_http_core_module.h
src/http/ngx_http_request.c
src/http/ngx_http_request.h

index ed766bcbaef3e4c6f97015da5c4d52323be4c35e..5cd0ee1f83a37fa630fc8965f2d7d8a47515dfc6 100644 (file)
@@ -1825,7 +1825,7 @@ ngx_http_add_addrs(ngx_conf_t *cf, ngx_http_port_t *hport,
             return NGX_ERROR;
         }
 
-        addrs[i].conf.core_srv_conf->virtual_names = vn;
+        addrs[i].conf.virtual_names = vn;
 
         vn->names.hash = addr[i].hash;
         vn->names.wc_head = addr[i].wc_head;
@@ -1882,7 +1882,7 @@ ngx_http_add_addrs6(ngx_conf_t *cf, ngx_http_port_t *hport,
             return NGX_ERROR;
         }
 
-        addrs6[i].conf.core_srv_conf->virtual_names = vn;
+        addrs6[i].conf.virtual_names = vn;
 
         vn->names.hash = addr[i].hash;
         vn->names.wc_head = addr[i].wc_head;
index 571b5b76f676b8a3481b5e613013463192a47861..e1692fd03ea6155eb38c92df7975ff18ad2d43b9 100644 (file)
@@ -153,8 +153,6 @@ typedef struct {
     /* server ctx */
     ngx_http_conf_ctx_t        *ctx;
 
-    ngx_http_virtual_names_t   *virtual_names;
-
     ngx_str_t                   server_name;
 
     size_t                      connection_pool_size;
@@ -180,6 +178,8 @@ typedef struct {
     /* the default server configuration for this address:port */
     ngx_http_core_srv_conf_t  *core_srv_conf;
 
+    ngx_http_virtual_names_t  *virtual_names;
+
 #if (NGX_HTTP_SSL)
     ngx_uint_t                 ssl;   /* unsigned  ssl:1; */
 #endif
index 17d867a6307ef746038f8df15603d4fb2049f5d6..31ab640e24ccb26ef387b2d7188479b8aefa3450 100644 (file)
@@ -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_request_t *r, u_char *host, size_t len)
 {
     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_request_t *r, u_char *host, size_t len)
 
     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_request_t *r, u_char *host, size_t len)
 
 #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_request_t *r, u_char *host, size_t len)
 
         ncaptures = 0;
 
-        sn = vn->regex;
+        sn = r->virtual_names->regex;
 
-        for (i = 0; i < vn->nregex; i++) {
+        for (i = 0; i < r->virtual_names->nregex; i++) {
 
             if (sn[i].captures && r->captures == NULL) {
 
index ee87669586bc6156ccd5f19122fb39bb6afefa02..23a88463037c889b02b05b97400894d3049480d8 100644 (file)
@@ -387,6 +387,8 @@ struct ngx_http_request_s {
     ngx_http_post_subrequest_t       *post_subrequest;
     ngx_http_posted_request_t        *posted_requests;
 
+    ngx_http_virtual_names_t         *virtual_names;
+
     ngx_int_t                         phase_handler;
     ngx_http_handler_pt               content_handler;
     ngx_uint_t                        access_code;