summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-05-30 13:56:13 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2016-05-30 13:56:13 +0100
commitdba74f394e9e35d81c5ae6419fd9ccb0715a8547 (patch)
treedd910896f7bba86cdc6dc71d350397912688ac94 /lib
parent705bd90caf11f97943374a14fa898a82f3ca52a9 (diff)
downloadgitano-dba74f394e9e35d81c5ae6419fd9ccb0715a8547.tar.gz
Ensure curl operations are pcall'd
Diffstat (limited to 'lib')
-rw-r--r--lib/gitano/actions.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitano/actions.lua b/lib/gitano/actions.lua
index 06b5af7..264fa48 100644
--- a/lib/gitano/actions.lua
+++ b/lib/gitano/actions.lua
@@ -42,7 +42,7 @@ local function update_actions(conf, repo, tags)
return true
end
-local function curl_txn(url, headers, body, content_type)
+local function _curl_txn(url, headers, body, content_type)
local method = (body and body ~= "") and "POST" or "GET"
local args = { "curl", "--max-filesize", tostring(1024*1024),
"--insecure", "-X", method, "-D-", "-s" }
@@ -90,6 +90,13 @@ local function curl_txn(url, headers, body, content_type)
return code, msg, headers, content
end
+local function curl_txn(...)
+ local ok, code, msg, headers, content = pcall(_curl_txn, ...)
+ if not ok then
+ code, msg, headers, content = "500", code, {}, ""
+ end
+ return code, msg, headers, content
+end
local function http_get(host, path)
log.warn("Hook using legacy http_get or http.get, please update to use new fetch() interface")