Software /
code /
prosody
Changeset
5453:116971a751d3
Merge 0.9->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 08 Apr 2013 17:22:15 +0100 |
parents | 5446:51686426cac2 (current diff) 5452:edf3db386a19 (diff) |
children | 5455:16493e410fa8 |
files | |
diffstat | 5 files changed, 19 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/core/s2smanager.lua Mon Apr 08 15:32:51 2013 +0100 +++ b/core/s2smanager.lua Mon Apr 08 17:22:15 2013 +0100 @@ -24,15 +24,8 @@ 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 @@ 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
--- a/core/sessionmanager.lua Mon Apr 08 15:32:51 2013 +0100 +++ b/core/sessionmanager.lua Mon Apr 08 17:22:15 2013 +0100 @@ -29,17 +29,8 @@ 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 @@ 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
--- a/net/http.lua Mon Apr 08 15:32:51 2013 +0100 +++ b/net/http.lua Mon Apr 08 17:22:15 2013 +0100 @@ -11,6 +11,8 @@ 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 @@ 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
--- a/plugins/mod_posix.lua Mon Apr 08 15:32:51 2013 +0100 +++ b/plugins/mod_posix.lua Mon Apr 08 17:22:15 2013 +0100 @@ -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 @@ 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
--- a/util-src/pposix.c Mon Apr 08 15:32:51 2013 +0100 +++ b/util-src/pposix.c Mon Apr 08 17:22:15 2013 +0100 @@ -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 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; }