X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=http-backend.c;h=d1e83d0906dbc9d677630cdf74615ec3f9dfc46d;hb=f9bdf9b2102bd848c7a3eabff2ba5af63828de54;hp=f729488fc5f787c0f4997aacdd1bb14732d717f7;hpb=7b576f9910a2945688f04f6ff9d03771f2956618;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);