From: Matthew Wild Date: Wed, 2 Apr 2014 16:41:38 +0000 (+0100) Subject: Merge 0.9->0.10 X-Git-Url: https://git.enpas.org/?a=commitdiff_plain;h=a87ec53e152b80f64351b3f9dc4db8974d2e8f8a;p=prosody.git Merge 0.9->0.10 --- a87ec53e152b80f64351b3f9dc4db8974d2e8f8a diff --cc core/portmanager.lua index 95900c08,421d7fc6..4cbf3eb3 --- a/core/portmanager.lua +++ b/core/portmanager.lua @@@ -111,9 -113,9 +113,9 @@@ function activate(service_name } bind_ports = set.new(type(bind_ports) ~= "table" and { bind_ports } or bind_ports ); - local mode, ssl = listener.default_mode or "*a"; + local mode, ssl = listener.default_mode or default_mode; local hooked_ports = {}; - + for interface in bind_interfaces do for port in bind_ports do local port_number = tonumber(port); diff --cc util/xmppstream.lua index 550170c9,73f5e314..586ad5f9 --- a/util/xmppstream.lua +++ b/util/xmppstream.lua @@@ -40,25 -43,29 +43,29 @@@ local ns_pattern = "^([^"..ns_separator _M.ns_separator = ns_separator; _M.ns_pattern = ns_pattern; - function new_sax_handlers(session, stream_callbacks) + local function dummy_cb() end + + function new_sax_handlers(session, stream_callbacks, cb_handleprogress) local xml_handlers = {}; - + local cb_streamopened = stream_callbacks.streamopened; local cb_streamclosed = stream_callbacks.streamclosed; local cb_error = stream_callbacks.error or function(session, e, stanza) error("XML stream error: "..tostring(e)..(stanza and ": "..tostring(stanza) or ""),2); end; local cb_handlestanza = stream_callbacks.handlestanza; + cb_handleprogress = cb_handleprogress or dummy_cb; - + local stream_ns = stream_callbacks.stream_ns or xmlns_streams; local stream_tag = stream_callbacks.stream_tag or "stream"; if stream_ns ~= "" then stream_tag = stream_ns..ns_separator..stream_tag; end local stream_error_tag = stream_ns..ns_separator..(stream_callbacks.error_tag or "error"); - + local stream_default_ns = stream_callbacks.default_ns; - + local stack = {}; local chardata, stanza = {}; + local stanza_size = 0; local non_streamns_depth = 0; function xml_handlers:StartElement(tagname, attr) if stanza and #chardata > 0 then @@@ -85,8 -92,11 +92,11 @@@ attr[k] = nil; end end - + if not stanza then --if we are not currently inside a stanza + if lxp_supports_bytecount then + stanza_size = self:getcurrentbytecount(); + end if session.notopen then if tagname == stream_tag then non_streamns_depth = 0; @@@ -102,9 -116,12 +116,12 @@@ if curr_ns == "jabber:client" and name ~= "iq" and name ~= "presence" and name ~= "message" then cb_error(session, "invalid-top-level-element"); end - + stanza = setmetatable({ name = name, attr = attr, tags = {} }, stanza_mt); else -- we are inside a stanza, so add a tag + if lxp_supports_bytecount then + stanza_size = stanza_size + self:getcurrentbytecount(); + end t_insert(stack, stanza); local oldstanza = stanza; stanza = setmetatable({ name = name, attr = attr, tags = {} }, stanza_mt); @@@ -157,12 -211,12 +211,12 @@@ end xml_handlers.Comment = restricted_handler; xml_handlers.ProcessingInstruction = restricted_handler; - + local function reset() - stanza, chardata = nil, {}; + stanza, chardata, stanza_size = nil, {}, 0; stack = {}; end - + local function set_session(stream, new_session) session = new_session; end