summaryrefslogtreecommitdiff
path: root/bin/gitano-smart-http.cgi.in
diff options
context:
space:
mode:
authorRichard Ipsum <richardipsum@fastmail.co.uk>2015-07-10 22:13:29 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-10-30 18:54:37 +0100
commit25ba9b74ee5eeddf7cbc6a9c3d3770bbf9653d7f (patch)
tree4d1fcbaafa743bf4bef15867f9cabae571ac5c06 /bin/gitano-smart-http.cgi.in
parent8e29fb9c131a7e77eb15423d76acbc2df2c4c907 (diff)
downloadgitano-25ba9b74ee5eeddf7cbc6a9c3d3770bbf9653d7f.tar.gz
Fix empty command bug
This fixes a bug that causes gitano to crash when it's given an empty command list Opening and closing of the log should be done in the application, so it can log before checking for authorization, log after, and clean up at the end
Diffstat (limited to 'bin/gitano-smart-http.cgi.in')
-rwxr-xr-xbin/gitano-smart-http.cgi.in10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/gitano-smart-http.cgi.in b/bin/gitano-smart-http.cgi.in
index f294b28..6f8fdee 100755
--- a/bin/gitano-smart-http.cgi.in
+++ b/bin/gitano-smart-http.cgi.in
@@ -59,8 +59,14 @@ if request_method == "GET" or request_method == "POST" then
local user = os.getenv("REMOTE_USER") or "gitano/anonymous"
local cmdline = parse_request(request_method)
+ local start_log_level = gitano.log.get_level()
+ gitano.log.cap_level(gitano.log.level.INFO)
+ local transactionid = gitano.log.syslog.open()
+
if cmdline and gitano.auth.is_authorized(user, "http", cmdline,
- os.getenv("GITANO_ROOT")) then
+ os.getenv("GITANO_ROOT"),
+ transactionid,
+ start_log_level) then
local proc = subprocess.spawn_simple({"git", "http-backend"})
local exit_code
@@ -72,6 +78,8 @@ if request_method == "GET" or request_method == "POST" then
else
stdout:write("Status: 403 Forbidden\r\n\r\n")
end
+
+ gitano.log.syslog.close()
else
stdout:write("Status: 405 Method Not Allowed\r\n")
stdout:write("Allow: GET, POST\r\n\r\n")