comparison src/http/ngx_http_variables.c @ 864:7521e5f5d555

use host part in URL
author Igor Sysoev <igor@sysoev.ru>
date Thu, 23 Nov 2006 20:20:23 +0000
parents 97e89a42711f
children a6fe6bedb9e3
comparison
equal deleted inserted replaced
863:57cb2052dcc6 864:7521e5f5d555
665 665
666 static ngx_int_t 666 static ngx_int_t
667 ngx_http_variable_host(ngx_http_request_t *r, ngx_http_variable_value_t *v, 667 ngx_http_variable_host(ngx_http_request_t *r, ngx_http_variable_value_t *v,
668 uintptr_t data) 668 uintptr_t data)
669 { 669 {
670 if (r->headers_in.host) { 670 if (r->host_start == NULL) {
671 v->len = r->headers_in.host_name_len; 671
672 v->data = r->headers_in.host->value.data; 672 if (r->headers_in.host) {
673 v->len = r->headers_in.host_name_len;
674 v->data = r->headers_in.host->value.data;
675
676 } else {
677 v->len = r->server_name.len;
678 v->data = r->server_name.data;
679 }
673 680
674 } else { 681 } else {
675 v->len = r->server_name.len; 682 v->len = r->host_end - r->host_start;
676 v->data = r->server_name.data; 683 v->data = r->host_start;
677 } 684 }
678 685
679 v->valid = 1; 686 v->valid = 1;
680 v->no_cachable = 0; 687 v->no_cachable = 0;
681 v->not_found = 0; 688 v->not_found = 0;