akosut 96/04/12 18:26:55
Modified: src mod_mime.c
Log:
Correctly reset the handler when an unknown file extension is present,
and return DECLINED when no content type has been set.
Revision Changes Path
1.9 +5 -2 apache/src/mod_mime.c
Index: mod_mime.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_mime.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C3 -r1.8 -r1.9
*** mod_mime.c 1996/04/11 06:05:53 1.8
--- mod_mime.c 1996/04/13 01:26:53 1.9
***************
*** 221,227 ****
char *fn = strrchr(r->filename, '/');
mime_dir_config *conf =
(mime_dir_config *)get_module_config(r->per_dir_config, &mime_module);
! char *ext, *type;
if (S_ISDIR(r->finfo.st_mode)) {
r->content_type = DIR_MAGIC_TYPE;
--- 221,227 ----
char *fn = strrchr(r->filename, '/');
mime_dir_config *conf =
(mime_dir_config *)get_module_config(r->per_dir_config, &mime_module);
! char *ext, *type, *orighandler = r->handler;
if (S_ISDIR(r->finfo.st_mode)) {
r->content_type = DIR_MAGIC_TYPE;
***************
*** 263,275 ****
/* This is to deal with cases such as foo.gif.bak, which we want
* to not have a type. So if we find an unknown extension, we
! * zap the type/language/encoding (but not the handler)
*/
if (!found) {
r->content_type = NULL;
r->content_language = NULL;
r->content_encoding = NULL;
}
}
--- 263,276 ----
/* This is to deal with cases such as foo.gif.bak, which we want
* to not have a type. So if we find an unknown extension, we
! * zap the type/language/encoding and reset the handler
*/
if (!found) {
r->content_type = NULL;
r->content_language = NULL;
r->content_encoding = NULL;
+ r->handler = orighandler;
}
}
***************
*** 280,285 ****
--- 281,288 ----
r->content_type = pstrdup(r->pool, conf->type);
if (conf->handler && strcmp(conf->handler, "none"))
r->handler = pstrdup(r->pool, conf->handler);
+
+ if (!r->content_type) return DECLINED;
return OK;
}