Mercurial > hg > nginx-vendor-0-5
comparison src/http/ngx_http_variables.c @ 318:3021f899881a NGINX_0_5_29
nginx 0.5.29
*) Feature: $nginx_version variable.
Thanks to Nick S. Grechukh.
*) Bugfix: if the FastCGI header was split in records, then nginx
passed garbage in the header to a client.
*) Bugfix: Sun Studio compatibility on Solaris/amd64 and
Solaris/sparc64.
Thanks to Jiang Hong and Andrei Nigmatulin.
*) 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 | cba14c1e2a4b |
children | 1e9e2c5e7c14 |
comparison
equal
deleted
inserted
replaced
317:c012154f05d1 | 318:3021f899881a |
---|---|
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 = |
499 ngx_http_variable_value_t *v, uintptr_t data) | 505 ngx_http_variable_value_t *v, uintptr_t data) |
500 { | 506 { |
501 ssize_t s, *sp; | 507 ssize_t s, *sp; |
502 ngx_str_t val; | 508 ngx_str_t val; |
503 | 509 |
504 val.len = v->len & 0xffff; | 510 val.len = v->len; |
505 val.data = v->data; | 511 val.data = v->data; |
506 | 512 |
507 s = ngx_parse_size(&val); | 513 s = ngx_parse_size(&val); |
508 | 514 |
509 if (s == NGX_ERROR) { | 515 if (s == NGX_ERROR) { |
1198 v->len = r->request_body->temp_file->file.name.len; | 1204 v->len = r->request_body->temp_file->file.name.len; |
1199 v->valid = 1; | 1205 v->valid = 1; |
1200 v->no_cachable = 0; | 1206 v->no_cachable = 0; |
1201 v->not_found = 0; | 1207 v->not_found = 0; |
1202 v->data = r->request_body->temp_file->file.name.data; | 1208 v->data = r->request_body->temp_file->file.name.data; |
1209 | |
1210 return NGX_OK; | |
1211 } | |
1212 | |
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; | |
1203 | 1223 |
1204 return NGX_OK; | 1224 return NGX_OK; |
1205 } | 1225 } |
1206 | 1226 |
1207 | 1227 |