comparison src/http/ngx_http_core_module.c @ 440:6281966854a5 NGINX_0_7_32

nginx 0.7.32 *) Feature: now a directory existence testing can be set explicitly in the "try_files" directive. *) Bugfix: fastcgi_store stored files not always. *) Bugfix: in geo ranges. *) Bugfix: in shared memory allocations if nginx was built without debugging. Thanks to Andrey Kvasov.
author Igor Sysoev <http://sysoev.ru>
date Mon, 26 Jan 2009 00:00:00 +0300
parents ce4f9ff90bfa
children 670af56a1158
comparison
equal deleted inserted replaced
439:02687ee42c28 440:6281966854a5
1036 { 1036 {
1037 size_t len, root, alias; 1037 size_t len, root, alias;
1038 ssize_t reserve, allocated; 1038 ssize_t reserve, allocated;
1039 u_char *p, *name; 1039 u_char *p, *name;
1040 ngx_str_t path; 1040 ngx_str_t path;
1041 ngx_uint_t test_dir;
1041 ngx_http_try_file_t *tf; 1042 ngx_http_try_file_t *tf;
1042 ngx_open_file_info_t of; 1043 ngx_open_file_info_t of;
1043 ngx_http_script_code_pt code; 1044 ngx_http_script_code_pt code;
1044 ngx_http_script_engine_t e; 1045 ngx_http_script_engine_t e;
1045 ngx_http_core_loc_conf_t *clcf; 1046 ngx_http_core_loc_conf_t *clcf;
1130 if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) { 1131 if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) {
1131 ngx_memcpy(name, name + alias, len - alias); 1132 ngx_memcpy(name, name + alias, len - alias);
1132 path.len -= alias; 1133 path.len -= alias;
1133 } 1134 }
1134 } 1135 }
1136
1137 test_dir = tf->test_dir;
1135 1138
1136 tf++; 1139 tf++;
1137 1140
1138 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 1141 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1139 "try to use file: \"%s\"", name); 1142 "try to use file: \"%s\"", name);
1170 } 1173 }
1171 1174
1172 continue; 1175 continue;
1173 } 1176 }
1174 1177
1175 if (!of.is_file) { 1178 if (of.is_dir && !test_dir) {
1176 continue; 1179 continue;
1177 } 1180 }
1178 1181
1179 path.len -= root; 1182 path.len -= root;
1180 path.data += root; 1183 path.data += root;
3851 3854
3852 for (i = 0; i < cf->args->nelts - 1; i++) { 3855 for (i = 0; i < cf->args->nelts - 1; i++) {
3853 3856
3854 tf[i].name = value[i + 1]; 3857 tf[i].name = value[i + 1];
3855 3858
3859 if (tf[i].name.data[tf[i].name.len - 1] == '/') {
3860 tf[i].test_dir = 1;
3861 tf[i].name.len--;
3862 }
3863
3856 n = ngx_http_script_variables_count(&tf[i].name); 3864 n = ngx_http_script_variables_count(&tf[i].name);
3857 3865
3858 if (n) { 3866 if (n) {
3859 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); 3867 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
3860 3868