Skip to content

Commit

Permalink
$nginx_version
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsysoev committed Jul 22, 2007
1 parent aa5c021 commit f36ed59
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/http/ngx_http_variables.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_http.h>
#include <nginx.h>


static ngx_int_t ngx_http_variable_request(ngx_http_request_t *r,
Expand Down Expand Up @@ -66,6 +67,8 @@ static ngx_int_t ngx_http_variable_sent_keep_alive(ngx_http_request_t *r,
static ngx_int_t ngx_http_variable_sent_transfer_encoding(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);

static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);

/*
* TODO:
Expand Down Expand Up @@ -205,6 +208,9 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
offsetof(ngx_http_request_t, limit_rate),
NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOCACHABLE, 0 },

{ ngx_string("nginx_version"), NULL, ngx_http_variable_nginx_version,
0, 0, 0 },

{ ngx_null_string, NULL, NULL, 0, 0, 0 }
};

Expand Down Expand Up @@ -1205,6 +1211,20 @@ ngx_http_variable_request_body_file(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)
{
v->len = sizeof(NGINX_VERSION) - 1;
v->valid = 1;
v->no_cachable = 0;
v->not_found = 0;
v->data = (u_char *) NGINX_VERSION;

return NGX_OK;
}


ngx_int_t
ngx_http_variables_add_core_vars(ngx_conf_t *cf)
{
Expand Down

0 comments on commit f36ed59

Please sign in to comment.