comparison src/http/modules/ngx_http_index_module.c @ 394:05981f639d21 NGINX_0_7_9

nginx 0.7.9 *) Change: now ngx_http_charset_module works by default with following MIME types: text/html, text/css, text/xml, text/plain, text/vnd.wap.wml, application/x-javascript, and application/rss+xml. *) Feature: the "charset_types" and "addition_types" directives. *) Feature: now the "gzip_types", "ssi_types", and "sub_filter_types" directives use hash. *) Feature: the ngx_cpp_test_module. *) Feature: the "expires" directive supports daily time. *) Feature: the ngx_http_xslt_module improvements and bug fixing. Thanks to Denis F. Latypoff and Maxim Dounin. *) Bugfix: the "log_not_found" directive did not work for index files tests. *) Bugfix: HTTPS connections might hang, if kqueue, epoll, rtsig, or eventport methods were used; the bug had appeared in 0.7.7. *) Bugfix: if the "server_name", "valid_referers", and "map" directives used an "*.domain.tld" wildcard and exact name "domain.tld" was not set, then the exact name was matched by the wildcard; the bugs had appeared in 0.3.18.
author Igor Sysoev <http://sysoev.ru>
date Tue, 12 Aug 2008 00:00:00 +0400
parents 0b6053502c55
children 9d81578d04bb
comparison
equal deleted inserted replaced
393:040b8c84d040 394:05981f639d21
25 #define NGX_HTTP_DEFAULT_INDEX "index.html" 25 #define NGX_HTTP_DEFAULT_INDEX "index.html"
26 26
27 27
28 static ngx_int_t ngx_http_index_test_dir(ngx_http_request_t *r, 28 static ngx_int_t ngx_http_index_test_dir(ngx_http_request_t *r,
29 ngx_http_core_loc_conf_t *clcf, u_char *path, u_char *last); 29 ngx_http_core_loc_conf_t *clcf, u_char *path, u_char *last);
30 static ngx_int_t ngx_http_index_error(ngx_http_request_t *r, u_char *file, 30 static ngx_int_t ngx_http_index_error(ngx_http_request_t *r,
31 ngx_err_t err); 31 ngx_http_core_loc_conf_t *clcf, u_char *file, ngx_err_t err);
32 32
33 static ngx_int_t ngx_http_index_init(ngx_conf_t *cf); 33 static ngx_int_t ngx_http_index_init(ngx_conf_t *cf);
34 static void *ngx_http_index_create_loc_conf(ngx_conf_t *cf); 34 static void *ngx_http_index_create_loc_conf(ngx_conf_t *cf);
35 static char *ngx_http_index_merge_loc_conf(ngx_conf_t *cf, 35 static char *ngx_http_index_merge_loc_conf(ngx_conf_t *cf,
36 void *parent, void *child); 36 void *parent, void *child);
225 if (of.err == 0) { 225 if (of.err == 0) {
226 return NGX_HTTP_INTERNAL_SERVER_ERROR; 226 return NGX_HTTP_INTERNAL_SERVER_ERROR;
227 } 227 }
228 228
229 if (of.err == NGX_ENOTDIR || of.err == NGX_EACCES) { 229 if (of.err == NGX_ENOTDIR || of.err == NGX_EACCES) {
230 return ngx_http_index_error(r, path.data, of.err); 230 return ngx_http_index_error(r, clcf, path.data, of.err);
231 } 231 }
232 232
233 if (!dir_tested) { 233 if (!dir_tested) {
234 rc = ngx_http_index_test_dir(r, clcf, path.data, name - 1); 234 rc = ngx_http_index_test_dir(r, clcf, path.data, name - 1);
235 235
304 { 304 {
305 if (of.err) { 305 if (of.err) {
306 306
307 if (of.err == NGX_ENOENT) { 307 if (of.err == NGX_ENOENT) {
308 *last = c; 308 *last = c;
309 return ngx_http_index_error(r, dir.data, NGX_ENOENT); 309 return ngx_http_index_error(r, clcf, dir.data, NGX_ENOENT);
310 } 310 }
311 311
312 ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err, 312 ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err,
313 ngx_open_file_n " \"%s\" failed", dir.data); 313 ngx_open_file_n " \"%s\" failed", dir.data);
314 } 314 }
328 return NGX_HTTP_INTERNAL_SERVER_ERROR; 328 return NGX_HTTP_INTERNAL_SERVER_ERROR;
329 } 329 }
330 330
331 331
332 static ngx_int_t 332 static ngx_int_t
333 ngx_http_index_error(ngx_http_request_t *r, u_char *file, ngx_err_t err) 333 ngx_http_index_error(ngx_http_request_t *r, ngx_http_core_loc_conf_t *clcf,
334 u_char *file, ngx_err_t err)
334 { 335 {
335 if (err == NGX_EACCES) { 336 if (err == NGX_EACCES) {
336 ngx_log_error(NGX_LOG_ERR, r->connection->log, err, 337 ngx_log_error(NGX_LOG_ERR, r->connection->log, err,
337 "\"%s\" is forbidden", file); 338 "\"%s\" is forbidden", file);
338 339
339 return NGX_HTTP_FORBIDDEN; 340 return NGX_HTTP_FORBIDDEN;
340 } 341 }
341 342
342 ngx_log_error(NGX_LOG_ERR, r->connection->log, err, 343 if (clcf->log_not_found) {
343 "\"%s\" is not found", file); 344 ngx_log_error(NGX_LOG_ERR, r->connection->log, err,
345 "\"%s\" is not found", file);
346 }
344 347
345 return NGX_HTTP_NOT_FOUND; 348 return NGX_HTTP_NOT_FOUND;
346 } 349 }
347 350
348 351