Mercurial > hg > nginx
comparison src/http/modules/ngx_http_index_handler.c @ 1:d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 15 Aug 2002 17:20:26 +0000 |
parents | 4eff17414a43 |
children | 4f3879d9b6f6 |
comparison
equal
deleted
inserted
replaced
0:4eff17414a43 | 1:d220029ac7f3 |
---|---|
18 | 18 |
19 cf = (ngx_http_index_handler_loc_conf_t *) | 19 cf = (ngx_http_index_handler_loc_conf_t *) |
20 ngx_get_module_loc_conf(r, &ngx_http_index_handler_module); | 20 ngx_get_module_loc_conf(r, &ngx_http_index_handler_module); |
21 | 21 |
22 index_len = (*(r->uri_end - 1) == '/') ? cf->max_index_len : 0; | 22 index_len = (*(r->uri_end - 1) == '/') ? cf->max_index_len : 0; |
23 name = ngx_palloc(r->pool, r->uri_end - r->uri_start + index_len | 23 |
24 + r->server->doc_root_len); | 24 ngx_test_null(name, |
25 if (name == NULL) | 25 ngx_palloc(r->pool, r->uri_end - r->uri_start + index_len |
26 return NGX_ERROR; | 26 + r->server->doc_root_len), |
27 NGX_HTTP_INTERNAL_SERVER_ERROR); | |
27 | 28 |
28 loc = ngx_cpystrn(name, r->server->doc_root, r->server->doc_root_len); | 29 loc = ngx_cpystrn(name, r->server->doc_root, r->server->doc_root_len); |
29 file = ngx_cpystrn(loc, r->uri_start, r->uri_end - r->uri_start + 1); | 30 file = ngx_cpystrn(loc, r->uri_start, r->uri_end - r->uri_start + 1); |
30 | 31 |
31 /* URI without / on the end - check directory */ | 32 /* URI without / on the end - check directory */ |
37 "ngx_http_handler: " ngx_stat_n " %s failed", name); | 38 "ngx_http_handler: " ngx_stat_n " %s failed", name); |
38 | 39 |
39 if (err == NGX_ENOENT) | 40 if (err == NGX_ENOENT) |
40 return NGX_HTTP_NOT_FOUND; | 41 return NGX_HTTP_NOT_FOUND; |
41 else | 42 else |
42 return NGX_ERROR; | 43 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
43 } | 44 } |
44 | 45 |
45 if (ngx_is_dir(r->stat)) { | 46 if (ngx_is_dir(r->stat)) { |
46 *file++ = '/'; | 47 *file++ = '/'; |
47 *file = '\0'; | 48 *file = '\0'; |