summaryrefslogtreecommitdiffabout
path: root/cgit.c
Side-by-side diff
Diffstat (limited to 'cgit.c') (more/less context) (show whitespace changes)
-rw-r--r--cgit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 2039ab1..4f414c3 100644
--- a/cgit.c
+++ b/cgit.c
@@ -18,4 +18,12 @@
const char *cgit_version = CGIT_VERSION;
+void add_mimetype(const char *name, const char *value)
+{
+ struct string_list_item *item;
+
+ item = string_list_insert(xstrdup(name), &ctx.cfg.mimetypes);
+ item->util = xstrdup(value);
+}
+
void config_cb(const char *name, const char *value)
{
@@ -102,4 +110,6 @@ void config_cb(const char *name, const char *value)
else if (!strcmp(name, "local-time"))
ctx.cfg.local_time = atoi(value);
+ else if (!prefixcmp(name, "mimetype."))
+ add_mimetype(name + 9, value);
else if (!strcmp(name, "repo.group"))
ctx.cfg.repo_group = xstrdup(value);
@@ -214,4 +224,5 @@ static void prepare_context(struct cgit_context *ctx)
ctx->page.expires = ctx->page.modified;
ctx->page.etag = NULL;
+ memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list));
}