cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar99/12/01 12:34:18 Modified:htdocs/manual/mod mod_autoindex.html src CHANGES src/modules/standard mod_autoindex.c Log: Add a FoldersFirst keyword to the IndexOptions directive, which causes subdirectories to always appear first in FancyIndexed listings. Reviewed by: Ryan Bloom, Martin Kraemer, Jim Jagielski Revision ChangesPath 1.32 +24 -8 apache-1.3/htdocs/manual/mod/mod_autoindex.html Index: mod_autoindex.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_autoindex.html,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- mod_autoindex.html1999/05/13 18:25:45 1.31 +++ mod_autoindex.html1999/12/01 20:33:48 1.32 @@ -545,7 +545,8 @@ REL=Help STRONGCompatibility:/STRONG/A '+/-' syntax and merging of multiple SAMPIndexOptions/SAMP directives is only available with - Apache 1.3.3 and later + Apache 1.3.3 and later; the sampFoldersFirst/samp option is only + available with Apache 1.3.10 and later P The IndexOptions directive specifies the behavior of the directory indexing. @@ -564,6 +565,21 @@ is combined with any SAMPIndexOptions/SAMP directive already specified for the current scope./STRONG /BLOCKQUOTE +dta name=indexoptions:foldersfirstFoldersFirst + (iApache 1.3.10 and later/i)/a/dt +dd +If this option is enabled, subdirectories in a FancyIndexed listing +will ialways/i appear first, followed by normal files in the +directory. The listing is basically broken into two components, +the files and the subdirectories, and each is sorted separately and +then displayed subdirectories-first. For instance, if the sort order +is descending by name, and sampFoldersFirst/samp is enabled, +subdirectory sampZed/samp will be listed before subdirectory +sampBeta/samp, which will be listed before normal files +sampGamma/samp and sampAlpha/samp. +bThis option only has an effect if +a href=#indexoptions:fancyindexingsampFancyIndexing/samp/a +is also enabled./b/dd DTA NAME=indexoptions:iconheightIconHeight[=pixels] (EMApache 1.3 and later/EM)/A DD !--%plaintext lt;?INDEX {\tt IconHeight} index optiongt; -- @@ -648,14 +664,14 @@ The 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: -BLOCKQUOTECODE -lt;Directory /web/docsgt; BR -IndexOptions FancyIndexing BR -lt;/Directorygt;BR -lt;Directory /web/docs/specgt; BR -IndexOptions ScanHTMLTitles BR +BLOCKQUOTEpre +lt;Directory /web/docsgt; +IndexOptions FancyIndexing lt;/Directorygt; -/CODE/BLOCKQUOTE +lt;Directory /web/docs/specgt; +IndexOptions ScanHTMLTitles +lt;/Directorygt; +/pre/BLOCKQUOTE then only CODEScanHTMLTitles/CODE will be set for the /web/docs/spec directory. /P 1.1465+4 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1464 retrieving revision 1.1465 diff -u -r1.1464 -r1.1465 --- CHANGES 1999/12/01 20:24:50 1.1464 +++ CHANGES 1999/12/01 20:33:58 1.1465 @@ -1,5 +1,9 @@ Changes with Apache 1.3.10 + *) Add IndexOptions FoldersFirst to allow fancy-indexed directory + listings to have the subdirectories always listed at the top. + [Ken Coar] + *) BS2000: Use send() instead of write() in the core buff routines for better performance and fewer restrictions (max. transfer size) [Martin Kraemer] 1.111 +24 -0 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.110 retrieving revision 1.111 diff -u -r1.110 -r1.111 --- mod_autoindex.c 1999/06/05 15:48:12 1.110 +++ mod_autoindex.c 1999/12/01 20:34:10 1.111 @@ -95,6 +95,7 @@ #define SUPPRESS_PREAMBLE 64 #define SUPPRESS_COLSORT 128 #define NO_OPTIONS 256 +#define FOLDERS_FIRST 512 #define K_PAD 1 #define K_NOPAD 0 @@ -400,6 +401,9 @@ else if (!strcasecmp(w, SuppressColumnSorting)) { option = SUPPRESS_COLSORT; } +else if (!strcasecmp(w, FoldersFirst)) { +option = FOLDERS_FIRST; + } else if (!strcasecmp(w, None)) { if (action != '\0') { return Cannot combine '+' or '-' with 'None' keyword; @@ -681,6 +685,8 @@ time_t lm; struct ent *next; int ascending; +int isdir; +int checkdir; char key; }; @@ -1147,6
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar99/12/01 14:10:50 Modified:htdocs/manual/mod mod_autoindex.html src CHANGES src/modules/standard mod_autoindex.c Log: Add the long-awaited IndexOptions DescriptionWidth keyword. It was waiting for a way to avoid breaking HTML tags, but that's already been done as much as possible -- we can't do anything about breaking HTML elements without putting a full parser in. PR: 2324 Revision ChangesPath 1.33 +22 -1 apache-1.3/htdocs/manual/mod/mod_autoindex.html Index: mod_autoindex.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_autoindex.html,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- mod_autoindex.html1999/12/01 20:33:48 1.32 +++ mod_autoindex.html1999/12/01 22:10:32 1.33 @@ -215,6 +215,17 @@ CODEIndexOptionsnbsp;SuppressSize/CODE, and 19 bytes may be added if CODEIndexOptionsnbsp;SuppressLastModified/CODE is in effect. The widest this column can be is therefore 49 bytes. +blockquote +As of Apache 1.3.10, the +a href=#indexoptions:descriptionwidthDescriptionWidth/a +sampIndexOptions/samp keyword allows you to adjust this width +to any arbitrary size. +/blockquote +bCaution:/b Descriptive text defined with sampAddDescription/samp +may contain HTML markup, such as tags and character entities. If the +width of the description column should happen to truncate a tagged +element (such as cutting off the end of a bolded phrase), the results +may affect the rest of the directory listing. /P HR @@ -545,13 +556,23 @@ REL=Help STRONGCompatibility:/STRONG/A '+/-' syntax and merging of multiple SAMPIndexOptions/SAMP directives is only available with - Apache 1.3.3 and later; the sampFoldersFirst/samp option is only + Apache 1.3.3 and later; the sampFoldersFirst/samp and + sampDescriptionWidth/samp options are only available with Apache 1.3.10 and later P The IndexOptions directive specifies the behavior of the directory indexing. EMOption/EM can be one of DL +dta name=indexoptions:descriptionwidthDescriptionWidth=[emn/em | *] + (emApache 1.3.10 and later/em)/a +dd +The sampDescriptionWidth/samp keyword allows you to specify the +width of the description column in characters. If the keyword value +is 'samp*/samp', then the column is automatically sized to the +length of the longest filename in the display. +bSee the section on a href=#adddescriptionsampAddDescription/samp/a +for dangers inherent in truncating descriptions./b/dd DTA NAME=indexoptions:fancyindexingFancyIndexing/A DD!--%plaintext lt;?INDEX {\tt FancyIndexing} index optiongt; -- This turns on fancy indexing of directories. 1.1468+5 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1467 retrieving revision 1.1468 diff -u -r1.1467 -r1.1468 --- CHANGES 1999/12/01 20:54:55 1.1467 +++ CHANGES 1999/12/01 22:10:39 1.1468 @@ -1,5 +1,10 @@ Changes with Apache 1.3.10 + *) Add IndexOptions DescriptionWidth so that the width of the + description field in fancy-indexed directory listings can + be specified. + [Ken Coar] PR#2324, plus lots that are closed unsatisfied + *) EBCDIC: Escaped characters were encoding the ebcdic representation of the special characters, not the latin1 representation. This would result in invalid URI's for, e.g., filenames (with special chars) 1.112 +80 -19apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.111 retrieving revision 1.112 diff -u -r1.111 -r1.112 --- mod_autoindex.c 1999/12/01 20:34:10 1.111 +++ mod_autoindex.c 1999/12/01 22:10:45 1.112 @@ -125,6 +125,7 @@ * Other default dimensions. */ #define DEFAULT_NAME_WIDTH 23 +#define DEFAULT_DESC_WIDTH 23 struct item { char *type; @@ -141,13 +142,14 @@ } ai_desc_t; typedef struct autoindex_config_struct { - char *default_icon; int opts; int incremented_opts; int decremented_opts; int name_width; int name_adjust; +int desc_width; +int desc_adjust; int icon_width; int icon_height; char *default_order; @@ -465,6 +467,31 @@ d_cfg-name_adjust = K_NOADJUST; } } + else if (!strcasecmp(w, DescriptionWidth)) { + if (action != '-') { + return DescriptionWidth with no value may
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar99/06/04 11:30:37 Modified:.STATUS src CHANGES src/include ap_mmn.h httpd.h src/main util.c src/modules/standard mod_autoindex.c Log: mod_autoindex was only checking for exact matches of text/html for ScanHTMLTitles, which meant that text/html;charset=foo documents wouldn't be scanned. As a side effect of this patch, add ap_field_noparam(), which returns the unparameterised value for any HTTP field that can use '*( ; parameter)'. PR: 4524 Revision ChangesPath 1.701 +1 -7 apache-1.3/STATUS Index: STATUS === RCS file: /home/cvs/apache-1.3/STATUS,v retrieving revision 1.700 retrieving revision 1.701 diff -u -r1.700 -r1.701 --- STATUS1999/06/04 17:40:04 1.700 +++ STATUS1999/06/04 18:30:07 1.701 @@ -1,5 +1,5 @@ 1.3 STATUS: - Last modified at [$Date: 1999/06/04 17:40:04 $] + Last modified at [$Date: 1999/06/04 18:30:07 $] Release: @@ -105,12 +105,6 @@ * Tony Finch's patch to support mass virtual hosting Message-ID: [EMAIL PROTECTED] Status: Dean +1 - -* Ken's patch to work around exact matches of content-types (PR#4524) - (Long-term fix should involve breaking this [and other fields with - parameters] into pieces.) - Message-ID: [EMAIL PROTECTED] - Status: Ken +1 * Brian Havard's patch to remove dependency of mod_auth_dbm on mod_auth. (PR#2598) 1.1370+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1369 retrieving revision 1.1370 diff -u -r1.1369 -r1.1370 --- CHANGES 1999/06/04 17:15:49 1.1369 +++ CHANGES 1999/06/04 18:30:16 1.1370 @@ -1,5 +1,8 @@ Changes with Apache 1.3.7 + *) Fix mod_autoindex's handling of ScanHTMLTitles when file + content-types are text/html;parameters. PR#4524 [Ken Coar] + *) Remove mxb support from mod_negotiation -- it was a draft feature never accepted into any standard, and it opens up certain DoS attacks. [Koen Holtman [EMAIL PROTECTED]] 1.37 +2 -1 apache-1.3/src/include/ap_mmn.h Index: ap_mmn.h === RCS file: /home/cvs/apache-1.3/src/include/ap_mmn.h,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- ap_mmn.h 1999/05/21 15:38:49 1.36 +++ ap_mmn.h 1999/06/04 18:30:22 1.37 @@ -218,6 +218,7 @@ * 19990320.2 - add cmd_parms.context, ap_set_config_vectors, *export ap_add_file_conf * 19990320.3 - add ap_regexec() + * 19990604.4 - add ap_field_noparam() */ #define MODULE_MAGIC_COOKIE 0x41503133UL /* AP13 */ @@ -225,7 +226,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 19990320 #endif -#define MODULE_MAGIC_NUMBER_MINOR 3 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 4 /* 0...n */ #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR/* backward compat */ /* Useful for testing for features. */ 1.280 +1 -0 apache-1.3/src/include/httpd.h Index: httpd.h === RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v retrieving revision 1.279 retrieving revision 1.280 diff -u -r1.279 -r1.280 --- httpd.h 1999/06/02 07:08:18 1.279 +++ httpd.h 1999/06/04 18:30:24 1.280 @@ -920,6 +920,7 @@ API_EXPORT(struct tm *) ap_get_gmtoff(int *tz); API_EXPORT(char *) ap_get_time(void); +API_EXPORT(char *) ap_field_noparam(pool *p, const char *intype); API_EXPORT(char *) ap_ht_time(pool *p, time_t t, const char *fmt, int gmt); API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t t); 1.163 +17 -0 apache-1.3/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.162 retrieving revision 1.163 diff -u -r1.162 -r1.163 --- util.c1999/05/25 15:24:01 1.162 +++ util.c1999/06/04 18:30:31 1.163 @@ -119,6 +119,23 @@ return (time_string); } +/* + * Examine a field value (such as a media-/content-type) string and return + * it sans any parameters; e.g., strip off any ';charset=foo' and the like. + */ +API_EXPORT(char *) ap_field_noparam(pool *p, const char *intype) +{ +const char *semi; + +semi = strchr(intype, ';'); +if (semi != NULL) { + while ((semi intype)
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c mod_include.c
coar99/05/13 11:25:59 Modified:htdocs/manual/mod mod_autoindex.html src CHANGES src/modules/standard mod_autoindex.c mod_include.c Log: Someone finally stood up and made the ReadmeName and HeaderName features use subrequests. Not only that, but they can be parsed for SSIs too! PR: 1574, 3026, 3529, 3569, 4256 Submitted by: Raymond S Brand [EMAIL PROTECTED] Reviewed by: Ken Coar Revision ChangesPath 1.31 +57 -17apache-1.3/htdocs/manual/mod/mod_autoindex.html Index: mod_autoindex.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_autoindex.html,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- mod_autoindex.html1999/01/04 14:35:53 1.30 +++ mod_autoindex.html1999/05/13 18:25:45 1.31 @@ -426,20 +426,53 @@ A HREF=directive-dict.html#Module REL=Help -STRONGModule:/STRONG/A mod_autoindexP +STRONGModule:/STRONG/A mod_autoindex + BR + A + HREF=directive-dict.html#Compatibility + REL=Help + STRONGCompatibility:/STRONG/A some features only available after + 1.3.6; see text +P The HeaderName directive sets the name of the file that will be inserted at the top of the index listing. EMFilename/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 EMfilename/EMCODE.html/CODE -as an HTML document, otherwise it will include EMfilename/EM as plain -text. Example: +to include. +/P +BLOCKQUOTESTRONGApache 1.3.6 and earlier:/STRONG +The module first attempts to include EMfilename/EMCODE.html/CODE +as an HTML document, otherwise it will try to include EMfilename/EM as +plain text. EMFilename/EM is treated as a filesystem path relative +to the directory being indexed. In no case is SSI processing done. +Example: BLOCKQUOTECODEHeaderName 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. - -PSee also A HREF=#readmenameReadmeName/A.PHR +/BLOCKQUOTE +BLOCKQUOTESTRONGApache versions after 1.3.6:/STRONG +EMFilename/EM is treated as a URI path relative to the one used +to access the directory being indexed, and must resolve to a document +with a major content type of SAMPtext/SAMP (EMe.g./EM, +SAMPtext/html/SAMP, SAMPtext/plain/SAMP, EMetc./EM). +This means that EMfilename/EM may refer to a CGI script if the +script's actual file type (as opposed to its output) is marked as +SAMPtext/html/SAMP such as with a directive like: +PRE +AddType text/html .cgi +/PRE +A HREF=../content-negotiation.htmlContent negotiation/A +will be performed if the SAMPMultiViews/SAMP +A HREF=core.html#optionsoption/A is enabled. +If EMfilename/EM resolves to a static SAMPtext/html/SAMP document +(not a CGI script) and the +SAMPIncludes/SAMP A HREF=core.html#optionsoption/A is enabled, +the file will be processed for server-side includes (see the +A HREF=mod_include.htmlSAMPmod_include/SAMP/A documentation). +/BLOCKQUOTE +P +See also A HREF=#readmenameReadmeName/A. +PHR H2A NAME=indexignoreIndexIgnore/A/H2 !--%plaintext lt;?INDEX {\tt IndexIgnore} directivegt; -- @@ -753,19 +786,26 @@ A HREF=directive-dict.html#Module REL=Help -STRONGModule:/STRONG/A mod_autoindexP +STRONGModule:/STRONG/A mod_autoindex + BR + A + HREF=directive-dict.html#Compatibility + REL=Help + STRONGCompatibility:/STRONG/A some features only available after + 1.3.6; see text +P The ReadmeName directive sets the name of the file that will be appended to the end of the index listing. EMFilename/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 EMfilename/EMCODE.html/CODE -as an HTML document, otherwise it will include EMfilename/EM as plain -text. Example: -BLOCKQUOTECODEReadmeName 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. - +to include, and is taken to be relative to the location being indexed. +/P +BLOCKQUOTE +STRONGThe EMfilename/EM argument is treated as a stub filename +in Apache 1.3.6 and earlier, and as a relative URI in later versions. +Details of how it is handled may be found under the description of +the A HREF=#headernameHeaderName/A directive, which uses the +same mechanism and changed at the same time as ReadmeName./STRONG
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar99/05/03 12:05:19 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: Rip loose another piece of mod_autoindex's configuration hairball, breaking the description handling free from the path/filename paradigm used for most of the stuff. Make AddDescription work as documented. PR: 1898, 3072 Revision ChangesPath 1.1342+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1341 retrieving revision 1.1342 diff -u -r1.1341 -r1.1342 --- CHANGES 1999/05/03 15:09:04 1.1341 +++ CHANGES 1999/05/03 19:05:11 1.1342 @@ -1,5 +1,8 @@ Changes with Apache 1.3.7 + *) Modify mod_autoindex's handling of AddDescription so that the + behaviour matches the documentation. [Ken Coar] PR#1898, 3072. + *) Add functionality to the install-bindist.sh script created by binbuild.sh to use tar when copying distribution files to the serverroot. This allows upgrading an existing installation 1.105 +76 -6 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.104 retrieving revision 1.105 diff -u -r1.104 -r1.105 --- mod_autoindex.c 1999/05/01 17:13:04 1.104 +++ mod_autoindex.c 1999/05/03 19:05:17 1.105 @@ -72,6 +72,7 @@ #include http_log.h #include http_main.h #include util_script.h +#include fnmatch.h module MODULE_VAR_EXPORT autoindex_module; @@ -131,6 +132,12 @@ char *data; }; +typedef struct ai_desc_t { +char *pattern; +char *description; +int full_path; +} ai_desc_t; + typedef struct autoindex_config_struct { char *default_icon; @@ -143,8 +150,12 @@ int icon_height; char *default_order; -array_header *icon_list, *alt_list, *desc_list, *ign_list; -array_header *hdr_list, *rdme_list; +array_header *icon_list; +array_header *alt_list; +array_header *desc_list; +array_header *ign_list; +array_header *hdr_list; +array_header *rdme_list; } autoindex_config_rec; @@ -257,10 +268,31 @@ return NULL; } +/* + * Add description text for a filename pattern. Prefix the pattern + * with a wildcard unless it begins with '/' signifying an absolute + * path. If the pattern contains a '/' anywhere, add a slash to the + * prefix so that bar/bletch won't be matched by foobar/bletch, + * and make a note that there's a delimiter; the matching routine + * simplifies to just the actual filename whenever it can. This allows + * definitions in parent directories to be made for files in subordinate + * ones using relative paths. Always postfix with a wildard so that + * partial or leading names will match. + */ 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); +autoindex_config_rec *dcfg = (autoindex_config_rec *) d; +ai_desc_t *desc_entry; +char *prefix = ; + +desc_entry = (ai_desc_t *) ap_push_array(dcfg-desc_list); +desc_entry-full_path = (strchr(to, '/') == NULL) ? 0 : 1; +if (*to != '/') { + prefix = desc_entry-full_path ? */ : *; +} +desc_entry-pattern = ap_pstrcat(dcfg-desc_list-pool, + prefix, to, *, NULL); +desc_entry-description = ap_pstrdup(dcfg-desc_list-pool, desc); return NULL; } @@ -530,7 +562,7 @@ new-name_adjust = K_UNSET; new-icon_list = ap_make_array(p, 4, sizeof(struct item)); new-alt_list = ap_make_array(p, 4, sizeof(struct item)); -new-desc_list = ap_make_array(p, 4, sizeof(struct item)); +new-desc_list = ap_make_array(p, 4, sizeof(ai_desc_t)); new-ign_list = ap_make_array(p, 4, sizeof(struct item)); new-hdr_list = ap_make_array(p, 4, sizeof(struct item)); new-rdme_list = ap_make_array(p, 4, sizeof(struct item)); @@ -688,7 +720,6 @@ #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) @@ -705,6 +736,45 @@ r.content_type = r.content_encoding = NULL; return find_item(r, d-icon_list, 1); +} + +/* + * Look through the list of pattern/description pairs and return the first one + * if any) that matches the filename in the request. If multiple patterns + * match, only
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar99/05/03 13:48:44 Modified:src/modules/standard mod_autoindex.c Log: Improve the filename pattern matching so that we only do wildcard processing when we must, and simple scanning when we can. Revision ChangesPath 1.106 +49 -13apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.105 retrieving revision 1.106 diff -u -r1.105 -r1.106 --- mod_autoindex.c 1999/05/03 19:05:17 1.105 +++ mod_autoindex.c 1999/05/03 20:48:43 1.106 @@ -136,6 +136,7 @@ char *pattern; char *description; int full_path; +int wildcards; } ai_desc_t; typedef struct autoindex_config_struct { @@ -269,16 +270,27 @@ } /* - * Add description text for a filename pattern. Prefix the pattern - * with a wildcard unless it begins with '/' signifying an absolute - * path. If the pattern contains a '/' anywhere, add a slash to the - * prefix so that bar/bletch won't be matched by foobar/bletch, - * and make a note that there's a delimiter; the matching routine - * simplifies to just the actual filename whenever it can. This allows - * definitions in parent directories to be made for files in subordinate - * ones using relative paths. Always postfix with a wildard so that - * partial or leading names will match. + * Add description text for a filename pattern. If the pattern has + * wildcards already (or we need to add them), add leading and + * trailing wildcards to it to ensure substring processing. If the + * pattern contains a '/' anywhere, force wildcard matching mode, + * add a slash to the prefix so that bar/bletch won't be matched + * by foobar/bletch, and make a note that there's a delimiter; + * the matching routine simplifies to just the actual filename + * whenever it can. This allows definitions in parent directories + * to be made for files in subordinate ones using relative paths. */ + +/* + * Absent a strcasestr() function, we have to force wildcards on + * systems for which AAA and aaa mean the same file. + */ +#ifdef CASE_BLIND_FILESYSTEM +#define WILDCARDS_REQUIRED 1 +#else +#define WILDCARDS_REQUIRED 0 +#endif + static const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to) { autoindex_config_rec *dcfg = (autoindex_config_rec *) d; @@ -287,11 +299,17 @@ desc_entry = (ai_desc_t *) ap_push_array(dcfg-desc_list); desc_entry-full_path = (strchr(to, '/') == NULL) ? 0 : 1; -if (*to != '/') { +desc_entry-wildcards = (WILDCARDS_REQUIRED + || desc_entry-full_path + || ap_is_fnmatch(to)); +if (desc_entry-wildcards) { prefix = desc_entry-full_path ? */ : *; + desc_entry-pattern = ap_pstrcat(dcfg-desc_list-pool, + prefix, to, *, NULL); } -desc_entry-pattern = ap_pstrcat(dcfg-desc_list-pool, - prefix, to, *, NULL); +else { + desc_entry-pattern = ap_pstrdup(dcfg-desc_list-pool, to); +} desc_entry-description = ap_pstrdup(dcfg-desc_list-pool, desc); return NULL; } @@ -745,6 +763,13 @@ * same as the order in which directives were processed, earlier matching * directives will dominate. */ + +#ifdef CASE_BLIND_FILESYSTEM +#define MATCH_FLAGS FNM_CASE_BLIND +#else +#define MATCH_FLAGS 0 +#endif + static char *find_desc(autoindex_config_rec *dcfg, request_rec *r) { int i; @@ -765,12 +790,23 @@ } for (i = 0; i dcfg-desc_list-nelts; ++i) { ai_desc_t *tuple = list[i]; + int found; /* * Only use the full-path filename if the pattern contains '/'s. */ filename = (tuple-full_path) ? filename_full : filename_only; - if (ap_fnmatch(tuple-pattern, filename, 0) == 0) { + /* + * Make the comparison using the cheapest method; only do + * wildcard checking if we must. + */ + if (tuple-wildcards) { + found = (ap_fnmatch(tuple-pattern, filename, MATCH_FLAGS) == 0); + } + else { + found = (strstr(filename, tuple-pattern) != NULL); + } + if (found) { return tuple-description; } }
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
dgaudet 99/05/01 10:13:05 Modified:src/modules/standard mod_autoindex.c Log: fix a slight problem with my recent fix to mod_autoindex Submitted by: Raymond S Brand [EMAIL PROTECTED] Revision ChangesPath 1.104 +2 -2 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.103 retrieving revision 1.104 diff -u -r1.103 -r1.104 --- mod_autoindex.c 1999/04/21 02:00:55 1.103 +++ mod_autoindex.c 1999/05/01 17:13:04 1.104 @@ -1167,8 +1167,8 @@ nwidth = name_width; } ap_rvputs(r, A HREF=\, anchor, \, - ap_escape_html(scratch, t2), pad_scratch + nwidth, - /A, NULL); + ap_escape_html(scratch, t2), /A, pad_scratch + nwidth, + NULL); /* * The blank before the storm.. er, before the next field. */
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
dgaudet 99/04/20 19:00:57 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: we don't need padding when we're not doing fancyindexing PR: 3770 Submitted by: [EMAIL PROTECTED] Revision ChangesPath 1.1318+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1317 retrieving revision 1.1318 diff -u -r1.1317 -r1.1318 --- CHANGES 1999/04/21 01:29:17 1.1317 +++ CHANGES 1999/04/21 02:00:48 1.1318 @@ -1,5 +1,8 @@ Changes with Apache 1.3.7 + *) IndexOptions None generated extra spaces at the end of each + line. [EMAIL PROTECTED] PR#3770 + *) The 100 Continue response wasn't being sent after internal redirects. [Jose KAHAN [EMAIL PROTECTED]] PR#3910, 3806, 3575 1.103 +1 -1 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.102 retrieving revision 1.103 diff -u -r1.102 -r1.103 --- mod_autoindex.c 1999/04/20 21:53:25 1.102 +++ mod_autoindex.c 1999/04/21 02:00:55 1.103 @@ -1198,7 +1198,7 @@ } else { ap_rvputs(r, LIA HREF=\, anchor, \ , t2, - /A, pad_scratch + strlen(t2), NULL); + /A, NULL); } ap_rputc('\n', r); }
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar99/01/04 06:35:56 Modified:.STATUS htdocs/manual/mod mod_autoindex.html src CHANGES src/modules/standard mod_autoindex.c Log: Allow fancyindexed directories to be presorted in some other way than by name. PR: 1699 Submitted by: Ken Coar Reviewed by: Martin Kraemer Revision ChangesPath 1.587 +1 -7 apache-1.3/STATUS Index: STATUS === RCS file: /home/cvs/apache-1.3/STATUS,v retrieving revision 1.586 retrieving revision 1.587 diff -u -r1.586 -r1.587 --- STATUS1999/01/03 13:46:16 1.586 +++ STATUS1999/01/04 14:35:52 1.587 @@ -1,5 +1,5 @@ 1.3 STATUS: - Last modified at [$Date: 1999/01/03 13:46:16 $] + Last modified at [$Date: 1999/01/04 14:35:52 $] Release: @@ -93,12 +93,6 @@ vhost-xxx.html document out of it. -- rse Available Patches: - -* Ken's default sort order for autoindexed listings - First pass for concept; maybe directive should be renamed or - syntax changed? - Message-ID: [EMAIL PROTECTED] - Status: Ken +1 (concept), Martin +1 (concept) * Lars' 'binbuild' patch Message-ID: [EMAIL PROTECTED] 1.30 +61 -0 apache-1.3/htdocs/manual/mod/mod_autoindex.html Index: mod_autoindex.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_autoindex.html,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- mod_autoindex.html1998/10/22 17:43:20 1.29 +++ mod_autoindex.html1999/01/04 14:35:53 1.30 @@ -74,6 +74,7 @@ LIA HREF=#headernameHeaderName/A LIA HREF=#indexignoreIndexIgnore/A LIA HREF=#indexoptionsIndexOptions/A +LIA HREF=#indexorderdefaultIndexOrderDefault/A LIA HREF=#readmenameReadmeName/A /MENU HR @@ -668,6 +669,66 @@ /P /DD /DL + +HR + +H2A NAME=indexorderdefaultIndexOrderDefault/A/H2 +!--%plaintext lt;?INDEX {\tt IndexOrderDefault} directivegt; -- +A + HREF=directive-dict.html#Syntax + REL=Help +STRONGSyntax:/STRONG/A IndexOrderDefault +EMAscending|Descending/EM EMName|Date|Size|Description/EM +BR +A + HREF=directive-dict.html#Context + REL=Help +STRONGContext:/STRONG/A server config, virtual host, directory, +.htaccess +BR +A + HREF=directive-dict.html#Override + REL=Help +STRONGOverride:/STRONG/A Indexes +BR +A + HREF=directive-dict.html#Status + REL=Help +STRONGStatus:/STRONG/A Base +BR +A + HREF=directive-dict.html#Module + REL=Help +STRONGModule:/STRONG/A mod_autoindex +BR +A + HREF=directive-dict.html#Compatibility + REL=Help +STRONGCompatibility:/STRONG/A IndexOrderDefault is only available in +Apache 1.3.4 and later. + +P +The SAMPIndexOrderDefault/SAMP directive is used in combination with +the A HREF=#indexoptions:fancyindexingSAMPFancyIndexing/SAMP/A +index option. By default, fancyindexed directory listings are displayed in ascending order by filename; the SAMPIndexOrderDefault/SAMP allows +you to change this initial display order. +/P +P +SAMPIndexOrderDefault/SAMP takes two arguments. The first must be either +SAMPAscending/SAMP or SAMPDescending/SAMP, indicating the direction +of the sort. The second argument must be one of the keywords +SAMPName/SAMP, SAMPDate/SAMP, SAMPSize/SAMP, or +SAMPDescription/SAMP, and identifies the primary key. The secondary +key is EMalways/EM the ascending filename. +/P +P +You can force a directory listing to only be displayed in a particular +order by combining this directive with the +A HREF=#indexoptions:suppresscolumnsorting +SAMPSuppressColumnSorting/SAMP/A index option; this will prevent +the client from requesting the directory listing in a different order. +/P + HR H2A NAME=readmenameReadmeName/A/H2 1.1200+5 -1 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1199 retrieving revision 1.1200 diff -u -r1.1199 -r1.1200 --- CHANGES 1999/01/03 16:45:23 1.1199 +++ CHANGES 1999/01/04 14:35:54 1.1200 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) Added IndexOrderDefault directive to supply a default sort order + for FancyIndexed directory listings. [Ken Coar] PR#1699 + *) Change the ap_assert macro to a variant that works on all platforms. [Richard Prinz [EMAIL PROTECTED]] PR#2575 @@ -19,7 +22,8 @@ *) Make top-level Makefile aware of a parallel build procedures (make -j) by making sure the src/support/ tools are _forced_ to be build last (they - depend on other
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar99/01/04 11:49:46 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: Fix mod_autoindex's handling of SuppressColumnSorting; the display order could be manually overridden by putting the appropriate query string into the URL (one of the strings the column-header anchors used). Revision ChangesPath 1.1201+6 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1200 retrieving revision 1.1201 diff -u -r1.1200 -r1.1201 --- CHANGES 1999/01/04 14:35:54 1.1200 +++ CHANGES 1999/01/04 19:49:36 1.1201 @@ -1,5 +1,11 @@ Changes with Apache 1.3.4 + *) IndexOptions SuppressColumnSorting only turned off making + the column headers anchors; you could still change the display + order by manually adding a '?N=A' or similar query string to the + URL. Now SuppressColumnSorting locks in the sort order so + it can't be overridden this way. [Ken Coar] + *) Added IndexOrderDefault directive to supply a default sort order for FancyIndexed directory listings. [Ken Coar] PR#1699 1.101 +20 -22apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.100 retrieving revision 1.101 diff -u -r1.100 -r1.101 --- mod_autoindex.c 1999/01/04 14:35:55 1.100 +++ mod_autoindex.c 1999/01/04 19:49:41 1.101 @@ -1365,35 +1365,33 @@ /* * Figure out what sort of indexing (if any) we're supposed to use. + * + * If no QUERY_STRING was specified or column sorting has been + * explicitly disabled, we use the default specified by the + * IndexOrderDefault directive (if there is one); otherwise, + * we fall back to ascending by name. */ -if (autoindex_opts SUPPRESS_COLSORT) { +qstring = r-args; +if ((autoindex_opts SUPPRESS_COLSORT) + || ((qstring == NULL) || (*qstring == '\0'))) { + qstring = autoindex_conf-default_order; +} +/* + * If there is no specific ordering defined for this directory, + * default to ascending by filename. + */ +if ((qstring == NULL) || (*qstring == '\0')) { keyid = K_NAME; direction = D_ASCENDING; } else { - qstring = r-args; - - /* - * If no QUERY_STRING was specified, we use the default specified - * by the IndexOrderDefault directive (if there is one); otherwise, - * we fall back to ascending by name. - */ - if ((qstring == NULL) || (*qstring == '\0')) { - qstring = autoindex_conf-default_order; + keyid = *qstring; + ap_getword(r-pool, qstring, '='); + if (qstring != '\0') { + direction = *qstring; } - if ((qstring == NULL) || (*qstring == '\0')) { - keyid = K_NAME; - direction = D_ASCENDING; - } else { - keyid = *qstring; - ap_getword(r-pool, qstring, '='); - if (qstring != '\0') { - direction = *qstring; - } - else { - direction = D_ASCENDING; - } + direction = D_ASCENDING; } }
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
martin 98/10/28 11:34:00 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: For files where the last modified time stamp was unavailable (e.g., broken symlinks), an empty string was printed which was 2 bytes short. The size and description columns were therefore not aligned correctly. (This is a remainder of the %y to %Y fix: the two missing spaces are for the century) Revision ChangesPath 1.1128+5 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1127 retrieving revision 1.1128 diff -u -r1.1127 -r1.1128 --- CHANGES 1998/10/28 19:26:29 1.1127 +++ CHANGES 1998/10/28 19:33:52 1.1128 @@ -1,5 +1,10 @@ Changes with Apache 1.3.4 + *) Fix in mod_autoindex: for files where the last modified time stamp was + unavailable, an empty string was printed which was 2 bytes short. + The size and description columns were therefore not aligned correctly. + [Martin Kraemer] (no PR#) + *) Update BS2000 OS code to work with recent versions. Starting with release A17, the child fork() must be replaced by a _rfork(). (BS2000 only) [Martin Kraemer] 1.98 +2 -1 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.97 retrieving revision 1.98 diff -u -r1.97 -r1.98 --- mod_autoindex.c 1998/10/17 14:17:10 1.97 +++ mod_autoindex.c 1998/10/28 19:33:57 1.98 @@ -1176,7 +1176,8 @@ ap_rputs(time_str, r); } else { - ap_rputs( , r); + /*Length=22-Feb-1998 23:42 (see 4 lines above) */ + ap_rputs( , r); } } if (!(autoindex_opts SUPPRESS_SIZE)) {
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar98/10/17 07:17:11 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: IndexOptions NameWidth was not getting inherited properly by directories that had mod_autoindex directives in the .htaccess but no actual IndexOptions line. Also, NameWidth, IconHeight, and IconWidth couldn't be incrementally enabled with '+'. Revision ChangesPath 1.1110+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1109 retrieving revision 1.1110 diff -u -r1.1109 -r1.1110 --- CHANGES 1998/10/16 07:04:41 1.1109 +++ CHANGES 1998/10/17 14:17:08 1.1110 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) Fix inheritance of IndexOptions NameWidth and remove unintended + restriction on +NameWidth, +IconHeight, and +IconWidth. [Ken Coar] + *) Fix per-directory config merging for cases in which a 500 error is encountered in an .htaccess file somewhere down the tree. [Ken Coar] PR#2409 1.97 +28 -12apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.96 retrieving revision 1.97 diff -u -r1.96 -r1.97 --- mod_autoindex.c 1998/10/04 06:13:18 1.96 +++ mod_autoindex.c 1998/10/17 14:17:10 1.97 @@ -98,6 +98,10 @@ #define K_PAD 1 #define K_NOPAD 0 +#define K_NOADJUST 0 +#define K_ADJUST 1 +#define K_UNSET 2 + /* * Define keys for sorting. */ @@ -368,8 +372,8 @@ } } else if (!strncasecmp(w, IconWidth=, 10)) { - if (action != '\0') { - return Cannot combine '+' or '-' with IconWidth=n; + if (action == '-') { + return Cannot combine '-' with IconWidth=n; } d_cfg-icon_width = atoi(w[10]); } @@ -382,8 +386,8 @@ } } else if (!strncasecmp(w, IconHeight=, 11)) { - if (action != '\0') { - return Cannot combine '+' or '-' with IconHeight=n; + if (action == '-') { + return Cannot combine '-' with IconHeight=n; } d_cfg-icon_height = atoi(w[11]); } @@ -393,14 +397,14 @@ '-NameWidth'; } d_cfg-name_width = DEFAULT_NAME_WIDTH; - d_cfg-name_adjust = 0; + d_cfg-name_adjust = K_NOADJUST; } else if (!strncasecmp(w, NameWidth=, 10)) { - if (action != '\0') { - return Cannot combine '+' or '-' with NameWidth=n; + if (action == '-') { + return Cannot combine '-' with NameWidth=n; } if (w[10] == '*') { - d_cfg-name_adjust = 1; + d_cfg-name_adjust = K_ADJUST; } else { int width = atoi(w[10]); @@ -409,6 +413,7 @@ return NameWidth value must be greater than 1; } d_cfg-name_width = width; + d_cfg-name_adjust = K_NOADJUST; } } else { @@ -477,7 +482,7 @@ new-icon_width = 0; new-icon_height = 0; new-name_width = DEFAULT_NAME_WIDTH; -new-name_adjust = 0; +new-name_adjust = K_UNSET; new-icon_list = ap_make_array(p, 4, sizeof(struct item)); new-alt_list = ap_make_array(p, 4, sizeof(struct item)); new-desc_list = ap_make_array(p, 4, sizeof(struct item)); @@ -550,9 +555,20 @@ */ new-opts |= new-incremented_opts; new-opts = ~new-decremented_opts; +} +/* + * Inherit the NameWidth settings if there aren't any specific to + * the new location; otherwise we'll end up using the defaults set in the + * config-rec creation routine. + */ +if (add-name_adjust == K_UNSET) { + new-name_width = base-name_width; + new-name_adjust = base-name_adjust; +} +else { + new-name_width = add-name_width; + new-name_adjust = add-name_adjust; } -new-name_width = add-name_width; -new-name_adjust = add-name_adjust; return new; } @@ -1030,7 +1046,7 @@ } name_width = d-name_width; -if (d-name_adjust) { +if (d-name_adjust == K_ADJUST) { for (x = 0; x n; x++) { int t = strlen(ar[x]-name); if (t name_width) {
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
marc98/10/03 23:13:19 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: Fix mod_autoindex bug where directories got a size of 0k instead of -. This was introduced by a bogus cleanup in rev 1.31; -1 was changed to 0 to avoid storing -1 in a size_t, when the correct fix is to change the size_t to an off_t. Submitter's patch modified for correctness. PR: 3130 Submitted by: Martin Plechsmid [EMAIL PROTECTED] Revision ChangesPath 1.1099+4 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1098 retrieving revision 1.1099 diff -u -r1.1098 -r1.1099 --- CHANGES 1998/10/03 19:28:16 1.1098 +++ CHANGES 1998/10/04 06:13:16 1.1099 @@ -1,5 +1,9 @@ Changes with Apache 1.3.3 + *) Fix mod_autoindex bug where directories got a size of 0k instead + of -. [Martin Plechsmid [EMAIL PROTECTED], Marc Slemko] + PR#3130 + *) PORT: DRS 6000 machine. [Paul Debleecker [EMAIL PROTECTED]] *) Add the server signature text (from the core ServerSignature directive) 1.96 +3 -3 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.95 retrieving revision 1.96 diff -u -r1.95 -r1.96 --- mod_autoindex.c 1998/10/02 21:35:38 1.95 +++ mod_autoindex.c 1998/10/04 06:13:18 1.96 @@ -569,7 +569,7 @@ char *icon; char *alt; char *desc; -size_t size; +off_t size; time_t lm; struct ent *next; int ascending; @@ -859,7 +859,7 @@ p = (struct ent *) ap_pcalloc(r-pool, sizeof(struct ent)); p-name = ap_pstrdup(r-pool, name); -p-size = 0; +p-size = -1; p-icon = NULL; p-alt = NULL; p-desc = NULL; @@ -879,7 +879,7 @@ if (!(p-alt = find_alt(d, rr, 1))) { p-alt = DIR; } - p-size = 0; + p-size = -1; p-name = ap_pstrcat(r-pool, name, /, NULL); } else {
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar98/10/02 14:35:40 Modified:htdocs/manual/mod mod_autoindex.html src/modules/standard mod_autoindex.c Log: Back off a portion of the incremental-IndexOptions patch; unprefixed keywords should clear all inherited options and start setting the local directory's options from scratch. Otherwise, 'keyword' and '+keyword' are essentially identical, and clearing inheritance a pain. Revision ChangesPath 1.26 +4 -8 apache-1.3/htdocs/manual/mod/mod_autoindex.html Index: mod_autoindex.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/mod/mod_autoindex.html,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- mod_autoindex.html1998/09/28 22:32:10 1.25 +++ mod_autoindex.html1998/10/02 21:35:33 1.26 @@ -637,8 +637,8 @@ Whenever a '+' or '-' prefixed keyword is encountered, it is applied to the current SAMPIndexOptions/SAMP settings (which may have been inherited from an upper-level directory). However, whenever an unprefixed -keyword is processed, it clears all incremental settings. Consider -the following example: +keyword is processed, it clears all inherited options and any incremental +settings encountered so far. Consider the following example: /P BLOCKQUOTECODEIndexOptions +ScanHTMLTitles -IconsAreLinks FancyIndexing BR @@ -654,13 +654,9 @@ /P P To unconditionally set the CODEIndexOptions/CODE for a -particular directory, clearing the inherited settings, use +particular directory, clearing the inherited settings, specify +keywords without either '+' or '-' prefixes. /P -BLOCKQUOTECODE -IndexOptions None -BR -IndexOptions EMnew-setting/EM ... -/CODE/BLOCKQUOTE /DD /DL HR 1.95 +24 -9 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.94 retrieving revision 1.95 diff -u -r1.94 -r1.95 --- mod_autoindex.c 1998/09/28 22:32:12 1.94 +++ mod_autoindex.c 1998/10/02 21:35:38 1.95 @@ -512,23 +512,38 @@ if (add-opts NO_OPTIONS) { /* * If the current directory says 'no options' then we also - * clear any incremental mods from being inheritable. + * clear any incremental mods from being inheritable further down. */ new-opts = NO_OPTIONS; new-incremented_opts = 0; new-decremented_opts = 0; } else { - new-incremented_opts = (base-incremented_opts - | add-incremented_opts) - ~add-decremented_opts; - new-decremented_opts = (base-decremented_opts - | add-decremented_opts); /* - * We've got some local settings, so make sure we don't inadvertently - * inherit an IndexOptions None from above. + * If there were any non-incremental options selected for + * this directory, they dominate and we don't inherit *anything.* + * Contrariwise, we *do* inherit if the only settings here are + * incremental ones. */ - new-opts = ((base-opts | add-opts) ~NO_OPTIONS); + if (add-opts == 0) { + new-incremented_opts = (base-incremented_opts + | add-incremented_opts) + ~add-decremented_opts; + new-decremented_opts = (base-decremented_opts + | add-decremented_opts); + /* + * We may have incremental settings, so make sure we don't + * inadvertently inherit an IndexOptions None from above. + */ + new-opts = (base-opts ~NO_OPTIONS); + } + else { + /* + * There are local non-incremental settings, which clear + * all inheritance from above. They *are* the new base settings. + */ + new-opts = add-opts;; + } /* * We're guaranteed that there'll be no overlap between * the add-options and the remove-options.
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar98/09/24 03:41:56 Modified:src/modules/standard mod_autoindex.c Log: Oops. Logical NOT used instead of bitwise. Submitted by: Ben Yoshino [EMAIL PROTECTED] Reviewed by: Ken Coar Revision ChangesPath 1.92 +1 -1 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- mod_autoindex.c 1998/09/02 21:04:41 1.91 +++ mod_autoindex.c 1998/09/24 10:41:55 1.92 @@ -293,7 +293,7 @@ cfg = (autoindex_config_rec *) d; curopts = cfg-opts; -newopts = (arg ? (curopts | FANCY_INDEXING) : (curopts !FANCY_INDEXING)); +newopts = (arg ? (curopts | FANCY_INDEXING) : (curopts ~FANCY_INDEXING)); cfg-opts = newopts; return NULL; }
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar98/09/24 08:53:41 Modified:src/modules/standard mod_autoindex.c Log: mod_autoindex wasn't inheriting options from parent directories properly; the use of any other mod_autoindex directives in a .htaccess that didn't also include IndexOptions would wipe out any IndexOptions settings. PR: 3061 Revision ChangesPath 1.93 +11 -2 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- mod_autoindex.c 1998/09/24 10:41:55 1.92 +++ mod_autoindex.c 1998/09/24 15:53:40 1.93 @@ -93,6 +93,7 @@ #define SUPPRESS_DESC 32 #define SUPPRESS_PREAMBLE 64 #define SUPPRESS_COLSORT 128 +#define NO_OPTIONS 256 #define K_PAD 1 #define K_NOPAD 0 @@ -331,7 +332,7 @@ opts |= SUPPRESS_COLSORT; } else if (!strcasecmp(w, None)) { - opts = 0; + opts = NO_OPTIONS; } else if (!strcasecmp(w, IconWidth)) { d_cfg-icon_width = DEFAULT_ICON_WIDTH; @@ -362,6 +363,9 @@ return Invalid directory indexing option; } } +if ((opts NO_OPTIONS) (opts ~NO_OPTIONS)) { + return Cannot combine other IndexOptions keywords with 'None'; +} d_cfg-opts = opts; return NULL; } @@ -436,7 +440,12 @@ new-desc_list = ap_append_arrays(p, add-desc_list, base-desc_list); new-icon_list = ap_append_arrays(p, add-icon_list, base-icon_list); new-rdme_list = ap_append_arrays(p, add-rdme_list, base-rdme_list); -new-opts = add-opts; +if (add-opts NO_OPTIONS) { + new-opts = NO_OPTIONS; +} +else { + new-opts = base-opts | add-opts; +} new-name_width = add-name_width; new-name_adjust = add-name_adjust;
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar98/09/02 14:04:43 Modified:htdocs/manual/mod mod_autoindex.html src CHANGES src/modules/standard mod_autoindex.c Log: Update the filname column width-sizing piece of mod_autoindex so that it's customisable with a NameLength keyword on the IndexOptions directive. A value of '*' means 'as wide as the longest filename,' which was the default effect of the last patch in this area. PR: 1949, 2324 Revision ChangesPath 1.21 +12 -2 apache-1.3/htdocs/manual/mod/mod_autoindex.html Index: mod_autoindex.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/mod/mod_autoindex.html,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- mod_autoindex.html1998/08/31 01:18:48 1.20 +++ mod_autoindex.html1998/09/02 21:04:39 1.21 @@ -482,10 +482,14 @@ DD!--%plaintext lt;?INDEX {\tt FancyIndexing} index optiongt; -- This turns on fancy indexing of directories. BLOCKQUOTE - STRONGNote that the SAMPFancyIndexing/SAMP and + STRONGNote that in versions of Apache prior to 1.3.2, the + SAMPFancyIndexing/SAMP and SAMPIndexOptions/SAMP directives will override each other. You should use SAMPIndexOptionsnbsp;FancyIndexing/SAMP in preference - to the standalone SAMPFancyIndexing/SAMP directive./STRONG + to the standalone SAMPFancyIndexing/SAMP directive. + As of Apache 1.3.2, a standalone SAMPFancyIndexing/SAMP directive + is combined with any SAMPIndexOptions/SAMP directive already + specified for the current scope./STRONG /BLOCKQUOTE DTIconHeight[=pixels] (EMApache 1.3 and later/EM) DD @@ -512,6 +516,12 @@ 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. +DTNameLength=[EMn/EM | *] (EMApache 1.3.2 and later/EM) +DD +The NameLength keyword allows you to specify the width of the +filename column in bytes. If the keyword value is 'SAMP*/SAMP', +then the column is automatically sized to the length of the longest +filename in the display. DTScanHTMLTitles DD!--%plaintext lt;?INDEX {\tt ScanHTMLTitles} index optiongt; -- This enables the extraction of the title from HTML documents for fancy 1.1044+4 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1043 retrieving revision 1.1044 diff -u -r1.1043 -r1.1044 --- CHANGES 1998/09/01 17:21:11 1.1043 +++ CHANGES 1998/09/02 21:04:40 1.1044 @@ -1,5 +1,9 @@ Changes with Apache 1.3.2 + *) Add NameWidth keyword to IndexOptions directive so that the + width of the filename column is customisable. [Ken Coar, Dean Gaudet] + PR#1949, 2324. + *) Recognize lowercase _and_ uppercase `uname' results under SCO OpenServer. [David Coelho [EMAIL PROTECTED]] 1.91 +103 -11 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- mod_autoindex.c 1998/08/31 01:18:53 1.90 +++ mod_autoindex.c 1998/09/02 21:04:41 1.91 @@ -94,6 +94,9 @@ #define SUPPRESS_PREAMBLE 64 #define SUPPRESS_COLSORT 128 +#define K_PAD 1 +#define K_NOPAD 0 + /* * Define keys for sorting. */ @@ -111,6 +114,11 @@ #define DEFAULT_ICON_WIDTH 20 #define DEFAULT_ICON_HEIGHT 22 +/* + * Other default dimensions. + */ +#define DEFAULT_NAME_WIDTH 23 + struct item { char *type; char *apply_to; @@ -122,6 +130,8 @@ char *default_icon; int opts; +int name_width; +int name_adjust; int icon_width; int icon_height; @@ -335,6 +345,19 @@ else if (!strncasecmp(w, IconHeight=, 11)) { d_cfg-icon_height = atoi(w[11]); } + else if (!strncasecmp(w, NameWidth=, 10)) { + if (w[10] == '*') { + d_cfg-name_adjust = 1; + } + else { + int width = atoi(w[10]); + + if (width 1) { + return NameWidth value must be greater than 1; + } + d_cfg-name_width = width; + } + } else { return Invalid directory indexing option; } @@ -382,6 +405,8 @@ new-icon_width = 0; new-icon_height = 0; +new-name_width = DEFAULT_NAME_WIDTH; +new-name_adjust = 0; new-icon_list = ap_make_array(p, 4, sizeof(struct item));
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar98/08/30 18:18:55 Modified:htdocs/manual new_features_1_3.html upgrading_to_1_3.html htdocs/manual/mod mod_autoindex.html src CHANGES src/modules/standard mod_autoindex.c Log: Clean up mod_autoindex's storage of the IndexOptions settings. They are per-directory, not per-filename, so keeping them in an array is confusing and pointless. They're now stored in an int in the module config record. Also (finally!) fix the FancyIndexing directive so it gets merged into any IndexOptions settings for the current directory, rather than replacing them. Revision ChangesPath 1.68 +6 -0 apache-1.3/htdocs/manual/new_features_1_3.html Index: new_features_1_3.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/new_features_1_3.html,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- new_features_1_3.html 1998/07/20 00:18:18 1.67 +++ new_features_1_3.html 1998/08/31 01:18:45 1.68 @@ -268,6 +268,12 @@ height and width attributes to the CODElt;IMGgt;/CODE tag in directory listings. +LIThe A HREF=mod/mod_autoindex.html#fancyindexing +SAMPFancyIndexing/SAMP/A directive now correctly has +the same impact as SAMPIndexOptionsnbsp;FancyIndexing/SAMP + without replacing the effect of any existing SAMPIndexOptions/SAMP + directive. + /UL DTSTRONGLess Buffering of CGI Script Output/STRONG 1.28 +4 -0 apache-1.3/htdocs/manual/upgrading_to_1_3.html Index: upgrading_to_1_3.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/upgrading_to_1_3.html,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- upgrading_to_1_3.html 1998/07/04 15:10:50 1.27 +++ upgrading_to_1_3.html 1998/08/31 01:18:45 1.28 @@ -72,6 +72,10 @@ H3Run-Time Configuration Changes/H3 UL + LIStandalone STRONGSAMPFancyIndexing/SAMP/STRONG directives +are now combined with the settings of any SAMPIndexOptions/SAMP +directive already in effect, rather than replacing them. + /LI LISTRONGSAMPAuthName/SAMP strings will need to be quoted/STRONG in SAMP.htaccess/SAMP or server configuration files if they contain blank characters (like spaces). For example, if you use 1.20 +6 -2 apache-1.3/htdocs/manual/mod/mod_autoindex.html Index: mod_autoindex.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/mod/mod_autoindex.html,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- mod_autoindex.html1998/05/20 14:12:54 1.19 +++ mod_autoindex.html1998/08/31 01:18:48 1.20 @@ -373,10 +373,14 @@ preference. /P BLOCKQUOTE - STRONGNote that the SAMPFancyIndexing/SAMP and + STRONGNote that in versions of Apache prior to 1.3.2, the + SAMPFancyIndexing/SAMP and SAMPIndexOptions/SAMP directives will override each other. You should use SAMPIndexOptionsnbsp;FancyIndexing/SAMP in preference - to the standalone SAMPFancyIndexing/SAMP directive./STRONG + to the standalone SAMPFancyIndexing/SAMP directive. + As of Apache 1.3.2, a standalone SAMPFancyIndexing/SAMP directive + is combined with any SAMPIndexOptions/SAMP directive already + specified for the current scope./STRONG /BLOCKQUOTE HR 1.1040+5 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1039 retrieving revision 1.1040 diff -u -r1.1039 -r1.1040 --- CHANGES 1998/08/28 11:27:19 1.1039 +++ CHANGES 1998/08/31 01:18:51 1.1040 @@ -1,5 +1,10 @@ Changes with Apache 1.3.2 + *) Simplify handling of IndexOptions in mod_autoindex -- and BTW + cause the standalone FancyIndexing directive to logically OR + into any existing IndexOptions settings rather than wiping + them out. [Ken Coar] + *) Changes in ftp proxy: make URL parsing simpler by using the parsed_uri stuff. + Add display of the current directory in cases where it's 1.90 +28 -39apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.89 retrieving revision 1.90 diff -u -r1.89 -r1.90 --- mod_autoindex.c 1998/08/29 18:27:10 1.89 +++ mod_autoindex.c 1998/08/31 01:18:53 1.90 @@ -121,11
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
martin 98/08/29 11:27:11 Modified:src/modules/standard mod_autoindex.c Log: Make configuration parsing for IconWidth/Height somewhat easier and more robust. Previously, the IconWidth/IconHeight directives were not checked correctly (e.g., IconWidthFailsToDetectThis=10 would be parsed as a legal IconWidth=10 option). Also, copying the argument and parsing it with ap_getword() seems to be a waste of computing time. Revision ChangesPath 1.89 +10 -22apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.88 retrieving revision 1.89 diff -u -r1.88 -r1.89 --- mod_autoindex.c 1998/08/22 06:57:17 1.88 +++ mod_autoindex.c 1998/08/29 18:27:10 1.89 @@ -319,29 +319,17 @@ else if (!strcasecmp(w, None)) { opts = 0; } - else if (!strncasecmp(w, IconWidth, 9)) { - if (strchr(w, '=') != NULL) { - const char *x = ap_pstrdup(cmd-pool, w); - char *val; - val = ap_getword(cmd-pool, x, '='); - val = ap_getword(cmd-pool, x, '='); - d_cfg-icon_width = atoi(val); - } - else { - d_cfg-icon_width = DEFAULT_ICON_WIDTH; - } + else if (!strcasecmp(w, IconWidth)) { + d_cfg-icon_width = DEFAULT_ICON_WIDTH; } - else if (!strncasecmp(w, IconHeight, 10)) { - if (strchr(w, '=') != NULL) { - const char *x = ap_pstrdup(cmd-pool, w); - char *val; - val = ap_getword(cmd-pool, x, '='); - val = ap_getword(cmd-pool, x, '='); - d_cfg-icon_height = atoi(val); - } - else { - d_cfg-icon_height = DEFAULT_ICON_HEIGHT; - } + else if (!strncasecmp(w, IconWidth=, 10)) { + d_cfg-icon_width = atoi(w[10]); + } + else if (!strcasecmp(w, IconHeight)) { + d_cfg-icon_height = DEFAULT_ICON_HEIGHT; + } + else if (!strncasecmp(w, IconHeight=, 11)) { + d_cfg-icon_height = atoi(w[11]); } else { return Invalid directory indexing option;
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
dgaudet 98/08/21 23:57:17 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: dynamincally size the filename column Reviewed by: Martin Kraemer Revision ChangesPath 1.1031+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1030 retrieving revision 1.1031 diff -u -r1.1030 -r1.1031 --- CHANGES 1998/08/20 04:07:43 1.1030 +++ CHANGES 1998/08/22 06:57:15 1.1031 @@ -1,5 +1,8 @@ Changes with Apache 1.3.2 + *) Dynamically size the filename column of mod_autoindex output. + [Dean Gaudet] + *) Add the ability to do POST requests to the ab benchmarking tool. [Kurt Sussman [EMAIL PROTECTED]] PR#2871 1.88 +28 -32apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.87 retrieving revision 1.88 diff -u -r1.87 -r1.88 --- mod_autoindex.c 1998/08/06 17:30:56 1.87 +++ mod_autoindex.c 1998/08/22 06:57:17 1.88 @@ -865,15 +865,29 @@ autoindex_config_rec * d, request_rec *r, int autoindex_opts, char keyid, char direction) { -int x, len; +int x; char *name = r-uri; char *tp; int static_columns = (autoindex_opts SUPPRESS_COLSORT); pool *scratch = ap_make_sub_pool(r-pool); +int name_width; +char *name_scratch; if (name[0] == '\0') name = /; +name_width = 23; +for (x = 0; x n; x++) { + int t = strlen(ar[x]-name); + if (t name_width) { + name_width = t; + } +} +++name_width; +name_scratch = ap_palloc(r-pool, name_width + 1); +memset(name_scratch, ' ', name_width); +name_scratch[name_width] = 0; + if (autoindex_opts FANCY_INDEXING) { ap_rputs(PRE, r); if ((tp = find_default_icon(d, ^^BLANKICON^^))) { @@ -891,7 +905,7 @@ ap_rputs( , r); } emit_link(r, Name, K_NAME, keyid, direction, static_columns); - ap_rputs( , r); + ap_rputs(name_scratch + 4, r); if (!(autoindex_opts SUPPRESS_LAST_MOD)) { emit_link(r, Last modified, K_LAST_MOD, keyid, direction, static_columns); @@ -912,7 +926,8 @@ } for (x = 0; x n; x++) { - char *anchor = NULL, *t = NULL, *t2 = NULL; + char *anchor, *t, *t2; + char *pad; ap_clear_pool(scratch); @@ -922,40 +937,21 @@ if (t[0] == '\0') { t = /; } - anchor = ap_pstrcat(scratch, A HREF=\, - ap_escape_html(scratch, -ap_os_escape_path(scratch, t, - 0)), - \, NULL); - t2 = Parent Directory/A ; +/* 1234567890123456 */ + t2 = Parent Directory; + pad = name_scratch + 16; + anchor = ap_escape_html(scratch, ap_os_escape_path(scratch, t, 0)); } else { t = ar[x]-name; - len = strlen(t); - if (len 23) { - t2 = ap_pstrdup(scratch, t); - t2[21] = '.'; - t2[22] = '.'; - t2[23] = '\0'; - t2 = ap_escape_html(scratch, t2); - t2 = ap_pstrcat(scratch, t2, /A, NULL); - } - else { - char buff[24] =; - t2 = ap_escape_html(scratch, t); - buff[23 - len] = '\0'; - t2 = ap_pstrcat(scratch, t2, /A, buff, NULL); - } - anchor = ap_pstrcat(scratch, A HREF=\, - ap_escape_html(scratch, -ap_os_escape_path(scratch, t, - 0)), - \, NULL); + pad = name_scratch + strlen(t); + t2 = ap_escape_html(scratch, t); + anchor = ap_escape_html(scratch, ap_os_escape_path(scratch, t, 0)); } if (autoindex_opts FANCY_INDEXING) { if (autoindex_opts ICONS_ARE_LINKS) { - ap_rputs(anchor, r); + ap_rvputs(r, A HREF=\, anchor, \, NULL); } if ((ar[x]-icon) || d-default_icon) { ap_rvputs(r, IMG SRC=\, @@ -974,7 +970,7 @@ ap_rputs(/A, r); } - ap_rvputs(r, , anchor, t2, NULL); + ap_rvputs(r, A HREF=\,
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
dgaudet 98/07/06 21:54:05 Modified:src/modules/standard mod_autoindex.c Log: - fix a gcc -Wall warning in dsortf() (Ken you should be using -Wall) - remove unnecessary complexity and verbiage (backport dsortf from apache-nspr) Revision ChangesPath 1.85 +21 -74apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.84 retrieving revision 1.85 diff -u -r1.84 -r1.85 --- mod_autoindex.c 1998/06/20 11:20:39 1.84 +++ mod_autoindex.c 1998/07/07 04:54:04 1.85 @@ -1017,12 +1017,9 @@ static int dsortf(struct ent **e1, struct ent **e2) { -char *s1; -char *s2; struct ent *c1; struct ent *c2; int result = 0; -int compare_by_string = 1; /* * First, see if either of the entries is for the parent directory. @@ -1040,87 +1037,37 @@ */ if ((*e1)-ascending) { c1 = *e1; - c2 = *e2; +c2 = *e2; } else { c1 = *e2; c2 = *e1; } -/* - * Choose the right values for the sort keys. - */ switch (c1-key) { case K_LAST_MOD: -/* - * Since the last-modified time is a monotonically increasing integer, - * we can short-circuit this process with a simple comparison. - */ -result = c1-lm - c2-lm; - if (result != 0) { - result = (result 0) ? 1 : -1; - } - compare_by_string = 0; - break; + if (c1-lm c2-lm) { +return 1; +} +else if (c1-lm c2-lm) { +return -1; +} +break; case K_SIZE: -/* - * We can pull the same trick with the size as with the mtime. - */ -result = c1-size - c2-size; - if (result != 0) { - result = (result 0) ? 1 : -1; - } - compare_by_string = 0; - break; +if (c1-size c2-size) { +return 1; +} +else if (c1-size c2-size) { +return -1; +} +break; case K_DESC: - s1 = c1-desc; - s2 = c2-desc; - break; -case K_NAME: -default: - s1 = c1-name; - s2 = c2-name; - break; -} - -if (compare_by_string) { -/* - * Take some care, here, in case one string or the other (or both) is - * NULL. - */ - -/* - * Two valid strings, compare normally. - */ -if ((s1 != NULL) (s2 != NULL)) { - result = strcmp(s1, s2); - } - /* - * Two NULL strings - primary keys are equal (fake it). - */ - else if ((s1 == NULL) (s2 == NULL)) { - result = 0; - } - /* - * s1 is NULL, but s2 is a string - so s2 wins. - */ - else if (s1 == NULL) { - result = -1; - } - /* - * Last case: s1 is a string and s2 is NULL, so s1 wins. - */ - else { - result = 1; - } -} -/* - * If the keys were equal, the file name is *always* the secondary key - - * in ascending order. - */ -if (!result) { - result = strcmp((*e1)-name, (*e2)-name); +result = strcmp(c1-desc ? c1-desc : , c2-desc ? c2-desc : ); +if (result) { +return result; +} +break; } -return result; +return strcmp(c1-name, c2-name); }
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar98/06/19 06:31:31 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: IndexIgnore was looking for an exact match of the filename against the pattern, even though on Win32 README.html, Readme.html, and readme.html are all the same file. PR: 2455 Revision ChangesPath 1.926 +3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.925 retrieving revision 1.926 diff -u -r1.925 -r1.926 --- CHANGES 1998/06/17 13:33:59 1.925 +++ CHANGES 1998/06/19 13:31:28 1.926 @@ -1,5 +1,8 @@ Changes with Apache 1.3.1 + *) IndexIgnore should be case-blind on Win32 (and any other case-aware + but case-insensitive platforms). [Ken Coar] PR#2455 + *) Enable DSO support for OpenBSD in general, not only for 2.x, because it also works for OpenBSD 1.x. [Ralf S. Engelschall] 1.83 +10 -0 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- mod_autoindex.c 1998/06/16 03:40:13 1.82 +++ mod_autoindex.c 1998/06/19 13:31:30 1.83 @@ -534,10 +534,20 @@ ap++; } +#ifndef WIN32 if (!ap_strcmp_match(path, p-apply_path) !ap_strcmp_match(tt, ap)) { return 1; } +#else /* !WIN32 */ + /* + * On Win32, the match must be case-blind. + */ + if (!ap_strcasecmp_match(path, p-apply_path) + !ap_strcasecmp_match(tt, ap)) { + return 1; + } +#endif /* !WIN32 */ } return 0; }
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
brian 98/06/15 20:40:13 Modified:src/modules/standard mod_autoindex.c Log: shut up gcc's warning. Revision ChangesPath 1.82 +1 -1 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- mod_autoindex.c 1998/06/13 15:23:08 1.81 +++ mod_autoindex.c 1998/06/16 03:40:13 1.82 @@ -1009,7 +1009,7 @@ char *s2; struct ent *c1; struct ent *c2; -int result; +int result = 0; int compare_by_string = 1; /*
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar98/06/12 04:20:57 Modified:src/modules/standard mod_autoindex.c Log: Style-guide cleanups. Revision ChangesPath 1.78 +175 -122 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.77 retrieving revision 1.78 diff -u -r1.77 -r1.78 --- mod_autoindex.c 1998/05/16 21:11:17 1.77 +++ mod_autoindex.c 1998/06/12 11:20:56 1.78 @@ -142,15 +142,9 @@ */ static void emit_preamble(request_rec *r, char *title) { -ap_rvputs - ( - r, - !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 3.2 Final//EN\\n, - HTML\n HEAD\n TITLEIndex of , - title, - /TITLE\n /HEAD\n BODY\n, - NULL - ); +ap_rvputs(r, !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 3.2 Final//EN\\n, + HTML\n HEAD\n TITLEIndex of , title, + /TITLE\n /HEAD\n BODY\n, NULL); } static void push_item(array_header *arr, char *type, char *to, char *path, @@ -158,33 +152,41 @@ { struct item *p = (struct item *) ap_push_array(arr); -if (!to) +if (!to) { to = ; -if (!path) +} +if (!path) { path = ; +} p-type = type; p-data = data ? ap_pstrdup(arr-pool, data) : NULL; p-apply_path = ap_pstrcat(arr-pool, path, *, NULL); -if ((type == BY_PATH) (!ap_is_matchexp(to))) +if ((type == BY_PATH) (!ap_is_matchexp(to))) { p-apply_to = ap_pstrcat(arr-pool, *, to, NULL); -else if (to) +} +else if (to) { p-apply_to = ap_pstrdup(arr-pool, to); -else +} +else { 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**)) +if (cmd-info == BY_PATH) { +if (!strcmp(to, **DIRECTORY**)) { to = ^^DIRECTORY^^; + } +} if (cmd-info == BY_ENCODING) { ap_str_tolower(to); } -push_item(((autoindex_config_rec *) d)-alt_list, cmd-info, to, cmd-path, alt); +push_item(((autoindex_config_rec *) d)-alt_list, cmd-info, to, + cmd-path, alt); return NULL; } @@ -203,28 +205,24 @@ *cl = '\0'; /* Lose closing paren */ add_alt(cmd, d, alt[1], to); } -if (cmd-info == BY_PATH) - if (!strcmp(to, **DIRECTORY**)) +if (cmd-info == BY_PATH) { +if (!strcmp(to, **DIRECTORY**)) { to = ^^DIRECTORY^^; + } +} if (cmd-info == BY_ENCODING) { ap_str_tolower(to); } -push_item(((autoindex_config_rec *) d)-icon_list, cmd-info, to, cmd-path, - iconbak); +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 - ); +push_item(((autoindex_config_rec *) d)-desc_list, cmd-info, to, + cmd-path, desc); return NULL; } @@ -239,7 +237,8 @@ if (strchr(name, '/')) { return HeaderName cannot contain a /; } -push_item(((autoindex_config_rec *) d)-hdr_list, 0, NULL, cmd-path, name); +push_item(((autoindex_config_rec *) d)-hdr_list, 0, NULL, cmd-path, + name); return NULL; } @@ -248,15 +247,16 @@ if (strchr(name, '/')) { return ReadmeName cannot contain a /; } -push_item(((autoindex_config_rec *) d)-rdme_list, 0, NULL, cmd-path, name); +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 *) (long) opts, NULL, - cmd-path, NULL); +push_item(((autoindex_config_rec *) d)-opts_list, (char *) (long) opts, + NULL, cmd-path, NULL); return NULL; } @@ -273,25 +273,33 @@ while (optstr[0]) { w = ap_getword_conf(cmd-pool, optstr); - if (!strcasecmp(w, FancyIndexing)) + if (!strcasecmp(w, FancyIndexing)) { opts |= FANCY_INDEXING; - else if (!strcasecmp(w, IconsAreLinks)) + } + else if (!strcasecmp(w, IconsAreLinks)) { opts |= ICONS_ARE_LINKS; - else if (!strcasecmp(w, ScanHTMLTitles)) + } + else if (!strcasecmp(w, ScanHTMLTitles)) { opts |=
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
coar98/06/12 08:53:26 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: I've been meaning to clean up these integer-as-string comparisons for a while, and encountered the misplacement of the parent directory entry during testing. Needing the parent-directory test in a second location prompted streamlining simplification of the method. Revision ChangesPath 1.911 +9 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.910 retrieving revision 1.911 diff -u -r1.910 -r1.911 --- CHANGES 1998/06/10 21:13:26 1.910 +++ CHANGES 1998/06/12 15:53:21 1.911 @@ -1,5 +1,14 @@ Changes with Apache 1.3.1 + *) Improve performance of directory listings (mod_autoindex) by comparing + integer keys (last-modified and size) as integers rather than converting + them to strings first. Also use a set of explicit byte tests rather + than strcmp() to check for parent directory-ness of an entry. Oh, and + make sure the parent directory (if displayed) is *always* listed first + regardless of the sort key. Overall performance winnage should be good + in CPU time, instruction cache, and memory usage, particularly for large + directories. [Ken Coar] + *) Add httpd -t (test) option for running configuration syntax tests only. If something is broken it complains and exits with a return code non-equal to 0. This can be used manually by the user to check the Apache 1.79 +119 -60 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- mod_autoindex.c 1998/06/12 11:20:56 1.78 +++ mod_autoindex.c 1998/06/12 15:53:23 1.79 @@ -136,6 +136,37 @@ #define BY_PATH c_by_path /* + * Return true if the specified string refers to the parent directory (i.e., + * matches .. or ../). Hopefully this one call is significantly less + * expensive than multiple strcmp() calls. + */ +static int is_parent(const char *name) +{ +/* + * If it's no name at all, it isn't our parent. + */ +if (name == NULL) { +return 0; +} +/* + * Nor is it if the name isn't long enough. + */ +if ((name[0] == '\0') || (name[1] == '\0')) { +return 0; +} +/* + * Now, IFF the first two bytes are dots, and the third byte is either + * EOS (\0) or a slash followed by EOS, we have a match. + */ +if (((name[0] == '.') (name[1] == '.')) + ((name[2] == '\0') + || ((name[2] == '/') (name[3] == '\0' { +return 1; +} +return 0; +} + +/* * This routine puts the standard HTML header at the top of the index page. * We include the DOCTYPE because we may be using features therefrom (i.e., * HEIGHT and WIDTH attributes on the icons if we're FancyIndexing). @@ -417,9 +448,7 @@ char *alt; char *desc; size_t size; -char *size_cmp; time_t lm; -char *lm_cmp; struct ent *next; int ascending; char key; @@ -750,20 +779,15 @@ } ap_destroy_sub_req(rr); -} -if (keyid == K_SIZE) { - p-size_cmp = ap_palloc(r-pool, 14); - ap_snprintf(p-size_cmp, 14, %013d, p-size); } +/* + * We don't need to take any special action for the file size key. If + * we did, it would go here. + */ if (keyid == K_LAST_MOD) { - struct tm *ts = localtime(p-lm); - - if(ts) { - p-lm_cmp = ap_palloc(r-pool, 15); - strftime(p-lm_cmp, 15, %Y%m%d%H%M%S, ts); +if (p-lm 0) { + p-lm = 0; } - else - p-lm_cmp=NULL; } return (p); } @@ -892,7 +916,7 @@ ap_clear_pool(scratch); - if ((!strcmp(ar[x]-name, ../)) || (!strcmp(ar[x]-name, ..))) { + if (is_parent(ar[x]-name)) { t = ap_make_full_path(scratch, name, ../); ap_getparents(t); if (t[0] == '\0') { @@ -986,73 +1010,108 @@ } } +/* + * Compare two file entries according to the sort criteria. The return + * is essentially a signum function value. + */ static int dsortf(struct ent **e1, struct ent **e2) { char *s1; char *s2; -char *s3; +struct ent *c1; +struct ent *c2; int result; +int compare_by_string = 1; /* + * First, see if either of the entries is for the parent directory. + * If so, that
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
dgaudet 98/06/12 10:42:43 Modified:src/modules/standard mod_autoindex.c Log: - It's not possible for name to be NULL. - It's not necessary to test name[0] == 0 because the next if will fail in that event anyhow. Ditto for name[1] == 0. Revision ChangesPath 1.80 +1 -13 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- mod_autoindex.c 1998/06/12 15:53:23 1.79 +++ mod_autoindex.c 1998/06/12 17:42:42 1.80 @@ -140,20 +140,8 @@ * matches .. or ../). Hopefully this one call is significantly less * expensive than multiple strcmp() calls. */ -static int is_parent(const char *name) +static ap_inline int is_parent(const char *name) { -/* - * If it's no name at all, it isn't our parent. - */ -if (name == NULL) { -return 0; -} -/* - * Nor is it if the name isn't long enough. - */ -if ((name[0] == '\0') || (name[1] == '\0')) { -return 0; -} /* * Now, IFF the first two bytes are dots, and the third byte is either * EOS (\0) or a slash followed by EOS, we have a match.
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
ben 98/05/16 14:11:17 Modified:src CHANGES src/modules/standard mod_autoindex.c Log: Fix conversion of time -1. Revision ChangesPath 1.850 +3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.849 retrieving revision 1.850 diff -u -r1.849 -r1.850 --- CHANGES 1998/05/16 16:34:44 1.849 +++ CHANGES 1998/05/16 21:11:15 1.850 @@ -1,5 +1,8 @@ Changes with Apache 1.3b7 + *) WIN32: Clicking on Last Modified in a fancy index caused a crash. Fixed. + [Ben Laurie] PR#2238 + *) WIN32: CGIs could cause a hang (because of a deadlock in the standard C library), so CGI handling has been changed to use Win32 native handles instead of C file descriptors. 1.77 +6 -2 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- mod_autoindex.c 1998/05/03 16:46:50 1.76 +++ mod_autoindex.c 1998/05/16 21:11:17 1.77 @@ -718,8 +718,12 @@ if (keyid == K_LAST_MOD) { struct tm *ts = localtime(p-lm); - p-lm_cmp = ap_palloc(r-pool, 15); - strftime(p-lm_cmp, 15, %Y%m%d%H%M%S, ts); + if(ts) { + p-lm_cmp = ap_palloc(r-pool, 15); + strftime(p-lm_cmp, 15, %Y%m%d%H%M%S, ts); + } + else + p-lm_cmp=NULL; } return (p); }
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
jim 98/05/03 09:46:50 Modified:.STATUS src CHANGES src/modules/standard mod_autoindex.c Log: PR: 2112 Submitted by: Jim Jagielski Reviewed by: Dean Gaudet, Ralf Engelschall Revision ChangesPath 1.354 +1 -5 apache-1.3/STATUS Index: STATUS === RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.353 retrieving revision 1.354 diff -u -r1.353 -r1.354 --- STATUS1998/05/03 16:29:38 1.353 +++ STATUS1998/05/03 16:46:47 1.354 @@ -82,6 +82,7 @@ * Ben's WIN32: Make roots of filesystems (e.g. c:/) work, PR#1558 * Ben's WIN32: Extensive overhaul of the way UNCs are handled. * Ralf's fix for referer/agent log entries in installed httpd.conf, PR#2175 +* Jim's fix for MIME type case sensitivity disparity, PR#2112 Available Patches: @@ -136,11 +137,6 @@ CustomLog-like tailoring of directory listing formats FINAL RELEASE SHOWSTOPPERS: - -* MIME type case sensitivity disparity between 1.2.6 and 1.3b6 (PR #2112) - mod_autoindex should lowercase the mime-type when comparing - [PATCH] [EMAIL PROTECTED] - Status: Jim, Dean +1 * proxy security fixes from 1.2.5 need to be brought forward Jim: What are these? 1.810 +4 -1 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.809 retrieving revision 1.810 diff -u -r1.809 -r1.810 --- CHANGES 1998/05/03 10:22:29 1.809 +++ CHANGES 1998/05/03 16:46:48 1.810 @@ -1,5 +1,8 @@ Changes with Apache 1.3b7 - + + *) mod_autoindex's find_itme() was sensitive to MIME type case. + [Jim Jagielski] PR#2112 + *) Make sure the referer_log and agent_log entries in the default httpd.conf file are also adjusted for the actual relative installation paths. [Ralf S. Engelschall] PR#2175 1.76 +2 -2 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- mod_autoindex.c 1998/04/15 17:09:29 1.75 +++ mod_autoindex.c 1998/05/03 16:46:50 1.76 @@ -437,13 +437,13 @@ else if (!path_only) { if (!content_encoding) { if (p-type == BY_TYPE) { - if (content_type !ap_strcmp_match(content_type, p-apply_to)) + if (content_type !ap_strcasecmp_match(content_type, p-apply_to)) return p-data; } } else { if (p-type == BY_ENCODING) { - if (!ap_strcmp_match(content_encoding, p-apply_to)) + if (!ap_strcasecmp_match(content_encoding, p-apply_to)) return p-data; } }
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
dgaudet 98/03/05 20:25:46 Modified:src/modules/standard mod_autoindex.c Log: indent Revision ChangesPath 1.69 +2 -2 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- mod_autoindex.c 1998/02/12 02:18:43 1.68 +++ mod_autoindex.c 1998/03/06 04:25:45 1.69 @@ -1150,8 +1150,8 @@ if (allow_opts OPT_INDEXES) { /* 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... + * Fixing this in the sub_req_lookup functions themselves is difficult, + * and would probably break virtual includes... */ if (r-filename[strlen(r-filename) - 1] != '/') {
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c mod_mime.c mod_negotiation.c
dgaudet 98/02/11 17:09:47 Modified:src CHANGES src/modules/standard mod_autoindex.c mod_mime.c mod_negotiation.c Log: Old clients really don't want to see Content-Encoding: gzip. So now we preserve the encoding given by the AddEncoding directive. This allows us, for example, to move forward with things like AddEncoding deflate .df, while preserving backwards brokenness with AddEncoding x-gzip .gz. Submitted by: [EMAIL PROTECTED] Reviewed by: Dean Gaudet Revision ChangesPath 1.626 +4 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.625 retrieving revision 1.626 diff -u -r1.625 -r1.626 --- CHANGES 1998/02/09 13:25:40 1.625 +++ CHANGES 1998/02/12 01:09:41 1.626 @@ -1,5 +1,9 @@ Changes with Apache 1.3b5 + *) Preserve the content encoding given by the AddEncoding directive + when the client doesn't otherwise specify an encoding. + [Ronald Tschalaer [EMAIL PROTECTED]] + *) WIN32: Append a '.' to extensionless executables in spawn[lv]e* replacements, which makes them work. [Sam Robb [EMAIL PROTECTED], Ben Laurie] 1.67 +0 -6 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- mod_autoindex.c 1998/02/06 09:11:39 1.66 +++ mod_autoindex.c 1998/02/12 01:09:44 1.67 @@ -178,9 +178,6 @@ to = ^^DIRECTORY^^; if (cmd-info == BY_ENCODING) { str_tolower(to); - if (to[0] == 'x' to[1] == '-') { - to += 2; - } } push_item(((autoindex_config_rec *) d)-alt_list, cmd-info, to, cmd-path, alt); @@ -207,9 +204,6 @@ to = ^^DIRECTORY^^; if (cmd-info == BY_ENCODING) { str_tolower(to); - if (to[0] == 'x' to[1] == '-') { - to += 2; - } } push_item(((autoindex_config_rec *) d)-icon_list, cmd-info, to, cmd-path, 1.31 +0 -2 apache-1.3/src/modules/standard/mod_mime.c Index: mod_mime.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- mod_mime.c1998/02/06 09:11:39 1.30 +++ mod_mime.c1998/02/12 01:09:44 1.31 @@ -127,8 +127,6 @@ { if (*ext == '.') ++ext; -if ((enc[0] == 'x' || enc[0] == 'X') enc[1] == '-') -enc += 2; table_set(m-encoding_types, ext, enc); return NULL; } 1.70 +16 -6 apache-1.3/src/modules/standard/mod_negotiation.c Index: mod_negotiation.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_negotiation.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- mod_negotiation.c 1998/02/10 05:54:02 1.69 +++ mod_negotiation.c 1998/02/12 01:09:45 1.70 @@ -1463,6 +1463,7 @@ int i; accept_rec *accept_recs = (accept_rec *) neg-accept_encodings-elts; char *enc = variant-content_encoding; +char *x_enc = NULL; if (!enc || is_identity_encoding(enc)) { return; @@ -1479,19 +1480,28 @@ /* Go through each of the encodings on the Accept-Encoding: header, * looking for a match with our encoding - */ + * Prefer non- 'x-' prefixed token (e.g. gzip over x-gzip) */ +if (enc[0] == 'x' enc[1] == '-') { +enc += 2; +} for (i = 0; i neg-accept_encodings-nelts; ++i) { char *name = accept_recs[i].type_name; -int off = 0; - - if (name[0] == 'x' name[1] == '-') -off = 2; -if (!strcmp(name+off, enc)) { +if (!strcmp(name, enc)) { variant-encoding_quality = 1; variant-content_encoding = name; return; } + +if (name[0] == 'x' name[1] == '-' !strcmp(name+2, enc)) { +x_enc = name; +} +} + +if (x_enc != NULL) { +variant-encoding_quality = 1; +variant-content_encoding = x_enc; +return; } /* Encoding not found on Accept-Encoding: header, so it is
cvs commit: apache-1.3/src/modules/standard mod_autoindex.c mod_negotiation.c
dgaudet 98/02/11 18:18:45 Modified:src/ap ap_snprintf.c src/helpers dummy.c src/main fnmatch.c http_core.c src/modules/standard mod_autoindex.c mod_negotiation.c Log: Clean up gcc 2.8.0 -Wall warnings... so we don't have to deal with PRs about them. Revision ChangesPath 1.13 +2 -1 apache-1.3/src/ap/ap_snprintf.c Index: ap_snprintf.c === RCS file: /export/home/cvs/apache-1.3/src/ap/ap_snprintf.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ap_snprintf.c 1998/01/07 16:45:56 1.12 +++ ap_snprintf.c 1998/02/12 02:18:38 1.13 @@ -426,7 +426,7 @@ return (buf); } -if (format == 'f') +if (format == 'f') { if (decimal_point = 0) { *s++ = '0'; if (precision 0) { @@ -443,6 +443,7 @@ if (precision 0 || add_dp) *s++ = '.'; } +} else { *s++ = *p++; if (precision 0 || add_dp) 1.4 +1 -1 apache-1.3/src/helpers/dummy.c Index: dummy.c === RCS file: /export/home/cvs/apache-1.3/src/helpers/dummy.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- dummy.c 1997/07/25 02:03:17 1.3 +++ dummy.c 1998/02/12 02:18:39 1.4 @@ -1,7 +1,7 @@ /* this file is used by TestLib */ int foo ( const char *c ) { -return 0; +return *c; } int main(void) { const char *c = '\0'; 1.6 +6 -3 apache-1.3/src/main/fnmatch.c Index: fnmatch.c === RCS file: /export/home/cvs/apache-1.3/src/main/fnmatch.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- fnmatch.c 1997/11/06 22:03:40 1.5 +++ fnmatch.c 1998/02/12 02:18:40 1.6 @@ -84,12 +84,15 @@ return (FNM_NOMATCH); /* Optimize for pattern with * at end or before /. */ - if (c == EOS) - if (flags FNM_PATHNAME) + if (c == EOS) { + if (flags FNM_PATHNAME) { return (strchr(string, '/') == NULL ? 0 : FNM_NOMATCH); - else + } + else { return (0); + } + } else if (c == '/' flags FNM_PATHNAME) { if ((string = strchr(string, '/')) == NULL) return (FNM_NOMATCH); 1.158 +12 -6 apache-1.3/src/main/http_core.c Index: http_core.c === RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v retrieving revision 1.157 retrieving revision 1.158 diff -u -r1.157 -r1.158 --- http_core.c 1998/02/08 23:15:34 1.157 +++ http_core.c 1998/02/12 02:18:41 1.158 @@ -690,11 +690,14 @@ const char *err = check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); if (err != NULL) return err; -if (!is_directory (arg)) - if (cmd-server-is_virtual) +if (!is_directory (arg)) { + if (cmd-server-is_virtual) { fprintf (stderr, Warning: DocumentRoot [%s] does not exist\n, arg); - else + } + else { return DocumentRoot must be a directory; + } +} conf-document_root = arg; return NULL; @@ -1551,11 +1554,14 @@ return; } -if ((str = getword_conf(cmd-pool, arg))) - if (!strcasecmp(str, max)) +if ((str = getword_conf(cmd-pool, arg))) { + if (!strcasecmp(str, max)) { cur = limit-rlim_max; - else + } + else { cur = atol(str); + } +} else { aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, cmd-server, Invalid parameters for %s, cmd-cmd-name); 1.68 +8 -4 apache-1.3/src/modules/standard/mod_autoindex.c Index: mod_autoindex.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- mod_autoindex.c 1998/02/12 01:09:44 1.67 +++ mod_autoindex.c 1998/02/12 02:18:43 1.68 @@ -635,12 +635,16 @@ 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)) - if (y == x) + for (y = x; titlebuf[y]; y++) {