aboutsummaryrefslogtreecommitdiff
path: root/httpd/httpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'httpd/httpd.c')
-rw-r--r--httpd/httpd.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/httpd/httpd.c b/httpd/httpd.c
index 5f6788c..cc67865 100644
--- a/httpd/httpd.c
+++ b/httpd/httpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.c,v 1.37 2015/06/03 02:24:36 millert Exp $ */
+/* $OpenBSD: httpd.c,v 1.38 2015/07/18 06:00:43 reyk Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
@@ -1217,7 +1217,7 @@ media_purge(struct mediatypes *types)
}
struct media_type *
-media_find(struct mediatypes *types, char *file)
+media_find(struct mediatypes *types, const char *file)
{
struct media_type *match, media;
char *p;
@@ -1241,6 +1241,21 @@ media_find(struct mediatypes *types, char *file)
return (match);
}
+struct media_type *
+media_find_config(struct httpd *env, struct server_config *srv_conf,
+ const char *file)
+{
+ struct media_type *match;
+
+ if ((match = media_find(env->sc_mediatypes, file)) != NULL)
+ return (match);
+ else if (srv_conf->flags & SRVFLAG_DEFAULT_TYPE)
+ return (&srv_conf->default_type);
+
+ /* fallback to the global default type */
+ return (&env->sc_default_type);
+}
+
int
media_cmp(struct media_type *a, struct media_type *b)
{