diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2008-07-07 11:20:46 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2008-07-07 11:20:46 +0000 |
| commit | 696f38c2dd6b6c6c88239893442b5c81e3f4fcd1 (patch) | |
| tree | 99b7b11996c22a3f47ded71972b2e451fdf4bbcc /src/http/ngx_http_variables.c | |
| parent | 36efca02afd1216fb2a4fb2e5488dd1294ce5e5b (diff) | |
| download | nginx-696f38c2dd6b6c6c88239893442b5c81e3f4fcd1.tar.gz nginx-696f38c2dd6b6c6c88239893442b5c81e3f4fcd1.tar.bz2 | |
r2012 merge:
$hostname variable
Diffstat (limited to '')
| -rw-r--r-- | src/http/ngx_http_variables.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index c2a27a76a..16f092305 100644 --- 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_transfer_encoding(ngx_http_request_t *r, 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_core_variables[] = { { 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_request_t *r, } +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) { |
