diff --git a/NEWS b/NEWS index 0f59a3c0..a775f2ca 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ NEWS ==== - 1.4.17 - + * added dir-listing.set-footer in mod_dirlisting (#1277) * fixed hardcoded font-sizes in mod_dirlisting (#1267) * fixed different ETag length on 32/64 platforms (#1279) diff --git a/src/mod_dirlisting.c b/src/mod_dirlisting.c index e920a27f..4b63c5c5 100644 --- a/src/mod_dirlisting.c +++ b/src/mod_dirlisting.c @@ -59,6 +59,7 @@ typedef struct { buffer *external_css; buffer *encoding; + buffer *set_footer; } plugin_config; typedef struct { @@ -173,6 +174,7 @@ FREE_FUNC(mod_dirlisting_free) { excludes_buffer_free(s->excludes); buffer_free(s->external_css); buffer_free(s->encoding); + buffer_free(s->set_footer); free(s); } @@ -240,6 +242,8 @@ static int parse_config_entry(server *srv, plugin_config *s, array *ca, const ch #define CONFIG_SHOW_HEADER "dir-listing.show-header" #define CONFIG_HIDE_HEADER_FILE "dir-listing.hide-header-file" #define CONFIG_DIR_LISTING "server.dir-listing" +#define CONFIG_SET_FOOTER "dir-listing.set-footer" + SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) { plugin_data *p = p_d; @@ -256,6 +260,7 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) { { CONFIG_SHOW_HEADER, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */ { CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */ { CONFIG_DIR_LISTING, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */ + { CONFIG_SET_FOOTER, NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */ { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } }; @@ -278,6 +283,7 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) { s->show_header = 0; s->hide_header_file = 0; s->encoding = buffer_init(); + s->set_footer = buffer_init(); cv[0].destination = s->excludes; cv[1].destination = &(s->dir_listing); @@ -289,6 +295,7 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) { cv[7].destination = &(s->show_header); cv[8].destination = &(s->hide_header_file); cv[9].destination = &(s->dir_listing); /* old name */ + cv[10].destination = s->set_footer; p->config_storage[i] = s; ca = ((data_config *)srv->config_context->data[i])->value; @@ -318,6 +325,7 @@ static int mod_dirlisting_patch_connection(server *srv, connection *con, plugin_ PATCH(show_header); PATCH(hide_header_file); PATCH(excludes); + PATCH(set_footer); /* skip the first, the global context */ for (i = 1; i < srv->config_context->used; i++) { @@ -348,6 +356,8 @@ static int mod_dirlisting_patch_connection(server *srv, connection *con, plugin_ PATCH(show_header); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_HIDE_HEADER_FILE))) { PATCH(hide_header_file); + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_SET_FOOTER))) { + PATCH(set_footer); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXCLUDE))) { PATCH(excludes); } @@ -567,7 +577,9 @@ static void http_list_directory_footer(server *srv, connection *con, plugin_data "