From 607ba9efcd69a23fdfd7177d61e138109b958261 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 23 Nov 2012 01:51:30 +0100 Subject: net.server_select: Better names for config options (thanks MattJ) --- net/server_select.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/net/server_select.lua b/net/server_select.lua index 9104dace..8cb4e235 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -749,16 +749,16 @@ changesettings = function( new ) if type( new ) ~= "table" then return nil, "invalid settings table" end - _selecttimeout = tonumber( new.timeout ) or _selecttimeout - _sleeptime = tonumber( new.sleeptime ) or _sleeptime - _maxsendlen = tonumber( new.maxsendlen ) or _maxsendlen - _maxreadlen = tonumber( new.maxreadlen ) or _maxreadlen - _checkinterval = tonumber( new.checkinterval ) or _checkinterval - _sendtimeout = tonumber( new.sendtimeout ) or _sendtimeout - _readtimeout = tonumber( new.readtimeout ) or _readtimeout - _cleanqueue = new.cleanqueue - _maxclientsperserver = new._maxclientsperserver or _maxclientsperserver - _maxsslhandshake = new._maxsslhandshake or _maxsslhandshake + _selecttimeout = tonumber( new.select_timeout ) or _selecttimeout + _sleeptime = tonumber( new.select_sleep_time ) or _sleeptime + _maxsendlen = tonumber( new.max_send_buffer_size ) or _maxsendlen + _maxreadlen = tonumber( new.max_receive_buffer_size ) or _maxreadlen + _checkinterval = tonumber( new.select_idle_check_interval ) or _checkinterval + _sendtimeout = tonumber( new.send_timeout ) or _sendtimeout + _readtimeout = tonumber( new.read_timeout ) or _readtimeout + _cleanqueue = new.select_clean_queue + _maxclientsperserver = new.max_connections or _maxclientsperserver + _maxsslhandshake = new.max_ssl_handshake_roundtrips or _maxsslhandshake return true end -- cgit v1.2.3 From ecd82d4f6106bf1d76f046f6a360a0ce084b1d1b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 23 Nov 2012 01:51:30 +0100 Subject: net.server: Make server_* configurable in the config file. --- net/server.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/net/server.lua b/net/server.lua index 3fad4b45..23c6f956 100644 --- a/net/server.lua +++ b/net/server.lua @@ -36,9 +36,41 @@ if use_luaevent then end end else + use_luaevent = false; server = require "net.server_select"; end +if prosody then + local config_get = require "core.configmanager".get; + local function load_config() + local settings = config_get("*", "core", "network_settings"); + if use_luaevent then + local event_settings = { + ACCEPT_DELAY = settings.event_accept_retry_interval; + CLEAR_DELAY = settings.event_clear_interval; + CONNECT_TIMEOUT = settings.connect_timeout; + DEBUG = settings.debug; + HANDSHAKE_TIMEOUT = settings.ssl_handshake_timeout; + MAX_CONNECTIONS = settings.max_connections; + MAX_HANDSHAKE_ATTEMPTS = settings.max_ssl_handshake_roundtrips; + MAX_READ_LENGTH = settings.max_receive_buffer_size; + MAX_SEND_LENGTH = settings.max_send_buffer_size; + READ_TIMEOUT = settings.read_timeout; + WRITE_TIMEOUT = settings.send_timeout; + }; + + for k, v in pairs(event_settings) do + server.cfg[k] = v; + end + return true; + else + return server.changesettings(settings); + end + end + load_config(); + prosody.events.add_handler("config-reloaded", load_config); +end + -- require "net.server" shall now forever return this, -- ie. server_select or server_event as chosen above. return server; -- cgit v1.2.3 From 22e8b30fef19893b4e521a9346b2b614486733f4 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 23 Nov 2012 17:16:22 +0100 Subject: net.server: Fix when no network_settings set and using libevent --- net/server.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/server.lua b/net/server.lua index 23c6f956..d80b8a18 100644 --- a/net/server.lua +++ b/net/server.lua @@ -43,7 +43,7 @@ end if prosody then local config_get = require "core.configmanager".get; local function load_config() - local settings = config_get("*", "core", "network_settings"); + local settings = config_get("*", "core", "network_settings") or {}; if use_luaevent then local event_settings = { ACCEPT_DELAY = settings.event_accept_retry_interval; -- cgit v1.2.3 From db1908120b188b52439127a80fe26913dd2b6b2f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 25 Nov 2012 05:12:13 +0100 Subject: mod_admin_adhoc: Remove unused form --- plugins/mod_admin_adhoc.lua | 9 --------- 1 file changed, 9 deletions(-) diff --git a/plugins/mod_admin_adhoc.lua b/plugins/mod_admin_adhoc.lua index aa1af3ff..9f3175d0 100644 --- a/plugins/mod_admin_adhoc.lua +++ b/plugins/mod_admin_adhoc.lua @@ -212,15 +212,6 @@ function end_user_session_handler(self, data, state) end end -local end_user_session_layout = dataforms_new{ - title = "Ending a User Session"; - instructions = "Fill out this form to end a user's session."; - - { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/admin" }; - { name = "accountjids", type = "jid-multi", label = "The Jabber ID(s) for which to end sessions" }; -}; - - function get_user_password_handler(self, data, state) local get_user_password_layout = dataforms_new{ title = "Getting User's Password"; -- cgit v1.2.3 From 3e74495e5557a7d73385b3894a32e60be0356a46 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 29 Nov 2012 07:15:04 +0500 Subject: mod_http: Fix pattern and slightly improve efficiency and memory usage of wildcard HTTP handlers --- plugins/mod_http.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index f386f870..e73778ae 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -88,10 +88,10 @@ function module.add_host(module) local data = handler; handler = function () return data; end elseif event_name:sub(-2, -1) == "/*" then - local base_path = event_name:match("/(.+)/*$"); + local base_path_len = #event_name:match("(/.+/)%*$")+1; local _handler = handler; handler = function (event) - local path = event.request.path:sub(#base_path+1); + local path = event.request.path:sub(base_path_len); return _handler(event, path); end; end -- cgit v1.2.3