29#define APR_WANT_STRFUNC
71#define MULTIMATCH_UNSET 0
72#define MULTIMATCH_ANY 1
73#define MULTIMATCH_NEGOTIATED 2
74#define MULTIMATCH_HANDLERS 4
75#define MULTIMATCH_FILTERS 8
111 '(',
')',
'<',
'>',
'@',
',',
';',
':',
112 '\\',
'"',
'/',
'[',
']',
'?',
'=',
116module AP_MODULE_DECLARE_DATA mime_module;
122 new->extension_mappings =
NULL;
123 new->remove_mappings =
NULL;
125 new->default_language =
NULL;
129 new->use_path_info = 2;
179 for (
i = 0;
i < remove->
nelts;
i++) {
202 base->extension_mappings,
207 if (
base->extension_mappings ==
NULL) {
211 new->extension_mappings =
base->extension_mappings;
218 new->extension_mappings =
223 if (
new->extension_mappings) {
227 new->remove_mappings =
NULL;
239 new->use_path_info =
base->use_path_info;
259 if (!
m->extension_mappings) {
299 if (!
m->remove_mappings) {
328 if (errmsg !=
NULL) {
334 return "Any is incompatible with NegotiatedOnly, "
335 "Filters and Handlers";
341 return "NegotiatedOnly is incompatible with Any, "
342 "Filters and Handlers";
349 return "Filters is incompatible with Any and NegotiatedOnly";
356 return "Handlers is incompatible with Any and NegotiatedOnly";
371 "a charset (e.g., iso-2022-jp), followed by one or more "
375 "an encoding (e.g., gzip), followed by one or more file extensions"),
378 "a handler name followed by one or more file extensions"),
381 "input filter name (or ; delimited names) followed by one or "
382 "more file extensions"),
385 "a language (e.g., fr), followed by one or more file extensions"),
388 "output filter name (or ; delimited names) followed by one or "
389 "more file extensions"),
392 "a mime type followed by one or more file extensions"),
395 "language to use for documents with no other language file extension"),
397 "NegotiatedOnly (default), Handlers and/or Filters, or Any"),
400 "one or more file extensions"),
403 "one or more file extensions"),
406 "one or more file extensions"),
409 "one or more file extensions"),
412 "one or more file extensions"),
415 "one or more file extensions"),
418 "one or more file extensions"),
420 "the MIME types config file"),
423 "Set to 'yes' to allow mod_mime to use path info for type checking"),
444 "Invalid mime types config path %s",
452 "could not open mime types config file %s.",
460 const char *
ll = l, *
ct;
487 for (; *
s ==
' ' || *
s ==
'\t' || *
s ==
'\n';
s++)
543 char *attribute, *
value;
566 "mod_mime: analyze_ct: cannot get media type from '%s'",
573 }
while (*cp && (*cp !=
'/') && !
apr_isspace(*cp) && (*cp !=
';'));
574 if (!*cp || (*cp ==
';')) {
576 "Cannot get media type from '%s'",
585 "mod_mime: analyze_ct: cannot get media type from '%s'",
589 ctp->type_len = cp -
ctp->type;
599 "Cannot get media subtype.");
605 }
while (*cp && !
apr_isspace(*cp) && (*cp !=
';'));
606 ctp->subtype_len = cp -
ctp->subtype;
618 if (cp ==
NULL || *cp ==
'\0') {
620 "Cannot get media parameter.");
627 while (cp !=
NULL && *cp !=
'\0') {
628 if (attribute ==
NULL) {
633 else if (*cp ==
' ' || *cp ==
'\t' || *cp ==
'\n') {
637 else if (*cp ==
'=') {
639 if (attribute ==
NULL || *attribute ==
'\0') {
641 "Cannot get media parameter.");
646 if (cp ==
NULL || *cp ==
'\0') {
648 "Cannot get media parameter.");
656 "Cannot get media parameter.");
671 while (
quoted && *cp !=
'\0') {
678 else if (*cp ==
'"') {
680 while (*cp ==
' ' || *cp ==
'\t' || *cp ==
'\n') {
683 if (*cp !=
';' && *cp !=
'\0') {
685 "Cannot get media parameter.");
692 "Cannot get media parameter.");
702 else if (*cp ==
'\0' || *cp ==
';') {
707 "Cannot get media parameter.");
715 "Cannot get media parameter.");
720 pp->attr = attribute;
813 while (*
fntmp ==
'.')
866 if (
exinfo->charset_type) {
867 charset =
exinfo->charset_type;
870 if (
exinfo->language_type) {
879 if (
exinfo->encoding_type) {
911 if (
exinfo->input_filters) {
921 if (
exinfo->output_filters) {
962 tmp +=
ctp->type_len;
965 tmp +=
ctp->subtype_len;
969 if (charset && !
strcmp(
pp->attr,
"charset")) {
990 if (charset && !
override) {
992 "; charset=", charset,
Symbol export macros and hook functions.
const char apr_size_t len
APR general purpose library routines.
APR Standard Headers Support.
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
#define ap_get_module_config(v, m)
#define AP_INIT_ITERATE2(directive, func, mconfig, where, help)
int ap_cfg_closefile(ap_configfile_t *cfp)
void ap_hook_post_config(ap_HOOK_post_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
apr_status_t ap_pcfg_openfile(ap_configfile_t **ret_cfg, apr_pool_t *p, const char *name)
#define AP_DECLARE_MODULE(foo)
#define AP_INIT_FLAG(directive, func, mconfig, where, help)
#define AP_INIT_ITERATE(directive, func, mconfig, where, help)
char * ap_server_root_relative(apr_pool_t *p, const char *fname)
const char * ap_set_string_slot(cmd_parms *cmd, void *struct_ptr, const char *arg)
#define ap_set_module_config(v, m, val)
const char * ap_set_flag_slot(cmd_parms *cmd, void *struct_ptr, int arg)
apr_status_t ap_cfg_getline(char *buf, apr_size_t bufsize, ap_configfile_t *cfp)
#define AP_TYPES_CONFIG_FILE
ap_filter_t * ap_add_input_filter(const char *name, void *ctx, request_rec *r, conn_rec *c)
ap_filter_t * ap_add_output_filter(const char *name, void *ctx, request_rec *r, conn_rec *c)
void ap_set_content_type_ex(request_rec *r, const char *ct, int trusted)
void ap_hook_type_checker(ap_HOOK_type_checker_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
#define AP_REQUEST_IS_TRUSTED_CT(r)
apr_file_t apr_off_t start
apr_pool_t apr_dbd_t apr_dbd_results_t ** res
#define HTTP_INTERNAL_SERVER_ERROR
#define STANDARD20_MODULE_STUFF
char * ap_getword(apr_pool_t *p, const char **line, char stop)
#define ap_strrchr_c(s, c)
#define ap_strchr_c(s, c)
void ap_str_tolower(char *s)
char * ap_getword_conf(apr_pool_t *p, const char **line)
const char * ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
apr_seek_where_t apr_off_t * offset
int strcasecmp(const char *a, const char *b)
#define APR_HASH_KEY_STRING
apr_vformatter_buff_t * c
#define apr_pcalloc(p, size)
static void remove_items(apr_pool_t *p, apr_array_header_t *remove, apr_hash_t *mappings)
static const char * multiviews_match(cmd_parms *cmd, void *m_, const char *include)
static int mime_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
static const char * remove_extension_type(cmd_parms *cmd, void *m_, const char *ext)
static char * zap_sp_and_dup(apr_pool_t *p, const char *start, const char *end, apr_size_t *len)
static void * overlay_extension_mappings(apr_pool_t *p, const void *key, apr_ssize_t klen, const void *overlay_val, const void *base_val, const void *data)
#define MULTIMATCH_HANDLERS
#define MULTIMATCH_FILTERS
static content_type * analyze_ct(request_rec *r, const char *s)
static const char * zap_sp(const char *s)
static const char * add_extension_info(cmd_parms *cmd, void *m_, const char *value_, const char *ext)
static apr_hash_t * mime_type_extensions
static void register_hooks(apr_pool_t *p)
#define MULTIMATCH_NEGOTIATED
static const char * remove_extension_info(cmd_parms *cmd, void *m_, const char *ext)
static void * create_mime_dir_config(apr_pool_t *p, char *dummy)
static const char * set_types_config(cmd_parms *cmd, void *dummy, const char *arg)
static int is_token(char c)
static int is_qtext(char c)
static int is_quoted_pair(const char *s)
static int find_ct(request_rec *r)
static void * merge_mime_dir_configs(apr_pool_t *p, void *basev, void *addv)
static const command_rec mime_cmds[]
apr_hash_t * extension_mappings
apr_array_header_t * remove_mappings
A structure that represents the current request.
apr_array_header_t * content_languages
const char * content_type
struct ap_conf_vector_t * per_dir_config
const char * content_encoding
A structure to store information for each virtual server.
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray