X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=http-backend.c;h=d1e83d0906dbc9d677630cdf74615ec3f9dfc46d;hb=6106ce4669051f1f4d3d21a2b22d24747e643147;hp=f729488fc5f787c0f4997aacdd1bb14732d717f7;hpb=a598331f952b5bd89f72fcf20a44ab3aa2918b3f;p=git.git diff --git a/http-backend.c b/http-backend.c index f729488fc..d1e83d090 100644 --- a/http-backend.c +++ b/http-backend.c @@ -538,15 +538,19 @@ static void service_rpc(char *service_name) static NORETURN void die_webcgi(const char *err, va_list params) { - char buffer[1000]; + static int dead; - http_status(500, "Internal Server Error"); - hdr_nocache(); - end_headers(); + if (!dead) { + char buffer[1000]; + dead = 1; - vsnprintf(buffer, sizeof(buffer), err, params); - fprintf(stderr, "fatal: %s\n", buffer); - exit(0); + vsnprintf(buffer, sizeof(buffer), err, params); + fprintf(stderr, "fatal: %s\n", buffer); + http_status(500, "Internal Server Error"); + hdr_nocache(); + end_headers(); + } + exit(0); /* we successfully reported a failure ;-) */ } static char* getdir(void) @@ -648,6 +652,9 @@ int main(int argc, char **argv) setup_path(); if (!enter_repo(dir, 0)) not_found("Not a git repository: '%s'", dir); + if (!getenv("GIT_HTTP_EXPORT_ALL") && + access("git-daemon-export-ok", F_OK) ) + not_found("Repository not exported: '%s'", dir); git_config(http_config, NULL); cmd->imp(cmd_arg);