Mercurial > hg > nginx-quic
diff src/http/ngx_http_variables.c @ 2096:a2199268010a stable-0.6
r2012 merge:
$hostname variable
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 07 Jul 2008 11:20:46 +0000 |
parents | 65cff41e9a4e |
children | 2a92804f4109 8e4450668968 |
line wrap: on
line diff
--- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -75,6 +75,8 @@ static ngx_int_t ngx_http_variable_sent_ static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_http_variable_hostname(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); /* * TODO: @@ -221,6 +223,9 @@ static ngx_http_variable_t ngx_http_cor { ngx_string("nginx_version"), NULL, ngx_http_variable_nginx_version, 0, 0, 0 }, + { ngx_string("hostname"), NULL, ngx_http_variable_hostname, + 0, 0, 0 }, + { ngx_null_string, NULL, NULL, 0, 0, 0 } }; @@ -1272,6 +1277,20 @@ ngx_http_variable_nginx_version(ngx_http } +static ngx_int_t +ngx_http_variable_hostname(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + v->len = ngx_cycle->hostname.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = ngx_cycle->hostname.data; + + return NGX_OK; +} + + ngx_int_t ngx_http_variables_add_core_vars(ngx_conf_t *cf) {