aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-04-08 17:22:15 +0100
committerMatthew Wild <mwild1@gmail.com>2013-04-08 17:22:15 +0100
commit94b629076096ad83c60c01af607d3aee160584b4 (patch)
treeb63f60f6dff8c647f5952a2a92bb0a1da8d2a94f
parent308088b1faaf9a50df3432378e0bc4be52b35ab3 (diff)
parent7e9a5cc5a36ae7d653836615143b5a78a505bfed (diff)
downloadprosody-94b629076096ad83c60c01af607d3aee160584b4.tar.gz
prosody-94b629076096ad83c60c01af607d3aee160584b4.zip
Merge 0.9->trunk
-rw-r--r--core/s2smanager.lua9
-rw-r--r--core/sessionmanager.lua11
-rw-r--r--net/http.lua5
-rw-r--r--plugins/mod_posix.lua10
-rw-r--r--util-src/pposix.c11
5 files changed, 19 insertions, 27 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index 5777cb8e..e4de498a 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -24,15 +24,8 @@ local fire_event = prosody.events.fire_event;
module "s2smanager"
-local open_sessions = 0;
-
function new_incoming(conn)
local session = { conn = conn, type = "s2sin_unauthed", direction = "incoming", hosts = {} };
- if true then
- session.trace = newproxy(true);
- getmetatable(session.trace).__gc = function () open_sessions = open_sessions - 1; end;
- end
- open_sessions = open_sessions + 1;
session.log = logger_init("s2sin"..tostring(session):match("[a-f0-9]+$"));
incoming_s2s[session] = true;
return session;
@@ -62,7 +55,7 @@ local resting_session = { -- Resting, not dead
function retire_session(session, reason)
local log = session.log or log;
for k in pairs(session) do
- if k ~= "trace" and k ~= "log" and k ~= "id" and k ~= "conn" then
+ if k ~= "log" and k ~= "id" and k ~= "conn" then
session[k] = nil;
end
end
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index e721835d..d178fb2d 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -29,17 +29,8 @@ local getmetatable = getmetatable;
module "sessionmanager"
-local open_sessions = 0;
-
function new_session(conn)
local session = { conn = conn, type = "c2s_unauthed", conntime = gettime() };
- if true then
- session.trace = newproxy(true);
- getmetatable(session.trace).__gc = function () open_sessions = open_sessions - 1; end;
- end
- open_sessions = open_sessions + 1;
- log("debug", "open sessions now: %d", open_sessions);
-
local filter = initialize_filters(session);
local w = conn.write;
session.send = function (t)
@@ -72,7 +63,7 @@ local resting_session = { -- Resting, not dead
function retire_session(session)
local log = session.log or log;
for k in pairs(session) do
- if k ~= "trace" and k ~= "log" and k ~= "id" then
+ if k ~= "log" and k ~= "id" then
session[k] = nil;
end
end
diff --git a/net/http.lua b/net/http.lua
index a1e4e523..ec55af92 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -11,6 +11,8 @@ local b64 = require "util.encodings".base64.encode;
local url = require "socket.url"
local httpstream_new = require "util.httpstream".new;
+local ssl_available = pcall(require, "ssl");
+
local server = require "net.server"
local t_insert, t_concat = table.insert, table.concat;
@@ -177,6 +179,9 @@ function request(u, ex, callback)
req.method, req.headers, req.body = method, headers, body;
local using_https = req.scheme == "https";
+ if using_https and not ssl_available then
+ error("SSL not available, unable to contact https URL");
+ end
local port = tonumber(req.port) or (using_https and 443 or 80);
-- Connect the socket, and wrap it with net.server
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua
index e871e5cf..28fd7f38 100644
--- a/plugins/mod_posix.lua
+++ b/plugins/mod_posix.lua
@@ -7,10 +7,12 @@
--
-local want_pposix_version = "0.3.5";
+local want_pposix_version = "0.3.6";
local pposix = assert(require "util.pposix");
-if pposix._VERSION ~= want_pposix_version then module:log("warn", "Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version); end
+if pposix._VERSION ~= want_pposix_version then
+ module:log("warn", "Unknown version (%s) of binary pposix module, expected %s. Perhaps you need to recompile?", tostring(pposix._VERSION), want_pposix_version);
+end
local signal = select(2, pcall(require, "util.signal"));
if type(signal) == "string" then
@@ -118,9 +120,9 @@ function syslog_sink_maker(config)
local syslog, format = pposix.syslog_log, string.format;
return function (name, level, message, ...)
if ... then
- syslog(level, format(message, ...));
+ syslog(level, name, format(message, ...));
else
- syslog(level, message);
+ syslog(level, name, message);
end
end;
end
diff --git a/util-src/pposix.c b/util-src/pposix.c
index 99a308cf..f5cc8270 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -13,7 +13,7 @@
* POSIX support functions for Lua
*/
-#define MODULE_VERSION "0.3.5"
+#define MODULE_VERSION "0.3.6"
#include <stdlib.h>
#include <math.h>
@@ -204,12 +204,13 @@ int level_constants[] = {
};
int lc_syslog_log(lua_State* L)
{
- int level = luaL_checkoption(L, 1, "notice", level_strings);
- level = level_constants[level];
+ int level = level_constants[luaL_checkoption(L, 1, "notice", level_strings)];
- luaL_checkstring(L, 2);
+ if(lua_gettop(L) == 3)
+ syslog(level, "%s: %s", luaL_checkstring(L, 2), luaL_checkstring(L, 3));
+ else
+ syslog(level, "%s", lua_tostring(L, 2));
- syslog(level, "%s", lua_tostring(L, 2));
return 0;
}