author | Georg Lukas <georg@op-co.de> | 2009-11-28 02:44:33 (UTC) |
---|---|---|
committer | Georg Lukas <georg@op-co.de> | 2009-11-28 02:44:33 (UTC) |
commit | ef07ccc72da0270e9298c36046a0187dc359b0da (patch) (unidiff) | |
tree | 57a2ffdeb929d9b4ed44dfae3a1fb7ca550aac63 /cgit.c | |
parent | 545b5a5dcae2a0c322381493ee90f6c37353da9c (diff) | |
download | cgit-ef07ccc72da0270e9298c36046a0187dc359b0da.zip cgit-ef07ccc72da0270e9298c36046a0187dc359b0da.tar.gz cgit-ef07ccc72da0270e9298c36046a0187dc359b0da.tar.bz2 |
"max-blob-size" config var to limit generated HTML size
Sometimes it is not feasible to generate the HTML pretty-print for large
files, especially if a source-filter is involved or binary data is to be
displayed. The "max-blob-size" config var allows to disable HTML output
for blobs bigger than X KBytes. Plain downloads are not affected.
Signed-off-by: Georg Lukas <georg@op-co.de>
-rw-r--r-- | cgit.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -162,12 +162,14 @@ void config_cb(const char *name, const char *value) | |||
162 | else if (!strcmp(name, "embedded")) | 162 | else if (!strcmp(name, "embedded")) |
163 | ctx.cfg.embedded = atoi(value); | 163 | ctx.cfg.embedded = atoi(value); |
164 | else if (!strcmp(name, "max-message-length")) | 164 | else if (!strcmp(name, "max-message-length")) |
165 | ctx.cfg.max_msg_len = atoi(value); | 165 | ctx.cfg.max_msg_len = atoi(value); |
166 | else if (!strcmp(name, "max-repodesc-length")) | 166 | else if (!strcmp(name, "max-repodesc-length")) |
167 | ctx.cfg.max_repodesc_len = atoi(value); | 167 | ctx.cfg.max_repodesc_len = atoi(value); |
168 | else if (!strcmp(name, "max-blob-size")) | ||
169 | ctx.cfg.max_blob_size = atoi(value); | ||
168 | else if (!strcmp(name, "max-repo-count")) | 170 | else if (!strcmp(name, "max-repo-count")) |
169 | ctx.cfg.max_repo_count = atoi(value); | 171 | ctx.cfg.max_repo_count = atoi(value); |
170 | else if (!strcmp(name, "max-commit-count")) | 172 | else if (!strcmp(name, "max-commit-count")) |
171 | ctx.cfg.max_commit_count = atoi(value); | 173 | ctx.cfg.max_commit_count = atoi(value); |
172 | else if (!strcmp(name, "scan-path")) | 174 | else if (!strcmp(name, "scan-path")) |
173 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) | 175 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
@@ -267,12 +269,13 @@ static void prepare_context(struct cgit_context *ctx) | |||
267 | ctx->cfg.enable_tree_linenumbers = 1; | 269 | ctx->cfg.enable_tree_linenumbers = 1; |
268 | ctx->cfg.max_repo_count = 50; | 270 | ctx->cfg.max_repo_count = 50; |
269 | ctx->cfg.max_commit_count = 50; | 271 | ctx->cfg.max_commit_count = 50; |
270 | ctx->cfg.max_lock_attempts = 5; | 272 | ctx->cfg.max_lock_attempts = 5; |
271 | ctx->cfg.max_msg_len = 80; | 273 | ctx->cfg.max_msg_len = 80; |
272 | ctx->cfg.max_repodesc_len = 80; | 274 | ctx->cfg.max_repodesc_len = 80; |
275 | ctx->cfg.max_blob_size = 0; | ||
273 | ctx->cfg.max_stats = 0; | 276 | ctx->cfg.max_stats = 0; |
274 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 277 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
275 | ctx->cfg.renamelimit = -1; | 278 | ctx->cfg.renamelimit = -1; |
276 | ctx->cfg.robots = "index, nofollow"; | 279 | ctx->cfg.robots = "index, nofollow"; |
277 | ctx->cfg.root_title = "Git repository browser"; | 280 | ctx->cfg.root_title = "Git repository browser"; |
278 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; | 281 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |