[rabbitmq-discuss] Mochiweb MAX_RECV_BODY and JSON_RPC plugin

Simon MacMullen simon at rabbitmq.com
Mon Aug 22 10:03:42 BST 2011

On 19/08/11 21:20, Gavin M. Roy wrote:
> Ran into an unintended snag with JSON Channel RPC with regard to a
> mochiweb limitation.
> Mochiweb has a hardcoded constant for the maximum body size for a
> request at 1MB:
> https://github.com/mochi/mochiweb/blob/master/src/mochiweb_request.erl#L47
> This is a problem when you're trying to POST messages that are larger
> than 1MB.
> The fix is relatively easy, but I wanted to find out if there was any
> patching of mochiweb prior to making the mochiweb.ez file or is the file
> just provided for convenience and providing a tagged supported version.
> That is, if I recompile it with the # I want, can I just go from the
> vanilla mochiweb repo?

We patch mochiweb a bit, to make it build on older versions of Erlang, 
and to remove its dependency on the "crypto" application. I guess you 
could live without these, but more importantly we also use a specific 
version (basically what was the latest version at the point I started 
writing rabbitmq-management) and haven't tested with newer versions.

If I were you I would add your patch to our set and build with our 
wrapper. To do this, check out rabbitmq-public-umbrella, then check out 
the mochiweb-wrapper repository within it:


(or run "make checkout" which will check out everything including 

Then within mochiweb-wrapper add your patch, and add it to 
WRAPPER_PATCHES in package.mk, then "make dist".

Alternatively you could build it yourself but I would try to use the 
same version as we do - 9a53dbd7b2c52eb5b9d4 in the mochiweb git repo.

Cheers, Simon

Simon MacMullen
RabbitMQ, VMware

More information about the rabbitmq-discuss mailing list