comparison src/http/ngx_http_variables.c @ 1329:80e6f567574f

$nginx_version
author Igor Sysoev <igor@sysoev.ru>
date Sun, 22 Jul 2007 13:12:16 +0000
parents 33d6c994a0b2
children 8682f64fccb3
comparison
equal deleted inserted replaced
1324:d01f9856e3a0 1329:80e6f567574f
6 6
7 #include <ngx_config.h> 7 #include <ngx_config.h>
8 #include <ngx_core.h> 8 #include <ngx_core.h>
9 #include <ngx_event.h> 9 #include <ngx_event.h>
10 #include <ngx_http.h> 10 #include <ngx_http.h>
11 #include <nginx.h>
11 12
12 13
13 static ngx_int_t ngx_http_variable_request(ngx_http_request_t *r, 14 static ngx_int_t ngx_http_variable_request(ngx_http_request_t *r,
14 ngx_http_variable_value_t *v, uintptr_t data); 15 ngx_http_variable_value_t *v, uintptr_t data);
15 static void ngx_http_variable_request_set_size(ngx_http_request_t *r, 16 static void ngx_http_variable_request_set_size(ngx_http_request_t *r,
64 static ngx_int_t ngx_http_variable_sent_keep_alive(ngx_http_request_t *r, 65 static ngx_int_t ngx_http_variable_sent_keep_alive(ngx_http_request_t *r,
65 ngx_http_variable_value_t *v, uintptr_t data); 66 ngx_http_variable_value_t *v, uintptr_t data);
66 static ngx_int_t ngx_http_variable_sent_transfer_encoding(ngx_http_request_t *r, 67 static ngx_int_t ngx_http_variable_sent_transfer_encoding(ngx_http_request_t *r,
67 ngx_http_variable_value_t *v, uintptr_t data); 68 ngx_http_variable_value_t *v, uintptr_t data);
68 69
70 static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r,
71 ngx_http_variable_value_t *v, uintptr_t data);
69 72
70 /* 73 /*
71 * TODO: 74 * TODO:
72 * Apache CGI: AUTH_TYPE, PATH_INFO (null), PATH_TRANSLATED 75 * Apache CGI: AUTH_TYPE, PATH_INFO (null), PATH_TRANSLATED
73 * REMOTE_HOST (null), REMOTE_IDENT (null), 76 * REMOTE_HOST (null), REMOTE_IDENT (null),
203 { ngx_string("limit_rate"), ngx_http_variable_request_set_size, 206 { ngx_string("limit_rate"), ngx_http_variable_request_set_size,
204 ngx_http_variable_request, 207 ngx_http_variable_request,
205 offsetof(ngx_http_request_t, limit_rate), 208 offsetof(ngx_http_request_t, limit_rate),
206 NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOCACHABLE, 0 }, 209 NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOCACHABLE, 0 },
207 210
211 { ngx_string("nginx_version"), NULL, ngx_http_variable_nginx_version,
212 0, 0, 0 },
213
208 { ngx_null_string, NULL, NULL, 0, 0, 0 } 214 { ngx_null_string, NULL, NULL, 0, 0, 0 }
209 }; 215 };
210 216
211 217
212 ngx_http_variable_value_t ngx_http_variable_null_value = 218 ngx_http_variable_value_t ngx_http_variable_null_value =
1203 1209
1204 return NGX_OK; 1210 return NGX_OK;
1205 } 1211 }
1206 1212
1207 1213
1214 static ngx_int_t
1215 ngx_http_variable_nginx_version(ngx_http_request_t *r,
1216 ngx_http_variable_value_t *v, uintptr_t data)
1217 {
1218 v->len = sizeof(NGINX_VERSION) - 1;
1219 v->valid = 1;
1220 v->no_cachable = 0;
1221 v->not_found = 0;
1222 v->data = (u_char *) NGINX_VERSION;
1223
1224 return NGX_OK;
1225 }
1226
1227
1208 ngx_int_t 1228 ngx_int_t
1209 ngx_http_variables_add_core_vars(ngx_conf_t *cf) 1229 ngx_http_variables_add_core_vars(ngx_conf_t *cf)
1210 { 1230 {
1211 ngx_int_t rc; 1231 ngx_int_t rc;
1212 ngx_http_variable_t *v; 1232 ngx_http_variable_t *v;