aboutsummaryrefslogtreecommitdiffstats
path: root/net/http.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-04-02 00:24:07 +0200
committerKim Alvefur <zash@zash.se>2017-04-02 00:24:07 +0200
commit3e7bffe8c8c5c1ee0022dca4d1a5bb7b16d78b1b (patch)
tree145d8406bf680dceda67cb06b17afdeb1947a9da /net/http.lua
parent3e4952567c828aa7a475fa9bcc48f794d92fdf2c (diff)
downloadprosody-3e7bffe8c8c5c1ee0022dca4d1a5bb7b16d78b1b.tar.gz
prosody-3e7bffe8c8c5c1ee0022dca4d1a5bb7b16d78b1b.zip
net.http: Pass error all the way to callback
Diffstat (limited to 'net/http.lua')
-rw-r--r--net/http.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/http.lua b/net/http.lua
index dcf94bdd..2fd46db9 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -68,7 +68,7 @@ end
function listener.ondisconnect(conn, err)
local request = requests[conn];
if request and request.conn then
- request:reader(nil, err);
+ request:reader(nil, err or "closed");
end
requests[conn] = nil;
end
@@ -126,7 +126,7 @@ local function request(u, ex, callback)
local req = url.parse(u);
if not (req and req.host) then
- callback(nil, 0, req);
+ callback("invalid-url", 0, req);
return nil, "invalid-url";
end
@@ -190,7 +190,7 @@ local function request(u, ex, callback)
local handler, conn = server.addclient(host, port_number, listener, "*a", sslctx)
if not handler then
- callback(nil, 0, req);
+ callback(conn, 0, req);
return nil, conn;
end
req.handler, req.conn = handler, conn