aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
diff options
context:
space:
mode:
Diffstat (limited to 'cgit.c')
-rw-r--r--cgit.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index cb1149d..7b228af 100644
--- a/cgit.c
+++ b/cgit.c
@@ -17,6 +17,14 @@
17 17
18const char *cgit_version = CGIT_VERSION; 18const char *cgit_version = CGIT_VERSION;
19 19
20void add_mimetype(const char *name, const char *value)
21{
22 struct string_list_item *item;
23
24 item = string_list_insert(xstrdup(name), &ctx.cfg.mimetypes);
25 item->util = xstrdup(value);
26}
27
20struct cgit_filter *new_filter(const char *cmd, int extra_args) 28struct cgit_filter *new_filter(const char *cmd, int extra_args)
21{ 29{
22 struct cgit_filter *f; 30 struct cgit_filter *f;
@@ -66,6 +74,8 @@ void config_cb(const char *name, const char *value)
66 ctx.cfg.virtual_root = ""; 74 ctx.cfg.virtual_root = "";
67 } else if (!strcmp(name, "nocache")) 75 } else if (!strcmp(name, "nocache"))
68 ctx.cfg.nocache = atoi(value); 76 ctx.cfg.nocache = atoi(value);
77 else if (!strcmp(name, "noplainemail"))
78 ctx.cfg.noplainemail = atoi(value);
69 else if (!strcmp(name, "noheader")) 79 else if (!strcmp(name, "noheader"))
70 ctx.cfg.noheader = atoi(value); 80 ctx.cfg.noheader = atoi(value);
71 else if (!strcmp(name, "snapshots")) 81 else if (!strcmp(name, "snapshots"))
@@ -122,6 +132,8 @@ void config_cb(const char *name, const char *value)
122 ctx.cfg.clone_prefix = xstrdup(value); 132 ctx.cfg.clone_prefix = xstrdup(value);
123 else if (!strcmp(name, "local-time")) 133 else if (!strcmp(name, "local-time"))
124 ctx.cfg.local_time = atoi(value); 134 ctx.cfg.local_time = atoi(value);
135 else if (!prefixcmp(name, "mimetype."))
136 add_mimetype(name + 9, value);
125 else if (!strcmp(name, "repo.group")) 137 else if (!strcmp(name, "repo.group"))
126 ctx.cfg.repo_group = xstrdup(value); 138 ctx.cfg.repo_group = xstrdup(value);
127 else if (!strcmp(name, "repo.url")) 139 else if (!strcmp(name, "repo.url"))
@@ -240,6 +252,7 @@ static void prepare_context(struct cgit_context *ctx)
240 ctx->page.modified = time(NULL); 252 ctx->page.modified = time(NULL);
241 ctx->page.expires = ctx->page.modified; 253 ctx->page.expires = ctx->page.modified;
242 ctx->page.etag = NULL; 254 ctx->page.etag = NULL;
255 memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list));
243} 256}
244 257
245struct refmatch { 258struct refmatch {