mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
move r->virtual_names to ngx_http_core_srv_conf_t
This commit is contained in:
parent
1966aedd6d
commit
fed1ca0dc7
@ -1812,7 +1812,7 @@ ngx_http_add_addrs(ngx_conf_t *cf, ngx_http_port_t *hport,
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
addrs[i].conf.virtual_names = vn;
|
addrs[i].conf.core_srv_conf->virtual_names = vn;
|
||||||
|
|
||||||
vn->names.hash = addr[i].hash;
|
vn->names.hash = addr[i].hash;
|
||||||
vn->names.wc_head = addr[i].wc_head;
|
vn->names.wc_head = addr[i].wc_head;
|
||||||
@ -1869,7 +1869,7 @@ ngx_http_add_addrs6(ngx_conf_t *cf, ngx_http_port_t *hport,
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
addrs6[i].conf.virtual_names = vn;
|
addrs6[i].conf.core_srv_conf->virtual_names = vn;
|
||||||
|
|
||||||
vn->names.hash = addr[i].hash;
|
vn->names.hash = addr[i].hash;
|
||||||
vn->names.wc_head = addr[i].wc_head;
|
vn->names.wc_head = addr[i].wc_head;
|
||||||
|
@ -150,6 +150,8 @@ typedef struct {
|
|||||||
/* server ctx */
|
/* server ctx */
|
||||||
ngx_http_conf_ctx_t *ctx;
|
ngx_http_conf_ctx_t *ctx;
|
||||||
|
|
||||||
|
ngx_http_virtual_names_t *virtual_names;
|
||||||
|
|
||||||
ngx_str_t server_name;
|
ngx_str_t server_name;
|
||||||
|
|
||||||
size_t connection_pool_size;
|
size_t connection_pool_size;
|
||||||
@ -175,8 +177,6 @@ typedef struct {
|
|||||||
/* the default server configuration for this address:port */
|
/* the default server configuration for this address:port */
|
||||||
ngx_http_core_srv_conf_t *core_srv_conf;
|
ngx_http_core_srv_conf_t *core_srv_conf;
|
||||||
|
|
||||||
ngx_http_virtual_names_t *virtual_names;
|
|
||||||
|
|
||||||
#if (NGX_HTTP_SSL)
|
#if (NGX_HTTP_SSL)
|
||||||
ngx_uint_t ssl; /* unsigned ssl:1; */
|
ngx_uint_t ssl; /* unsigned ssl:1; */
|
||||||
#endif
|
#endif
|
||||||
|
@ -374,8 +374,6 @@ ngx_http_init_request(ngx_event_t *rev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r->virtual_names = addr_conf->virtual_names;
|
|
||||||
|
|
||||||
/* the default server configuration for the address:port */
|
/* the default server configuration for the address:port */
|
||||||
cscf = addr_conf->core_srv_conf;
|
cscf = addr_conf->core_srv_conf;
|
||||||
|
|
||||||
@ -1614,11 +1612,15 @@ ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
|
|||||||
{
|
{
|
||||||
u_char *server;
|
u_char *server;
|
||||||
ngx_uint_t hash;
|
ngx_uint_t hash;
|
||||||
|
ngx_http_virtual_names_t *vn;
|
||||||
ngx_http_core_loc_conf_t *clcf;
|
ngx_http_core_loc_conf_t *clcf;
|
||||||
ngx_http_core_srv_conf_t *cscf;
|
ngx_http_core_srv_conf_t *cscf;
|
||||||
u_char buf[32];
|
u_char buf[32];
|
||||||
|
|
||||||
if (r->virtual_names == NULL) {
|
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
||||||
|
vn = cscf->virtual_names;
|
||||||
|
|
||||||
|
if (vn == NULL) {
|
||||||
return NGX_DECLINED;
|
return NGX_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1634,7 +1636,7 @@ ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
|
|||||||
|
|
||||||
hash = ngx_hash_strlow(server, host, len);
|
hash = ngx_hash_strlow(server, host, len);
|
||||||
|
|
||||||
cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len);
|
cscf = ngx_hash_find_combined(&vn->names, hash, server, len);
|
||||||
|
|
||||||
if (cscf) {
|
if (cscf) {
|
||||||
goto found;
|
goto found;
|
||||||
@ -1642,7 +1644,7 @@ ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
|
|||||||
|
|
||||||
#if (NGX_PCRE)
|
#if (NGX_PCRE)
|
||||||
|
|
||||||
if (r->virtual_names->nregex) {
|
if (vn->nregex) {
|
||||||
ngx_int_t n;
|
ngx_int_t n;
|
||||||
ngx_uint_t i;
|
ngx_uint_t i;
|
||||||
ngx_str_t name;
|
ngx_str_t name;
|
||||||
@ -1651,9 +1653,9 @@ ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
|
|||||||
name.len = len;
|
name.len = len;
|
||||||
name.data = server;
|
name.data = server;
|
||||||
|
|
||||||
sn = r->virtual_names->regex;
|
sn = vn->regex;
|
||||||
|
|
||||||
for (i = 0; i < r->virtual_names->nregex; i++) {
|
for (i = 0; i < vn->nregex; i++) {
|
||||||
|
|
||||||
n = ngx_regex_exec(sn[i].regex, &name, NULL, 0);
|
n = ngx_regex_exec(sn[i].regex, &name, NULL, 0);
|
||||||
|
|
||||||
|
@ -384,8 +384,6 @@ struct ngx_http_request_s {
|
|||||||
ngx_http_post_subrequest_t *post_subrequest;
|
ngx_http_post_subrequest_t *post_subrequest;
|
||||||
ngx_http_posted_request_t *posted_requests;
|
ngx_http_posted_request_t *posted_requests;
|
||||||
|
|
||||||
ngx_http_virtual_names_t *virtual_names;
|
|
||||||
|
|
||||||
ngx_int_t phase_handler;
|
ngx_int_t phase_handler;
|
||||||
ngx_http_handler_pt content_handler;
|
ngx_http_handler_pt content_handler;
|
||||||
ngx_uint_t access_code;
|
ngx_uint_t access_code;
|
||||||
|
Loading…
Reference in New Issue
Block a user