comparison src/http/ngx_http_variables.c @ 2007:b9de93d804ea

*) host in request line has priority *) allow several Host headers *) validate host
author Igor Sysoev <igor@sysoev.ru>
date Thu, 15 May 2008 14:44:47 +0000
parents 0d9c6fe7502b
children b56d4b1ebac7
comparison
equal deleted inserted replaced
2006:b52cb9bf2064 2007:b9de93d804ea
710 ngx_http_variable_host(ngx_http_request_t *r, ngx_http_variable_value_t *v, 710 ngx_http_variable_host(ngx_http_request_t *r, ngx_http_variable_value_t *v,
711 uintptr_t data) 711 uintptr_t data)
712 { 712 {
713 ngx_http_core_srv_conf_t *cscf; 713 ngx_http_core_srv_conf_t *cscf;
714 714
715 if (r->host_start == NULL) { 715 if (r->headers_in.server.len) {
716 716 v->len = r->headers_in.server.len;
717 if (r->headers_in.host) { 717 v->data = r->headers_in.server.data;
718 v->len = r->headers_in.host_name_len;
719 v->data = r->headers_in.host->value.data;
720
721 } else {
722 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
723
724 v->len = cscf->server_name.len;
725 v->data = cscf->server_name.data;
726 }
727
728 } else if (r->host_end) {
729 v->len = r->host_end - r->host_start;
730 v->data = r->host_start;
731 718
732 } else { 719 } else {
733 v->not_found = 1; 720 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
734 return NGX_OK; 721
722 v->len = cscf->server_name.len;
723 v->data = cscf->server_name.data;
735 } 724 }
736 725
737 v->valid = 1; 726 v->valid = 1;
738 v->no_cacheable = 0; 727 v->no_cacheable = 0;
739 v->not_found = 0; 728 v->not_found = 0;