summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_variables.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-07-07 10:22:30 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-07-07 10:22:30 +0000
commitc410db96b9103d30a33a7f16f3ede58265d63bab (patch)
treed4c212a844ca250be346fe28359e2180a52b7e26 /src/http/ngx_http_variables.c
parentb5f5da3a37f2169d6745f7160203a792ab49cac0 (diff)
downloadnginx-c410db96b9103d30a33a7f16f3ede58265d63bab.tar.gz
nginx-c410db96b9103d30a33a7f16f3ede58265d63bab.tar.bz2
r2008 merge:
*) host in request line has priority *) allow several Host headers *) validate host
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r--src/http/ngx_http_variables.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index df00675eb..c2a27a76a 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -712,26 +712,15 @@ ngx_http_variable_host(ngx_http_request_t *r, ngx_http_variable_value_t *v,
{
ngx_http_core_srv_conf_t *cscf;
- if (r->host_start == NULL) {
-
- if (r->headers_in.host) {
- v->len = r->headers_in.host_name_len;
- v->data = r->headers_in.host->value.data;
-
- } else {
- cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
-
- v->len = cscf->server_name.len;
- v->data = cscf->server_name.data;
- }
-
- } else if (r->host_end) {
- v->len = r->host_end - r->host_start;
- v->data = r->host_start;
+ if (r->headers_in.server.len) {
+ v->len = r->headers_in.server.len;
+ v->data = r->headers_in.server.data;
} else {
- v->not_found = 1;
- return NGX_OK;
+ cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
+
+ v->len = cscf->server_name.len;
+ v->data = cscf->server_name.data;
}
v->valid = 1;