From 111b381b0cfdb9d66c76bc5145442a0c448b6212 Mon Sep 17 00:00:00 2001 From: Robert Ricci Date: Wed, 4 Sep 2013 19:03:45 +0000 Subject: [PATCH] Return proper http status codes --- tools/git/gitmaild | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/git/gitmaild b/tools/git/gitmaild index 187cb9b24..15ded372b 100755 --- a/tools/git/gitmaild +++ b/tools/git/gitmaild @@ -89,7 +89,6 @@ if (!$debug) { open(STDERR, ">&STDOUT") || die "can't dup stdout: $!"; } - # # Main loop - pretty simple! # @@ -116,7 +115,18 @@ while (my $connection = $listen_socket->accept()) { } # Child - exit run_gitmail(decode_json($request->content()),\%get_vars); + my $rv = run_gitmail(decode_json($request->content()),\%get_vars); + + if ($rv == 0) { + $connection->send_error(RC_INTERNAL_SERVER_ERROR); + $connection->close(); + exit 1; + } else { + # This means it worked, but we are not going to return any + # content to the caller + $connection->send_status_line(RC_NO_CONTENT); + $connection->close(); + } } } @@ -228,7 +238,7 @@ sub run_gitmail($$) { # # Done! # - return 0; + return 1; } -- GitLab