aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/http.lua8
-rw-r--r--net/http/server.lua4
2 files changed, 6 insertions, 6 deletions
diff --git a/net/http.lua b/net/http.lua
index 639ecf6a..3b783a41 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -17,9 +17,9 @@ local ssl_available = pcall(require, "ssl");
local server = require "net.server"
local t_insert, t_concat = table.insert, table.concat;
-local pairs, ipairs = pairs, ipairs;
-local tonumber, tostring, xpcall, select, debug_traceback, char, format =
- tonumber, tostring, xpcall, select, debug.traceback, string.char, string.format;
+local pairs = pairs;
+local tonumber, tostring, xpcall, select, traceback =
+ tonumber, tostring, xpcall, select, debug.traceback;
local log = require "util.logger".init("http");
@@ -101,7 +101,7 @@ local function request_reader(request, data, err)
request.parser:feed(data);
end
-local function handleerr(err) log("error", "Traceback[http]: %s: %s", tostring(err), debug_traceback()); end
+local function handleerr(err) log("error", "Traceback[http]: %s", traceback(tostring(err), 2)); end
function request(u, ex, callback)
local req = url.parse(u);
diff --git a/net/http/server.lua b/net/http/server.lua
index 577b05ef..dec7da19 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -9,7 +9,7 @@ local pairs = pairs;
local s_upper = string.upper;
local setmetatable = setmetatable;
local xpcall = xpcall;
-local debug = debug;
+local traceback = debug.traceback;
local tostring = tostring;
local codes = require "net.http.codes";
@@ -88,7 +88,7 @@ local _1, _2, _3;
local function _handle_request() return handle_request(_1, _2, _3); end
local last_err;
-local function _traceback_handler(err) last_err = err; log("error", "Traceback[http]: %s: %s", tostring(err), debug.traceback()); end
+local function _traceback_handler(err) last_err = err; log("error", "Traceback[httpserver]: %s", traceback(tostring(err), 2)); end
events.add_handler("http-error", function (error)
return "Error processing request: "..codes[error.code]..". Check your error log for more information.";
end, -1);