All, I committed a one-line fix (suggested by Adam) to trunk which now allows multipart/related PUT's to succeed without mochiweb closing the connection. At base, mochiweb uses a process dictionary variable to keep track of whether it ought to close the connection or not. Because we use the request from a different process, part of that handling is skipped, causing mochiweb to close a connection when it shouldn't. The fix (or, less charitably, *hack*) fixes that issue.
I've struggled to write an etap test that demonstrates the original problem (the bug was discovered when doing performance testing from a node.js-based test program) and I feel I owe one. I would like this patch to land on 1.0.x where I think a confirming test is mandatory. I'll continue trying to write the test and will put it to trunk once I have it. In the meantime, I would like to hear from others about whether this should go to 1.0.x? It allows efficient and atomic insertion of documents with attachments, which is an important feature for me, though to date it is only used by the replicator. B.
