# HG changeset patch # User Kim Alvefur # Date 1577679563 -3600 # Node ID a1f1f703d604c6f74c27b31e8598e5b8f1a17009 # Parent 9b4fd2553365cda4b0671fb847f3290567148eb3 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. diff -r 9b4fd2553365 -r a1f1f703d604 mod_rest/mod_rest.lua --- 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"],