diff src/http/ngx_http_variables.c @ 322:d16d691432c9 NGINX_0_6_5

nginx 0.6.5 *) Feature: $nginx_version variable. Thanks to Nick S. Grechukh. *) Feature: the mail proxy supports AUTHENTICATE in IMAP mode. Thanks to Maxim Dounin. *) Feature: the mail proxy supports STARTTLS in SMTP mode. Thanks to Maxim Dounin. *) Bugfix: now nginx escapes space in $memcached_key variable. *) Bugfix: nginx was incorrectly built by Sun Studio on Solaris/amd64. Thanks to Jiang Hong. *) Bugfix: of minor potential bugs. Thanks to Coverity's Scan.
author Igor Sysoev <http://sysoev.ru>
date Mon, 23 Jul 2007 00:00:00 +0400
parents 95183808f549
children f7cd062ee035
line wrap: on
line diff
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -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,
@@ -66,6 +67,8 @@ static ngx_int_t ngx_http_variable_sent_
 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:
@@ -205,6 +208,9 @@ static ngx_http_variable_t  ngx_http_cor
       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 }
 };
 
@@ -1205,6 +1211,20 @@ ngx_http_variable_request_body_file(ngx_
 }
 
 
+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)
 {