Commit 111b381b authored by Robert Ricci's avatar Robert Ricci

Return proper http status codes

parent 3883f938
...@@ -89,7 +89,6 @@ if (!$debug) { ...@@ -89,7 +89,6 @@ if (!$debug) {
open(STDERR, ">&STDOUT") || die "can't dup stdout: $!"; open(STDERR, ">&STDOUT") || die "can't dup stdout: $!";
} }
# #
# Main loop - pretty simple! # Main loop - pretty simple!
# #
...@@ -116,7 +115,18 @@ while (my $connection = $listen_socket->accept()) { ...@@ -116,7 +115,18 @@ while (my $connection = $listen_socket->accept()) {
} }
# Child # 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($$) { ...@@ -228,7 +238,7 @@ sub run_gitmail($$) {
# #
# Done! # Done!
# #
return 0; return 1;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment