httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@hyperreal.org>
Subject cvs commit: apache/src CHANGES Configuration.tmpl mod_autoindex.c mod_dir.c
Date Tue, 08 Jul 1997 19:50:50 GMT
dgaudet     97/07/08 12:50:49

  Modified:    htdocs/manual/mod  directives.html index.html
                        mod_autoindex.html mod_dir.html
               src       CHANGES Configuration.tmpl mod_autoindex.c
                        mod_dir.c
  Log:
  Automatic indexes moved from mod_dir into mod_autoindex.  The mod_autoindex
  CVS files are copies of the mod_dir files so that we retain history in
  both places.
  
  Revision  Changes    Path
  1.26      +13 -13    apache/htdocs/manual/mod/directives.html
  
  Index: directives.html
  ===================================================================
  RCS file: /export/home/cvs/apache/htdocs/manual/mod/directives.html,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -C3 -r1.25 -r1.26
  *** directives.html	1997/07/08 04:45:24	1.25
  --- directives.html	1997/07/08 19:50:39	1.26
  ***************
  *** 19,33 ****
    <li><A HREF="core.html#accessconfig">AccessConfig</A>
    <li><A HREF="core.html#accessfilename">AccessFileName</A>
    <li><A HREF="mod_actions.html#action">Action</A>
  ! <li><A HREF="mod_dir.html#addalt">AddAlt</A>
  ! <li><A HREF="mod_dir.html#addaltbyencoding">AddAltByEncoding</A>
  ! <li><A HREF="mod_dir.html#addaltbytype">AddAltByType</A>
  ! <li><A HREF="mod_dir.html#adddescription">AddDescription</A>
    <li><A HREF="mod_mime.html#addencoding">AddEncoding</A>
    <li><A HREF="mod_mime.html#addhandler">AddHandler</A>
  ! <li><A HREF="mod_dir.html#addicon">AddIcon</A>
  ! <li><A HREF="mod_dir.html#addiconbyencoding">AddIconByEncoding</A>
  ! <li><A HREF="mod_dir.html#addiconbytype">AddIconByType</A>
    <li><A HREF="mod_mime.html#addlanguage">AddLanguage</A>
    <li><A HREF="core.html#addmodule">AddModule</A>
    <li><A HREF="mod_mime.html#addtype">AddType</A>
  --- 19,33 ----
    <li><A HREF="core.html#accessconfig">AccessConfig</A>
    <li><A HREF="core.html#accessfilename">AccessFileName</A>
    <li><A HREF="mod_actions.html#action">Action</A>
  ! <li><A HREF="mod_autoindex.html#addalt">AddAlt</A>
  ! <li><A HREF="mod_autoindex.html#addaltbyencoding">AddAltByEncoding</A>
  ! <li><A HREF="mod_autoindex.html#addaltbytype">AddAltByType</A>
  ! <li><A HREF="mod_autoindex.html#adddescription">AddDescription</A>
    <li><A HREF="mod_mime.html#addencoding">AddEncoding</A>
    <li><A HREF="mod_mime.html#addhandler">AddHandler</A>
  ! <li><A HREF="mod_autoindex.html#addicon">AddIcon</A>
  ! <li><A HREF="mod_autoindex.html#addiconbyencoding">AddIconByEncoding</A>
  ! <li><A HREF="mod_autoindex.html#addiconbytype">AddIconByType</A>
    <li><A HREF="mod_mime.html#addlanguage">AddLanguage</A>
    <li><A HREF="core.html#addmodule">AddModule</A>
    <li><A HREF="mod_mime.html#addtype">AddType</A>
  ***************
  *** 73,79 ****
    <li><A HREF="mod_log_config.html#cookielog">CookieLog</A> (mod_log_config)
    <li><A HREF="mod_usertrack.html#cookietracking">CookieTracking</A>
    <li><A HREF="mod_log_config.html#customlog">CustomLog</A>
  ! <li><A HREF="mod_dir.html#defaulticon">DefaultIcon</A>
    <li><A HREF="core.html#defaulttype">DefaultType</A>
    <li><A HREF="mod_access.html#deny">deny</A>
    <li><A HREF="core.html#directory">&lt;Directory&gt;</A>
  --- 73,79 ----
    <li><A HREF="mod_log_config.html#cookielog">CookieLog</A> (mod_log_config)
    <li><A HREF="mod_usertrack.html#cookietracking">CookieTracking</A>
    <li><A HREF="mod_log_config.html#customlog">CustomLog</A>
  ! <li><A HREF="mod_autoindex.html#defaulticon">DefaultIcon</A>
    <li><A HREF="core.html#defaulttype">DefaultType</A>
    <li><A HREF="mod_access.html#deny">deny</A>
    <li><A HREF="core.html#directory">&lt;Directory&gt;</A>
  ***************
  *** 86,106 ****
    <li><A HREF="mod_expires.html#expiresactive">ExpiresActive</A>
    <li><A HREF="mod_expires.html#expiresbytype">ExpiresByType</A>
    <li><A HREF="mod_expires.html#expiresdefault">ExpiresDefault</A>
  ! <li><A HREF="mod_dir.html#fancyindexing">FancyIndexing</A>
    <li><A HREF="core.html#files">&lt;Files&gt;</A>
    <li><A HREF="core.html#filesmatch">&lt;FilesMatch&gt;</A>
    <li><A HREF="mod_mime.html#forcetype">ForceType</A>
    <li><A HREF="core.html#group">Group</A>
    <li><A HREF="mod_headers.html#header">Header</A>
  ! <li><A HREF="mod_dir.html#headername">HeaderName</A>
    <li><A HREF="core.html#hostnamelookups">HostNameLookups</A>
    <li><A HREF="core.html#identitycheck">IdentityCheck</A>
    <li><A HREF="core.html#ifmodule">&lt;IfModule&gt;</A>
    <li><A HREF="mod_imap.html#imapbase">ImapBase</A>
    <li><A HREF="mod_imap.html#imapdefault">ImapDefault</A>
    <li><A HREF="mod_imap.html#imapmenu">ImapMenu</A>
  ! <li><A HREF="mod_dir.html#indexignore">IndexIgnore</A>
  ! <li><A HREF="mod_dir.html#indexoptions">IndexOptions</A>
    <li><A HREF="core.html#keepalive">KeepAlive</A>
    <li><A HREF="core.html#keepalivetimeout">KeepAliveTimeout</A>
    <li><A HREF="mod_negotiation.html#languagepriority">LanguagePriority</A>
  --- 86,106 ----
    <li><A HREF="mod_expires.html#expiresactive">ExpiresActive</A>
    <li><A HREF="mod_expires.html#expiresbytype">ExpiresByType</A>
    <li><A HREF="mod_expires.html#expiresdefault">ExpiresDefault</A>
  ! <li><A HREF="mod_autoindex.html#fancyindexing">FancyIndexing</A>
    <li><A HREF="core.html#files">&lt;Files&gt;</A>
    <li><A HREF="core.html#filesmatch">&lt;FilesMatch&gt;</A>
    <li><A HREF="mod_mime.html#forcetype">ForceType</A>
    <li><A HREF="core.html#group">Group</A>
    <li><A HREF="mod_headers.html#header">Header</A>
  ! <li><A HREF="mod_autoindex.html#headername">HeaderName</A>
    <li><A HREF="core.html#hostnamelookups">HostNameLookups</A>
    <li><A HREF="core.html#identitycheck">IdentityCheck</A>
    <li><A HREF="core.html#ifmodule">&lt;IfModule&gt;</A>
    <li><A HREF="mod_imap.html#imapbase">ImapBase</A>
    <li><A HREF="mod_imap.html#imapdefault">ImapDefault</A>
    <li><A HREF="mod_imap.html#imapmenu">ImapMenu</A>
  ! <li><A HREF="mod_autoindex.html#indexignore">IndexIgnore</A>
  ! <li><A HREF="mod_autoindex.html#indexoptions">IndexOptions</A>
    <li><A HREF="core.html#keepalive">KeepAlive</A>
    <li><A HREF="core.html#keepalivetimeout">KeepAliveTimeout</A>
    <li><A HREF="mod_negotiation.html#languagepriority">LanguagePriority</A>
  ***************
  *** 131,137 ****
    <li><A HREF="mod_proxy.html#proxypass">ProxyPass</A>
    <li><A HREF="mod_proxy.html#proxyremote">ProxyRemote</A>
    <li><A HREF="mod_proxy.html#proxyrequests">ProxyRequests</A>
  ! <li><A HREF="mod_dir.html#readmename">ReadmeName</A>
    <li><A HREF="mod_alias.html#redirect">Redirect</A>
    <li><A HREF="mod_alias.html#redirectmatch">RedirectMatch</A>
    <li><A HREF="mod_alias.html#redirectperm">RedirectPermanent</A>
  --- 131,137 ----
    <li><A HREF="mod_proxy.html#proxypass">ProxyPass</A>
    <li><A HREF="mod_proxy.html#proxyremote">ProxyRemote</A>
    <li><A HREF="mod_proxy.html#proxyrequests">ProxyRequests</A>
  ! <li><A HREF="mod_autoindex.html#readmename">ReadmeName</A>
    <li><A HREF="mod_alias.html#redirect">Redirect</A>
    <li><A HREF="mod_alias.html#redirectmatch">RedirectMatch</A>
    <li><A HREF="mod_alias.html#redirectperm">RedirectPermanent</A>
  
  
  
  1.16      +3 -1      apache/htdocs/manual/mod/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /export/home/cvs/apache/htdocs/manual/mod/index.html,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -C3 -r1.15 -r1.16
  *** index.html	1997/07/07 18:18:39	1.15
  --- index.html	1997/07/08 19:50:40	1.16
  ***************
  *** 44,49 ****
  --- 44,51 ----
    <dd>User authentication using DBM files.
    <dt><A HREF="mod_auth_msql.html">mod_auth_msql</A>
    <dd>User authentication using mSQL files.
  + <dt><A HREF="mod_autoindex.html">mod_autoindex</A>
  + <dd>Automatic directory listings.
    <dt><A HREF="mod_browser.html">mod_browser</A> Apache 1.2 and up
    <dd>Set environment variables based on User-Agent strings
    <dt><A HREF="mod_cern_meta.html">mod_cern_meta</a>
  ***************
  *** 56,62 ****
    <dt><A HREF="mod_digest.html">mod_digest</A>
    <dd>MD5 authentication
    <dt><A HREF="mod_dir.html">mod_dir</A>
  ! <dd>Automatic directory listings.
    <dt><A HREF="mod_dld.html">mod_dld</A>
    <dd>Start-time linking with the GNU libdld.
    <dt><A HREF="mod_env.html">mod_env</A>
  --- 58,64 ----
    <dt><A HREF="mod_digest.html">mod_digest</A>
    <dd>MD5 authentication
    <dt><A HREF="mod_dir.html">mod_dir</A>
  ! <dd>Basic directory handling.
    <dt><A HREF="mod_dld.html">mod_dld</A>
    <dd>Start-time linking with the GNU libdld.
    <dt><A HREF="mod_env.html">mod_env</A>
  
  
  
  1.9       +12 -45    apache/htdocs/manual/mod/mod_autoindex.html
  
  Index: mod_autoindex.html
  ===================================================================
  RCS file: /export/home/cvs/apache/htdocs/manual/mod/mod_autoindex.html,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -C3 -r1.8 -r1.9
  *** mod_autoindex.html	1997/07/06 17:19:16	1.8
  --- mod_autoindex.html	1997/07/08 19:50:41	1.9
  ***************
  *** 1,7 ****
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <HTML>
    <HEAD>
  ! <TITLE>Apache module mod_dir</TITLE>
    </HEAD>
    
    <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
  --- 1,7 ----
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <HTML>
    <HEAD>
  ! <TITLE>Apache module mod_autoindex</TITLE>
    </HEAD>
    
    <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
  ***************
  *** 13,37 ****
     ALINK="#FF0000"
    >
    <!--#include virtual="header.html" -->
  ! <H1 ALIGN="CENTER">Module mod_dir</H1>
    
  ! This module is contained in the <code>mod_dir.c</code> file, and
  ! is compiled in by default. It provides for directory indexing.
    
    <h2>Summary</h2>
  ! This module controls the directory indexing. The index of a directory
  ! can come from one of two sources:
    <ul>
    <li>A file written by the user, typically called <code>index.html</code>.
  ! The <A HREF="#directoryindex">DirectoryIndex</A> directive sets the name
  ! of this file.
    <li>Otherwise, a listing generated by the server. The other directives
    control the format of this listing. The <A HREF="#addicon">AddIcon</A>,
    <A HREF="#addiconbyencoding">AddIconByEncoding</A> and
    <A HREF="#addiconbytype">AddIconByType</A> are used to set a list of
    icons to display for various file types; for each file listed, the
  ! first icon listed that matches the file is displayed.
    </ul>
    
    
    <h2>Directives</h2>
  --- 13,40 ----
     ALINK="#FF0000"
    >
    <!--#include virtual="header.html" -->
  ! <H1 ALIGN="CENTER">Module mod_autoindex</H1>
    
  ! This module is contained in the <code>mod_autoindex.c</code> file, and
  ! is compiled in by default. It provides for automatic directory indexing.
    
    <h2>Summary</h2>
  ! The index of a directory can come from one of two sources:
    <ul>
    <li>A file written by the user, typically called <code>index.html</code>.
  ! The <A HREF="mod_dir.html#directoryindex">DirectoryIndex</A> directive sets
  ! the name of this file.
  ! This is controlled by <a href="mod_dir.html"><code>mod_dir</code></a>.
    <li>Otherwise, a listing generated by the server. The other directives
    control the format of this listing. The <A HREF="#addicon">AddIcon</A>,
    <A HREF="#addiconbyencoding">AddIconByEncoding</A> and
    <A HREF="#addiconbytype">AddIconByType</A> are used to set a list of
    icons to display for various file types; for each file listed, the
  ! first icon listed that matches the file is displayed.  These
  ! are controlled by <code>mod_autoindex</code>.
    </ul>
  + The two functions are separated so that you can completely remove
  + (or replace) automatic index generation should you want to.
    
    
    <h2>Directives</h2>
  ***************
  *** 45,51 ****
    <li><A HREF="#addiconbyencoding">AddIconByEncoding</A>
    <li><A HREF="#addiconbytype">AddIconByType</A>
    <li><A HREF="#defaulticon">DefaultIcon</A>
  - <li><A HREF="#directoryindex">DirectoryIndex</A>
    <li><A HREF="#fancyindexing">FancyIndexing</A>
    <li><A HREF="#headername">HeaderName</A>
    <li><A HREF="#indexignore">IndexIgnore</A>
  --- 48,53 ----
  ***************
  *** 199,239 ****
    <blockquote><code>
    DefaultIcon /icon/unknown.xbm
    </code></blockquote><p><hr>
  - 
  - <A name="directoryindex"><h2>DirectoryIndex</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt DirectoryIndex} directive&gt; -->
  - <strong>Syntax:</strong> DirectoryIndex <em>local-url local-url ...</em><br>
  - <strong>Default:</strong> <code>DirectoryIndex index.html</code><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - The DirectoryIndex directive sets the list of resources to look for,
  - when the client requests an index of the directory by specifying a /
  - at the end of the a directory name. <em>Local-url</em> is the
  - (%-encoded) URL of a document on the server relative to the requested
  - directory; it is usually the name of a file in the directory. Several
  - URLs may be given, in which case the server will return the first one
  - that it finds. If none of the resources exist and the
  - <CODE>Indexes</CODE> option is set, the server will generate its own
  - listing of the directory.
  - <P>
  - 
  - Example:
  - <blockquote><code>
  - DirectoryIndex index.html
  - </code></blockquote>
  - then a request for <code>http://myserver/docs/</code> would return
  - <code>http://myserver/docs/index.html</code> if it exists, or would list
  - the directory if it did not. <p>
  - 
  - Note that the documents do not need to be relative to the directory;
  - <blockquote><code>
  - DirectoryIndex index.html index.txt /cgi-bin/index.pl</code></blockquote>
  - would cause the CGI script <code>/cgi-bin/index.pl</code> to be executed
  - if neither <code>index.html</code> or <code>index.txt</code> existed in
  - a directory.<p><hr>
    
    <A name="fancyindexing"><h2>FancyIndexing</h2></A>
    <!--%plaintext &lt;?INDEX {\tt FancyIndexing} directive&gt; -->
  --- 201,206 ----
  
  
  
  1.9       +15 -317   apache/htdocs/manual/mod/mod_dir.html
  
  Index: mod_dir.html
  ===================================================================
  RCS file: /export/home/cvs/apache/htdocs/manual/mod/mod_dir.html,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -C3 -r1.8 -r1.9
  *** mod_dir.html	1997/07/06 17:19:16	1.8
  --- mod_dir.html	1997/07/08 19:50:41	1.9
  ***************
  *** 16,205 ****
    <H1 ALIGN="CENTER">Module mod_dir</H1>
    
    This module is contained in the <code>mod_dir.c</code> file, and
  ! is compiled in by default. It provides for directory indexing.
    
    <h2>Summary</h2>
  ! This module controls the directory indexing. The index of a directory
  ! can come from one of two sources:
    <ul>
    <li>A file written by the user, typically called <code>index.html</code>.
  ! The <A HREF="#directoryindex">DirectoryIndex</A> directive sets the name
  ! of this file.
  ! <li>Otherwise, a listing generated by the server. The other directives
  ! control the format of this listing. The <A HREF="#addicon">AddIcon</A>,
  ! <A HREF="#addiconbyencoding">AddIconByEncoding</A> and
  ! <A HREF="#addiconbytype">AddIconByType</A> are used to set a list of
  ! icons to display for various file types; for each file listed, the
  ! first icon listed that matches the file is displayed.
    </ul>
  ! 
    
    <h2>Directives</h2>
    
    <menu>
  - <li><A HREF="#addalt">AddAlt</A>
  - <li><A HREF="#addaltbyencoding">AddAltByEncoding</A>
  - <li><A HREF="#addaltbytype">AddAltByType</A>
  - <li><A HREF="#adddescription">AddDescription</A>
  - <li><A HREF="#addicon">AddIcon</A>
  - <li><A HREF="#addiconbyencoding">AddIconByEncoding</A>
  - <li><A HREF="#addiconbytype">AddIconByType</A>
  - <li><A HREF="#defaulticon">DefaultIcon</A>
    <li><A HREF="#directoryindex">DirectoryIndex</A>
  - <li><A HREF="#fancyindexing">FancyIndexing</A>
  - <li><A HREF="#headername">HeaderName</A>
  - <li><A HREF="#indexignore">IndexIgnore</A>
  - <li><A HREF="#indexoptions">IndexOptions</A>
  - <li><A HREF="#readmename">ReadmeName</A>
    </menu>
    <hr>
    
  - <A name="addalt"><h2>AddAlt</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt AddAlt} directive&gt; -->
  - <strong>Syntax:</strong> AddAlt <em>string file file...</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - This sets the alternate text to display for a file, instead of an icon, for
  - <A HREF="#fancyindexing">FancyIndexing</A>. <em>File</em> is a file
  - extension, partial filename, wild-card expression or full filename for files
  - to describe. <em>String</em> is enclosed in double quotes
  - (<code>&quot;</code>).  This alternate text is displayed if the client is
  - image-incapable or has image loading disabled.
  - 
  - <HR>
  - <A name="addaltbyencoding"><h2>AddAltByEncoding</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt AddAltByEncoding} directive&gt; -->
  - <strong>Syntax:</strong> AddAltByEncoding <em>string MIME-encoding
  -     MIME-encoding...</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - This sets the alternate text to display for a file, instead of an icon, for
  - <A HREF="#fancyindexing">FancyIndexing</A>. <em>MIME-encoding</em> is a
  - valid content-encoding, such as <SAMP>x-compress</SAMP>.
  - <em>String</em> is enclosed in double quotes
  - (<code>&quot;</code>).  This alternate text is displayed if the client is
  - image-incapable or has image loading disabled.
  - 
  - <HR>
  - <A name="addaltbytype"><h2>AddAltByType</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt AddAltByType} directive&gt; -->
  - <strong>Syntax:</strong> AddAltByType <em>string MIME-type MIME-type...</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - This sets the alternate text to display for a file, instead of an icon, for
  - <A HREF="#fancyindexing">FancyIndexing</A>. <em>MIME-type</em> is a
  - valid content-type, such as <SAMP>text/html</SAMP>.
  - <em>String</em> is enclosed in double quotes
  - (<code>&quot;</code>).  This alternate text is displayed if the client is
  - image-incapable or has image loading disabled.
  - 
  - <HR>
  - 
  - <A name="adddescription"><h2>AddDescription</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt AddDescription} directive&gt; -->
  - <strong>Syntax:</strong> AddDescription <em>string file file...</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - This sets the description to display for a file, for
  - <A HREF="#fancyindexing">FancyIndexing</A>. <em>File</em> is a file
  - extension, partial filename, wild-card expression or full filename for files
  - to describe. <em>String</em> is enclosed in double quotes
  - (<code>&quot;</code>). Example:
  - <blockquote><code>AddDescription "The planet Mars" /web/pics/mars.gif
  - </code></blockquote><p><hr>
  - 
  - <A name="addicon"><h2>AddIcon</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt AddIcon} directive&gt; -->
  - <strong>Syntax:</strong> AddIcon <em>icon name name ...</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - This sets the icon to display next to a file ending in <em>name</em> for
  - <A HREF="#fancyindexing">FancyIndexing</A>. <em>Icon</em> is either a
  - (%-escaped) relative URL to the icon, or of the format
  - (<em>alttext</em>,<em>url</em>) where <em>alttext</em> is the text tag given
  - for an icon for non-graphical browsers.<p>
  - 
  - <em>Name</em> is either ^^DIRECTORY^^ for directories, ^^BLANKICON^^ for
  - blank lines (to format the list correctly), a file extension, a wildcard
  - expression, a partial filename or a complete filename. Examples:
  - <blockquote><code>
  - AddIcon (IMG,/icons/image.xbm) .gif .jpg .xbm <br>
  - AddIcon /icons/dir.xbm ^^DIRECTORY^^ <br>
  - AddIcon /icons/backup.xbm *~
  - </code></blockquote>
  - <A HREF="#addiconbytype">AddIconByType</A> should be used in preference to
  - AddIcon, when possible.<p><hr>
  - 
  - <A name="addiconbyencoding"><h2>AddIconByEncoding</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt AddIconByEncoding} directive&gt; -->
  - <strong>Syntax:</strong> AddIconByEncoding <em>icon mime-encoding mime-encoding
  - ...</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - This sets the icon to display next to files with
  - <em>mime-encoding</em> for <A HREF="#fancyindexing">FancyIndexing</A>.
  - <em>Icon</em> is either a (%-escaped) relative URL to the icon, or of the
  - format (<em>alttext</em>,<em>url</em>) where <em>alttext</em> is the text tag
  - given for an icon for non-graphical browsers.<p>
  - 
  - <em>Mime-encoding</em> is a wildcard expression matching required the
  - content-encoding. Examples:
  - <blockquote><code>
  - AddIconByEncoding /icons/compress.xbm x-compress
  - </code></blockquote><p><hr>
  - 
  - <A name="addiconbytype"><h2>AddIconByType</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt AddIconByType} directive&gt; -->
  - <strong>Syntax:</strong> AddIconByType <em>icon mime-type mime-type ...</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - This sets the icon to display next to files of type <em>mime-type</em> for
  - <A HREF="#fancyindexing">FancyIndexing</A>. <em>Icon</em> is either a
  - (%-escaped) relative URL to the icon, or of the format
  - (<em>alttext</em>,<em>url</em>) where <em>alttext</em> is the text tag given
  - for an icon for non-graphical browsers.<p>
  - <em>Mime-type</em> is a wildcard expression matching required the mime types.
  - Examples:
  - <blockquote><code>
  - AddIconByType (IMG,/icons/image.xbm) image/*
  - </code></blockquote><p><hr>
  - 
  - <A name="defaulticon"><h2>DefaultIcon</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt DefaultIcon} directive&gt; -->
  - <strong>Syntax:</strong> DefaultIcon <em>url</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - The DefaultIcon directive sets the icon to display for files when no
  - specific icon is known, for <A HREF="#fancyindexing">FancyIndexing</A>.
  - <em>Url</em> is a (%-escaped) relative URL to the icon. Examples:
  - <blockquote><code>
  - DefaultIcon /icon/unknown.xbm
  - </code></blockquote><p><hr>
  - 
    <A name="directoryindex"><h2>DirectoryIndex</h2></A>
    <!--%plaintext &lt;?INDEX {\tt DirectoryIndex} directive&gt; -->
    <strong>Syntax:</strong> DirectoryIndex <em>local-url local-url ...</em><br>
  --- 16,49 ----
    <H1 ALIGN="CENTER">Module mod_dir</H1>
    
    This module is contained in the <code>mod_dir.c</code> file, and
  ! is compiled in by default.  It provides for "trailing slash" redirects and
  ! serving directory index files.
    
    <h2>Summary</h2>
  ! The index of a directory can come from one of two sources:
    <ul>
    <li>A file written by the user, typically called <code>index.html</code>.
  ! The <A HREF="#directoryindex">DirectoryIndex</A> directive sets
  ! the name of this file.
  ! This is controlled by <code>mod_dir</code>.
  ! <li>Otherwise, a listing generated by the server.  This is provided by
  ! <a href="mod_autoindex.html"><code>mod_autoindex</code></a>.
    </ul>
  ! The two functions are separated so that you can completely remove
  ! (or replace) automatic index generation should you want to.
  ! <p>A "trailing slash" redirect is issued when the server receives a
  ! request for a URL <SAMP>http://servername/foo/dirname</SAMP> where
  ! <SAMP>dirname</SAMP> is a directory.  Directories require a trailing
  ! slash, so <code>mod_dir</code> issues a redirect to
  ! <SAMP>http://servername/foo/dirname/</SAMP>.
    
    <h2>Directives</h2>
    
    <menu>
    <li><A HREF="#directoryindex">DirectoryIndex</A>
    </menu>
    <hr>
    
    <A name="directoryindex"><h2>DirectoryIndex</h2></A>
    <!--%plaintext &lt;?INDEX {\tt DirectoryIndex} directive&gt; -->
    <strong>Syntax:</strong> DirectoryIndex <em>local-url local-url ...</em><br>
  ***************
  *** 234,385 ****
    would cause the CGI script <code>/cgi-bin/index.pl</code> to be executed
    if neither <code>index.html</code> or <code>index.txt</code> existed in
    a directory.<p><hr>
  - 
  - <A name="fancyindexing"><h2>FancyIndexing</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt FancyIndexing} directive&gt; -->
  - <strong>Syntax:</strong> FancyIndexing <em>boolean</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - The FancyIndexing directive sets the FancyIndexing option for a directory.
  - <em>Boolean</em> can be <code>on</code> or <code>off</code>. The
  - <A HREF="#indexoptions">IndexOptions</A> directive should be used in
  - preference.<p><hr>
  - 
  - <A name="headername"><h2>HeaderName</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt HeaderName} directive&gt; -->
  - <strong>Syntax:</strong> HeaderName <em>filename</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - The HeaderName directive sets the name of the file that will be inserted
  - at the top of the index listing. <em>Filename</em> is the name of the file
  - to include, and is taken to be relative to the directory being indexed.
  - The server first attempts to include <em>filename</em><code>.html</code>
  - as an HTML document, otherwise it will include <em>filename</em> as plain
  - text. Example:
  - <blockquote><code>HeaderName HEADER</code></blockquote>
  - when indexing the directory <code>/web</code>, the server will first look for
  - the HTML file <code>/web/HEADER.html</code> and include it if found, otherwise
  - it will include the plain text file <code>/web/HEADER</code>, if it exists.
  - 
  - <p>See also <A HREF="#readmename">ReadmeName</A>.<p><hr>
  - 
  - <A name="indexignore"><h2>IndexIgnore</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt IndexIgnore} directive&gt; -->
  - <strong>Syntax:</strong> IndexIgnore <em>file file ...</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - The IndexIgnore directive adds to the list of files to hide when listing
  - a directory. <em>File</em> is a file extension, partial filename,
  - wildcard expression or full filename for files to ignore. Multiple
  - IndexIgnore directives add to the list, rather than the replacing the list
  - of ignored files. By default, the list contains `<code>.</code>'. Example:
  - <blockquote><code>
  - IndexIgnore README .htaccess *~
  - </code></blockquote><p><hr>
  - 
  - <A name="indexoptions"><h2>IndexOptions</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt IndexOptions} directive&gt; -->
  - <strong>Syntax:</strong> IndexOptions <em>option option ...</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - The IndexOptions directive specifies the behavior of the directory indexing.
  - <em>Option</em> can be one of
  - <dl>
  - <dt>FancyIndexing
  - <dd><!--%plaintext &lt;?INDEX {\tt FancyIndexing} index option&gt; -->
  - This turns on fancy indexing of directories.
  - <dt>IconsAreLinks
  - <dd>
  - <!--%plaintext &lt;?INDEX {\tt IconsAreLinks} index option&gt; -->
  - This makes the icons part of the anchor for the filename, for
  - fancy indexing.
  - <dt>ScanHTMLTitles
  - <dd><!--%plaintext &lt;?INDEX {\tt ScanHTMLTitles} index option&gt; -->
  - This enables the extraction of the title from HTML documents for fancy
  - indexing. If the file does not have a description given by
  - <A HREF="#adddescription">AddDescription</A> then httpd will read the
  - document for the value of the TITLE tag.  This is CPU and disk intensive.
  - <dt>SuppressLastModified
  - <dd>
  - <!--%plaintext &lt;?INDEX {\tt SuppressLastModified} index option&gt; -->
  - This will suppress the display of the last modification date, in fancy
  - indexing listings.
  - <dt>SuppressSize
  - <dd>
  - <!--%plaintext &lt;?INDEX {\tt SuppressSize} index option&gt; -->
  - This will suppress the file size in fancy indexing listings.
  - <dt>SuppressDescription
  - <dd>
  - <!--%plaintext &lt;?INDEX {\tt SuppressDescription} index option&gt; -->
  - This will suppress the file description in fancy indexing listings.
  - <dt>IconHeight[=pixels] (<EM>Apache 1.3 and later</EM>)
  - <dd>
  - <!--%plaintext &lt;?INDEX {\tt IconHeight} index option&gt; -->
  - Presence of this option, when used with IconWidth, will cause the server
  - to include <SAMP>HEIGHT</SAMP> and <SAMP>WIDTH</SAMP> attributes in the
  - <SAMP>IMG</SAMP> tag for the file icon.  This allows browser to
  - precalculate the page layout without having to wait until all the
  - images have been loaded.  If no value is given for the option, it
  - defaults to the standard height of the icons supplied with the Apache
  - software.
  - <dt>IconWidth[=pixels] (<EM>Apache 1.3 and later</EM>)
  - <dd>
  - <!--%plaintext &lt;?INDEX {\tt IconWidth} index option&gt; -->
  - Presence of this option, when used with IconHeight, will cause the server
  - to include <SAMP>HEIGHT</SAMP> and <SAMP>WIDTH</SAMP> attributes in the
  - <SAMP>IMG</SAMP> tag for the file icon.  This allows browser to
  - precalculate the page layout without having to wait until all the
  - images have been loaded.  If no value is given for the option, it
  - defaults to the standard width of the icons supplied with the Apache
  - software.
  - </dl>
  - This default is that no options are enabled. If multiple IndexOptions
  - could apply to a directory, then the most specific one is taken complete;
  - the options are not merged. For example:
  - <blockquote><code>
  - &lt;Directory /web/docs&gt; <br>
  - IndexOptions FancyIndexing <br>
  - &lt;/Directory&gt;<br>
  - &lt;Directory /web/docs/spec&gt; <br>
  - IndexOptions ScanHTMLTitles <br>
  - &lt;/Directory&gt;
  - </code></blockquote>
  - then only <code>ScanHTMLTitles</code> will be set for the /web/docs/spec
  - directory.<p><hr>
  - 
  - <A name="readmename"><h2>ReadmeName</h2></A>
  - <!--%plaintext &lt;?INDEX {\tt ReadmeName} directive&gt; -->
  - <strong>Syntax:</strong> ReadmeName <em>filename</em><br>
  - <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
  - <Strong>Override:</strong> Indexes<br>
  - <strong>Status:</strong> Base<br>
  - <strong>Module:</strong> mod_dir<p>
  - 
  - The ReadmeName directive sets the name of the file that will be appended
  - to the end of the index listing. <em>Filename</em> is the name of the file
  - to include, and is taken to be relative to the directory being indexed.
  - The server first attempts to include <em>filename</em><code>.html</code>
  - as an HTML document, otherwise it will include <em>filename</em> as plain
  - text. Example:
  - <blockquote><code>ReadmeName README</code></blockquote>
  - when indexing the directory <code>/web</code>, the server will first look for
  - the HTML file <code>/web/README.html</code> and include it if found, otherwise
  - it will include the plain text file <code>/web/README</code>, if it exists.
  - 
  - <p>See also <A HREF="#headername">HeaderName</A>.<p>
  - 
    
    <!--#include virtual="footer.html" -->
    </BODY>
  --- 78,83 ----
  
  
  
  1.329     +5 -0      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.328
  retrieving revision 1.329
  diff -C3 -r1.328 -r1.329
  *** CHANGES	1997/07/08 06:32:32	1.328
  --- CHANGES	1997/07/08 19:50:45	1.329
  ***************
  *** 1,5 ****
  --- 1,10 ----
    Changes with Apache 1.3
    
  +   *) Automatic indexing removed from mod_dir and placed into mod_autoindex.
  +      This allows the admin to completely remove automatic indexing
  +      from the server, while still supporting the basic functions of
  +      trailing-slash redirects and DirectoryIndex files.  [Dean Gaudet]
  + 
      *) popendir/pclosedir created to properly protect directory scanning.
         [Dean Gaudet] PR#525
    
  
  
  
  1.66      +4 -2      apache/src/Configuration.tmpl
  
  Index: Configuration.tmpl
  ===================================================================
  RCS file: /export/home/cvs/apache/src/Configuration.tmpl,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -C3 -r1.65 -r1.66
  *** Configuration.tmpl	1997/07/07 18:18:42	1.65
  --- Configuration.tmpl	1997/07/08 19:50:45	1.66
  ***************
  *** 175,185 ****
    # Module info_module         mod_info.o
    
    ## mod_include translates server-side include (SSI) statements in text files.
  ! ## mod_dir handles requests on directories and directory indexes.
    ## mod_cgi handles CGI scripts.
    
    Module includes_module     mod_include.o
  ! Module dir_module          mod_dir.o
    Module cgi_module          mod_cgi.o
    
    ## The asis module implemented ".asis" file types, which allow the embedding
  --- 175,187 ----
    # Module info_module         mod_info.o
    
    ## mod_include translates server-side include (SSI) statements in text files.
  ! ## mod_autoindex handles requests for directories which have no index file
  ! ## mod_dir handles requests on directories and directory index files.
    ## mod_cgi handles CGI scripts.
    
    Module includes_module     mod_include.o
  ! Module autoindex_module    mod_autoindex.o
  ! Module dir_module	   mod_dir.o
    Module cgi_module          mod_cgi.o
    
    ## The asis module implemented ".asis" file types, which allow the embedding
  
  
  
  1.33      +82 -157   apache/src/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_autoindex.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -C3 -r1.32 -r1.33
  *** mod_autoindex.c	1997/07/08 06:32:34	1.32
  --- mod_autoindex.c	1997/07/08 19:50:46	1.33
  ***************
  *** 51,57 ****
     */
    
    /*
  !  * http_dir.c: Handles the on-the-fly html index generation
     * 
     * Rob McCool
     * 3/23/93
  --- 51,57 ----
     */
    
    /*
  !  * mod_autoindex.c: Handles the on-the-fly html index generation
     * 
     * Rob McCool
     * 3/23/93
  ***************
  *** 72,78 ****
    #include "nt/readdir.h"
    #endif
    
  ! module dir_module;
    
    /****************************************************************
     *
  --- 72,78 ----
    #include "nt/readdir.h"
    #endif
    
  ! module autoindex_module;
    
    /****************************************************************
     *
  ***************
  *** 99,115 ****
        char *data;
    };
    
  ! typedef struct dir_config_struct {
    
        char *default_icon;
  -     char *index_names;
        int icon_width;
        int icon_height;
      
        array_header *icon_list, *alt_list, *desc_list, *ign_list;
        array_header *hdr_list, *rdme_list, *opts_list;
      
  ! } dir_config_rec;
    
    char c_by_encoding, c_by_type, c_by_path;
    
  --- 99,114 ----
        char *data;
    };
    
  ! typedef struct autoindex_config_struct {
    
        char *default_icon;
        int icon_width;
        int icon_height;
      
        array_header *icon_list, *alt_list, *desc_list, *ign_list;
        array_header *hdr_list, *rdme_list, *opts_list;
      
  ! } autoindex_config_rec;
    
    char c_by_encoding, c_by_type, c_by_path;
    
  ***************
  *** 117,123 ****
    #define BY_TYPE &c_by_type
    #define BY_PATH &c_by_path
    
  ! void push_item(array_header *arr, char *type, char *to, char *path, char *data)
    {
        struct item *p = (struct item *)push_array(arr);
    
  --- 116,123 ----
    #define BY_TYPE &c_by_type
    #define BY_PATH &c_by_path
    
  ! static void push_item(array_header *arr, char *type, char *to, char *path,
  !     char *data)
    {
        struct item *p = (struct item *)push_array(arr);
    
  ***************
  *** 136,152 ****
            p->apply_to = NULL;
    }
    
  ! const char *add_alt(cmd_parms *cmd, void *d, char *alt, char *to)
    {
        if (cmd->info == BY_PATH)
            if(!strcmp(to,"**DIRECTORY**"))
                to = "^^DIRECTORY^^";
    
  !     push_item(((dir_config_rec *)d)->alt_list, cmd->info, to, cmd->path, alt);
        return NULL;
    }
    
  ! const char *add_icon(cmd_parms *cmd, void *d, char *icon, char *to)
    {
        char *iconbak = pstrdup (cmd->pool, icon);
    
  --- 136,152 ----
            p->apply_to = NULL;
    }
    
  ! static const char *add_alt(cmd_parms *cmd, void *d, char *alt, char *to)
    {
        if (cmd->info == BY_PATH)
            if(!strcmp(to,"**DIRECTORY**"))
                to = "^^DIRECTORY^^";
    
  !     push_item(((autoindex_config_rec *)d)->alt_list, cmd->info, to, cmd->path, alt);
        return NULL;
    }
    
  ! static const char *add_icon(cmd_parms *cmd, void *d, char *icon, char *to)
    {
        char *iconbak = pstrdup (cmd->pool, icon);
    
  ***************
  *** 159,212 ****
            if(!strcmp(to,"**DIRECTORY**"))
                to = "^^DIRECTORY^^";
    
  !     push_item(((dir_config_rec *)d)->icon_list, cmd->info, to, cmd->path,
    	      iconbak);
        return NULL;
    }
    
  ! const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to)
    {
  !     push_item(((dir_config_rec *)d)->desc_list, cmd->info, to, cmd->path,desc);
        return NULL;
    }
    
  ! const char *add_ignore(cmd_parms *cmd, void *d, char *ext) {
  !     push_item(((dir_config_rec *)d)->ign_list, 0, ext, cmd->path, NULL);
        return NULL;
    }
    
  ! const char *add_header(cmd_parms *cmd, void *d, char *name) {
        if (strchr (name, '/')) {
    	return "HeaderName cannot contain a /";
        }
  !     push_item(((dir_config_rec *)d)->hdr_list, 0, NULL, cmd->path, name);
        return NULL;
    }
    
  ! const char *add_readme(cmd_parms *cmd, void *d, char *name) {
        if (strchr (name, '/')) {
    	return "ReadmeName cannot contain a /";
        }
  !     push_item(((dir_config_rec *)d)->rdme_list, 0, NULL, cmd->path, name);
        return NULL;
    }
    
    
  ! const char *add_opts_int(cmd_parms *cmd, void *d, int opts) {
  !     push_item(((dir_config_rec *)d)->opts_list, (char*)opts, NULL,
    	      cmd->path, NULL);
        return NULL;
    }
    
  ! const char *fancy_indexing (cmd_parms *cmd, void *d, int arg)
    {
        return add_opts_int (cmd, d, arg? FANCY_INDEXING : 0);
    }
    
  ! const char *add_opts(cmd_parms *cmd, void *d, const char *optstr) {
        char *w;
        int opts = 0;
  !     dir_config_rec *d_cfg = (dir_config_rec *) d;
    
        while(optstr[0]) {
            w = getword_conf(cmd->pool, &optstr);
  --- 159,212 ----
            if(!strcmp(to,"**DIRECTORY**"))
                to = "^^DIRECTORY^^";
    
  !     push_item(((autoindex_config_rec *)d)->icon_list, cmd->info, to, cmd->path,
    	      iconbak);
        return NULL;
    }
    
  ! static const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to)
    {
  !     push_item(((autoindex_config_rec *)d)->desc_list, cmd->info, to, cmd->path,desc);
        return NULL;
    }
    
  ! static const char *add_ignore(cmd_parms *cmd, void *d, char *ext) {
  !     push_item(((autoindex_config_rec *)d)->ign_list, 0, ext, cmd->path, NULL);
        return NULL;
    }
    
  ! static const char *add_header(cmd_parms *cmd, void *d, char *name) {
        if (strchr (name, '/')) {
    	return "HeaderName cannot contain a /";
        }
  !     push_item(((autoindex_config_rec *)d)->hdr_list, 0, NULL, cmd->path, name);
        return NULL;
    }
    
  ! static const char *add_readme(cmd_parms *cmd, void *d, char *name) {
        if (strchr (name, '/')) {
    	return "ReadmeName cannot contain a /";
        }
  !     push_item(((autoindex_config_rec *)d)->rdme_list, 0, NULL, cmd->path, name);
        return NULL;
    }
    
    
  ! static const char *add_opts_int(cmd_parms *cmd, void *d, int opts) {
  !     push_item(((autoindex_config_rec *)d)->opts_list, (char*)opts, NULL,
    	      cmd->path, NULL);
        return NULL;
    }
    
  ! static const char *fancy_indexing (cmd_parms *cmd, void *d, int arg)
    {
        return add_opts_int (cmd, d, arg? FANCY_INDEXING : 0);
    }
    
  ! static const char *add_opts(cmd_parms *cmd, void *d, const char *optstr) {
        char *w;
        int opts = 0;
  !     autoindex_config_rec *d_cfg = (autoindex_config_rec *) d;
    
        while(optstr[0]) {
            w = getword_conf(cmd->pool, &optstr);
  ***************
  *** 256,262 ****
    
    #define DIR_CMD_PERMS OR_INDEXES
    
  ! command_rec dir_cmds[] = {
    { "AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, ITERATE2,
        "an icon URL followed by one or more filenames" },
    { "AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, ITERATE2,
  --- 256,262 ----
    
    #define DIR_CMD_PERMS OR_INDEXES
    
  ! static command_rec autoindex_cmds[] = {
    { "AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, ITERATE2,
        "an icon URL followed by one or more filenames" },
    { "AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, ITERATE2,
  ***************
  *** 280,300 ****
    { "FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, FLAG,
        "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)" },
    { "DefaultIcon", set_string_slot,
  !     (void*)XtOffsetOf(dir_config_rec, default_icon),
        DIR_CMD_PERMS, TAKE1, "an icon URL"},
  - { "DirectoryIndex", set_string_slot,
  -     (void*)XtOffsetOf(dir_config_rec, index_names),
  -     DIR_CMD_PERMS, RAW_ARGS,
  -     "a list of file names" },
    { NULL }
    };
    
  ! void *create_dir_config (pool *p, char *dummy)
    {
  !     dir_config_rec *new =
  !         (dir_config_rec *) pcalloc (p, sizeof(dir_config_rec));
    
  -     new->index_names = NULL;
        new->icon_width = 0;
        new->icon_height = 0;
        new->icon_list = make_array (p, 4, sizeof (struct item));
  --- 280,295 ----
    { "FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, FLAG,
        "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)" },
    { "DefaultIcon", set_string_slot,
  !     (void*)XtOffsetOf(autoindex_config_rec, default_icon),
        DIR_CMD_PERMS, TAKE1, "an icon URL"},
    { NULL }
    };
    
  ! static void *create_autoindex_config (pool *p, char *dummy)
    {
  !     autoindex_config_rec *new =
  !         (autoindex_config_rec *) pcalloc (p, sizeof(autoindex_config_rec));
    
        new->icon_width = 0;
        new->icon_height = 0;
        new->icon_list = make_array (p, 4, sizeof (struct item));
  ***************
  *** 308,321 ****
        return (void *)new;
    }
    
  ! void *merge_dir_configs (pool *p, void *basev, void *addv)
    {
  !     dir_config_rec *new=(dir_config_rec*)pcalloc (p, sizeof(dir_config_rec));
  !     dir_config_rec *base = (dir_config_rec *)basev;
  !     dir_config_rec *add = (dir_config_rec *)addv;
    
        new->default_icon = add->default_icon?add->default_icon:base->default_icon;
  -     new->index_names = add->index_names? add->index_names: base->index_names;
        new->icon_height = add->icon_height ? add->icon_height : base->icon_height;
        new->icon_width = add->icon_width ? add->icon_width : base->icon_width;
    
  --- 303,315 ----
        return (void *)new;
    }
    
  ! static void *merge_autoindex_configs (pool *p, void *basev, void *addv)
    {
  !     autoindex_config_rec *new=(autoindex_config_rec*)pcalloc (p, sizeof(autoindex_config_rec));
  !     autoindex_config_rec *base = (autoindex_config_rec *)basev;
  !     autoindex_config_rec *add = (autoindex_config_rec *)addv;
    
        new->default_icon = add->default_icon?add->default_icon:base->default_icon;
        new->icon_height = add->icon_height ? add->icon_height : base->icon_height;
        new->icon_width = add->icon_width ? add->icon_width : base->icon_width;
    
  ***************
  *** 347,353 ****
        struct ent *next;
    };
    
  ! char *find_item(request_rec *r, array_header *list, int path_only) {
        char *content_type = r->content_type;
        char *content_encoding = r->content_encoding;
        char *path = r->filename;
  --- 341,347 ----
        struct ent *next;
    };
    
  ! static char *find_item(request_rec *r, array_header *list, int path_only) {
        char *content_type = r->content_type;
        char *content_encoding = r->content_encoding;
        char *path = r->filename;
  ***************
  *** 389,395 ****
    #define find_header(d,p) find_item(p,d->hdr_list,0)
    #define find_readme(d,p) find_item(p,d->rdme_list,0)
    
  ! char *find_default_icon (dir_config_rec *d, char *bogus_name)
    {
        request_rec r;
    
  --- 383,389 ----
    #define find_header(d,p) find_item(p,d->hdr_list,0)
    #define find_readme(d,p) find_item(p,d->rdme_list,0)
    
  ! static char *find_default_icon (autoindex_config_rec *d, char *bogus_name)
    {
        request_rec r;
    
  ***************
  *** 404,410 ****
        return find_item (&r, d->icon_list, 1);
    }
    
  ! int ignore_entry(dir_config_rec *d, char *path) {
        array_header *list = d->ign_list;
        struct item *items = (struct item *)list->elts;
        char *tt;
  --- 398,404 ----
        return find_item (&r, d->icon_list, 1);
    }
    
  ! static int ignore_entry(autoindex_config_rec *d, char *path) {
        array_header *list = d->ign_list;
        struct item *items = (struct item *)list->elts;
        char *tt;
  ***************
  *** 431,437 ****
        return 0;
    }
    
  ! int find_opts(dir_config_rec *d, request_rec *r) {
        char *path = r->filename;
        array_header *list = d->opts_list;
        struct item *items = (struct item *)list->elts;
  --- 425,431 ----
        return 0;
    }
    
  ! static int find_opts(autoindex_config_rec *d, request_rec *r) {
        char *path = r->filename;
        array_header *list = d->opts_list;
        struct item *items = (struct item *)list->elts;
  ***************
  *** 452,458 ****
     */
    
    
  ! int insert_readme(char *name, char *readme_fname, int rule, request_rec *r) {
        char *fn;
        FILE *f;
        struct stat finfo;
  --- 446,454 ----
     */
    
    
  ! static int insert_readme(char *name, char *readme_fname, int rule,
  !     request_rec *r)
  ! {
        char *fn;
        FILE *f;
        struct stat finfo;
  ***************
  *** 516,522 ****
    }
    
    
  ! char *find_title(request_rec *r) {
        char titlebuf[MAX_STRING_LEN], *find = "<TITLE>";
        FILE *thefile = NULL;
        int x,y,n,p;
  --- 512,518 ----
    }
    
    
  ! static char *find_title(request_rec *r) {
        char titlebuf[MAX_STRING_LEN], *find = "<TITLE>";
        FILE *thefile = NULL;
        int x,y,n,p;
  ***************
  *** 548,555 ****
        return NULL;
    }
    
  ! struct ent *make_dir_entry(char *name, int dir_opts,
  ! 			   dir_config_rec *d, request_rec *r)
    {
        struct ent *p;
    
  --- 544,551 ----
        return NULL;
    }
    
  ! static struct ent *make_autoindex_entry(char *name, int autoindex_opts,
  ! 			   autoindex_config_rec *d, request_rec *r)
    {
        struct ent *p;
    
  ***************
  *** 567,573 ****
        p->desc = NULL;
        p->lm = -1;
    
  !     if(dir_opts & FANCY_INDEXING) {
            request_rec *rr = sub_req_lookup_file (name, r);
    	
    	if (rr->finfo.st_mode != 0) {
  --- 563,569 ----
        p->desc = NULL;
        p->lm = -1;
    
  !     if(autoindex_opts & FANCY_INDEXING) {
            request_rec *rr = sub_req_lookup_file (name, r);
    	
    	if (rr->finfo.st_mode != 0) {
  ***************
  *** 589,595 ****
    	
            p->desc = find_desc(d, rr);
    	
  !         if((!p->desc) && (dir_opts & SCAN_HTML_TITLES))
                p->desc = pstrdup (r->pool, find_title(rr));
    
    	destroy_sub_req (rr);
  --- 585,591 ----
    	
            p->desc = find_desc(d, rr);
    	
  !         if((!p->desc) && (autoindex_opts & SCAN_HTML_TITLES))
                p->desc = pstrdup (r->pool, find_title(rr));
    
    	destroy_sub_req (rr);
  ***************
  *** 597,608 ****
        return(p);
    }
    
  ! char *terminate_description(dir_config_rec *d, char *desc, int dir_opts) {
        int maxsize = 23;
        register int x;
        
  !     if(dir_opts & SUPPRESS_LAST_MOD) maxsize += 17;
  !     if(dir_opts & SUPPRESS_SIZE) maxsize += 7;
    
        for(x=0;desc[x] && maxsize;x++) {
            if(desc[x] == '<') {
  --- 593,606 ----
        return(p);
    }
    
  ! static char *terminate_description(autoindex_config_rec *d, char *desc,
  !     int autoindex_opts)
  ! {
        int maxsize = 23;
        register int x;
        
  !     if(autoindex_opts & SUPPRESS_LAST_MOD) maxsize += 17;
  !     if(autoindex_opts & SUPPRESS_SIZE) maxsize += 7;
    
        for(x=0;desc[x] && maxsize;x++) {
            if(desc[x] == '<') {
  ***************
  *** 623,630 ****
        return desc;
    }
    
  ! void output_directories(struct ent **ar, int n,
  ! 			dir_config_rec *d, request_rec *r, int dir_opts)
    {
        int x, len;
        char *name = r->uri;
  --- 621,628 ----
        return desc;
    }
    
  ! static void output_directories(struct ent **ar, int n,
  !     autoindex_config_rec *d, request_rec *r, int autoindex_opts)
    {
        int x, len;
        char *name = r->uri;
  ***************
  *** 633,639 ****
        
        if(name[0] == '\0') name = "/";
    
  !     if(dir_opts & FANCY_INDEXING) {
            rputs("<PRE>", r);
            if((tp = find_default_icon(d,"^^BLANKICON^^"))) {
                rvputs(r, "<IMG SRC=\"", escape_html(scratch, tp),
  --- 631,637 ----
        
        if(name[0] == '\0') name = "/";
    
  !     if(autoindex_opts & FANCY_INDEXING) {
            rputs("<PRE>", r);
            if((tp = find_default_icon(d,"^^BLANKICON^^"))) {
                rvputs(r, "<IMG SRC=\"", escape_html(scratch, tp),
  ***************
  *** 650,660 ****
    	    rputs ("> ", r);
    	}
            rputs("Name                   ", r);
  !         if(!(dir_opts & SUPPRESS_LAST_MOD))
                rputs("Last modified     ", r);
  !         if(!(dir_opts & SUPPRESS_SIZE))
                rputs("Size  ", r);
  !         if(!(dir_opts & SUPPRESS_DESC))
                rputs("Description", r);
            rputs("\n<HR>\n", r);
        }
  --- 648,658 ----
    	    rputs ("> ", r);
    	}
            rputs("Name                   ", r);
  !         if(!(autoindex_opts & SUPPRESS_LAST_MOD))
                rputs("Last modified     ", r);
  !         if(!(autoindex_opts & SUPPRESS_SIZE))
                rputs("Size  ", r);
  !         if(!(autoindex_opts & SUPPRESS_DESC))
                rputs("Description", r);
            rputs("\n<HR>\n", r);
        }
  ***************
  *** 698,705 ****
    			      "\">", NULL);
            }
    
  !         if(dir_opts & FANCY_INDEXING) {
  !             if(dir_opts & ICONS_ARE_LINKS)
                    rputs(anchor, r);
                if((ar[x]->icon) || d->default_icon) {
                    rvputs(r, "<IMG SRC=\"", 
  --- 696,703 ----
    			      "\">", NULL);
            }
    
  !         if(autoindex_opts & FANCY_INDEXING) {
  !             if(autoindex_opts & ICONS_ARE_LINKS)
                    rputs(anchor, r);
                if((ar[x]->icon) || d->default_icon) {
                    rvputs(r, "<IMG SRC=\"", 
  ***************
  *** 718,728 ****
    		}
    		rputs (">", r);
    	    }
  !             if(dir_opts & ICONS_ARE_LINKS) 
                    rputs("</A>", r);
    
                rvputs(r," ", anchor, t2, NULL);
  !             if(!(dir_opts & SUPPRESS_LAST_MOD)) {
                    if(ar[x]->lm != -1) {
    		    char time[MAX_STRING_LEN];
                        struct tm *ts = localtime(&ar[x]->lm);
  --- 716,726 ----
    		}
    		rputs (">", r);
    	    }
  !             if(autoindex_opts & ICONS_ARE_LINKS) 
                    rputs("</A>", r);
    
                rvputs(r," ", anchor, t2, NULL);
  !             if(!(autoindex_opts & SUPPRESS_LAST_MOD)) {
                    if(ar[x]->lm != -1) {
    		    char time[MAX_STRING_LEN];
                        struct tm *ts = localtime(&ar[x]->lm);
  ***************
  *** 733,745 ****
                        rputs("                 ", r);
                    }
                }
  !             if(!(dir_opts & SUPPRESS_SIZE)) {
                    send_size(ar[x]->size,r);
                    rputs("  ", r);
                }
  !             if(!(dir_opts & SUPPRESS_DESC)) {
                    if(ar[x]->desc) {
  !                     rputs(terminate_description(d, ar[x]->desc, dir_opts), r);
                    }
                }
            }
  --- 731,743 ----
                        rputs("                 ", r);
                    }
                }
  !             if(!(autoindex_opts & SUPPRESS_SIZE)) {
                    send_size(ar[x]->size,r);
                    rputs("  ", r);
                }
  !             if(!(autoindex_opts & SUPPRESS_DESC)) {
                    if(ar[x]->desc) {
  !                     rputs(terminate_description(d, ar[x]->desc, autoindex_opts), r);
                    }
                }
            }
  ***************
  *** 747,753 ****
                rvputs(r, "<LI> ", anchor," ", t2, NULL);
            rputc('\n', r);
        }
  !     if(dir_opts & FANCY_INDEXING) {
            rputs("</PRE>", r);
        }
        else {
  --- 745,751 ----
                rvputs(r, "<LI> ", anchor," ", t2, NULL);
            rputc('\n', r);
        }
  !     if(autoindex_opts & FANCY_INDEXING) {
            rputs("</PRE>", r);
        }
        else {
  ***************
  *** 756,768 ****
    }
    
    
  ! int dsortf(struct ent **s1,struct ent **s2)
    {
        return(strcmp((*s1)->name,(*s2)->name));
    }
    
        
  ! int index_directory(request_rec *r, dir_config_rec *dir_conf)
    {
        char *title_name = escape_html(r->pool, r->uri);
        char *title_endp;
  --- 754,766 ----
    }
    
    
  ! static int dsortf(struct ent **s1,struct ent **s2)
    {
        return(strcmp((*s1)->name,(*s2)->name));
    }
    
        
  ! static int index_directory(request_rec *r, autoindex_config_rec *autoindex_conf)
    {
        char *title_name = escape_html(r->pool, r->uri);
        char *title_endp;
  ***************
  *** 774,780 ****
        struct ent *head,*p;
        struct ent **ar = NULL;
        char *tmp;
  !     int dir_opts = find_opts(dir_conf, r);
    
        if(!(d=popendir(r->pool, name))) {
            log_reason ("Can't open directory for index", r->filename, r);
  --- 772,778 ----
        struct ent *head,*p;
        struct ent **ar = NULL;
        char *tmp;
  !     int autoindex_opts = find_opts(autoindex_conf, r);
    
        if(!(d=popendir(r->pool, name))) {
            log_reason ("Can't open directory for index", r->filename, r);
  ***************
  *** 807,813 ****
    	    NULL
    	);
    
  !     if((!(tmp = find_header(dir_conf,r))) || (!(insert_readme(name,tmp,0,r))))
            rvputs(r, "<H1>Index of ", title_name, "</H1>\n", NULL);
    
        /* 
  --- 805,811 ----
    	    NULL
    	);
    
  !     if((!(tmp = find_header(autoindex_conf,r))) || (!(insert_readme(name,tmp,0,r))))
            rvputs(r, "<H1>Index of ", title_name, "</H1>\n", NULL);
    
        /* 
  ***************
  *** 816,822 ****
         */
        head=NULL;
        while((dstruct=readdir(d))) {
  !         if((p = make_dir_entry(dstruct->d_name, dir_opts, dir_conf, r))) {
                p->next=head;
                head=p;
                num_ent++;
  --- 814,820 ----
         */
        head=NULL;
        while((dstruct=readdir(d))) {
  !         if((p = make_autoindex_entry(dstruct->d_name, autoindex_opts, autoindex_conf, r))) {
                p->next=head;
                head=p;
                num_ent++;
  ***************
  *** 838,848 ****
    	      (int (*)(const void *,const void *))dsortf);
    #endif
        }
  !     output_directories(ar, num_ent, dir_conf, r, dir_opts);
        pclosedir(r->pool, d);
    
  !     if (dir_opts & FANCY_INDEXING)
  !         if((tmp = find_readme(dir_conf, r)))
                insert_readme(name,tmp,1,r);
        else {
            rputs("</UL>", r);
  --- 836,846 ----
    	      (int (*)(const void *,const void *))dsortf);
    #endif
        }
  !     output_directories(ar, num_ent, autoindex_conf, r, autoindex_opts);
        pclosedir(r->pool, d);
    
  !     if (autoindex_opts & FANCY_INDEXING)
  !         if((tmp = find_readme(autoindex_conf, r)))
                insert_readme(name,tmp,1,r);
        else {
            rputs("</UL>", r);
  ***************
  *** 856,940 ****
    
    /* The formal handler... */
    
  ! int handle_dir (request_rec *r)
    {
  !     dir_config_rec *d =
  !       (dir_config_rec *)get_module_config (r->per_dir_config, &dir_module);
  !     const char *names_ptr = d->index_names ? d->index_names : DEFAULT_INDEX;
        int allow_opts = allow_options (r);
  -     int error_notfound = 0;
  - 
  -     if (r->uri[0] == '\0' || r->uri[strlen(r->uri)-1] != '/') {
  - 	char* ifile;
  - 	if (r->args != NULL)
  -         	ifile = pstrcat (r->pool, escape_uri(r->pool, r->uri),
  - 			"/", "?", r->args, NULL);
  - 	else
  -         	ifile = pstrcat (r->pool, escape_uri(r->pool, r->uri),
  - 			 "/", NULL);
  - 
  - 	table_set (r->headers_out, "Location",
  - 		   construct_url(r->pool, ifile, r->server)); 
  - 	return HTTP_MOVED_PERMANENTLY;
  -     }
  - 
  -     /* KLUDGE --- make the sub_req lookups happen in the right directory.
  -      * Fixing this in the sub_req_lookup functions themselves is difficult,
  -      * and would probably break virtual includes...
  -      */
  - 
  -     r->filename = pstrcat (r->pool, r->filename, "/", NULL);
  -     
  -     while (*names_ptr) {
  -           
  - 	char *name_ptr = getword_conf (r->pool, &names_ptr);
  - 	request_rec *rr = sub_req_lookup_uri (name_ptr, r);
  -            
  - 	if (rr->status == HTTP_OK && rr->finfo.st_mode != 0) {
  - 	    char* new_uri = escape_uri(r->pool, rr->uri);
  - 
  - 	    if (rr->args != NULL)
  - 		new_uri = pstrcat(r->pool, new_uri, "?", rr->args, NULL);
  - 	    else if (r->args != NULL)
  - 		new_uri = pstrcat(r->pool, new_uri, "?", r->args, NULL);
  - 	
  - 	    destroy_sub_req (rr);
  - 	    internal_redirect (new_uri, r);
  - 	    return OK;
  - 	}
  - 
  - 	/* If the request returned a redirect, propagate it to the client */
  - 
  - 	if (is_HTTP_REDIRECT(rr->status) ||
  - 	    (rr->status == HTTP_NOT_ACCEPTABLE && *names_ptr == '\0')) {
  - 
  - 	    error_notfound = rr->status;
  - 	    r->notes = overlay_tables(r->pool, r->notes, rr->notes);
  - 	    r->headers_out = overlay_tables(r->pool, r->headers_out,
  - 	                                            rr->headers_out);
  - 	    r->err_headers_out = overlay_tables(r->pool, r->err_headers_out,
  - 	                                                rr->err_headers_out);
  - 	    destroy_sub_req(rr);
  - 	    return error_notfound;
  - 	}
  -             
  - 	/* If the request returned something other than 404 (or 200),
  - 	 * it means the module encountered some sort of problem. To be
  - 	 * secure, we should return the error, rather than create
  - 	 * along a (possibly unsafe) directory index.
  - 	 *
  - 	 * So we store the error, and if none of the listed files
  - 	 * exist, we return the last error response we got, instead
  - 	 * of a directory listing.
  - 	 */
  - 	if (rr->status && rr->status != HTTP_NOT_FOUND && rr->status != HTTP_OK)
  - 	    error_notfound = rr->status;
  - 
  -         destroy_sub_req (rr);
  -     }
  - 
  -     if (error_notfound)
  - 	return error_notfound;
    
        if (r->method_number != M_GET) return NOT_IMPLEMENTED;
        
  --- 854,865 ----
    
    /* The formal handler... */
    
  ! static int handle_autoindex (request_rec *r)
    {
  !     autoindex_config_rec *d =
  !       (autoindex_config_rec *)get_module_config (r->per_dir_config,
  !       &autoindex_module);
        int allow_opts = allow_options (r);
    
        if (r->method_number != M_GET) return NOT_IMPLEMENTED;
        
  ***************
  *** 949,968 ****
    }
    
    
  ! handler_rec dir_handlers[] = {
  ! { DIR_MAGIC_TYPE, handle_dir },
    { NULL }
    };
    
  ! module dir_module = {
       STANDARD_MODULE_STUFF,
       NULL,			/* initializer */
  !    create_dir_config,		/* dir config creater */
  !    merge_dir_configs,		/* dir merger --- default is to override */
       NULL,			/* server config */
       NULL,			/* merge server config */
  !    dir_cmds,			/* command table */
  !    dir_handlers,		/* handlers */
       NULL,			/* filename translation */
       NULL,			/* check_user_id */
       NULL,			/* check auth */
  --- 874,893 ----
    }
    
    
  ! static handler_rec autoindex_handlers[] = {
  ! { DIR_MAGIC_TYPE, handle_autoindex },
    { NULL }
    };
    
  ! module autoindex_module = {
       STANDARD_MODULE_STUFF,
       NULL,			/* initializer */
  !    create_autoindex_config,	/* dir config creater */
  !    merge_autoindex_configs,	/* dir merger --- default is to override */
       NULL,			/* server config */
       NULL,			/* merge server config */
  !    autoindex_cmds,		/* command table */
  !    autoindex_handlers,		/* handlers */
       NULL,			/* filename translation */
       NULL,			/* check_user_id */
       NULL,			/* check auth */
  
  
  
  1.33      +11 -769   apache/src/mod_dir.c
  
  Index: mod_dir.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_dir.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -C3 -r1.32 -r1.33
  *** mod_dir.c	1997/07/08 06:32:34	1.32
  --- mod_dir.c	1997/07/08 19:50:46	1.33
  ***************
  *** 51,62 ****
     */
    
    /*
  !  * http_dir.c: Handles the on-the-fly html index generation
  !  * 
  !  * Rob McCool
  !  * 3/23/93
  !  * 
  !  * Adapted to Apache by rst.
     */
    
    #include "httpd.h"
  --- 51,57 ----
     */
    
    /*
  !  * mod_dir.c: handle default index files, and trailing-/ redirects
     */
    
    #include "httpd.h"
  ***************
  *** 74,287 ****
    
    module dir_module;
    
  - /****************************************************************
  -  *
  -  * Handling configuration directives...
  -  */
  - 
  - #define FANCY_INDEXING 1	/* Indexing options */
  - #define ICONS_ARE_LINKS 2
  - #define SCAN_HTML_TITLES 4
  - #define SUPPRESS_LAST_MOD 8
  - #define SUPPRESS_SIZE 16
  - #define SUPPRESS_DESC 32
  - 
  - /*
  -  * These are the dimensions of the default icons supplied with Apache.
  -  */
  - #define DEFAULT_ICON_WIDTH 20
  - #define DEFAULT_ICON_HEIGHT 22
  - 
  - struct item {
  -     char *type;
  -     char *apply_to;
  -     char *apply_path;
  -     char *data;
  - };
  - 
    typedef struct dir_config_struct {
  - 
  -     char *default_icon;
        char *index_names;
  -     int icon_width;
  -     int icon_height;
  -   
  -     array_header *icon_list, *alt_list, *desc_list, *ign_list;
  -     array_header *hdr_list, *rdme_list, *opts_list;
  -   
    } dir_config_rec;
    
  - char c_by_encoding, c_by_type, c_by_path;
  - 
  - #define BY_ENCODING &c_by_encoding
  - #define BY_TYPE &c_by_type
  - #define BY_PATH &c_by_path
  - 
  - void push_item(array_header *arr, char *type, char *to, char *path, char *data)
  - {
  -     struct item *p = (struct item *)push_array(arr);
  - 
  -     if (!to) to = "";
  -     if (!path) path = "";
  -     
  -     p->type = type;
  -     p->data = data ? pstrdup(arr->pool, data): NULL;
  -     p->apply_path = pstrcat(arr->pool, path, "*", NULL);
  -     
  -     if((type == BY_PATH) && (!is_matchexp(to)))
  -         p->apply_to = pstrcat (arr->pool, "*", to, NULL);
  -     else if (to)
  -         p->apply_to = pstrdup (arr->pool, to);
  -     else
  -         p->apply_to = NULL;
  - }
  - 
  - const char *add_alt(cmd_parms *cmd, void *d, char *alt, char *to)
  - {
  -     if (cmd->info == BY_PATH)
  -         if(!strcmp(to,"**DIRECTORY**"))
  -             to = "^^DIRECTORY^^";
  - 
  -     push_item(((dir_config_rec *)d)->alt_list, cmd->info, to, cmd->path, alt);
  -     return NULL;
  - }
  - 
  - const char *add_icon(cmd_parms *cmd, void *d, char *icon, char *to)
  - {
  -     char *iconbak = pstrdup (cmd->pool, icon);
  - 
  -     if(icon[0] == '(') {
  -         char *alt = getword_nc (cmd->pool, &iconbak, ',');
  -         iconbak[strlen(iconbak) - 1] = '\0'; /* Lose closing paren */
  -         add_alt(cmd, d, &alt[1], to);
  -     }
  -     if(cmd->info == BY_PATH) 
  -         if(!strcmp(to,"**DIRECTORY**"))
  -             to = "^^DIRECTORY^^";
  - 
  -     push_item(((dir_config_rec *)d)->icon_list, cmd->info, to, cmd->path,
  - 	      iconbak);
  -     return NULL;
  - }
  - 
  - const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to)
  - {
  -     push_item(((dir_config_rec *)d)->desc_list, cmd->info, to, cmd->path,desc);
  -     return NULL;
  - }
  - 
  - const char *add_ignore(cmd_parms *cmd, void *d, char *ext) {
  -     push_item(((dir_config_rec *)d)->ign_list, 0, ext, cmd->path, NULL);
  -     return NULL;
  - }
  - 
  - const char *add_header(cmd_parms *cmd, void *d, char *name) {
  -     if (strchr (name, '/')) {
  - 	return "HeaderName cannot contain a /";
  -     }
  -     push_item(((dir_config_rec *)d)->hdr_list, 0, NULL, cmd->path, name);
  -     return NULL;
  - }
  - 
  - const char *add_readme(cmd_parms *cmd, void *d, char *name) {
  -     if (strchr (name, '/')) {
  - 	return "ReadmeName cannot contain a /";
  -     }
  -     push_item(((dir_config_rec *)d)->rdme_list, 0, NULL, cmd->path, name);
  -     return NULL;
  - }
  - 
  - 
  - const char *add_opts_int(cmd_parms *cmd, void *d, int opts) {
  -     push_item(((dir_config_rec *)d)->opts_list, (char*)opts, NULL,
  - 	      cmd->path, NULL);
  -     return NULL;
  - }
  - 
  - const char *fancy_indexing (cmd_parms *cmd, void *d, int arg)
  - {
  -     return add_opts_int (cmd, d, arg? FANCY_INDEXING : 0);
  - }
  - 
  - const char *add_opts(cmd_parms *cmd, void *d, const char *optstr) {
  -     char *w;
  -     int opts = 0;
  -     dir_config_rec *d_cfg = (dir_config_rec *) d;
  - 
  -     while(optstr[0]) {
  -         w = getword_conf(cmd->pool, &optstr);
  -         if(!strcasecmp(w,"FancyIndexing"))
  -             opts |= FANCY_INDEXING;
  -         else if(!strcasecmp(w,"IconsAreLinks"))
  -             opts |= ICONS_ARE_LINKS;
  -         else if(!strcasecmp(w,"ScanHTMLTitles"))
  -             opts |= SCAN_HTML_TITLES;
  -         else if(!strcasecmp(w,"SuppressLastModified"))
  -             opts |= SUPPRESS_LAST_MOD;
  -         else if(!strcasecmp(w,"SuppressSize"))
  -             opts |= SUPPRESS_SIZE;
  -         else if(!strcasecmp(w,"SuppressDescription"))
  -             opts |= SUPPRESS_DESC;
  -         else if(!strcasecmp(w,"None"))
  -             opts = 0;
  - 	else if (! strncasecmp (w, "IconWidth", 9)) {
  - 	    if (strchr (w, '=') != NULL) {
  - 		const char *x = pstrdup (cmd->pool, w);
  - 		char *val;
  - 		val = getword (cmd->pool, &x, '=');
  - 		val = getword (cmd->pool, &x, '=');
  - 		d_cfg->icon_width = atoi(val);
  - 	    }
  - 	    else {
  - 		d_cfg->icon_width = DEFAULT_ICON_WIDTH;
  - 	    }
  - 	}
  - 	else if (! strncasecmp (w, "IconHeight", 10)) {
  - 	    if (strchr (w, '=') != NULL) {
  - 		const char *x = pstrdup (cmd->pool, w);
  - 		char *val;
  - 		val = getword (cmd->pool, &x, '=');
  - 		val = getword (cmd->pool, &x, '=');
  - 		d_cfg->icon_height = atoi(val);
  - 	    }
  - 	    else {
  - 		d_cfg->icon_height = DEFAULT_ICON_HEIGHT;
  - 	    }
  - 	}
  - 	else
  - 	    return "Invalid directory indexing option";
  -     }
  -     return add_opts_int(cmd, d, opts);
  - }
  - 
    #define DIR_CMD_PERMS OR_INDEXES
    
  ! command_rec dir_cmds[] = {
  ! { "AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, ITERATE2,
  !     "an icon URL followed by one or more filenames" },
  ! { "AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, ITERATE2,
  !     "an icon URL followed by one or more MIME types" },
  ! { "AddIconByEncoding", add_icon, BY_ENCODING, DIR_CMD_PERMS, ITERATE2,
  !     "an icon URL followed by one or more content encodings" },
  ! { "AddAlt", add_alt, BY_PATH, DIR_CMD_PERMS, ITERATE2,
  !     "alternate descriptive text followed by one or more filenames" },
  ! { "AddAltByType", add_alt, BY_TYPE, DIR_CMD_PERMS, ITERATE2,
  !     "alternate descriptive text followed by one or more MIME types" },
  ! { "AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS, ITERATE2,
  !     "alternate descriptive text followed by one or more content encodings" },
  ! { "IndexOptions", add_opts, NULL, DIR_CMD_PERMS, RAW_ARGS,
  !     "one or more index options" },
  ! { "IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS, ITERATE,
  !     "one or more file extensions" },
  ! { "AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS, ITERATE2,
  !     "Descriptive text followed by one or more filenames" },
  ! { "HeaderName", add_header, NULL, DIR_CMD_PERMS, TAKE1, "a filename" },
  ! { "ReadmeName", add_readme, NULL, DIR_CMD_PERMS, TAKE1, "a filename" },
  ! { "FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, FLAG,
  !     "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)" },
  ! { "DefaultIcon", set_string_slot,
  !     (void*)XtOffsetOf(dir_config_rec, default_icon),
  !     DIR_CMD_PERMS, TAKE1, "an icon URL"},
    { "DirectoryIndex", set_string_slot,
        (void*)XtOffsetOf(dir_config_rec, index_names),
        DIR_CMD_PERMS, RAW_ARGS,
  --- 69,81 ----
    
    module dir_module;
    
    typedef struct dir_config_struct {
        char *index_names;
    } dir_config_rec;
    
    #define DIR_CMD_PERMS OR_INDEXES
    
  ! static command_rec dir_cmds[] = {
    { "DirectoryIndex", set_string_slot,
        (void*)XtOffsetOf(dir_config_rec, index_names),
        DIR_CMD_PERMS, RAW_ARGS,
  ***************
  *** 289,865 ****
    { NULL }
    };
    
  ! void *create_dir_config (pool *p, char *dummy)
    {
        dir_config_rec *new =
            (dir_config_rec *) pcalloc (p, sizeof(dir_config_rec));
    
        new->index_names = NULL;
  -     new->icon_width = 0;
  -     new->icon_height = 0;
  -     new->icon_list = make_array (p, 4, sizeof (struct item));
  -     new->alt_list = make_array (p, 4, sizeof (struct item));
  -     new->desc_list = make_array (p, 4, sizeof (struct item));
  -     new->ign_list = make_array (p, 4, sizeof (struct item));
  -     new->hdr_list = make_array (p, 4, sizeof (struct item));
  -     new->rdme_list = make_array (p, 4, sizeof (struct item));
  -     new->opts_list = make_array (p, 4, sizeof (struct item));
  -     
        return (void *)new;
    }
    
  ! void *merge_dir_configs (pool *p, void *basev, void *addv)
    {
        dir_config_rec *new=(dir_config_rec*)pcalloc (p, sizeof(dir_config_rec));
        dir_config_rec *base = (dir_config_rec *)basev;
        dir_config_rec *add = (dir_config_rec *)addv;
    
  -     new->default_icon = add->default_icon?add->default_icon:base->default_icon;
        new->index_names = add->index_names? add->index_names: base->index_names;
  -     new->icon_height = add->icon_height ? add->icon_height : base->icon_height;
  -     new->icon_width = add->icon_width ? add->icon_width : base->icon_width;
  - 
  -     new->alt_list = append_arrays (p, add->alt_list, base->alt_list);
  -     new->ign_list = append_arrays (p, add->ign_list, base->ign_list);
  -     new->hdr_list = append_arrays (p, add->hdr_list, base->hdr_list);
  -     new->desc_list = append_arrays (p, add->desc_list, base->desc_list);
  -     new->icon_list = append_arrays (p, add->icon_list, base->icon_list);
  -     new->rdme_list = append_arrays (p, add->rdme_list, base->rdme_list);
  -     new->opts_list = append_arrays (p, add->opts_list, base->opts_list);
  -     
        return new;
    }
    
  ! /****************************************************************
  !  *
  !  * Looking things up in config entries...
  !  */
  ! 
  ! /* Structure used to hold entries when we're actually building an index */
  ! 
  ! struct ent {
  !     char *name;
  !     char *icon;
  !     char *alt;
  !     char *desc;
  !     size_t size;
  !     time_t lm;
  !     struct ent *next;
  ! };
  ! 
  ! char *find_item(request_rec *r, array_header *list, int path_only) {
  !     char *content_type = r->content_type;
  !     char *content_encoding = r->content_encoding;
  !     char *path = r->filename;
  ! 
  !     struct item *items = (struct item *)list->elts;
  !     int i;
  ! 
  !     for (i = 0; i < list->nelts; ++i) {
  !         struct item *p = &items[i];
  !       
  !         /* Special cased for ^^DIRECTORY^^ and ^^BLANKICON^^ */
  !         if((path[0] == '^') || (!strcmp_match(path,p->apply_path))) {
  !             if(!*(p->apply_to))
  !                 return p->data;
  !             else if(p->type == BY_PATH || path[0] == '^') {
  !                 if(!strcmp_match(path,p->apply_to))
  !                     return p->data;
  !             } else if(!path_only) {
  !                 if(!content_encoding) {
  !                     if(p->type == BY_TYPE) {
  !                         if(content_type && !strcmp_match(content_type,p->apply_to))
  !                             return p->data;
  !                     }
  !                 } else {
  !                     if(p->type == BY_ENCODING) {
  !                         if(!strcmp_match(content_encoding,p->apply_to))
  !                             return p->data;
  !                     }
  !                 }
  !             }
  !         }
  !     }
  !     return NULL;
  ! }
  ! 
  ! #define find_icon(d,p,t) find_item(p,d->icon_list,t)
  ! #define find_alt(d,p,t) find_item(p,d->alt_list,t)
  ! #define find_desc(d,p) find_item(p,d->desc_list,0)
  ! #define find_header(d,p) find_item(p,d->hdr_list,0)
  ! #define find_readme(d,p) find_item(p,d->rdme_list,0)
  ! 
  ! char *find_default_icon (dir_config_rec *d, char *bogus_name)
  ! {
  !     request_rec r;
  ! 
  !     /* Bleah.  I tried to clean up find_item, and it lead to this bit
  !      * of ugliness.   Note that the fields initialized are precisely
  !      * those that find_item looks at...
  !      */
  !     
  !     r.filename = bogus_name;
  !     r.content_type = r.content_encoding = NULL;
  ! 
  !     return find_item (&r, d->icon_list, 1);
  ! }
  ! 
  ! int ignore_entry(dir_config_rec *d, char *path) {
  !     array_header *list = d->ign_list;
  !     struct item *items = (struct item *)list->elts;
  !     char *tt;
  !     int i;
  ! 
  !     if((tt=strrchr(path,'/')) == NULL)
  !       tt=path;
  !     else {
  !       tt++;
  !     }
  ! 
  !     for (i = 0; i < list->nelts; ++i) {
  !         struct item *p = &items[i];
  ! 	char *ap;
  ! 
  ! 	if((ap=strrchr(p->apply_to,'/')) == NULL)
  ! 	  ap=p->apply_to;
  ! 	else
  ! 	  ap++;
  ! 
  !         if(!strcmp_match(path,p->apply_path) && !strcmp_match(tt,ap))
  ! 	   return 1;
  !     }
  !     return 0;
  ! }
  ! 
  ! int find_opts(dir_config_rec *d, request_rec *r) {
  !     char *path = r->filename;
  !     array_header *list = d->opts_list;
  !     struct item *items = (struct item *)list->elts;
  !     int i;
  ! 
  !     for (i = 0; i < list->nelts; ++i) {
  !         struct item *p = &items[i];
  ! 	
  !         if(!strcmp_match(path,p->apply_path))
  !             return (int)p->type;
  !     }
  !     return 0;
  ! }
  ! 
  ! /*****************************************************************
  !  *
  !  * Actually generating output
  !  */
  ! 
  ! 
  ! int insert_readme(char *name, char *readme_fname, int rule, request_rec *r) {
  !     char *fn;
  !     FILE *f;
  !     struct stat finfo;
  !     int plaintext=0;
  !     request_rec *rr;
  ! 
  !     /* XXX: this is a load of crap, it needs to do a full sub_req_lookup_uri */
  !     fn = make_full_path(r->pool, name, readme_fname);
  !     fn = pstrcat(r->pool, fn, ".html", NULL);
  !     if(stat(fn,&finfo) == -1) {
  !         /* A brief fake multiviews search for README.html */
  !         fn[strlen(fn)-5] = '\0';
  !         if(stat(fn,&finfo) == -1)
  !             return 0;
  !         plaintext=1;
  !         if(rule) rputs("<HR>\n", r);
  !         rputs("<PRE>\n", r);
  !     }
  !     else if (rule) rputs("<HR>\n", r);
  !     /* XXX: when the above is rewritten properly, this necessary security
  !      * check will be redundant. -djg */
  !     rr = sub_req_lookup_file (fn, r);
  !     if (rr->status != HTTP_OK) {
  ! 	destroy_sub_req (rr);
  ! 	return 0;
  !     }
  !     destroy_sub_req (rr);
  !     if(!(f = pfopen(r->pool,fn,"r")))
  !         return 0;
  !     if (!plaintext)
  ! 	send_fd(f, r);
  !     else
  !     {
  ! 	char buf[IOBUFSIZE+1];
  ! 	int i, n, c, ch;
  ! 	while (!feof(f))
  ! 	{
  ! 	    do n = fread(buf, sizeof(char), IOBUFSIZE, f);
  ! 	    while (n == -1 && ferror(f) && errno == EINTR);
  ! 	    if (n == -1 || n == 0) break;
  ! 	    buf[n] = '\0';
  ! 	    c = 0;
  ! 	    while (c < n)
  ! 	    {
  ! 		for (i=c; i < n; i++)
  ! 		    if (buf[i] == '<' || buf[i] == '>' || buf[i] == '&') break;
  ! 		ch = buf[i];
  ! 		buf[i] = '\0';
  ! 		rputs(&buf[c], r);
  ! 		if (ch == '<') rputs("&lt;", r);
  ! 		else if (ch == '>') rputs("&gt;", r);
  ! 		else if (ch == '&') rputs("&amp;", r);
  ! 		c = i + 1;
  ! 	    }
  ! 	}
  !     }
  !     pfclose(r->pool, f);
  !     if(plaintext)
  !         rputs("</PRE>\n", r);
  !     return 1;
  ! }
  ! 
  ! 
  ! char *find_title(request_rec *r) {
  !     char titlebuf[MAX_STRING_LEN], *find = "<TITLE>";
  !     FILE *thefile = NULL;
  !     int x,y,n,p;
  ! 
  !     if (r->status != HTTP_OK) {
  ! 	return NULL;
  !     }
  !     if (r->content_type && !strcmp(r->content_type,"text/html") && !r->content_encoding) {
  !         if(!(thefile = pfopen(r->pool, r->filename,"r")))
  !             return NULL;
  !         n = fread(titlebuf,sizeof(char),MAX_STRING_LEN - 1,thefile);
  !         titlebuf[n] = '\0';
  !         for(x=0,p=0;titlebuf[x];x++) {
  !             if(toupper(titlebuf[x]) == find[p]) {
  !                 if(!find[++p]) {
  !                     if((p = ind(&titlebuf[++x],'<')) != -1)
  !                         titlebuf[x+p] = '\0';
  !                     /* Scan for line breaks for Tanmoy's secretary */
  !                     for(y=x;titlebuf[y];y++)
  !                         if((titlebuf[y] == CR) || (titlebuf[y] == LF))
  !                             titlebuf[y] = ' ';
  ! 		    pfclose (r->pool, thefile);
  !                     return pstrdup(r->pool, &titlebuf[x]);
  !                 }
  !             } else p=0;
  !         }
  ! 	pfclose(r->pool, thefile);
  !     }
  !     return NULL;
  ! }
  ! 
  ! struct ent *make_dir_entry(char *name, int dir_opts,
  ! 			   dir_config_rec *d, request_rec *r)
  ! {
  !     struct ent *p;
  ! 
  !     if((name[0] == '.') && (!name[1]))
  !         return(NULL);
  ! 
  !     if (ignore_entry(d, make_full_path (r->pool, r->filename, name)))
  !         return(NULL);
  ! 
  !     p=(struct ent *)pcalloc(r->pool, sizeof(struct ent));
  !     p->name = pstrdup (r->pool, name);
  !     p->size = 0;
  !     p->icon = NULL;
  !     p->alt = NULL;
  !     p->desc = NULL;
  !     p->lm = -1;
  ! 
  !     if(dir_opts & FANCY_INDEXING) {
  !         request_rec *rr = sub_req_lookup_file (name, r);
  ! 	
  ! 	if (rr->finfo.st_mode != 0) {
  !             p->lm = rr->finfo.st_mtime;
  !             if(S_ISDIR(rr->finfo.st_mode)) {
  !                 if(!(p->icon = find_icon(d,rr,1)))
  !                     p->icon = find_default_icon(d,"^^DIRECTORY^^");
  !                 if(!(p->alt = find_alt(d,rr,1)))
  !                     p->alt = "DIR";
  !                 p->size = 0;
  ! 		p->name = pstrcat (r->pool, name, "/", NULL);
  !             }
  !             else {
  !                 p->icon = find_icon(d, rr, 0);
  !                 p->alt = find_alt(d, rr, 0);
  !                 p->size = rr->finfo.st_size;
  !             }
  !         }
  ! 	
  !         p->desc = find_desc(d, rr);
  ! 	
  !         if((!p->desc) && (dir_opts & SCAN_HTML_TITLES))
  !             p->desc = pstrdup (r->pool, find_title(rr));
  ! 
  ! 	destroy_sub_req (rr);
  !     }
  !     return(p);
  ! }
  ! 
  ! char *terminate_description(dir_config_rec *d, char *desc, int dir_opts) {
  !     int maxsize = 23;
  !     register int x;
  !     
  !     if(dir_opts & SUPPRESS_LAST_MOD) maxsize += 17;
  !     if(dir_opts & SUPPRESS_SIZE) maxsize += 7;
  ! 
  !     for(x=0;desc[x] && maxsize;x++) {
  !         if(desc[x] == '<') {
  !             while(desc[x] != '>') {
  !                 if(!desc[x]) {
  !                     maxsize = 0;
  !                     break;
  !                 }
  !                 ++x;
  !             }
  !         }
  !         else --maxsize;
  !     }
  !     if(!maxsize) {
  !         desc[x-1] = '>';	/* Grump. */
  ! 	desc[x] = '\0';		/* Double Grump! */
  !     }
  !     return desc;
  ! }
  ! 
  ! void output_directories(struct ent **ar, int n,
  ! 			dir_config_rec *d, request_rec *r, int dir_opts)
  ! {
  !     int x, len;
  !     char *name = r->uri;
  !     char *tp;
  !     pool *scratch = make_sub_pool (r->pool);
  !     
  !     if(name[0] == '\0') name = "/";
  ! 
  !     if(dir_opts & FANCY_INDEXING) {
  !         rputs("<PRE>", r);
  !         if((tp = find_default_icon(d,"^^BLANKICON^^"))) {
  !             rvputs(r, "<IMG SRC=\"", escape_html(scratch, tp),
  ! 		   "\" ALT=\"     \"", NULL);
  ! 	    if (d->icon_width && d->icon_height) {
  ! 		rprintf
  ! 		    (
  ! 			r,
  ! 			" HEIGHT=\"%d\" WIDTH=\"%d\"",
  ! 			d->icon_height,
  ! 			d->icon_width
  ! 		    );
  ! 	    }
  ! 	    rputs ("> ", r);
  ! 	}
  !         rputs("Name                   ", r);
  !         if(!(dir_opts & SUPPRESS_LAST_MOD))
  !             rputs("Last modified     ", r);
  !         if(!(dir_opts & SUPPRESS_SIZE))
  !             rputs("Size  ", r);
  !         if(!(dir_opts & SUPPRESS_DESC))
  !             rputs("Description", r);
  !         rputs("\n<HR>\n", r);
  !     }
  !     else {
  !         rputs("<UL>", r);
  !     }
  !         
  !     for(x=0;x<n;x++) {
  ! 	char *anchor = NULL, *t = NULL, *t2 = NULL;
  ! 	
  ! 	clear_pool (scratch);
  ! 	
  !         if((!strcmp(ar[x]->name,"../")) || (!strcmp(ar[x]->name,".."))) {
  !             char *t = make_full_path (scratch, name, "../");
  !             getparents(t);
  !             if(t[0] == '\0') t = "/";
  ! 	    anchor = pstrcat (scratch, "<A HREF=\"",
  ! 			      escape_html(scratch, os_escape_path(scratch, t, 0)),
  ! 			      "\">", NULL);
  ! 	    t2 = "Parent Directory</A>       ";
  !         }
  !         else {
  ! 	    t = ar[x]->name;
  ! 	    len = strlen(t);
  !             if(len > 23) {
  ! 		t2 = pstrdup(scratch, t);
  ! 		t2[21] = '.';
  ! 		t2[22] = '.';
  !                 t2[23] = '\0';
  ! 		t2 = escape_html(scratch, t2);
  ! 		t2 = pstrcat(scratch, t2, "</A>", NULL);
  !             } else 
  ! 	    {
  ! 		char buff[24]="                       ";
  ! 		t2 = escape_html(scratch, t);
  ! 		buff[23-len] = '\0';
  ! 		t2 = pstrcat(scratch, t2, "</A>", buff, NULL);
  ! 	    }
  ! 	    anchor = pstrcat (scratch, "<A HREF=\"",
  ! 			      escape_html(scratch, os_escape_path(scratch, t, 0)),
  ! 			      "\">", NULL);
  !         }
  ! 
  !         if(dir_opts & FANCY_INDEXING) {
  !             if(dir_opts & ICONS_ARE_LINKS)
  !                 rputs(anchor, r);
  !             if((ar[x]->icon) || d->default_icon) {
  !                 rvputs(r, "<IMG SRC=\"", 
  ! 		       escape_html(scratch, ar[x]->icon ?
  ! 				   ar[x]->icon : d->default_icon),
  ! 		       "\" ALT=\"[", (ar[x]->alt ? ar[x]->alt : "   "),
  ! 		       "]\"", NULL);
  ! 		if (d->icon_width && d->icon_height) {
  ! 		    rprintf
  ! 			(
  ! 			    r,
  ! 			    " HEIGHT=\"%d\" WIDTH=\"%d\"",
  ! 			    d->icon_height,
  ! 			    d->icon_width
  ! 			);
  ! 		}
  ! 		rputs (">", r);
  ! 	    }
  !             if(dir_opts & ICONS_ARE_LINKS) 
  !                 rputs("</A>", r);
  ! 
  !             rvputs(r," ", anchor, t2, NULL);
  !             if(!(dir_opts & SUPPRESS_LAST_MOD)) {
  !                 if(ar[x]->lm != -1) {
  ! 		    char time[MAX_STRING_LEN];
  !                     struct tm *ts = localtime(&ar[x]->lm);
  !                     strftime(time,MAX_STRING_LEN,"%d-%b-%y %H:%M  ",ts);
  ! 		    rputs(time, r);
  !                 }
  !                 else {
  !                     rputs("                 ", r);
  !                 }
  !             }
  !             if(!(dir_opts & SUPPRESS_SIZE)) {
  !                 send_size(ar[x]->size,r);
  !                 rputs("  ", r);
  !             }
  !             if(!(dir_opts & SUPPRESS_DESC)) {
  !                 if(ar[x]->desc) {
  !                     rputs(terminate_description(d, ar[x]->desc, dir_opts), r);
  !                 }
  !             }
  !         }
  !         else
  !             rvputs(r, "<LI> ", anchor," ", t2, NULL);
  !         rputc('\n', r);
  !     }
  !     if(dir_opts & FANCY_INDEXING) {
  !         rputs("</PRE>", r);
  !     }
  !     else {
  !         rputs("</UL>", r);
  !     }
  ! }
  ! 
  ! 
  ! int dsortf(struct ent **s1,struct ent **s2)
  ! {
  !     return(strcmp((*s1)->name,(*s2)->name));
  ! }
  ! 
  !     
  ! int index_directory(request_rec *r, dir_config_rec *dir_conf)
  ! {
  !     char *title_name = escape_html(r->pool, r->uri);
  !     char *title_endp;
  !     char *name = r->filename;
  !     
  !     DIR *d;
  !     struct DIR_TYPE *dstruct;
  !     int num_ent=0,x;
  !     struct ent *head,*p;
  !     struct ent **ar = NULL;
  !     char *tmp;
  !     int dir_opts = find_opts(dir_conf, r);
  ! 
  !     if(!(d=popendir(r->pool, name))) {
  !         log_reason ("Can't open directory for index", r->filename, r);
  !         return HTTP_FORBIDDEN;
  !     }
  ! 
  !     r->content_type = "text/html";
  !     
  !     send_http_header(r);
  ! 
  !     if (r->header_only) {
  ! 	pclosedir (r->pool, d);
  ! 	return 0;
  !     }
  !     hard_timeout("send directory", r);
  ! 
  !     /* Spew HTML preamble */
  !     
  !     title_endp = title_name + strlen(title_name) - 1;
  ! 
  !     while (title_endp > title_name && *title_endp == '/')
  ! 	*title_endp-- = '\0';
  !     
  !     rvputs
  ! 	(
  ! 	    r,
  ! 	    "<HTML><HEAD>\n<TITLE>Index of ",
  ! 	    title_name,
  ! 	    "</TITLE>\n</HEAD><BODY>\n",
  ! 	    NULL
  ! 	);
  ! 
  !     if((!(tmp = find_header(dir_conf,r))) || (!(insert_readme(name,tmp,0,r))))
  !         rvputs(r, "<H1>Index of ", title_name, "</H1>\n", NULL);
  ! 
  !     /* 
  !      * Since we don't know how many dir. entries there are, put them into a 
  !      * linked list and then arrayificate them so qsort can use them. 
  !      */
  !     head=NULL;
  !     while((dstruct=readdir(d))) {
  !         if((p = make_dir_entry(dstruct->d_name, dir_opts, dir_conf, r))) {
  !             p->next=head;
  !             head=p;
  !             num_ent++;
  !         }
  !     }
  !     if (num_ent > 0) {
  !         ar=(struct ent **) palloc(r->pool, num_ent*sizeof(struct ent *));
  !         p=head;
  !         x=0;
  !         while(p) {
  !             ar[x++]=p;
  !             p = p->next;
  !         }
  !     
  !         qsort((void *)ar,num_ent,sizeof(struct ent *),
  ! #ifdef ULTRIX_BRAIN_DEATH
  ! 	      (int (*))dsortf);
  ! #else
  ! 	      (int (*)(const void *,const void *))dsortf);
  ! #endif
  !     }
  !     output_directories(ar, num_ent, dir_conf, r, dir_opts);
  !     pclosedir(r->pool, d);
  ! 
  !     if (dir_opts & FANCY_INDEXING)
  !         if((tmp = find_readme(dir_conf, r)))
  !             insert_readme(name,tmp,1,r);
  !     else {
  !         rputs("</UL>", r);
  !     }
  ! 
  !     rputs ("</BODY></HTML>\n", r);
  ! 
  !     kill_timeout(r);
  !     return 0;
  ! }
  ! 
  ! /* The formal handler... */
  ! 
  ! int handle_dir (request_rec *r)
    {
        dir_config_rec *d =
  !       (dir_config_rec *)get_module_config (r->per_dir_config, &dir_module);
        const char *names_ptr = d->index_names ? d->index_names : DEFAULT_INDEX;
        int allow_opts = allow_options (r);
        int error_notfound = 0;
  --- 83,112 ----
    { NULL }
    };
    
  ! static void *create_dir_config (pool *p, char *dummy)
    {
        dir_config_rec *new =
            (dir_config_rec *) pcalloc (p, sizeof(dir_config_rec));
    
        new->index_names = NULL;
        return (void *)new;
    }
    
  ! static void *merge_dir_configs (pool *p, void *basev, void *addv)
    {
        dir_config_rec *new=(dir_config_rec*)pcalloc (p, sizeof(dir_config_rec));
        dir_config_rec *base = (dir_config_rec *)basev;
        dir_config_rec *add = (dir_config_rec *)addv;
    
        new->index_names = add->index_names? add->index_names: base->index_names;
        return new;
    }
    
  ! static int handle_dir (request_rec *r)
    {
        dir_config_rec *d =
  !       (dir_config_rec *)get_module_config (r->per_dir_config,
  !       &dir_module);
        const char *names_ptr = d->index_names ? d->index_names : DEFAULT_INDEX;
        int allow_opts = allow_options (r);
        int error_notfound = 0;
  ***************
  *** 917,923 ****
    	    destroy_sub_req(rr);
    	    return error_notfound;
    	}
  !             
    	/* If the request returned something other than 404 (or 200),
    	 * it means the module encountered some sort of problem. To be
    	 * secure, we should return the error, rather than create
  --- 164,170 ----
    	    destroy_sub_req(rr);
    	    return error_notfound;
    	}
  ! 
    	/* If the request returned something other than 404 (or 200),
    	 * it means the module encountered some sort of problem. To be
    	 * secure, we should return the error, rather than create
  ***************
  *** 938,955 ****
    
        if (r->method_number != M_GET) return NOT_IMPLEMENTED;
        
  !     /* OK, nothing easy.  Trot out the heavy artillery... */
    
  !     if (allow_opts & OPT_INDEXES) 
  !         return index_directory (r, d);
  !     else {
  !         log_reason ("Directory index forbidden by rule", r->filename, r);
  !         return HTTP_FORBIDDEN;
  !     }
    }
    
    
  ! handler_rec dir_handlers[] = {
    { DIR_MAGIC_TYPE, handle_dir },
    { NULL }
    };
  --- 185,197 ----
    
        if (r->method_number != M_GET) return NOT_IMPLEMENTED;
        
  !     /* nothing for us to do, pass on through */
    
  !     return DECLINED;
    }
    
    
  ! static handler_rec dir_handlers[] = {
    { DIR_MAGIC_TYPE, handle_dir },
    { NULL }
    };
  
  
  

Mime
View raw message