Comparison

plugins/mod_s2s/mod_s2s.lua @ 10849:19e7092e062c

mod_c2s,mod_s2s: Use a distinct stream error for hitting stanza size limit Since this is not a real parse error, it should not be reported as such.
author Kim Alvefur <zash@zash.se>
date Sun, 31 May 2020 22:25:48 +0200
parent 10810:8a0a923e1ced
child 10850:bd2814f900dd
comparison
equal deleted inserted replaced
10848:7fd8976d47d7 10849:19e7092e062c
612 data = filter("bytes/in", data); 612 data = filter("bytes/in", data);
613 if data then 613 if data then
614 local ok, err = stream:feed(data); 614 local ok, err = stream:feed(data);
615 if ok then return; end 615 if ok then return; end
616 log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300)); 616 log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300));
617 session:close("not-well-formed", nil, "Received invalid XML from remote server"); 617 if err == "stanza-too-large" then
618 session:close({ condition = "policy-violation", text = "XML stanza is too big" }, nil, "Received invalid XML from remote server");
619 else
620 session:close("not-well-formed", nil, "Received invalid XML from remote server");
621 end
618 end 622 end
619 end 623 end
620 624
621 session.close = session_close; 625 session.close = session_close;
622 626