[ejabberd] max_stanza_size not working in mod_http_bind?

Badlop badlop at gmail.com
Sat Apr 11 18:57:46 MSD 2009

2009/4/11 Xia Qingran <qingran.xia at gmail.com>:
> I want to limit the max length of messages sending by XMPP web client(
> JWCHAT ), and I have taken a client check by Javascript. Moreover I
> must take this limitation on server side of mod_http_bind.
> With the help of the issue,
> https://support.process-one.net/browse/EJAB-416, I have taken the
> max_stanza_size in ejabberd_c2s:
>  {5222, ejabberd_c2s, [
>                        {certfile, "/usr/local/etc/ejabberd/xmppserver.pem"}, starttls,
>                        {access, c2s},
>                        {shaper, c2s_shaper},
>                        {ip, {127, 0, 0, 1}},
>                        {max_stanza_size, 4096}
>                       ]},
> Is this way right?

That configuration seems right.

It isn't documented in ejabberd Guide, but it is mentioned in the
source code ejabberd_http_bind.erl:
  %% Read c2s options from the first ejabberd_c2s configuration in
  %% the config file listen section
  Opts = ejabberd_c2s_config:get_c2s_limits(),

> And it is not woking when I successfully send and
> receive a message with 4096 chars.

Maybe the size calculation in ejabberd is not exact.
You can try to send messages a little bigger: 4097, or 4100, 4500 or
5000, until you find the connection is closed.

I configured {max_stanza_size, 2000}, and then connected with c2s to
port 5222, not http-bind. ejabberd allowed me to send messages with
less than 2536 bytes.

If I try to send a message with more than 2536 bytes, the client receives:
<error xmlns='http://etherx.jabber.org/streams'>
  <xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
and the server closes the connection.


More information about the ejabberd mailing list