view mod_compact_resource/mod_compact_resource.lua @ 3634:915e32d5a147

mod_smacks: fix bug for missbehaving clients sending multiple acks in a row Missbehaving clients, sending multiple acks in a row (I'm looking at you Monal!) triggered the ack-loop-prevention code added in 2017, leaving unacked stanzas in the queue. This fixes the bug while still preventing ack-loops.
author tmolitor <thilo@eightysoft.de>
date Tue, 30 Jul 2019 02:07:13 +0200
parents 6f34e51a23f0
children
line wrap: on
line source


local base64_encode = require"util.encodings".base64.encode;
local random_bytes = require"util.random".bytes;

local b64url = { ["+"] = "-", ["/"] = "_", ["="] = "" };
local function random_resource()
	return base64_encode(random_bytes(8)):gsub("[+/=]", b64url);
end

module:hook("pre-resource-bind", function (event)
	event.resource = random_resource();
end);