diff options
Diffstat (limited to 'cgit.c')
-rw-r--r-- | cgit.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -147,6 +147,8 @@ void config_cb(const char *name, const char *value) | |||
147 | ctx.cfg.enable_filter_overrides = atoi(value); | 147 | ctx.cfg.enable_filter_overrides = atoi(value); |
148 | else if (!strcmp(name, "enable-gitweb-owner")) | 148 | else if (!strcmp(name, "enable-gitweb-owner")) |
149 | ctx.cfg.enable_gitweb_owner = atoi(value); | 149 | ctx.cfg.enable_gitweb_owner = atoi(value); |
150 | else if (!strcmp(name, "enable-http-clone")) | ||
151 | ctx.cfg.enable_http_clone = atoi(value); | ||
150 | else if (!strcmp(name, "enable-index-links")) | 152 | else if (!strcmp(name, "enable-index-links")) |
151 | ctx.cfg.enable_index_links = atoi(value); | 153 | ctx.cfg.enable_index_links = atoi(value); |
152 | else if (!strcmp(name, "enable-commit-graph")) | 154 | else if (!strcmp(name, "enable-commit-graph")) |
@@ -312,6 +314,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
312 | ctx->cfg.logo = "/cgit.png"; | 314 | ctx->cfg.logo = "/cgit.png"; |
313 | ctx->cfg.local_time = 0; | 315 | ctx->cfg.local_time = 0; |
314 | ctx->cfg.enable_gitweb_owner = 1; | 316 | ctx->cfg.enable_gitweb_owner = 1; |
317 | ctx->cfg.enable_http_clone = 1; | ||
315 | ctx->cfg.enable_tree_linenumbers = 1; | 318 | ctx->cfg.enable_tree_linenumbers = 1; |
316 | ctx->cfg.max_repo_count = 50; | 319 | ctx->cfg.max_repo_count = 50; |
317 | ctx->cfg.max_commit_count = 50; | 320 | ctx->cfg.max_commit_count = 50; |
@@ -439,7 +442,7 @@ static int prepare_repo_cmd(struct cgit_context *ctx) | |||
439 | tmp = xstrdup(ctx->qry.head); | 442 | tmp = xstrdup(ctx->qry.head); |
440 | ctx->qry.head = ctx->repo->defbranch; | 443 | ctx->qry.head = ctx->repo->defbranch; |
441 | ctx->page.status = 404; | 444 | ctx->page.status = 404; |
442 | ctx->page.statusmsg = "not found"; | 445 | ctx->page.statusmsg = "Not found"; |
443 | cgit_print_http_headers(ctx); | 446 | cgit_print_http_headers(ctx); |
444 | cgit_print_docstart(ctx); | 447 | cgit_print_docstart(ctx); |
445 | cgit_print_pageheader(ctx); | 448 | cgit_print_pageheader(ctx); |
@@ -458,6 +461,8 @@ static void process_request(void *cbdata) | |||
458 | cmd = cgit_get_cmd(ctx); | 461 | cmd = cgit_get_cmd(ctx); |
459 | if (!cmd) { | 462 | if (!cmd) { |
460 | ctx->page.title = "cgit error"; | 463 | ctx->page.title = "cgit error"; |
464 | ctx->page.status = 404; | ||
465 | ctx->page.statusmsg = "Not found"; | ||
461 | cgit_print_http_headers(ctx); | 466 | cgit_print_http_headers(ctx); |
462 | cgit_print_docstart(ctx); | 467 | cgit_print_docstart(ctx); |
463 | cgit_print_pageheader(ctx); | 468 | cgit_print_pageheader(ctx); |
@@ -466,6 +471,11 @@ static void process_request(void *cbdata) | |||
466 | return; | 471 | return; |
467 | } | 472 | } |
468 | 473 | ||
474 | if (!ctx->cfg.enable_http_clone && cmd->is_clone) { | ||
475 | html_status(404, "Not found", 0); | ||
476 | return; | ||
477 | } | ||
478 | |||
469 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" | 479 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" |
470 | * in-project path limit to be made available at ctx->qry.vpath. | 480 | * in-project path limit to be made available at ctx->qry.vpath. |
471 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). | 481 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). |