|
|
|
@ -36,13 +36,6 @@ typedef struct {
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_TOP 0x00
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_PRE 0x00
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_ASIS 0x01
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_BOTTOM 0x02
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_DIV 0x04
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_IFRAME 0x08
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
ngx_str_t name;
|
|
|
|
@ -54,19 +47,39 @@ typedef struct {
|
|
|
|
|
} ngx_http_fancyindex_entry_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_TOP 0x00
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_PRE 0x00
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_ASIS 0x01
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_BOTTOM 0x02
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_DIV 0x04
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_README_IFRAME 0x08
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
NGX_HTTP_FANCYINDEX_INCLUDE_STATIC, /* Cache file contents on first request */
|
|
|
|
|
NGX_HTTP_FANCYINDEX_INCLUDE_CACHED, /* Cache file contents on first request,
|
|
|
|
|
and re-read if needed afterwards */
|
|
|
|
|
} ngx_http_fancyindex_include_mode_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
ngx_flag_t enable;
|
|
|
|
|
ngx_flag_t localtime;
|
|
|
|
|
ngx_flag_t exact_size;
|
|
|
|
|
ngx_flag_t enable;
|
|
|
|
|
ngx_flag_t localtime;
|
|
|
|
|
ngx_flag_t exact_size;
|
|
|
|
|
|
|
|
|
|
ngx_str_t header;
|
|
|
|
|
ngx_str_t footer;
|
|
|
|
|
ngx_str_t readme;
|
|
|
|
|
|
|
|
|
|
ngx_str_t header;
|
|
|
|
|
ngx_str_t footer;
|
|
|
|
|
ngx_str_t readme;
|
|
|
|
|
ngx_uint_t readme_flags;
|
|
|
|
|
|
|
|
|
|
ngx_uint_t readme_flags;
|
|
|
|
|
ngx_http_fancyindex_include_mode_t include_mode;
|
|
|
|
|
} ngx_http_fancyindex_loc_conf_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define nfi_conf_path_set(_c, _n) ((_c)->((_n).len) > 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_PREALLOCATE 50
|
|
|
|
|
#define NGX_HTTP_FANCYINDEX_NAME_LEN 50
|
|
|
|
|
|
|
|
|
@ -82,7 +95,7 @@ static char *ngx_http_fancyindex_merge_loc_conf(ngx_conf_t *cf,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static ngx_conf_bitmask_t ngx_http_fancyindex_readme_flags[] = {
|
|
|
|
|
static const ngx_conf_bitmask_t ngx_http_fancyindex_readme_flags[] = {
|
|
|
|
|
{ ngx_string("pre"), NGX_HTTP_FANCYINDEX_README_PRE },
|
|
|
|
|
{ ngx_string("asis"), NGX_HTTP_FANCYINDEX_README_ASIS },
|
|
|
|
|
{ ngx_string("top"), NGX_HTTP_FANCYINDEX_README_TOP },
|
|
|
|
@ -93,6 +106,14 @@ static ngx_conf_bitmask_t ngx_http_fancyindex_readme_flags[] = {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const ngx_conf_enum_t ngx_http_fancyindex_include_modes[] = {
|
|
|
|
|
{ ngx_string("static"), NGX_HTTP_FANCYINDEX_INCLUDE_STATIC },
|
|
|
|
|
{ ngx_string("cached"), NGX_HTTP_FANCYINDEX_INCLUDE_CACHED },
|
|
|
|
|
{ ngx_null_string, 0 },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static ngx_command_t ngx_http_fancyindex_commands[] = {
|
|
|
|
|
|
|
|
|
|
{ ngx_string("fancyindex"),
|
|
|
|
@ -144,6 +165,13 @@ static ngx_command_t ngx_http_fancyindex_commands[] = {
|
|
|
|
|
offsetof(ngx_http_fancyindex_loc_conf_t, readme_flags),
|
|
|
|
|
&ngx_http_fancyindex_readme_flags },
|
|
|
|
|
|
|
|
|
|
{ ngx_string("fancyindex_mode"),
|
|
|
|
|
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
|
|
|
|
ngx_conf_set_enum_slot,
|
|
|
|
|
NGX_HTTP_LOC_CONF_OFFSET,
|
|
|
|
|
offsetof(ngx_http_fancyindex_loc_conf_t, include_mode),
|
|
|
|
|
&ngx_http_fancyindex_include_modes },
|
|
|
|
|
|
|
|
|
|
ngx_null_command
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -683,6 +711,7 @@ ngx_http_fancyindex_create_loc_conf(ngx_conf_t *cf)
|
|
|
|
|
conf->localtime = NGX_CONF_UNSET;
|
|
|
|
|
conf->exact_size = NGX_CONF_UNSET;
|
|
|
|
|
conf->readme_flags = NGX_CONF_UNSET;
|
|
|
|
|
conf->include_mode = NGX_CONF_UNSET;
|
|
|
|
|
|
|
|
|
|
return conf;
|
|
|
|
|
}
|
|
|
|
@ -697,6 +726,8 @@ ngx_http_fancyindex_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
|
|
|
ngx_conf_merge_value(conf->enable, prev->enable, 0);
|
|
|
|
|
ngx_conf_merge_value(conf->localtime, prev->localtime, 0);
|
|
|
|
|
ngx_conf_merge_value(conf->exact_size, prev->exact_size, 1);
|
|
|
|
|
ngx_conf_merge_uint_value(conf->include_mode, prev->include_mode,
|
|
|
|
|
NGX_HTTP_FANCYINDEX_INCLUDE_STATIC);
|
|
|
|
|
|
|
|
|
|
ngx_conf_merge_str_value(conf->header, prev->header, "");
|
|
|
|
|
ngx_conf_merge_str_value(conf->footer, prev->footer, "");
|
|
|
|
|