akosut 96/04/10 23:05:53
Modified: conf access.conf-dist srm.conf-dist
src mod_mime.c
Log:
Add ForceType and SetHandler commands, which allow you to override the
content type or handler, respectively, in a <Directory> section, an
.htaccess file or a <Location> section.
Revision Changes Path
1.2 +15 -2 apache/conf/access.conf-dist
Index: access.conf-dist
===================================================================
RCS file: /export/home/cvs/apache/conf/access.conf-dist,v
retrieving revision 1.1
retrieving revision 1.2
diff -C3 -r1.1 -r1.2
*** access.conf-dist 1996/01/14 18:49:46 1.1
--- access.conf-dist 1996/04/11 06:05:49 1.2
***************
*** 53,58 ****
</Directory>
! # You may place any other directories you wish to have access
! # information for after this one.
--- 53,71 ----
</Directory>
! # Allow server status reports, with the URL of http://servername/status
! # Change the ".nowhere.com" to match your domain to enable.
!
! <Location /status>
! SetHandler server-status
!
! <Limit GET>
! order deny,allow
! deny from all
! allow from .nowhere.com
! </Limit>
! </Location>
!
! # You may place any other directories or locations you wish to have
! # access information for after this one.
1.5 +0 -4 apache/conf/srm.conf-dist
Index: srm.conf-dist
===================================================================
RCS file: /export/home/cvs/apache/conf/srm.conf-dist,v
retrieving revision 1.4
retrieving revision 1.5
diff -C3 -r1.4 -r1.5
*** srm.conf-dist 1996/04/04 15:10:26 1.4
--- srm.conf-dist 1996/04/11 06:05:50 1.5
***************
*** 167,176 ****
# To enable type maps, you might want to use
#AddHandler type-map var
- # If you are using the status module and don't care if anyone else
- # can see your status information you can use
- #AddHandler server-status status
-
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
--- 167,172 ----
1.8 +20 -0 apache/src/mod_mime.c
Index: mod_mime.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_mime.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C3 -r1.7 -r1.8
*** mod_mime.c 1996/04/10 00:27:56 1.7
--- mod_mime.c 1996/04/11 06:05:53 1.8
***************
*** 69,74 ****
--- 69,77 ----
table *encoding_types; /* Added with AddEncoding... */
table *language_types; /* Added with AddLanguage... */
table *handlers; /* Added with AddHandler... */
+
+ char *type; /* Type forced with ForceType */
+ char *handler; /* Handler forced with SetHandler */
} mime_dir_config;
module mime_module;
***************
*** 82,87 ****
--- 85,93 ----
new->encoding_types = make_table (p, 4);
new->language_types = make_table (p, 4);
new->handlers = make_table (p, 4);
+
+ new->type = NULL;
+ new->handler = NULL;
return new;
}
***************
*** 102,107 ****
--- 108,116 ----
new->handlers = overlay_tables (p, add->handlers,
base->handlers);
+ new->type = add->type ? add->type : base->type;
+ new->handler = add->handler ? add->handler : base->handler;
+
return new;
}
***************
*** 153,158 ****
--- 162,171 ----
"a language (e.g., fr), followed by one or more file extensions" },
{ "AddHandler", add_handler, NULL, OR_FILEINFO, ITERATE2,
"a handler name followed by one or more file extensions" },
+ { "ForceType", set_string_slot, (void*)XtOffsetOf(mime_dir_config, type),
+ OR_FILEINFO, TAKE1, "a media type" },
+ { "SetHandler", set_string_slot, (void*)XtOffsetOf(mime_dir_config,
handler),
+ OR_FILEINFO, TAKE1, "a handler name" },
{ "TypesConfig", set_types_config, NULL, RSRC_CONF, TAKE1,
"the MIME types config file" },
{ NULL }
***************
*** 260,265 ****
--- 273,285 ----
}
}
+
+ /* Check for overrides with ForceType/SetHandler */
+
+ if (conf->type && strcmp(conf->type, "none"))
+ r->content_type = pstrdup(r->pool, conf->type);
+ if (conf->handler && strcmp(conf->handler, "none"))
+ r->handler = pstrdup(r->pool, conf->handler);
return OK;
}