2 ===================================================================
3 --- src/config.c (revision 107)
4 +++ src/config.c (working copy)
7 { "dir-listing.hide-dotfiles", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 39 */
8 { "dir-listing.external-css", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 40 */
9 + { "dir-listing.hide", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 41 */
11 { "server.host", "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
12 { "server.docroot", "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
15 s->indexfiles = array_init();
16 s->mimetypes = array_init();
17 + s->dirlist_hide = array_init();
18 s->server_name = buffer_init();
19 s->ssl_pemfile = buffer_init();
20 s->ssl_ca_file = buffer_init();
22 cv[38].destination = s->ssl_ca_file;
23 cv[39].destination = &(s->hide_dotfiles);
24 cv[40].destination = s->dirlist_css;
25 + cv[41].destination = s->dirlist_hide;
27 srv->config_storage[i] = s;
33 + PATCH(dirlist_hide);
35 PATCH(max_keep_alive_requests);
36 PATCH(max_keep_alive_idle);
39 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("dir-listing.external-css"))) {
41 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("dir-listing.hide"))) {
42 + PATCH(dirlist_hide);
43 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.error-handler-404"))) {
45 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.indexfiles"))) {
47 ===================================================================
48 --- src/base.h (revision 107)
49 +++ src/base.h (working copy)
54 + array *dirlist_hide;
57 buffer *document_root;
59 ===================================================================
60 --- src/response.c (revision 107)
61 +++ src/response.c (working copy)
66 +static int http_list_directory_ishidden(array *hidden, const char *filename, size_t len) {
71 + for (i = 0; i < hidden->used; i++) {
72 + ds = (data_string*) hidden->data[i];
74 + if (ds->value->used == 0)
77 + ct_len = ds->value->used - 1;
81 + if (strncmp(filename + len - ct_len, ds->value->ptr, ct_len) == 0) {
89 static int http_list_directory(server *srv, connection *con, buffer *dir) {
93 char sizebuf[sizeof("999.9K")];
94 char datebuf[sizeof("2005-Jan-01 22:23:24")];
98 const char *content_type;
102 i = strlen(dent->d_name);
106 + if (http_list_directory_ishidden(con->conf.dirlist_hide, dent->d_name, i))
109 memcpy(path_file, dent->d_name, i + 1);
110 if (stat(path, &st) != 0)
114 content_type = "application/octet-stream";
115 for (k = 0; k < con->conf.mimetypes->used; k++) {
116 - data_string *ds = (data_string *)con->conf.mimetypes->data[k];
118 + ds = (data_string *)con->conf.mimetypes->data[k];
120 if (ds->key->used == 0)
123 ===================================================================
124 --- src/server.c (revision 107)
125 +++ src/server.c (working copy)
127 buffer_free(s->dirlist_css);
128 array_free(s->indexfiles);
129 array_free(s->mimetypes);
130 + array_free(s->dirlist_hide);
134 Index: doc/configuration.txt
135 ===================================================================
136 --- doc/configuration.txt (revision 107)
137 +++ doc/configuration.txt (working copy)
139 dir-listing.external-css
140 path to an external css stylesheet for the directory listing
143 + list of extensions to hide in directory listing.
146 + dir-listing.hide = ( "CVS", ".xyz" )
148 server.follow-symlink
149 allow to follow-symlinks