comparison src/http/ngx_http_script.c @ 102:f63280c59dd5 NGINX_0_2_5

nginx 0.2.5 *) Change: the duplicate value of the ngx_http_geo_module variable now causes the warning and changes old value. *) Feature: the ngx_http_ssi_module supports the "set" command. *) Feature: the ngx_http_ssi_module supports the "file" parameter in the "include" command. *) Feature: the ngx_http_ssi_module supports the variable value substitutions in expressions of the "if" command.
author Igor Sysoev <http://sysoev.ru>
date Tue, 04 Oct 2005 00:00:00 +0400
parents 991c6e4c7654
children d25a1d6034f1
comparison
equal deleted inserted replaced
101:5bb09dde34e7 102:f63280c59dd5
359 359
360 e->ip += sizeof(ngx_http_script_var_code_t); 360 e->ip += sizeof(ngx_http_script_var_code_t);
361 361
362 value = ngx_http_get_indexed_variable(e->request, code->index); 362 value = ngx_http_get_indexed_variable(e->request, code->index);
363 363
364 if (value == NULL || value == NGX_HTTP_VAR_NOT_FOUND) { 364 if (value && value != NGX_HTTP_VAR_NOT_FOUND) {
365 return 0; 365 return value->text.len;
366 } 366 }
367 367
368 return value->text.len; 368 return 0;
369 } 369 }
370 370
371 371
372 void 372 void
373 ngx_http_script_copy_var_code(ngx_http_script_engine_t *e) 373 ngx_http_script_copy_var_code(ngx_http_script_engine_t *e)
380 e->ip += sizeof(ngx_http_script_var_code_t); 380 e->ip += sizeof(ngx_http_script_var_code_t);
381 381
382 if (!e->skip) { 382 if (!e->skip) {
383 value = ngx_http_get_indexed_variable(e->request, code->index); 383 value = ngx_http_get_indexed_variable(e->request, code->index);
384 384
385 if (value == NULL || value == NGX_HTTP_VAR_NOT_FOUND) { 385 if (value && value != NGX_HTTP_VAR_NOT_FOUND) {
386 return; 386 e->pos = ngx_cpymem(e->pos, value->text.data, value->text.len);
387 } 387
388 388 if (e->log) {
389 e->pos = ngx_cpymem(e->pos, value->text.data, value->text.len); 389 ngx_log_debug1(NGX_LOG_DEBUG_HTTP,
390 390 e->request->connection->log, 0,
391 if (e->log) { 391 "http script var: \"%V\"", &e->buf);
392 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, 392 }
393 "http script var: \"%V\"", &e->buf);
394 } 393 }
395 } 394 }
396 } 395 }
397 396
398 397
877 876
878 e->ip += sizeof(ngx_http_script_var_code_t); 877 e->ip += sizeof(ngx_http_script_var_code_t);
879 878
880 value = ngx_http_get_indexed_variable(e->request, code->index); 879 value = ngx_http_get_indexed_variable(e->request, code->index);
881 880
882 if (value == NULL || value == NGX_HTTP_VAR_NOT_FOUND) { 881 if (value && value != NGX_HTTP_VAR_NOT_FOUND) {
883 e->sp->value = 0; 882 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
884 e->sp->text.len = 0; 883 "http script var: %ui, \"%V\"", value->value, &value->text);
885 e->sp->text.data = (u_char *) ""; 884 *e->sp = *value;
886 e->sp++; 885 e->sp++;
887 886
888 return; 887 return;
889 } 888 }
890 889
891 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, 890 e->sp->value = 0;
892 "http script var: %ui, \"%V\"", value->value, &value->text); 891 e->sp->text.len = 0;
893 892 e->sp->text.data = (u_char *) "";
894 *e->sp = *value;
895 e->sp++; 893 e->sp++;
896 } 894 }
897 895
898 896
899 void 897 void