diff options
Diffstat (limited to '')
-rw-r--r-- | ui-clone.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -77,8 +77,22 @@ static void send_file(const char *path) html_include(path); } +static void dispatch_to_git_http_backend(void) +{ + if (execl(ctx.cfg.http_backend_path, "git-http-backend", NULL) == -1) { + fprintf(stderr, "[cgit] http-backend-path (%s) could not be spawned: %s\n", + ctx.cfg.http_backend_path, strerror(errno)); + cgit_print_error_page(500, "Internal Server Error", "Internal Server Error"); + } +} + void cgit_clone_info(void) { + if (ctx.cfg.http_backend_path) { + dispatch_to_git_http_backend(); + return; + } + if (!ctx.qry.path || strcmp(ctx.qry.path, "refs")) { cgit_print_error_page(400, "Bad request", "Bad request"); return; @@ -94,6 +108,11 @@ void cgit_clone_objects(void) { char *p; + if (ctx.cfg.http_backend_path) { + dispatch_to_git_http_backend(); + return; + } + if (!ctx.qry.path) goto err; @@ -122,5 +141,30 @@ err: void cgit_clone_head(void) { + if (ctx.cfg.http_backend_path) { + dispatch_to_git_http_backend(); + return; + } + send_file(git_path("%s", "HEAD")); } + +void cgit_clone_git_upload_pack(void) +{ + if (ctx.cfg.http_backend_path) { + dispatch_to_git_http_backend(); + return; + } + + cgit_print_error_page(404, "Not found", "Not found"); +} + +void cgit_clone_git_receive_pack(void) +{ + if (ctx.cfg.http_backend_path) { + dispatch_to_git_http_backend(); + return; + } + + cgit_print_error_page(404, "Not found", "Not found"); +} |