mod_autoindex.c revision 53bb9198689cfcc08182c9bb27005368bcba42a2
842ae4bd224140319ae7feec1872b93dfd491143fielding/* ====================================================================
842ae4bd224140319ae7feec1872b93dfd491143fielding * The Apache Software License, Version 1.1
842ae4bd224140319ae7feec1872b93dfd491143fielding * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
842ae4bd224140319ae7feec1872b93dfd491143fielding * reserved.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Redistribution and use in source and binary forms, with or without
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * modification, are permitted provided that the following conditions
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 1. Redistributions of source code must retain the above copyright
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * notice, this list of conditions and the following disclaimer.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 2. Redistributions in binary form must reproduce the above copyright
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * notice, this list of conditions and the following disclaimer in
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the documentation and/or other materials provided with the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * distribution.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 3. The end-user documentation included with the redistribution,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * if any, must include the following acknowledgment:
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * "This product includes software developed by the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Apache Software Foundation (http://www.apache.org/)."
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Alternately, this acknowledgment may appear in the software itself,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * if and wherever such third-party acknowledgments normally appear.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 4. The names "Apache" and "Apache Software Foundation" must
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * not be used to endorse or promote products derived from this
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * software without prior written permission. For written
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * permission, please contact apache@apache.org.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * 5. Products derived from this software may not be called "Apache",
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * nor may "Apache" appear in their name, without prior written
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * permission of the Apache Software Foundation.
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
806b50b4d37ade77f1c767a1593fac5a2d7786c8minfrin * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
c07866e582be4daac7f6a0a8754fa12fca044663fuankg * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
07ed2f9227b98d2cac21a7121ef7ea5328fa3f98fuankg * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
15ff8c621815e8337abc10638f2b2853ee6fd076minfrin * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * SUCH DAMAGE.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * ====================================================================
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * This software consists of voluntary contributions made by many
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * individuals on behalf of the Apache Software Foundation. For more
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * information on the Apache Software Foundation, please see
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Portions of this software are based upon public domain software
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * originally written at the National Center for Supercomputing Applications,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * University of Illinois, Urbana-Champaign.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * mod_autoindex.c: Handles the on-the-fly html index generation
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Rob McCool
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Adapted to Apache by rst.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Version sort added by Martin Pool <mbp@humbug.org.au>. */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/****************************************************************
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Handling configuration directives...
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * Define keys for sorting.
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin#define K_SIZE 'S' /* Size (absolute, not as displayed) */
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * These are the dimensions of the default icons supplied with Apache.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Other default dimensions.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantztypedef struct ai_desc_t {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Return true if the specified string refers to the parent directory (i.e.,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * matches ".." or "../"). Hopefully this one call is significantly less
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * expensive than multiple strcmp() calls.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic apr_inline int is_parent(const char *name)
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * Now, IFF the first two bytes are dots, and the third byte is either
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * EOS (\0) or a slash followed by EOS, we have a match.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * This routine puts the standard HTML header at the top of the index page.
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * We include the DOCTYPE because we may be using features therefrom (i.e.,
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * HEIGHT and WIDTH attributes on the icons if we're FancyIndexing).
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic void emit_preamble(request_rec *r, char *title)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic void push_item(apr_array_header_t *arr, char *type, const char *to,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz struct item *p = (struct item *) apr_array_push(arr);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz p->data = data ? apr_pstrdup(arr->cont, data) : NULL;
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin p->apply_to = apr_pstrcat(arr->cont, "*", to, NULL);
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin else if (to) {
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrinstatic const char *add_alt(cmd_parms *cmd, void *d, const char *alt,
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin const char *to)
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin push_item(((autoindex_config_rec *) d)->alt_list, cmd->info, to,
289a94d4157967ac04dc5c865b94e361400eae0afuankgstatic const char *add_icon(cmd_parms *cmd, void *d, const char *icon,
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin const char *to)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz return "missing closing paren";
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin push_item(((autoindex_config_rec *) d)->icon_list, cmd->info, to,
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * Add description text for a filename pattern. If the pattern has
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * wildcards already (or we need to add them), add leading and
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * trailing wildcards to it to ensure substring processing. If the
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * pattern contains a '/' anywhere, force wildcard matching mode,
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * add a slash to the prefix so that "bar/bletch" won't be matched
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * by "foobar/bletch", and make a note that there's a delimiter;
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * the matching routine simplifies to just the actual filename
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * whenever it can. This allows definitions in parent directories
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * to be made for files in subordinate ones using relative paths.
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * Absent a strcasestr() function, we have to force wildcards on
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * systems for which "AAA" and "aaa" mean the same file.
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrinstatic const char *add_desc(cmd_parms *cmd, void *d, const char *desc,
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin const char *to)
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin autoindex_config_rec *dcfg = (autoindex_config_rec *) d;
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin desc_entry = (ai_desc_t *) apr_array_push(dcfg->desc_list);
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin desc_entry->full_path = (ap_strchr_c(to, '/') == NULL) ? 0 : 1;
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin desc_entry->pattern = apr_pstrcat(dcfg->desc_list->cont,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd desc_entry->pattern = apr_pstrdup(dcfg->desc_list->cont, to);
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin desc_entry->description = apr_pstrdup(dcfg->desc_list->cont, desc);
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrinstatic const char *add_ignore(cmd_parms *cmd, void *d, const char *ext)
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin push_item(((autoindex_config_rec *) d)->ign_list, 0, ext, cmd->path, NULL);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndstatic const char *add_header(cmd_parms *cmd, void *d, const char *name)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd push_item(((autoindex_config_rec *) d)->hdr_list, 0, NULL, cmd->path,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndstatic const char *add_readme(cmd_parms *cmd, void *d, const char *name)
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin push_item(((autoindex_config_rec *) d)->rdme_list, 0, NULL, cmd->path,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz/* A legacy directive, FancyIndexing is superseded by the IndexOptions
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * keyword. But for compatibility..
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrinstatic const char *fancy_indexing(cmd_parms *cmd, void *d, int arg)
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin return "FancyIndexing directive conflicts with existing "
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin "IndexOptions None";
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin newopts = (arg ? (curopts | FANCY_INDEXING) : (curopts & ~FANCY_INDEXING));
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrinstatic const char *add_opts(cmd_parms *cmd, void *d, const char *optstr)
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin autoindex_config_rec *d_cfg = (autoindex_config_rec *) d;
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "Cannot combine '+' or '-' with 'None' keyword";
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "Cannot combine '-' with IconWidth=n";
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "Cannot combine '-' with IconHeight=n";
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "NameWidth with no value may only appear as "
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "'-NameWidth'";
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "Cannot combine '-' with NameWidth=n";
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "NameWidth value must be greater than 5";
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "Invalid directory indexing option";
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "Cannot combine other IndexOptions keywords with 'None'";
5876f43a746f688a32b7201bced8591ddf19bd43minfrinstatic const char *set_default_order(cmd_parms *cmd, void *m, const char *direction,
51c6a215cedf19fe46a20b5cbb57f01ec4d5e8c4fuankg const char *key)
5876f43a746f688a32b7201bced8591ddf19bd43minfrin autoindex_config_rec *d_cfg = (autoindex_config_rec *) m;
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "First keyword must be 'Ascending' or 'Descending'";
5876f43a746f688a32b7201bced8591ddf19bd43minfrin return "Second keyword must be 'Name', 'Date', 'Size', or "
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "'Description'";
5876f43a746f688a32b7201bced8591ddf19bd43minfrin apr_cpystrn(d_cfg->default_order, temp, sizeof(temp));
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_ITERATE2("AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "an icon URL followed by one or more filenames"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_ITERATE2("AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "an icon URL followed by one or more MIME types"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_ITERATE2("AddIconByEncoding", add_icon, BY_ENCODING, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "an icon URL followed by one or more content encodings"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_ITERATE2("AddAlt", add_alt, BY_PATH, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "alternate descriptive text followed by one or more filenames"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_ITERATE2("AddAltByType", add_alt, BY_TYPE, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "alternate descriptive text followed by one or more MIME types"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_ITERATE2("AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "alternate descriptive text followed by one or more content encodings"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_RAW_ARGS("IndexOptions", add_opts, NULL, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "one or more index options"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_TAKE2("IndexOrderDefault", set_default_order, NULL, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "{Ascending,Descending} {Name,Size,Description,Date}"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_ITERATE("IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "one or more file extensions"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_ITERATE2("AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "Descriptive text followed by one or more filenames"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_TAKE1("HeaderName", add_header, NULL, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "a filename"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_TAKE1("ReadmeName", add_readme, NULL, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "a filename"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin AP_INIT_FLAG("FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)"),
5876f43a746f688a32b7201bced8591ddf19bd43minfrin (void *) XtOffsetOf(autoindex_config_rec, default_icon),
5876f43a746f688a32b7201bced8591ddf19bd43minfrinstatic void *create_autoindex_config(apr_pool_t *p, char *dummy)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz (autoindex_config_rec *) apr_pcalloc(p, sizeof(autoindex_config_rec));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->icon_list = apr_array_make(p, 4, sizeof(struct item));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->alt_list = apr_array_make(p, 4, sizeof(struct item));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->desc_list = apr_array_make(p, 4, sizeof(ai_desc_t));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->ign_list = apr_array_make(p, 4, sizeof(struct item));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->hdr_list = apr_array_make(p, 4, sizeof(struct item));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->rdme_list = apr_array_make(p, 4, sizeof(struct item));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return (void *) new;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndstatic void *merge_autoindex_configs(apr_pool_t *p, void *basev, void *addv)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd autoindex_config_rec *base = (autoindex_config_rec *) basev;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd autoindex_config_rec *add = (autoindex_config_rec *) addv;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new = (autoindex_config_rec *) apr_pcalloc(p, sizeof(autoindex_config_rec));
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->default_icon = add->default_icon ? add->default_icon
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz new->icon_height = add->icon_height ? add->icon_height : base->icon_height;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->icon_width = add->icon_width ? add->icon_width : base->icon_width;
07d000c26f08bb7d590da25057748b28b8b59741jim new->alt_list = apr_array_append(p, add->alt_list, base->alt_list);
07d000c26f08bb7d590da25057748b28b8b59741jim new->ign_list = apr_array_append(p, add->ign_list, base->ign_list);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->hdr_list = apr_array_append(p, add->hdr_list, base->hdr_list);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->desc_list = apr_array_append(p, add->desc_list, base->desc_list);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd new->icon_list = apr_array_append(p, add->icon_list, base->icon_list);
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin new->rdme_list = apr_array_append(p, add->rdme_list, base->rdme_list);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * If the current directory says 'no options' then we also
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * clear any incremental mods from being inheritable further down.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * If there were any nonincremental options selected for
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * this directory, they dominate and we don't inherit *anything.*
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Contrariwise, we *do* inherit if the only settings here are
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * incremental ones.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * We may have incremental settings, so make sure we don't
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * inadvertently inherit an IndexOptions None from above.
6850c836b8c7c688ef8a8ec280e798e1d0bfbf01trawick * There are local nonincremental settings, which clear
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * all inheritance from above. They *are* the new base settings.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * We're guaranteed that there'll be no overlap between
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * the add-options and the remove-options.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Inherit the NameWidth settings if there aren't any specific to
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * the new location; otherwise we'll end up using the defaults set in the
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * config-rec creation routine.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/****************************************************************
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Looking things up in config entries...
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd/* Structure used to hold entries when we're actually building an index */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9ndstatic char *find_item(request_rec *r, apr_array_header_t *list, int path_only)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd const char *content_type = ap_field_noparam(r->pool, r->content_type);
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Special cased for ^^DIRECTORY^^ and ^^BLANKICON^^ */
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if ((path[0] == '^') || (!ap_strcmp_match(path, p->apply_path))) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd if (!*(p->apply_to)) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return p->data;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return p->data;
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd else if (!path_only) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd return p->data;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#define find_icon(d,p,t) find_item(p,d->icon_list,t)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#define find_alt(d,p,t) find_item(p,d->alt_list,t)
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz#define find_header(d,p) find_item(p,d->hdr_list,0)
85fa7868b2734d79c4e27b74d54b6846a1f9176fcolmstatic char *find_default_icon(autoindex_config_rec *d, char *bogus_name)
13be69a729c912bea7d0aa22596b92717df92551pquerna /* Bleah. I tried to clean up find_item, and it lead to this bit
13be69a729c912bea7d0aa22596b92717df92551pquerna * of ugliness. Note that the fields initialized are precisely
13be69a729c912bea7d0aa22596b92717df92551pquerna * those that find_item looks at...
13be69a729c912bea7d0aa22596b92717df92551pquerna * Look through the list of pattern/description pairs and return the first one
13be69a729c912bea7d0aa22596b92717df92551pquerna * if any) that matches the filename in the request. If multiple patterns
13be69a729c912bea7d0aa22596b92717df92551pquerna * match, only the first one is used; since the order in the array is the
13be69a729c912bea7d0aa22596b92717df92551pquerna * same as the order in which directives were processed, earlier matching
13be69a729c912bea7d0aa22596b92717df92551pquerna * directives will dominate.
13be69a729c912bea7d0aa22596b92717df92551pquernastatic char *find_desc(autoindex_config_rec *dcfg, request_rec *r)
13be69a729c912bea7d0aa22596b92717df92551pquerna ai_desc_t *list = (ai_desc_t *) dcfg->desc_list->elts;
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin const char *filename;
13be69a729c912bea7d0aa22596b92717df92551pquerna * If the filename includes a path, extract just the name itself
13be69a729c912bea7d0aa22596b92717df92551pquerna * for the simple matches.
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin if ((filename_only = ap_strrchr_c(filename_full, '/')) == NULL) {
9de73d09e50d2daa2b0ba263d01cf6bf972a27fdrpluem * Only use the full-path filename if the pattern contains '/'s.
af91703d7657e52921bb36c44ff093b2d2077d0cminfrin filename = (tuple->full_path) ? filename_full : filename_only;
af91703d7657e52921bb36c44ff093b2d2077d0cminfrin * Make the comparison using the cheapest method; only do
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * wildcard checking if we must.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz found = (apr_fnmatch(tuple->pattern, filename, MATCH_FLAGS) == 0);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz found = (ap_strstr_c(filename, tuple->pattern) != NULL);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic int ignore_entry(autoindex_config_rec *d, char *path)
a059fab04e8584e8bfdcaf1103e2ec6f53f97a14pquerna#else /* !CASE_BLIND_FILESYSTEM */
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * On some platforms, the match must be case-blind. This is really
13be69a729c912bea7d0aa22596b92717df92551pquerna * a factor of the filesystem involved, but we can't detect that
be60e23cacdadb070a83d40086a6d689410acc38rpluem * reliably - so we have to granularise at the OS level.
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin#endif /* !CASE_BLIND_FILESYSTEM */
be60e23cacdadb070a83d40086a6d689410acc38rpluem/*****************************************************************
13be69a729c912bea7d0aa22596b92717df92551pquerna * Actually generating output
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Elements of the emitted document:
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Emitted unless SUPPRESS_PREAMBLE is set AND ap_run_sub_req
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * succeeds for the (content_type == text/html) header file.
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Header file
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Emitted if found (and able).
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * H1 tag line
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Emitted if a header file is NOT emitted.
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Directory stuff
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Always emitted.
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Emitted if FANCY_INDEXING is set.
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Readme file
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Emitted if found (and able).
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * ServerSig
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Emitted if ServerSignature is not Off AND a readme file
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * is NOT emitted.
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Postamble
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * Emitted unless SUPPRESS_PREAMBLE is set AND ap_run_sub_req
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrin * succeeds for the (content_type == text/html) readme file.
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * emit a plain text file
9ee5ae3a993134d40e9fb156b44b610ce261875cminfrinstatic void do_emit_plain(request_rec *r, apr_file_t *f)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd while (!apr_file_eof(f)) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd n = sizeof(char) * IOBUFSIZE;
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz while (stat != APR_SUCCESS && APR_STATUS_IS_EINTR(stat));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (n == -1 || n == 0) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd while (c < n) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd for (i = c; i < n; i++) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * Handle the preamble through the H1 tag line, inclusive. Locate
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the file with a subrequests. Process text/html documents by actually
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * running the subrequest; text/xxx documents get copied verbatim,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * and any other content type is ignored. This means that a non-text
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * document (such as HEADER.gif) might get multiviewed as the result
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * instead of a text document, meaning nothing will be displayed, but
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic void emit_head(request_rec *r, char *header_fname, int suppress_amble,
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * If there's a header file, send a subrequest to look for it. If it's
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * found and a text file, handle it -- otherwise fall through and
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * pretend there's nothing there.
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin && (rr = ap_sub_req_lookup_uri(header_fname, r, NULL))
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Check for the two specific cases we allow: text/html and
51c6a215cedf19fe46a20b5cbb57f01ec4d5e8c4fuankg * text/anything-else. The former is allowed to be processed for
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type),
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin /* Hope everything will work... */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * If there's a problem running the subrequest, display the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * preamble if we didn't do it before -- the header file
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * didn't get displayed.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* It didn't work */
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin else if (!strncasecmp("text/", rr->content_type, 5)) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * If we can open the file, prefix it with the preamble
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * regardless; since we'll be sending a <PRE> block around
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the file's contents, any HTML header it had won't end up
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin * where it belongs.
51c6a215cedf19fe46a20b5cbb57f01ec4d5e8c4fuankg ap_rvputs(r, "<H1>Index of ", title, "</H1>\n", NULL);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Handle the Readme file through the postamble, inclusive. Locate
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * the file with a subrequests. Process text/html documents by actually
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * running the subrequest; text/xxx documents get copied verbatim,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * and any other content type is ignored. This means that a non-text
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * document (such as FOOTER.gif) might get multiviewed as the result
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * instead of a text document, meaning nothing will be displayed, but
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic void emit_tail(request_rec *r, char *readme_fname, int suppress_amble)
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * If there's a readme file, send a subrequest to look for it. If it's
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * found and a text file, handle it -- otherwise fall through and
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * pretend there's nothing there.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Check for the two specific cases we allow: text/html and
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin * text/anything-else. The former is allowed to be processed for
9fe23388f983cb652b5d68e2bd92aa9f0568c574minfrin if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type),
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* worked... */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz else if (!strncasecmp("text/", rr->content_type, 5)) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin * If we can open the file, suppress the signature.
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin int x, y, p;
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin && (!strcasecmp(ap_field_noparam(r->pool, r->content_type),
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin if (n <= 0) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin for (x = 0, p = 0; titlebuf[x]; x++) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin if (!find[++p]) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin /* Scan for line breaks for Tanmoy's secretary */
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin for (y = x; titlebuf[y]; y++) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin if (y == x) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrinstatic struct ent *make_autoindex_entry(const char *name, int autoindex_opts,
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin if (ignore_entry(d, ap_make_full_path(r->pool, r->filename, name))) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin p = (struct ent *) apr_pcalloc(r->pool, sizeof(struct ent));
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin p->ascending = (apr_toupper(direction) == D_ASCENDING);
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin request_rec *rr = ap_sub_req_lookup_file(name, r, NULL);
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin if ((!p->desc) && (autoindex_opts & SCAN_HTML_TITLES)) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin * We don't need to take any special action for the file size key. If
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin * we did, it would go here.
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin if (p->lm < 0) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin return (p);
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrinstatic char *terminate_description(autoindex_config_rec *d, char *desc,
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin register int x;
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin for (x = 0; desc[x] && (maxsize > 0 || desc[x]=='<'); x++) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin /* entities like ä count as one character */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * Emit the anchor for the specified field. If a field is the key for the
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * current request, the link changes its meaning to reverse the order when
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * selected again. Non-active fields always start in ascending order.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantzstatic void emit_link(request_rec *r, char *anchor, char fname, char curkey,
2d728410bcf9e6e53698bb035f516e18efd76d8bnd reverse = ((curkey == fname) && (curdirection == D_ASCENDING));
2d728410bcf9e6e53698bb035f516e18efd76d8bnd ap_rvputs(r, "<A HREF=\"", qvalue, "\">", anchor, "</A>", NULL);
2d728410bcf9e6e53698bb035f516e18efd76d8bnd int static_columns = (autoindex_opts & SUPPRESS_COLSORT);
487d8b4e063696dd9698792a13c8e426635f1072nd for (x = 0; x < n; x++) {
5876f43a746f688a32b7201bced8591ddf19bd43minfrin ap_rvputs(r, "<IMG SRC=\"", ap_escape_html(scratch, tp),
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin " HEIGHT=\"%d\" WIDTH=\"%d\"",
2d728410bcf9e6e53698bb035f516e18efd76d8bnd emit_link(r, "Name", K_NAME, keyid, direction, static_columns);
2d728410bcf9e6e53698bb035f516e18efd76d8bnd * Emit the guaranteed-at-least-one-space-between-columns byte.
4e1b035de81cbd18cfaea3604d40209bc6919bd9trawick emit_link(r, "Last modified", K_LAST_MOD, keyid, direction,
fc1206972499ab73c4dfded43cef279d8bf01ad9minfrin emit_link(r, "Size", K_SIZE, keyid, direction, static_columns);
fc1206972499ab73c4dfded43cef279d8bf01ad9minfrin emit_link(r, "Description", K_DESC, keyid, direction,
fc1206972499ab73c4dfded43cef279d8bf01ad9minfrin for (x = 0; x < n; x++) {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (t[0] == '\0') {
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz anchor = ap_escape_html(scratch, ap_os_escape_path(scratch, t, 0));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz anchor = ap_escape_html(scratch, ap_os_escape_path(scratch, t, 0));
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_rvputs(r, "<A HREF=\"", anchor, "\">", NULL);
2d728410bcf9e6e53698bb035f516e18efd76d8bnd ap_escape_html(scratch, t2), "</A>", pad_scratch + nwidth,
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * The blank before the storm.. er, before the next field.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /*Length="22-Feb-1998 23:42 " (see 4 lines above) */
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantz * Compare two file entries according to the sort criteria. The return
4e1b035de81cbd18cfaea3604d40209bc6919bd9trawick * is essentially a signum function value.
663c339c8a4663cf1977f890481f8b7e251d3221jerenkrantzstatic int dsortf(struct ent **e1, struct ent **e2)
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * First, see if either of the entries is for the parent directory.
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * If so, that *always* sorts lower than anything else.
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz * All of our comparisons will be of the c1 entry against the c2 one,
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd * so assign them appropriately to take care of the ordering.
487d8b4e063696dd9698792a13c8e426635f1072nd return -1;
15351ab1a34130c1f880daef4e5dc15407a75969colm return -1;
487d8b4e063696dd9698792a13c8e426635f1072nd result = apr_strnatcmp(c1->desc ? c1->desc : "", c2->desc ? c2->desc : "");
487d8b4e063696dd9698792a13c8e426635f1072nd result = strcmp(c1->desc ? c1->desc : "", c2->desc ? c2->desc : "");
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin const char *qstring;
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin if ((status = apr_dir_open(&thedir, name, r->pool)) != APR_SUCCESS) {
03bdb4fb430b0d4e502ddfc75f7e9dbd91db72e9nd /* Spew HTML preamble */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz autoindex_opts & SUPPRESS_PREAMBLE, title_name);
fc1206972499ab73c4dfded43cef279d8bf01ad9minfrin * Figure out what sort of indexing (if any) we're supposed to use.
5dc4220fc22561537ce1421a03e11846a5b719ebminfrin * If no QUERY_STRING was specified or column sorting has been
fc1206972499ab73c4dfded43cef279d8bf01ad9minfrin * explicitly disabled, we use the default specified by the
5dc4220fc22561537ce1421a03e11846a5b719ebminfrin * IndexOrderDefault directive (if there is one); otherwise,
5dc4220fc22561537ce1421a03e11846a5b719ebminfrin * we fall back to ascending by name.
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin * If there is no specific ordering defined for this directory,
fac37c9794a18c24d187f4e0f97a9476c4344118minfrin * default to ascending by filename.
c42b94a839cae93073d33b0d21f0ff1118d958e8poirier * Since we don't know how many dir. entries there are, put them into a
1018201f5223624476334c6e23aead02db7c4040minfrin * linked list and then arrayificate them so qsort can use them.
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin while (apr_dir_read(&dirent, APR_FINFO_DIRENT, thedir) == APR_SUCCESS) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin p = make_autoindex_entry(dirent.name, autoindex_opts,
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin if (p != NULL) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin while (p) {
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin (int (*)(const void *, const void *)) dsortf);
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin output_directories(ar, num_ent, autoindex_conf, r, autoindex_opts, keyid,
6fee4e2faa2e45fe2636d01e35d03c2cf0c9d431minfrin/* The formal handler... */
1018201f5223624476334c6e23aead02db7c4040minfrin d = (autoindex_config_rec *) ap_get_module_config(r->per_dir_config,
f58bb3da705eb7ec926f4883597fc2eb1336a360minfrin /* OK, nothing easy. Trot out the heavy artillery... */
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz /* KLUDGE --- make the sub_req lookups happen in the right directory.
1018201f5223624476334c6e23aead02db7c4040minfrin * Fixing this in the sub_req_lookup functions themselves is difficult,
c42b94a839cae93073d33b0d21f0ff1118d958e8poirier * and would probably break virtual includes...
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz if (r->filename[strlen(r->filename) - 1] != '/') {
fc1206972499ab73c4dfded43cef279d8bf01ad9minfrin r->filename = apr_pstrcat(r->pool, r->filename, "/", NULL);
fc1206972499ab73c4dfded43cef279d8bf01ad9minfrin ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
5876f43a746f688a32b7201bced8591ddf19bd43minfrin "Directory index forbidden by rule: %s", r->filename);
9fe74ffcdea85800f04a7222f716f78ae60cce51jerenkrantz ap_hook_handler(handle_autoindex,NULL,NULL,APR_HOOK_MIDDLE);
fc1206972499ab73c4dfded43cef279d8bf01ad9minfrin merge_autoindex_configs, /* dir merger --- default is to override */