Mercurial > hg > nginx-vendor-1-0
comparison src/http/modules/ngx_http_autoindex_module.c @ 230:38e7b94d63ac NGINX_0_4_0
nginx 0.4.0
*) Change in internal API: the HTTP modules initialization was moved
from the init module phase to the HTTP postconfiguration phase.
*) Change: now the request body is not read beforehand for the
ngx_http_perl_module: it's required to start the reading using the
$r->has_request_body method.
*) Feature: the ngx_http_perl_module supports the DECLINED return code.
*) Feature: the ngx_http_dav_module supports the incoming "Date" header
line for the PUT method.
*) Feature: the "ssi" directive is available inside the "if" block.
*) Bugfix: a segmentation fault occurred if there was an "index"
directive with variables and the first index name was without
variables; bug appeared in 0.1.29.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 30 Aug 2006 00:00:00 +0400 |
parents | fa32d59d9a15 |
children | acd2ec3541cb |
comparison
equal
deleted
inserted
replaced
229:1965c8e23be7 | 230:38e7b94d63ac |
---|---|
46 | 46 |
47 static int ngx_libc_cdecl ngx_http_autoindex_cmp_entries(const void *one, | 47 static int ngx_libc_cdecl ngx_http_autoindex_cmp_entries(const void *one, |
48 const void *two); | 48 const void *two); |
49 static ngx_int_t ngx_http_autoindex_error(ngx_http_request_t *r, | 49 static ngx_int_t ngx_http_autoindex_error(ngx_http_request_t *r, |
50 ngx_dir_t *dir, ngx_str_t *name); | 50 ngx_dir_t *dir, ngx_str_t *name); |
51 static ngx_int_t ngx_http_autoindex_init(ngx_cycle_t *cycle); | 51 static ngx_int_t ngx_http_autoindex_init(ngx_conf_t *cf); |
52 static void *ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf); | 52 static void *ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf); |
53 static char *ngx_http_autoindex_merge_loc_conf(ngx_conf_t *cf, | 53 static char *ngx_http_autoindex_merge_loc_conf(ngx_conf_t *cf, |
54 void *parent, void *child); | 54 void *parent, void *child); |
55 | 55 |
56 | 56 |
81 }; | 81 }; |
82 | 82 |
83 | 83 |
84 static ngx_http_module_t ngx_http_autoindex_module_ctx = { | 84 static ngx_http_module_t ngx_http_autoindex_module_ctx = { |
85 NULL, /* preconfiguration */ | 85 NULL, /* preconfiguration */ |
86 NULL, /* postconfiguration */ | 86 ngx_http_autoindex_init, /* postconfiguration */ |
87 | 87 |
88 NULL, /* create main configuration */ | 88 NULL, /* create main configuration */ |
89 NULL, /* init main configuration */ | 89 NULL, /* init main configuration */ |
90 | 90 |
91 NULL, /* create server configuration */ | 91 NULL, /* create server configuration */ |
100 NGX_MODULE_V1, | 100 NGX_MODULE_V1, |
101 &ngx_http_autoindex_module_ctx, /* module context */ | 101 &ngx_http_autoindex_module_ctx, /* module context */ |
102 ngx_http_autoindex_commands, /* module directives */ | 102 ngx_http_autoindex_commands, /* module directives */ |
103 NGX_HTTP_MODULE, /* module type */ | 103 NGX_HTTP_MODULE, /* module type */ |
104 NULL, /* init master */ | 104 NULL, /* init master */ |
105 ngx_http_autoindex_init, /* init module */ | 105 NULL, /* init module */ |
106 NULL, /* init process */ | 106 NULL, /* init process */ |
107 NULL, /* init thread */ | 107 NULL, /* init thread */ |
108 NULL, /* exit thread */ | 108 NULL, /* exit thread */ |
109 NULL, /* exit process */ | 109 NULL, /* exit process */ |
110 NULL, /* exit master */ | 110 NULL, /* exit master */ |
588 | 588 |
589 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 589 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
590 } | 590 } |
591 | 591 |
592 | 592 |
593 static ngx_int_t | |
594 ngx_http_autoindex_init(ngx_cycle_t *cycle) | |
595 { | |
596 ngx_http_handler_pt *h; | |
597 ngx_http_core_main_conf_t *cmcf; | |
598 | |
599 cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module); | |
600 | |
601 h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers); | |
602 if (h == NULL) { | |
603 return NGX_ERROR; | |
604 } | |
605 | |
606 *h = ngx_http_autoindex_handler; | |
607 | |
608 return NGX_OK; | |
609 } | |
610 | |
611 | |
612 static void * | 593 static void * |
613 ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf) | 594 ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf) |
614 { | 595 { |
615 ngx_http_autoindex_loc_conf_t *conf; | 596 ngx_http_autoindex_loc_conf_t *conf; |
616 | 597 |
637 ngx_conf_merge_value(conf->localtime, prev->localtime, 0); | 618 ngx_conf_merge_value(conf->localtime, prev->localtime, 0); |
638 ngx_conf_merge_value(conf->exact_size, prev->exact_size, 1); | 619 ngx_conf_merge_value(conf->exact_size, prev->exact_size, 1); |
639 | 620 |
640 return NGX_CONF_OK; | 621 return NGX_CONF_OK; |
641 } | 622 } |
623 | |
624 | |
625 static ngx_int_t | |
626 ngx_http_autoindex_init(ngx_conf_t *cf) | |
627 { | |
628 ngx_http_handler_pt *h; | |
629 ngx_http_core_main_conf_t *cmcf; | |
630 | |
631 cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); | |
632 | |
633 h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers); | |
634 if (h == NULL) { | |
635 return NGX_ERROR; | |
636 } | |
637 | |
638 *h = ngx_http_autoindex_handler; | |
639 | |
640 return NGX_OK; | |
641 } |