comparison src/http/ngx_http_variables.c @ 416:a8e3f1441eec NGINX_0_7_17

nginx 0.7.17 *) Feature: now the "directio" directive works on Linux. *) Feature: the $pid variable. *) Bugfix: the "directio" optimization that had appeared in 0.7.15 did not work with open_file_cache. *) Bugfix: the "access_log" with variables did not work on Linux; the bug had appeared in 0.7.7. *) Bugfix: the ngx_http_charset_module did not understand quoted charset name received from backend.
author Igor Sysoev <http://sysoev.ru>
date Mon, 15 Sep 2008 00:00:00 +0400
parents 79c5df00501e
children b246022ef454
comparison
equal deleted inserted replaced
415:f6561f721532 416:a8e3f1441eec
75 ngx_http_variable_value_t *v, uintptr_t data); 75 ngx_http_variable_value_t *v, uintptr_t data);
76 76
77 static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r, 77 static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r,
78 ngx_http_variable_value_t *v, uintptr_t data); 78 ngx_http_variable_value_t *v, uintptr_t data);
79 static ngx_int_t ngx_http_variable_hostname(ngx_http_request_t *r, 79 static ngx_int_t ngx_http_variable_hostname(ngx_http_request_t *r,
80 ngx_http_variable_value_t *v, uintptr_t data);
81 static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
80 ngx_http_variable_value_t *v, uintptr_t data); 82 ngx_http_variable_value_t *v, uintptr_t data);
81 83
82 /* 84 /*
83 * TODO: 85 * TODO:
84 * Apache CGI: AUTH_TYPE, PATH_INFO (null), PATH_TRANSLATED 86 * Apache CGI: AUTH_TYPE, PATH_INFO (null), PATH_TRANSLATED
225 0, 0, 0 }, 227 0, 0, 0 },
226 228
227 { ngx_string("hostname"), NULL, ngx_http_variable_hostname, 229 { ngx_string("hostname"), NULL, ngx_http_variable_hostname,
228 0, 0, 0 }, 230 0, 0, 0 },
229 231
232 { ngx_string("pid"), NULL, ngx_http_variable_pid,
233 0, 0, 0 },
234
230 { ngx_null_string, NULL, NULL, 0, 0, 0 } 235 { ngx_null_string, NULL, NULL, 0, 0, 0 }
231 }; 236 };
232 237
233 238
234 ngx_http_variable_value_t ngx_http_variable_null_value = 239 ngx_http_variable_value_t ngx_http_variable_null_value =
1351 1356
1352 return NGX_OK; 1357 return NGX_OK;
1353 } 1358 }
1354 1359
1355 1360
1361 static ngx_int_t
1362 ngx_http_variable_pid(ngx_http_request_t *r,
1363 ngx_http_variable_value_t *v, uintptr_t data)
1364 {
1365 u_char *p;
1366
1367 p = ngx_pnalloc(r->pool, NGX_INT64_LEN);
1368 if (p == NULL) {
1369 return NGX_ERROR;
1370 }
1371
1372 v->len = ngx_sprintf(p, "%P", ngx_pid) - p;
1373 v->valid = 1;
1374 v->no_cacheable = 0;
1375 v->not_found = 0;
1376 v->data = p;
1377
1378 return NGX_OK;
1379 }
1380
1381
1356 ngx_int_t 1382 ngx_int_t
1357 ngx_http_variables_add_core_vars(ngx_conf_t *cf) 1383 ngx_http_variables_add_core_vars(ngx_conf_t *cf)
1358 { 1384 {
1359 ngx_int_t rc; 1385 ngx_int_t rc;
1360 ngx_http_variable_t *v; 1386 ngx_http_variable_t *v;