comparison src/http/modules/ngx_http_index_module.c @ 380:3ce4580ae286 NGINX_0_6_34

nginx 0.6.34 *) Change: now the EAGAIN error returned by connect() is not considered as temporary error. *) Change: now the "gzip_vary" directive turned on issues a "Vary: Accept-Encoding" header line for uncompressed responses too. *) Feature: the "expires" directive supports daily time. *) Feature: the "Expect" request header line support. *) Feature: now the "rewrite" directive does a redirect automatically if the "https://" protocol is used. *) Bugfix: the "listen" directive parameters such as "backlog", "rcvbuf", etc. were not set, if a default server was not the first one. *) Bugfix: the "log_not_found" directive did not work for index files tests. *) Bugfix: now if FastCGI server sends a "Location" header line without status line, then nginx uses 302 status code. Thanks to Maxim Dounin. *) Bugfix: the ngx_http_flv_module did not support several values in a query string. *) Bugfix: when a request to a directory was redirected with the slash added, nginx dropped a query string from the original request.
author Igor Sysoev <http://sysoev.ru>
date Thu, 27 Nov 2008 00:00:00 +0300
parents fc497c1dfb7c
children
comparison
equal deleted inserted replaced
379:522189e0ef36 380:3ce4580ae286
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);
223 if (of.err == 0) { 223 if (of.err == 0) {
224 return NGX_HTTP_INTERNAL_SERVER_ERROR; 224 return NGX_HTTP_INTERNAL_SERVER_ERROR;
225 } 225 }
226 226
227 if (of.err == NGX_ENOTDIR || of.err == NGX_EACCES) { 227 if (of.err == NGX_ENOTDIR || of.err == NGX_EACCES) {
228 return ngx_http_index_error(r, path.data, of.err); 228 return ngx_http_index_error(r, clcf, path.data, of.err);
229 } 229 }
230 230
231 if (!dir_tested) { 231 if (!dir_tested) {
232 rc = ngx_http_index_test_dir(r, clcf, path.data, name - 1); 232 rc = ngx_http_index_test_dir(r, clcf, path.data, name - 1);
233 233
301 { 301 {
302 if (of.err) { 302 if (of.err) {
303 303
304 if (of.err == NGX_ENOENT) { 304 if (of.err == NGX_ENOENT) {
305 *last = c; 305 *last = c;
306 return ngx_http_index_error(r, dir.data, NGX_ENOENT); 306 return ngx_http_index_error(r, clcf, dir.data, NGX_ENOENT);
307 } 307 }
308 308
309 if (of.err == NGX_EACCES) { 309 if (of.err == NGX_EACCES) {
310 310
311 *last = c; 311 *last = c;
338 return NGX_HTTP_INTERNAL_SERVER_ERROR; 338 return NGX_HTTP_INTERNAL_SERVER_ERROR;
339 } 339 }
340 340
341 341
342 static ngx_int_t 342 static ngx_int_t
343 ngx_http_index_error(ngx_http_request_t *r, u_char *file, ngx_err_t err) 343 ngx_http_index_error(ngx_http_request_t *r, ngx_http_core_loc_conf_t *clcf,
344 u_char *file, ngx_err_t err)
344 { 345 {
345 if (err == NGX_EACCES) { 346 if (err == NGX_EACCES) {
346 ngx_log_error(NGX_LOG_ERR, r->connection->log, err, 347 ngx_log_error(NGX_LOG_ERR, r->connection->log, err,
347 "\"%s\" is forbidden", file); 348 "\"%s\" is forbidden", file);
348 349
349 return NGX_HTTP_FORBIDDEN; 350 return NGX_HTTP_FORBIDDEN;
350 } 351 }
351 352
352 ngx_log_error(NGX_LOG_ERR, r->connection->log, err, 353 if (clcf->log_not_found) {
353 "\"%s\" is not found", file); 354 ngx_log_error(NGX_LOG_ERR, r->connection->log, err,
355 "\"%s\" is not found", file);
356 }
354 357
355 return NGX_HTTP_NOT_FOUND; 358 return NGX_HTTP_NOT_FOUND;
356 } 359 }
357 360
358 361