aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-12-16 23:32:11 +0000
committerMatthew Wild <mwild1@gmail.com>2013-12-16 23:32:11 +0000
commitbcc1c1a7d3db5accfe856b511ef946446b929312 (patch)
tree19fa0823b9f58cbf86368625aef15c98eeb8fe8b
parent975be94ee27690746706dfc360730ae0fbb8f754 (diff)
parentceba28fe83e3c5692701f22ce1ea4def69271f9e (diff)
downloadprosody-bcc1c1a7d3db5accfe856b511ef946446b929312.tar.gz
prosody-bcc1c1a7d3db5accfe856b511ef946446b929312.zip
Merge 0.9->0.10
-rw-r--r--net/http.lua3
-rw-r--r--net/server_select.lua6
2 files changed, 3 insertions, 6 deletions
diff --git a/net/http.lua b/net/http.lua
index 5ec3163c..ab9ec7b6 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -20,6 +20,7 @@ local t_insert, t_concat = table.insert, table.concat;
local pairs = pairs;
local tonumber, tostring, xpcall, select, traceback =
tonumber, tostring, xpcall, select, debug.traceback;
+local assert, error = assert, error
local log = require "util.logger".init("http");
@@ -173,7 +174,7 @@ function request(u, ex, callback)
sslctx = ex and ex.sslctx or { mode = "client", protocol = "sslv23", options = { "no_sslv2" } };
end
- req.handler, req.conn = server.wrapclient(conn, host, port_number, listener, "*a", sslctx);
+ req.handler, req.conn = assert(server.wrapclient(conn, host, port_number, listener, "*a", sslctx));
req.write = function (...) return req.handler:write(...); 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
diff --git a/net/server_select.lua b/net/server_select.lua
index 4721d6ad..c5e0772f 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -920,13 +920,9 @@ local wrapclient = function( socket, ip, serverport, listeners, pattern, sslctx
-- When socket is writeable, call onconnect
local _sendbuffer = handler.sendbuffer;
handler.sendbuffer = function ()
- _sendlistlen = removesocket( _sendlist, socket, _sendlistlen );
handler.sendbuffer = _sendbuffer;
listeners.onconnect(handler);
- -- If there was data with the incoming packet, handle it now.
- if #handler:bufferqueue() > 0 then
- return _sendbuffer();
- end
+ return _sendbuffer(); -- Send any queued outgoing data
end
end
end