You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2003/01/06 16:20:33 UTC

cvs commit: httpd-2.0/modules/generators mod_autoindex.c

wrowe       2003/01/06 07:20:32

  Modified:    .        CHANGES
               modules/generators mod_autoindex.c
  Log:
    Bring forward the IndexOptions IgnoreCase option to mod_autoindex
    from Apache 1.3 for both 2.0 and 2.1 (since the patch/feature was
    previously accepted for 1.3, I'm committing without the usual vote
    specific to 2.0.)  Only small modification of David's patch to avoid
    future reformatting of the options list and better handle the strnatcmp
    side effects.
  
  PR: 14276
  Submitted by:	David Shane Holden <dp...@yahoo.com>
  
  Revision  Changes    Path
  1.1021    +11 -7     httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1020
  retrieving revision 1.1021
  diff -u -r1.1020 -r1.1021
  --- CHANGES	4 Jan 2003 23:19:38 -0000	1.1020
  +++ CHANGES	6 Jan 2003 15:20:31 -0000	1.1021
  @@ -18,13 +18,6 @@
     *) Allow 'make depend' to work with non-GCC compilers.
        [Justin Erenkrantz]
   
  -  *) Rename CacheMaxStreamingBuffer to MCacheMaxStreamingBuffer. Move
  -     implementation of MCacheMaxStreamingBuffer from mod_cache to
  -     mod_mem_cache. MCacheMaxStreamingBuffer now defaults to the
  -     lesser of 100,000 bytes or MCacheMaxCacheObjectSize. This should 
  -     eliminate the need for explicitly coding MCacheMaxStreamingBuffer
  -     in most configurations. [Bill Stoddard]
  -
     *) mod_cache: Fix PR 15113, a core dump in cache_in_filter when
        a redirect occurs. The code was passing a format string and
        integer to apr_pstrcat. Changed to apr_psprintf.
  @@ -65,6 +58,10 @@
   
   Changes with Apache 2.0.45
   
  +  *) mod_autoindex: Bring forward the IndexOptions IgnoreCase option
  +     from Apache 1.3.  PR 14276
  +     [David Shane Holden <dp...@yahoo.com>, William Rowe]
  +
     *) mod_mime: Workaround to prevent a segfault if r->filename=NULL
        [Brian Pane]
   
  @@ -79,6 +76,13 @@
        Jeff Trawick]
   
   Changes with Apache 2.0.44
  +
  +  *) Rename CacheMaxStreamingBuffer to MCacheMaxStreamingBuffer. Move
  +     implementation of MCacheMaxStreamingBuffer from mod_cache to
  +     mod_mem_cache. MCacheMaxStreamingBuffer now defaults to the
  +     lesser of 100,000 bytes or MCacheMaxCacheObjectSize. This should 
  +     eliminate the need for explicitly coding MCacheMaxStreamingBuffer
  +     in most configurations. [Bill Stoddard]
   
     *) Replace APU_HAS_LDAPSSL_CLIENT_INIT with APU_HAS_LDAP_NETSCAPE_SSL
        as set by apr-util in util_ldap.c. This should allow mod_ldap
  
  
  
  1.113     +51 -20    httpd-2.0/modules/generators/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_autoindex.c,v
  retrieving revision 1.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- mod_autoindex.c	21 Nov 2002 23:53:21 -0000	1.112
  +++ mod_autoindex.c	6 Jan 2003 15:20:32 -0000	1.113
  @@ -94,22 +94,23 @@
    * Handling configuration directives...
    */
   
  -#define NO_OPTIONS          0x0001  /* Indexing options */
  -#define ICONS_ARE_LINKS     0x0002
  -#define SCAN_HTML_TITLES    0x0004
  -#define SUPPRESS_ICON       0x0008
  -#define SUPPRESS_LAST_MOD   0x0010
  -#define SUPPRESS_SIZE       0x0020
  -#define SUPPRESS_DESC       0x0040
  -#define SUPPRESS_PREAMBLE   0x0080
  -#define SUPPRESS_COLSORT    0x0100
  -#define SUPPRESS_RULES      0x0200
  -#define FOLDERS_FIRST       0x0400
  -#define VERSION_SORT        0x0800
  -#define TRACK_MODIFIED      0x1000
  -#define FANCY_INDEXING      0x2000
  -#define TABLE_INDEXING      0x4000
  -#define IGNORE_CLIENT       0x8000
  +#define NO_OPTIONS          (1 <<  0)  /* Indexing options */
  +#define ICONS_ARE_LINKS     (1 <<  1)
  +#define SCAN_HTML_TITLES    (1 <<  2)
  +#define SUPPRESS_ICON       (1 <<  3)
  +#define SUPPRESS_LAST_MOD   (1 <<  4)
  +#define SUPPRESS_SIZE       (1 <<  5)
  +#define SUPPRESS_DESC       (1 <<  6)
  +#define SUPPRESS_PREAMBLE   (1 <<  7)
  +#define SUPPRESS_COLSORT    (1 <<  8)
  +#define SUPPRESS_RULES      (1 <<  9)
  +#define FOLDERS_FIRST       (1 << 10)
  +#define VERSION_SORT        (1 << 11)
  +#define TRACK_MODIFIED      (1 << 12)
  +#define FANCY_INDEXING      (1 << 13)
  +#define TABLE_INDEXING      (1 << 14)
  +#define IGNORE_CLIENT       (1 << 15)
  +#define IGNORE_CASE         (1 << 16)
   
   #define K_NOADJUST 0
   #define K_ADJUST 1
  @@ -374,6 +375,9 @@
           else if (!strcasecmp(w, "IconsAreLinks")) {
               option = ICONS_ARE_LINKS;
           }
  +        else if (!strcasecmp(w, "IgnoreCase")) {
  +            option = IGNORE_CASE;
  +        }
           else if (!strcasecmp(w, "IgnoreClient")) {
               option = IGNORE_CLIENT;
           }
  @@ -724,7 +728,7 @@
       apr_off_t size;
       apr_time_t lm;
       struct ent *next;
  -    int ascending, version_sort;
  +    int ascending, ignore_case, version_sort;
       char key;
       int isdir;
   };
  @@ -1345,6 +1349,7 @@
       p->key = apr_toupper(keyid);
       p->ascending = (apr_toupper(direction) == D_ASCENDING);
       p->version_sort = !!(autoindex_opts & VERSION_SORT);
  +    p->ignore_case = !!(autoindex_opts & IGNORE_CASE);
   
       if (autoindex_opts & (FANCY_INDEXING | TABLE_INDEXING)) {
           p->lm = rr->finfo.mtime;
  @@ -1897,12 +1902,38 @@
           }
           break;
       }
  +
  +    /* names may identical when treated case-insensitively,
  +     * so always fall back on strcmp() flavors to put entries
  +     * in deterministic order.  This means that 'ABC' and 'abc'
  +     * will always appear in the same order, rather than
  +     * variably between 'ABC abc' and 'abc ABC' order.
  +     */
  +
       if (c1->version_sort) {
  -        return apr_strnatcmp(c1->name, c2->name);
  +        if (c1->ignore_case) {
  +            result = apr_strnatcasecmp (c1->name, c2->name);
  +        }
  +        if (!result) {
  +            result = apr_strnatcmp(c1->name, c2->name);
  +        }
       }
  -    else {
  -        return strcmp(c1->name, c2->name);
  +
  +    /* The names may be identical in respects other other than
  +     * filename case when strnatcmp is used above, so fall back 
  +     * to strcmp on conflicts so that fn1.01.zzz and fn1.1.zzz 
  +     * are also sorted in a deterministic order.
  +     */
  +
  +    if (!result && c1->ignore_case) {
  +        result = strcasecmp (c1->name, c2->name);
       }
  +
  +    if (!result) {
  +        result = strcmp (c1->name, c2->name);
  +    }
  +
  +    return result;
   }