Welcome! Log In Create A New Profile

Advanced

[PATCH] Core: add $nginx_build variable

Piotr Sikora
June 23, 2015 11:38PM
# HG changeset patch
# User Piotr Sikora <piotr@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@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)
{

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Core: add $nginx_build variable

Piotr Sikora 707 June 23, 2015 11:38PM

Re: [PATCH] Core: add $nginx_build variable

Piotr Sikora 355 July 05, 2015 11:14PM

Re: [PATCH] Core: add $nginx_build variable

Maxim Dounin 358 July 06, 2015 08:10AM

Re: [PATCH] Core: add $nginx_build variable

Maxim Dounin 374 July 13, 2015 02:26PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 152
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready