coar 99/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 Changes Path 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 --- STATUS 1999/06/04 17:40:04 1.700 +++ STATUS 1999/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.c 1999/05/25 15:24:01 1.162 +++ util.c 1999/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) && ap_isspace(semi[-1])) { + semi--; + } + } + return ap_pstrndup(p, intype, semi - intype); +} + API_EXPORT(char *) ap_ht_time(pool *p, time_t t, const char *fmt, int gmt) { char ts[MAX_STRING_LEN]; 1.109 +7 -4 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.108 retrieving revision 1.109 diff -u -r1.108 -r1.109 --- mod_autoindex.c 1999/05/13 19:00:43 1.108 +++ mod_autoindex.c 1999/06/04 18:30:35 1.109 @@ -957,7 +957,8 @@ * SSIs. */ if (rr->content_type != NULL) { - if (!strcasecmp("text/html", rr->content_type)) { + if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type), + "text/html")) { /* Hope everything will work... */ emit_amble = 0; emit_H1 = 0; @@ -1038,7 +1039,8 @@ * SSIs. */ if (rr->content_type != NULL) { - if (!strcasecmp("text/html", rr->content_type)) { + if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type), + "text/html")) { if (ap_run_sub_req(rr) == OK) { /* worked... */ suppress_sig = 1; @@ -1079,8 +1081,9 @@ if (r->status != HTTP_OK) { return NULL; } - if (r->content_type - && (!strcmp(r->content_type, "text/html") + if ((r->content_type != NULL) + && (!strcasecmp(ap_field_noparam(r->pool, r->content_type), + "text/html") || !strcmp(r->content_type, INCLUDES_MAGIC_TYPE)) && !r->content_encoding) { if (!(thefile = ap_pfopen(r->pool, r->filename, "r"))) {