Mercurial > hg > nginx-vendor-current
comparison src/http/ngx_http_script.c @ 180:4cd3e70c4d60 NGINX_0_3_37
nginx 0.3.37
*) Feature: the "limit_except" directive.
*) Feature: the "if" directive supports the "!~", "!~*", "-f", and
"!-f" operators.
*) Feature: the ngx_http_perl_module supports the $r->request_body
method.
*) Bugfix: in the ngx_http_addition_filter_module.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 07 Apr 2006 00:00:00 +0400 |
parents | 1b490fc19afa |
children | 54aabf2b0bc6 |
comparison
equal
deleted
inserted
replaced
179:654cbdc0401d | 180:4cd3e70c4d60 |
---|---|
586 } | 586 } |
587 | 587 |
588 e->ncaptures = 0; | 588 e->ncaptures = 0; |
589 | 589 |
590 if (code->test) { | 590 if (code->test) { |
591 e->sp->len = 0; | 591 if (code->negative_test) { |
592 e->sp->data = (u_char *) ""; | 592 e->sp->len = 1; |
593 e->sp->data = (u_char *) "1"; | |
594 | |
595 } else { | |
596 e->sp->len = 0; | |
597 e->sp->data = (u_char *) ""; | |
598 } | |
599 | |
593 e->sp++; | 600 e->sp++; |
594 | 601 |
595 e->ip += sizeof(ngx_http_script_regex_code_t); | 602 e->ip += sizeof(ngx_http_script_regex_code_t); |
596 return; | 603 return; |
597 } | 604 } |
616 } | 623 } |
617 | 624 |
618 e->ncaptures = code->ncaptures; | 625 e->ncaptures = code->ncaptures; |
619 | 626 |
620 if (code->test) { | 627 if (code->test) { |
621 e->sp->len = 1; | 628 if (code->negative_test) { |
622 e->sp->data = (u_char *) "1"; | 629 e->sp->len = 0; |
630 e->sp->data = (u_char *) ""; | |
631 | |
632 } else { | |
633 e->sp->len = 1; | |
634 e->sp->data = (u_char *) "1"; | |
635 } | |
636 | |
623 e->sp++; | 637 e->sp++; |
624 | 638 |
625 e->ip += sizeof(ngx_http_script_regex_code_t); | 639 e->ip += sizeof(ngx_http_script_regex_code_t); |
626 return; | 640 return; |
627 } | 641 } |
909 *res = ngx_http_variable_true_value; | 923 *res = ngx_http_variable_true_value; |
910 } | 924 } |
911 | 925 |
912 | 926 |
913 void | 927 void |
928 ngx_http_script_file_code(ngx_http_script_engine_t *e) | |
929 { | |
930 ngx_err_t err; | |
931 ngx_file_info_t fi; | |
932 ngx_http_variable_value_t *value; | |
933 ngx_http_script_file_code_t *code; | |
934 | |
935 value = e->sp - 1; | |
936 | |
937 code = (ngx_http_script_file_code_t *) e->ip; | |
938 e->ip += sizeof(ngx_http_script_file_code_t); | |
939 | |
940 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, | |
941 "http script file op %p", code->op); | |
942 | |
943 if (ngx_file_info(value->data, &fi) == -1) { | |
944 err = ngx_errno; | |
945 | |
946 if (err != NGX_ENOENT && err != NGX_ENOTDIR) { | |
947 ngx_log_error(NGX_LOG_CRIT, e->request->connection->log, err, | |
948 ngx_file_info_n " \"%s\" failed", value->data); | |
949 } | |
950 | |
951 switch (code->op) { | |
952 case ngx_http_script_file_plain: | |
953 goto false; | |
954 case ngx_http_script_file_not_plain: | |
955 goto true; | |
956 } | |
957 | |
958 goto false; | |
959 } | |
960 | |
961 switch (code->op) { | |
962 case ngx_http_script_file_plain: | |
963 if (ngx_is_file(&fi)) { | |
964 goto true; | |
965 } | |
966 goto false; | |
967 | |
968 case ngx_http_script_file_not_plain: | |
969 if (ngx_is_file(&fi)) { | |
970 goto false; | |
971 } | |
972 goto true; | |
973 } | |
974 | |
975 false: | |
976 | |
977 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, | |
978 "http script file op false"); | |
979 | |
980 *value = ngx_http_variable_null_value; | |
981 return; | |
982 | |
983 true: | |
984 | |
985 *value = ngx_http_variable_true_value; | |
986 return; | |
987 } | |
988 | |
989 | |
990 void | |
914 ngx_http_script_complex_value_code(ngx_http_script_engine_t *e) | 991 ngx_http_script_complex_value_code(ngx_http_script_engine_t *e) |
915 { | 992 { |
916 size_t len; | 993 size_t len; |
917 ngx_http_script_engine_t le; | 994 ngx_http_script_engine_t le; |
918 ngx_http_script_len_code_pt lcode; | 995 ngx_http_script_len_code_pt lcode; |