mod_rest: Allow collection of original stanza after sending HTTP request
Probably a premature optimization, but there should be no need to keep
the full original stanza after this point.
--- a/mod_rest/mod_rest.lua Mon Dec 30 05:18:52 2019 +0100
+++ b/mod_rest/mod_rest.lua Mon Dec 30 05:19:23 2019 +0100
@@ -127,8 +127,13 @@
receipt = st.stanza("received", { xmlns = "urn:xmpp:receipts", id = stanza.id });
end
+ local request_body = tostring(stanza);
+
+ -- Keep only the top level element and let the rest be GC'd
+ stanza = st.clone(stanza, true);
+
http.request(rest_url, {
- body = tostring(stanza),
+ body = request_body,
headers = {
["Content-Type"] = "application/xmpp+xml",
["Content-Language"] = stanza.attr["xml:lang"],