Software /
code /
prosody
Changeset
4471:ea24d73e6c94
net.http: Pass response object to callbacks (feels hacky, should this be passed *instead of* the request?)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 17 Jan 2012 00:30:52 +0000 |
parents | 4470:0209bd5c4259 |
children | 4472:9a4a82629bf3 4476:53ce21286b8c |
files | net/http.lua |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/net/http.lua Fri Jan 13 23:30:32 2012 +0000 +++ b/net/http.lua Tue Jan 17 00:30:52 2012 +0000 @@ -70,7 +70,7 @@ local function success_cb(r) if request.callback then for k,v in pairs(r) do request[k] = v; end - request.callback(r.body, r.code, request); + request.callback(r.body, r.code, request, r); request.callback = nil; end destroy_request(request); @@ -148,7 +148,7 @@ req.handler, req.conn = server.wrapclient(conn, req.host, port, listener, "*a", using_https and { mode = "client", protocol = "sslv23" }); req.write = function (...) return req.handler:write(...); end - req.callback = function (content, code, request) log("debug", "Calling callback, status %s", code or "---"); return select(2, xpcall(function () return callback(content, code, request) end, handleerr)); end + req.callback = function (content, code, request, response) log("debug", "Calling callback, status %s", code or "---"); return select(2, xpcall(function () return callback(content, code, request, response) end, handleerr)); end req.reader = request_reader; req.state = "status";