I'm not liking any of this code here.  I think it needs to be put in the same module as the chunking code.  It's okay to require mondemand-erlang in the mondemand-server, in order to move it all into a module and actually create some tests which chunk and dechunk.