26 #define NGX_HTTP_DEFAULT_INDEX "index.html"
35 static void *ngx_http_index_create_loc_conf(
ngx_conf_t *cf);
36 static char *ngx_http_index_merge_loc_conf(
ngx_conf_t *cf,
37 void *parent,
void *child);
46 ngx_http_index_set_index,
65 ngx_http_index_create_loc_conf,
66 ngx_http_index_merge_loc_conf
72 &ngx_http_index_module_ctx,
73 ngx_http_index_commands,
100 size_t len, root, reserve, allocated;
133 if (index[i].lengths == NULL) {
135 if (index[i].name.data[0] ==
'/') {
152 while (*(uintptr_t *) e.
ip) {
162 if (reserve > allocated) {
169 allocated = path.
data + path.
len - name;
172 if (index[i].values == NULL) {
184 while (*(uintptr_t *) e.
ip) {
201 "open index \"%V\"", &path);
227 #if (NGX_HAVE_OPENAT)
228 if (of.
err == NGX_EMLINK
229 || of.
err == NGX_ELOOP)
239 return ngx_http_index_error(r, clcf, path.
data, of.
err);
243 rc = ngx_http_index_test_dir(r, clcf, path.
data, name - 1);
269 if (uri.
data == NULL) {
286 u_char *path, u_char *last)
293 if (c !=
'/' || path == last) {
299 dir.
len = last - path;
303 "http index check dir: \"%V\"", &dir);
321 #if (NGX_HAVE_OPENAT)
322 if (of.
err == NGX_EMLINK
323 || of.
err == NGX_ELOOP)
361 "\"%s\" is not a directory", dir.
data);
373 "\"%s\" is forbidden", file);
380 "\"%s\" is not found", file);
388 ngx_http_index_create_loc_conf(
ngx_conf_t *cf)
405 ngx_http_index_merge_loc_conf(
ngx_conf_t *cf,
void *parent,
void *child)
455 *h = ngx_http_index_handler;
484 if (value[i].data[0] ==
'/' && i != cf->
args->
nelts - 1) {
486 "only the last index in \"index\" directive "
487 "should be absolute");
490 if (value[i].len == 0) {
492 "index \"%V\" in \"index\" directive is invalid",