[PATCH] Core: add $nginx_build variable
Piotr Sikora
piotr at cloudflare.com
Wed Jun 24 03:37:02 UTC 2015
# HG changeset patch
# User Piotr Sikora <piotr at cloudflare.com>
# Date 1435116970 25200
# Tue Jun 23 20:36:10 2015 -0700
# Node ID 3bbe405ecafcec573957a5afd9f2a75be19d52f0
# Parent 24488e6db782e24b9a30ba31f0b719204e582918
Core: add $nginx_build variable.
Signed-off-by: Piotr Sikora <piotr at cloudflare.com>
diff -r 24488e6db782 -r 3bbe405ecafc src/http/ngx_http_variables.c
--- a/src/http/ngx_http_variables.c Tue Jun 23 20:17:48 2015 +0300
+++ b/src/http/ngx_http_variables.c Tue Jun 23 20:36:10 2015 -0700
@@ -123,6 +123,8 @@ static ngx_int_t ngx_http_variable_conne
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_nginx_build(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);
static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
@@ -316,6 +318,9 @@ static ngx_http_variable_t ngx_http_cor
{ ngx_string("nginx_version"), NULL, ngx_http_variable_nginx_version,
0, 0, 0 },
+ { ngx_string("nginx_build"), NULL, ngx_http_variable_nginx_build,
+ 0, 0, 0 },
+
{ ngx_string("hostname"), NULL, ngx_http_variable_hostname,
0, 0, 0 },
@@ -2122,6 +2127,28 @@ ngx_http_variable_nginx_version(ngx_http
static ngx_int_t
+ngx_http_variable_nginx_build(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+#ifdef NGX_BUILD
+
+ v->len = sizeof(NGX_BUILD) - 1;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = (u_char *) NGX_BUILD;
+
+#else
+
+ v->not_found = 1;
+
+#endif
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_variable_hostname(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{
More information about the nginx-devel
mailing list