Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package prosody for openSUSE:Factory checked in at 2023-02-22 15:21:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/prosody (Old) and /work/SRC/openSUSE:Factory/.prosody.new.1706 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "prosody" Wed Feb 22 15:21:39 2023 rev:35 rq:1067095 version:0.12.3 Changes: -------- --- /work/SRC/openSUSE:Factory/prosody/prosody.changes 2023-02-16 16:56:46.722922893 +0100 +++ /work/SRC/openSUSE:Factory/.prosody.new.1706/prosody.changes 2023-02-22 15:21:43.613909044 +0100 @@ -1,0 +2,25 @@ +Wed Feb 22 07:15:38 UTC 2023 - Michael Vetter <mvet...@suse.com> + +- Update to 0.12.3: + Fixes and improvements: + * mod_storage_sql: Donât avoid initialization under prosodyctl + (fix #1787: mod_storage_sql changes (d580e6a57cbb) breaks prosodyctl) + * mod_storage_sql: Fix for breaking change in certain MySQL versions (#1639) + * prosodyctl check dns: Check for Direct TLS SRV records even if not configured (#1793) + Minor changes: + * mod_websocket: Fire pre-session-close event (fixes #1800: mod_websocket: + cleanly-closed sessions are hibernated by mod_smacks) + * sessionmanager: Mark session as destroyed to prevent reentry (fixes #1781) + * mod_admin_socket: Return error on unhandled input to prevent apparent freeze + * configure: Fix quoting of $LUA_SUFFIX (thanks shellcheck/Zash) + * net.http.parser: Improve handling of responses without content-length + * net.http.parser: Fix off-by-one error in chunk parser + * net.http.server: Add new API to get HTTP request from a connection + * net.http.server: Fix double close of file handle in chunked mode with opportunistic writes (#1789) + * util.prosodyctl.shell: Close state on exit to fix saving shell history + * mod_invites: Prefer landing page over xmpp URI in shell command + * mod_muc_mam: Add mam#extended form fields #1796 + * mod_muc_mam: Copy âinclude totalâ behavior from mod_mam + * util.startup: Close state on exit to ensure GC finalizers are called + +------------------------------------------------------------------- Old: ---- prosody-0.12.2.tar.gz prosody-0.12.2.tar.gz.asc New: ---- prosody-0.12.3.tar.gz prosody-0.12.3.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ prosody.spec ++++++ --- /var/tmp/diff_new_pack.DkD3vm/_old 2023-02-22 15:21:44.205912402 +0100 +++ /var/tmp/diff_new_pack.DkD3vm/_new 2023-02-22 15:21:44.209912424 +0100 @@ -1,7 +1,7 @@ # # spec file for package prosody # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define _piddir /run Name: prosody -Version: 0.12.2 +Version: 0.12.3 Release: 0 Summary: Communications server for Jabber/XMPP License: MIT ++++++ prosody-0.12.2.tar.gz -> prosody-0.12.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/.hg_archival.txt new/prosody-0.12.3/.hg_archival.txt --- old/prosody-0.12.2/.hg_archival.txt 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/.hg_archival.txt 2023-02-21 11:07:08.120425311 +0100 @@ -1,4 +1,4 @@ repo: 3e3171b59028ee70122cfec6ecf98f518f946b59 -node: 3784a8ce05961ddc0f0374f8c12618d9a411546b +node: 0598d822614f6637a5baaec78570db025c76f722 branch: 0.12 -tag: 0.12.2 +tag: 0.12.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/configure new/prosody-0.12.3/configure --- old/prosody-0.12.2/configure 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/configure 2023-02-21 11:07:08.120425311 +0100 @@ -303,7 +303,7 @@ LUA_SUFFIX="5.1"; LUA_SUFFIX_SET=yes fi - LUA_CF="$(pkg-config --cflags-only-I lua$LUA_SUFFIX)" + LUA_CF="$(pkg-config --cflags-only-I lua"$LUA_SUFFIX")" LUA_CF="${LUA_CF#*-I}" LUA_CF="${LUA_CF%% *}" if [ "$LUA_CF" != "" ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/core/sessionmanager.lua new/prosody-0.12.3/core/sessionmanager.lua --- old/prosody-0.12.2/core/sessionmanager.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/core/sessionmanager.lua 2023-02-21 11:07:08.120425311 +0100 @@ -93,10 +93,6 @@ end local function destroy_session(session, err) - (session.log or log)("debug", "Destroying session for %s (%s@%s)%s", - session.full_jid or "(unknown)", session.username or "(unknown)", - session.host or "(unknown)", err and (": "..err) or ""); - if session.destroyed then return; end -- Remove session/resource from user's session list @@ -105,9 +101,16 @@ -- Allow plugins to prevent session destruction if host_session.events.fire_event("pre-resource-unbind", {session=session, error=err}) then + (session.log or log)("debug", "Resource unbind prevented by module"); return; end + (session.log or log)("debug", "Unbinding resource for %s (%s@%s)%s", + session.full_jid or "(unknown)", session.username or "(unknown)", + session.host or "(unknown)", err and (": "..err) or ""); + + session.destroyed = true; -- Past this point the session is DOOMED! + host_session.sessions[session.username].sessions[session.resource] = nil; full_sessions[session.full_jid] = nil; @@ -118,6 +121,10 @@ end host_session.events.fire_event("resource-unbind", {session=session, error=err}); + else + (session.log or log)("debug", "Destroying unbound session for <%s@%s>%s", + session.username or "(unknown)", session.host or "(unknown)", + err and (": "..err) or ""); end retire_session(session); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/net/http/parser.lua new/prosody-0.12.3/net/http/parser.lua --- old/prosody-0.12.2/net/http/parser.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/net/http/parser.lua 2023-02-21 11:07:08.120425311 +0100 @@ -130,10 +130,13 @@ partial = true; }; end - if len and len > bodylimit then + if not len or len > bodylimit then -- Early notification, for redirection success_cb(packet); - if not packet.body_sink then error = true; return error_cb("content-length-limit-exceeded"); end + if not packet.body_sink and (len and len > bodylimit) then + error = true; + return error_cb("content-length-limit-exceeded"); + end end if chunked and not packet.body_sink then success_cb(packet); @@ -150,6 +153,7 @@ if not chunk_size then return; end chunk_size = chunk_size and tonumber(chunk_size, 16); if not chunk_size then error = true; return error_cb("invalid-chunk-size"); end + if chunk_size == 0 and chunk_header:find("\r\n\r\n", chunk_start-2, true) then local body_buffer = packet.body_buffer; if body_buffer then @@ -165,8 +169,8 @@ state, chunked = nil, nil; packet.partial = nil; success_cb(packet); - elseif buffer:length() - chunk_start - 2 >= chunk_size then -- we have a chunk - buffer:discard(chunk_start - 1); -- TODO verify that it's not off-by-one + elseif buffer:length() - chunk_start - 1 >= chunk_size then -- we have a chunk + buffer:discard(chunk_start - 1); (packet.body_sink or packet.body_buffer):write(buffer:read(chunk_size)); buffer:discard(2); -- CRLF else -- Partial chunk remaining @@ -174,9 +178,11 @@ end elseif packet.body_sink then local chunk = buffer:read_chunk(len); - while chunk and len > 0 do + while chunk and (not len or len > 0) do if packet.body_sink:write(chunk) then - len = len - #chunk; + if len then + len = len - #chunk; + end chunk = buffer:read_chunk(len); else error = true; @@ -188,9 +194,9 @@ packet.partial = nil; success_cb(packet); end - elseif buffer:length() >= len then + elseif not len or buffer:length() >= len then -- or not len assert(not chunked) - packet.body = buffer:read(len) or ""; + packet.body = len and buffer:read(len) or buffer:read_chunk() or ""; state = nil; packet.partial = nil; success_cb(packet); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/net/http/server.lua new/prosody-0.12.3/net/http/server.lua --- old/prosody-0.12.2/net/http/server.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/net/http/server.lua 2023-02-21 11:07:08.120425311 +0100 @@ -377,12 +377,12 @@ -- io.write("."); io.flush(); response.conn:write(chunk); else + incomplete[response.conn] = nil; if chunked then response.conn:write("0\r\n\r\n"); end -- io.write("\n"); if f.close then f:close(); end - incomplete[response.conn] = nil; return response:done(); end end @@ -428,6 +428,10 @@ function _M.set_option(name, value) options[name] = value; end +function _M.get_request_from_conn(conn) + local response = conn and conn._http_open_response; + return response and response.request or nil; +end _M.listener = listener; _M.codes = codes; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/net/http.lua new/prosody-0.12.3/net/http.lua --- old/prosody-0.12.2/net/http.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/net/http.lua 2023-02-21 11:07:08.120425311 +0100 @@ -94,7 +94,7 @@ r.body_length and ("%d bytes"):format(r.body_length) or "unknown length" ); if request.streaming_handler then - log("debug", "Request '%s': Streaming via handler"); + log("debug", "Request '%s': Streaming via handler", request.id); r.body_sink, finalize_sink = request.streaming_handler(r); end return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/plugins/mod_admin_shell.lua new/prosody-0.12.3/plugins/mod_admin_shell.lua --- old/prosody-0.12.2/plugins/mod_admin_shell.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/plugins/mod_admin_shell.lua 2023-02-21 11:07:08.120425311 +0100 @@ -198,6 +198,7 @@ if not ok then event.origin.send(st.stanza("repl-result", { type = "error" }):text(err)); end + return true; end); -- Console commands -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/plugins/mod_admin_socket.lua new/prosody-0.12.3/plugins/mod_admin_socket.lua --- old/prosody-0.12.2/plugins/mod_admin_socket.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/plugins/mod_admin_socket.lua 2023-02-21 11:07:08.120425311 +0100 @@ -19,6 +19,7 @@ local server = require "net.server"; local adminstream = require "util.adminstream"; +local st = require "util.stanza"; local socket_path = module:get_option_path("admin_socket", "prosody.sock", "data"); @@ -35,7 +36,11 @@ event_name = "admin/"..stanza.name; end module:log("debug", "Firing %s", event_name); - return module:fire_event(event_name, event_data); + local ret = module:fire_event(event_name, event_data); + if ret == nil then + session.send(st.stanza("repl-result", { type = "error" }):text("No module handled this query. Is mod_admin_shell enabled?")); + end + return ret; end module:hook("server-stopping", function () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/plugins/mod_invites.lua new/prosody-0.12.3/plugins/mod_invites.lua --- old/prosody-0.12.2/plugins/mod_invites.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/plugins/mod_invites.lua 2023-02-21 11:07:08.120425311 +0100 @@ -217,7 +217,7 @@ if not mod_invites then return nil, err or "mod_invites not loaded on this host"; end local invite, err = mod_invites.create_account(username); if not invite then return nil, err; end - return true, invite.uri; + return true, invite.landing_page or invite.uri; end function console_env.invite:create_contact(user_jid, allow_registration) @@ -226,7 +226,7 @@ if not mod_invites then return nil, err or "mod_invites not loaded on this host"; end local invite, err = mod_invites.create_contact(username, allow_registration); if not invite then return nil, err; end - return true, invite.uri; + return true, invite.landing_page or invite.uri; end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/plugins/mod_mam/mod_mam.lua new/prosody-0.12.3/plugins/mod_mam/mod_mam.lua --- old/prosody-0.12.2/plugins/mod_mam/mod_mam.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/plugins/mod_mam/mod_mam.lua 2023-02-21 11:07:08.120425311 +0100 @@ -138,9 +138,14 @@ local qset = rsm.get(query); local qmax = m_min(qset and qset.max or default_max_items, max_max_items); local reverse = qset and qset.before or false; + local before, after = qset and qset.before or qbefore, qset and qset.after or qafter; if type(before) ~= "string" then before = nil; end + -- A reverse query needs to be flipped + local flip = reverse; + -- A flip-page query needs to be the opposite of that. + if query:get_child("flip-page") then flip = not flip end module:log("debug", "Archive query by %s id=%s with=%s when=%s...%s rsm=%q", origin.username, @@ -150,11 +155,6 @@ qend and timestamp(qend) or "", qset); - -- A reverse query needs to be flipped - local flip = reverse; - -- A flip-page query needs to be the opposite of that. - if query:get_child("flip-page") then flip = not flip end - -- Load all the data! local data, err = archive:find(origin.username, { start = qstart; ["end"] = qend; -- Time range diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/plugins/mod_muc_mam.lua new/prosody-0.12.3/plugins/mod_muc_mam.lua --- old/prosody-0.12.2/plugins/mod_muc_mam.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/plugins/mod_muc_mam.lua 2023-02-21 11:07:08.120425311 +0100 @@ -67,6 +67,7 @@ module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information"); return false; end +local use_total = module:get_option_boolean("muc_log_include_total", true); local function archiving_enabled(room) if log_all_rooms then @@ -109,10 +110,20 @@ { name = "end"; type = "text-single"; datatype = "xs:dateTime" }; }; +if archive.caps and archive.caps.full_id_range then + table.insert(query_form, { name = "before-id"; type = "text-single"; }); + table.insert(query_form, { name = "after-id"; type = "text-single"; }); +end + +if archive.caps and archive.caps.ids then + table.insert(query_form, { name = "ids"; type = "list-multi"; }); +end + + -- Serve form module:hook("iq-get/bare/"..xmlns_mam..":query", function(event) local origin, stanza = event.origin, event.stanza; - origin.send(st.reply(stanza):tag("query", { xmlns = xmlns_mam }):add_child(query_form:form())); + origin.send(st.reply(stanza):query(xmlns_mam):add_child(query_form:form())); return true; end); @@ -172,6 +183,7 @@ local before, after = qset and qset.before or qbefore, qset and qset.after or qafter; if type(before) ~= "string" then before = nil; end + -- A reverse query needs to be flipped local flip = reverse; -- A flip-page query needs to be the opposite of that. @@ -187,11 +199,12 @@ -- Load all the data! local data, err = archive:find(room_node, { start = qstart; ["end"] = qend; -- Time range + with = "message<groupchat"; limit = qmax + 1; before = before; after = after; ids = qids; reverse = reverse; - with = "message<groupchat"; + total = use_total or qmax == 0; }); if not data then @@ -216,6 +229,8 @@ for id, item, when in data do count = count + 1; if count > qmax then + -- We requested qmax+1 items. If that many items are retrieved then + -- there are more results to page through, so: complete = nil; break; end @@ -259,7 +274,6 @@ first, last = last, first; end - origin.send(st.reply(stanza) :tag("fin", { xmlns = xmlns_mam, complete = complete }) :add_child(rsm.generate { @@ -551,4 +565,7 @@ else module:log("debug", "Archive expiry disabled"); + -- Don't ask the backend to count the potentially unbounded number of items, + -- it'll get slow. + use_total = module:get_option_boolean("mam_include_total", false); end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/plugins/mod_smacks.lua new/prosody-0.12.3/plugins/mod_smacks.lua --- old/prosody-0.12.2/plugins/mod_smacks.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/plugins/mod_smacks.lua 2023-02-21 11:07:08.120425311 +0100 @@ -500,6 +500,7 @@ session.conn = nil; conn:close(); end + session.log("debug", "Session going into hibernation (not being destroyed)") module:fire_event("smacks-hibernation-start", { origin = session; queue = session.outgoing_stanza_queue:table() }); return true; -- Postpone destruction for now end); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/plugins/mod_storage_sql.lua new/prosody-0.12.3/plugins/mod_storage_sql.lua --- old/prosody-0.12.2/plugins/mod_storage_sql.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/plugins/mod_storage_sql.lua 2023-02-21 11:07:08.120425311 +0100 @@ -469,12 +469,8 @@ local ok, err = archive_where_id_range(query, args, where); if not ok then return ok, err; end - if query.limit then - args[#args+1] = query.limit; - end - sql_query = sql_query:format(t_concat(where, " AND "), query.reverse - and "DESC" or "ASC", query.limit and " LIMIT ?" or ""); + and "DESC" or "ASC", query.limit and " LIMIT " .. query.limit or ""); return engine:select(sql_query, unpack(args)); end); if not ok then return ok, result; end @@ -592,6 +588,17 @@ if not ok then return ok, err; end if query.truncate == nil then sql_query = sql_query:format(t_concat(where, " AND ")); + elseif engine.params.driver == "MySQL" then + sql_query = [[ + DELETE result FROM prosodyarchive AS result JOIN ( + SELECT sort_id FROM prosodyarchive + WHERE %s + ORDER BY "sort_id" %s + LIMIT 18446744073709551615 OFFSET %s + ) AS limiter on result.sort_id = limiter.sort_id;]]; + + sql_query = string.format(sql_query, t_concat(where, " AND "), + query.reverse and "ASC" or "DESC", query.truncate); else args[#args+1] = query.truncate; local unlimited = "ALL"; @@ -613,15 +620,6 @@ ]]; end unlimited = "-1"; - elseif engine.params.driver == "MySQL" then - sql_query = [[ - DELETE result FROM prosodyarchive AS result JOIN ( - SELECT sort_id FROM prosodyarchive - WHERE %s - ORDER BY "sort_id" %s - LIMIT %s OFFSET ? - ) AS limiter on result.sort_id = limiter.sort_id;]]; - unlimited = "18446744073709551615"; end sql_query = string.format(sql_query, t_concat(where, " AND "), query.reverse and "ASC" or "DESC", unlimited); @@ -831,7 +829,6 @@ end function module.load() - if prosody.process_type == "prosodyctl" then return; end local engines = module:shared("/*/sql/connections"); local params = normalize_params(module:get_option("sql", default_params)); local db_uri = sql.db2uri(params); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/plugins/mod_websocket.lua new/prosody-0.12.3/plugins/mod_websocket.lua --- old/prosody-0.12.2/plugins/mod_websocket.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/plugins/mod_websocket.lua 2023-02-21 11:07:08.120425311 +0100 @@ -63,6 +63,9 @@ local function session_close(session, reason) local log = session.log or log; + local close_event_payload = { session = session, reason = reason }; + module:context(session.host):fire_event("pre-session-close", close_event_payload); + reason = close_event_payload.reason; if session.conn then if session.notopen then session:open_stream(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/prosody.release new/prosody-0.12.3/prosody.release --- old/prosody-0.12.2/prosody.release 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/prosody.release 2023-02-21 11:07:08.120425311 +0100 @@ -1 +1 @@ -0.12.2 +0.12.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/prosodyctl new/prosody-0.12.3/prosodyctl --- old/prosody-0.12.2/prosodyctl 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/prosodyctl 2023-02-21 11:07:08.120425311 +0100 @@ -663,11 +663,11 @@ local ok, ret = modulemanager.call_module_method(module, "command", arg); if ok then if type(ret) == "number" then - os.exit(ret); + os.exit(ret, true); elseif type(ret) == "string" then show_message(ret); end - os.exit(0); -- :) + os.exit(0, true); -- :) else show_message("Failed to execute command: "..error_messages[ret]); os.exit(1); -- :( @@ -745,10 +745,10 @@ end - os.exit(0); + os.exit(0, true); end - os.exit(commands[command](arg)); + os.exit(commands[command](arg), true); end, watchers); command_runner:run(true); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/spec/net_http_parser_spec.lua new/prosody-0.12.3/spec/net_http_parser_spec.lua --- old/prosody-0.12.2/spec/net_http_parser_spec.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/spec/net_http_parser_spec.lua 2023-02-21 11:07:08.120425311 +0100 @@ -8,18 +8,48 @@ end local function test_stream(stream, expect) + local chunks_processed = 0; local success_cb = spy.new(function (packet) assert.is_table(packet); if packet.body ~= false then assert.is_equal(expect.body, packet.body); end + if expect.chunks then + if chunks_processed == 0 then + assert.is_true(packet.partial); + packet.body_sink = { + write = function (_, data) + chunks_processed = chunks_processed + 1; + assert.equal(expect.chunks[chunks_processed], data); + return true; + end; + }; + end + end end); - local parser = http_parser.new(success_cb, error, stream:sub(1,4) == "HTTP" and "client" or "server") - for chunk in stream:gmatch("."..string.rep(".?", parser_input_bytes-1)) do - parser:feed(chunk); + local function options_cb() + return { + -- Force streaming API mode + body_size_limit = expect.chunks and 0 or nil; + buffer_size_limit = 10*1024*2; + }; + end + + local parser = http_parser.new(success_cb, error, (stream[1] or stream):sub(1,4) == "HTTP" and "client" or "server", options_cb) + if type(stream) == "string" then + for chunk in stream:gmatch("."..string.rep(".?", parser_input_bytes-1)) do + parser:feed(chunk); + end + else + for _, chunk in ipairs(stream) do + parser:feed(chunk); + end end + if expect.chunks then + assert.equal(chunks_processed, #expect.chunks); + end assert.spy(success_cb).was_called(expect.count or 1); end @@ -87,7 +117,7 @@ ]], { - body = "Hello", count = 2; + body = "Hello", count = 3; } ); end); @@ -116,7 +146,24 @@ ]], { - body = "Hello", count = 3; + body = "Hello", count = 4; + } + ); + end); + + it("should correctly find chunk boundaries", function () + test_stream({ + +CRLF[[ +HTTP/1.1 200 OK +Transfer-Encoding: chunked + +]].."3\r\n:)\n\r\n"}, + { + count = 1; -- Once (partial) + chunks = { + ":)\n" + }; } ); end); @@ -129,7 +176,7 @@ assert.equal("25930f021785ae14053a322c2dbc1897c3769720", sha1(data, true), "test data malformed"); test_stream(data, { - body = string.rep("~", 11085), count = 2; + body = string.rep("~", 11085), count = 3; }); end); end); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/util/prosodyctl/check.lua new/prosody-0.12.3/util/prosodyctl/check.lua --- old/prosody-0.12.2/util/prosodyctl/check.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/util/prosodyctl/check.lua 2023-02-21 11:07:08.120425311 +0100 @@ -809,6 +809,10 @@ modules:add(component_module); end + -- TODO Refactor these DNS SRV checks since they are very similar + -- FIXME Suggest concrete actionable steps to correct issues so that + -- users don't have to copy-paste the message into the support chat and + -- ask what to do about it. local is_component = not not host_options.component_module; print("Checking DNS for "..(is_component and "component" or "host").." "..jid.."..."); if node then @@ -838,7 +842,7 @@ end end end - if modules:contains("c2s") and c2s_tls_srv_required then + if modules:contains("c2s") then local res = dns.lookup("_xmpps-client._tcp."..idna.to_ascii(host)..".", "SRV"); if res and #res > 0 then for _, record in ipairs(res) do @@ -852,7 +856,7 @@ print(" SRV target "..target.." contains unknown Direct TLS client port: "..record.srv.port); end end - else + elseif c2s_tls_srv_required then print(" No _xmpps-client SRV record found for "..host..", but it looks like you need one."); all_targets_ok = false; end @@ -880,7 +884,7 @@ end end end - if modules:contains("s2s") and s2s_tls_srv_required then + if modules:contains("s2s") then local res = dns.lookup("_xmpps-server._tcp."..idna.to_ascii(host)..".", "SRV"); if res and #res > 0 then for _, record in ipairs(res) do @@ -894,7 +898,7 @@ print(" SRV target "..target.." contains unknown Direct TLS server port: "..record.srv.port); end end - else + elseif s2s_tls_srv_required then print(" No _xmpps-server SRV record found for "..host..", but it looks like you need one."); all_targets_ok = false; end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/util/prosodyctl/shell.lua new/prosody-0.12.3/util/prosodyctl/shell.lua --- old/prosody-0.12.2/util/prosodyctl/shell.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/util/prosodyctl/shell.lua 2023-02-21 11:07:08.120425311 +0100 @@ -39,7 +39,7 @@ if have_readline then readline.save_history(); end - os.exit(); + os.exit(0, true); end send_line(client, line); end @@ -112,7 +112,7 @@ client.events.add_handler("disconnected", function () print("--- session closed ---"); - os.exit(); + os.exit(0, true); end); client.events.add_handler("received", function (stanza) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prosody-0.12.2/util/startup.lua new/prosody-0.12.3/util/startup.lua --- old/prosody-0.12.2/util/startup.lua 2022-12-12 22:14:49.625073736 +0100 +++ new/prosody-0.12.3/util/startup.lua 2023-02-21 11:07:08.120425311 +0100 @@ -648,7 +648,7 @@ end function startup.exit() - os.exit(prosody.shutdown_code); + os.exit(prosody.shutdown_code, true); end -- prosodyctl only