comparison src/http/modules/ngx_http_index_module.c @ 439:dac47e9ef0d5 NGINX_0_7_27

nginx 0.7.27 *) Feature: the "try_files" directive. *) Feature: variables support in the "fastcgi_pass" directive. *) Feature: now the $geo variable may get an address from a variable. Thanks to Andrei Nigmatulin. *) Feature: now a location's modifier may be used without space before name. *) Feature: the $upstream_response_length variable. *) Bugfix: now a "add_header" directive does not add an empty value. *) Bugfix: if zero length static file was requested, then nginx just closed connection; the bug had appeared in 0.7.25. *) Bugfix: a MOVE method could not move file in non-existent directory. *) Bugfix: a segmentation fault occurred in worker process, if no one named location was defined in server, but some one was used in an error_page directive. Thanks to Sergey Bochenkov.
author Igor Sysoev <http://sysoev.ru>
date Mon, 15 Dec 2008 00:00:00 +0300
parents 9d81578d04bb
children 670af56a1158
comparison
equal deleted inserted replaced
438:3b8e9d1bc9bb 439:dac47e9ef0d5
97 { 97 {
98 u_char *p, *name; 98 u_char *p, *name;
99 size_t len, nlen, root, allocated; 99 size_t len, nlen, root, allocated;
100 ngx_int_t rc; 100 ngx_int_t rc;
101 ngx_str_t path, uri; 101 ngx_str_t path, uri;
102 ngx_log_t *log;
103 ngx_uint_t i, dir_tested; 102 ngx_uint_t i, dir_tested;
104 ngx_http_index_t *index; 103 ngx_http_index_t *index;
105 ngx_open_file_info_t of; 104 ngx_open_file_info_t of;
106 ngx_http_script_code_pt code; 105 ngx_http_script_code_pt code;
107 ngx_http_script_engine_t e; 106 ngx_http_script_engine_t e;
120 /* TODO: Win32 */ 119 /* TODO: Win32 */
121 if (r->zero_in_uri) { 120 if (r->zero_in_uri) {
122 return NGX_DECLINED; 121 return NGX_DECLINED;
123 } 122 }
124 123
125 log = r->connection->log;
126
127 ilcf = ngx_http_get_module_loc_conf(r, ngx_http_index_module); 124 ilcf = ngx_http_get_module_loc_conf(r, ngx_http_index_module);
128 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 125 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
129 126
130 allocated = 0; 127 allocated = 0;
131 root = 0; 128 root = 0;
204 path.len = e.pos - path.data; 201 path.len = e.pos - path.data;
205 202
206 *e.pos++ = '\0'; 203 *e.pos++ = '\0';
207 } 204 }
208 205
209 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "open index \"%V\"", &path); 206 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
207 "open index \"%V\"", &path);
210 208
211 ngx_memzero(&of, sizeof(ngx_open_file_info_t)); 209 ngx_memzero(&of, sizeof(ngx_open_file_info_t));
212 210
213 of.directio = clcf->directio; 211 of.directio = clcf->directio;
214 of.valid = clcf->open_file_cache_valid; 212 of.valid = clcf->open_file_cache_valid;
217 of.events = clcf->open_file_cache_events; 215 of.events = clcf->open_file_cache_events;
218 216
219 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) 217 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
220 != NGX_OK) 218 != NGX_OK)
221 { 219 {
222 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, of.err, 220 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, of.err,
223 ngx_open_file_n " \"%s\" failed", path.data); 221 ngx_open_file_n " \"%s\" failed", path.data);
224 222
225 if (of.err == 0) { 223 if (of.err == 0) {
226 return NGX_HTTP_INTERNAL_SERVER_ERROR; 224 return NGX_HTTP_INTERNAL_SERVER_ERROR;
227 } 225 }
242 240
243 if (of.err == NGX_ENOENT) { 241 if (of.err == NGX_ENOENT) {
244 continue; 242 continue;
245 } 243 }
246 244
247 ngx_log_error(NGX_LOG_ERR, log, of.err, 245 ngx_log_error(NGX_LOG_ERR, r->connection->log, of.err,
248 ngx_open_file_n " \"%s\" failed", path.data); 246 ngx_open_file_n " \"%s\" failed", path.data);
249 247
250 return NGX_HTTP_INTERNAL_SERVER_ERROR; 248 return NGX_HTTP_INTERNAL_SERVER_ERROR;
251 } 249 }
252 250