Mercurial > hg > nginx-vendor-0-5
comparison src/http/modules/ngx_http_rewrite_handler.c @ 48:6cfc63e68377 NGINX_0_1_24
nginx 0.1.24
*) Feature: the ngx_http_ssi_filter_module supports the QUERY_STRING
and DOCUMENT_URI variables.
*) Bugfix: the ngx_http_autoindex_module may some times return the 404
response for existent directory, if this directory was used in
"alias" directive.
*) Bugfix: the ngx_http_ssi_filter_module ran incorrectly for large
responses.
*) Bugfix: the lack of the "Referer" header line was always accounted
as valid referrer.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 04 Mar 2005 00:00:00 +0300 |
parents | a39d1b793287 |
children |
comparison
equal
deleted
inserted
replaced
47:4ae32548452c | 48:6cfc63e68377 |
---|---|
538 | 538 |
539 e->sp++; | 539 e->sp++; |
540 | 540 |
541 e->ip += sizeof(ngx_http_rewrite_var_code_t); | 541 e->ip += sizeof(ngx_http_rewrite_var_code_t); |
542 | 542 |
543 if (!(value = ngx_http_get_variable(e->request, code->index))) { | 543 if (!(value = ngx_http_get_indexed_variable(e->request, code->index))) { |
544 *e->sp = (uintptr_t) 0; | 544 *e->sp = (uintptr_t) 0; |
545 return; | 545 return; |
546 } | 546 } |
547 | 547 |
548 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, | 548 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, |
694 ngx_conf_merge_unsigned_value(conf->stack_size, prev->stack_size, 10); | 694 ngx_conf_merge_unsigned_value(conf->stack_size, prev->stack_size, 10); |
695 | 695 |
696 if (conf->referers == NULL) { | 696 if (conf->referers == NULL) { |
697 conf->referers = prev->referers; | 697 conf->referers = prev->referers; |
698 ngx_conf_merge_value(conf->no_referer, prev->no_referer, 0); | 698 ngx_conf_merge_value(conf->no_referer, prev->no_referer, 0); |
699 } | |
700 | |
701 if (conf->no_referer == NGX_CONF_UNSET) { | |
702 conf->no_referer = 0; | |
699 } | 703 } |
700 | 704 |
701 if (conf->codes == NULL) { | 705 if (conf->codes == NULL) { |
702 return NGX_CONF_OK; | 706 return NGX_CONF_OK; |
703 } | 707 } |
1023 | 1027 |
1024 void *mconf; | 1028 void *mconf; |
1025 char *rv; | 1029 char *rv; |
1026 u_char *elts; | 1030 u_char *elts; |
1027 ngx_str_t *value; | 1031 ngx_str_t *value; |
1032 ngx_int_t index; | |
1028 ngx_uint_t i; | 1033 ngx_uint_t i; |
1029 ngx_conf_t save; | 1034 ngx_conf_t save; |
1030 ngx_http_rewrite_code_pt *code; | 1035 ngx_http_rewrite_code_pt *code; |
1031 ngx_http_module_t *module; | 1036 ngx_http_module_t *module; |
1032 ngx_http_conf_ctx_t *ctx, *pctx; | 1037 ngx_http_conf_ctx_t *ctx, *pctx; |
1033 ngx_http_variable_t *var; | |
1034 ngx_http_core_loc_conf_t *clcf, *pclcf, **clcfp; | 1038 ngx_http_core_loc_conf_t *clcf, *pclcf, **clcfp; |
1035 ngx_http_core_main_conf_t *cmcf; | 1039 ngx_http_core_main_conf_t *cmcf; |
1036 ngx_http_rewrite_if_code_t *if_code; | 1040 ngx_http_rewrite_if_code_t *if_code; |
1037 ngx_http_rewrite_var_code_t *var_code; | 1041 ngx_http_rewrite_var_code_t *var_code; |
1038 ngx_http_rewrite_loc_conf_t *nlcf; | 1042 ngx_http_rewrite_loc_conf_t *nlcf; |
1117 } | 1121 } |
1118 | 1122 |
1119 *code = ngx_http_rewrite_invalid_referer_code; | 1123 *code = ngx_http_rewrite_invalid_referer_code; |
1120 | 1124 |
1121 } else { | 1125 } else { |
1122 | |
1123 cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); | 1126 cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); |
1124 | 1127 |
1125 var = cmcf->variables.elts; | 1128 index = ngx_http_get_variable_index(cmcf, &value[1]); |
1126 for (i = 0; i < cmcf->variables.nelts; i++) { | 1129 |
1127 if (var[i].name.len != value[1].len) { | 1130 if (index == -1) { |
1128 continue; | |
1129 } | |
1130 | |
1131 if (ngx_strncasecmp(var[i].name.data, value[1].data, | |
1132 var[i].name.len) == 0) | |
1133 { | |
1134 break; | |
1135 } | |
1136 } | |
1137 | |
1138 if (i == cmcf->variables.nelts) { | |
1139 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 1131 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
1140 "unknown variable name \"%V\"", &value[1]); | 1132 "unknown variable name \"%V\"", &value[1]); |
1141 return NGX_CONF_ERROR; | 1133 return NGX_CONF_ERROR; |
1142 } | 1134 } |
1143 | 1135 |
1146 if (var_code == NULL) { | 1138 if (var_code == NULL) { |
1147 return NGX_CONF_ERROR; | 1139 return NGX_CONF_ERROR; |
1148 } | 1140 } |
1149 | 1141 |
1150 var_code->code = ngx_http_rewrite_var_code; | 1142 var_code->code = ngx_http_rewrite_var_code; |
1151 var_code->index = var[i].index; | 1143 var_code->index = index; |
1152 } | 1144 } |
1153 | 1145 |
1154 if_code = ngx_array_push_n(lcf->codes, sizeof(ngx_http_rewrite_if_code_t)); | 1146 if_code = ngx_array_push_n(lcf->codes, sizeof(ngx_http_rewrite_if_code_t)); |
1155 if (if_code == NULL) { | 1147 if (if_code == NULL) { |
1156 return NULL; | 1148 return NULL; |