tl;dr: CouchDB* doesn’t seem to correctly parse MIME multipart uploads when the 
HTTP transfer is chunked. It generates an Erlang exception.

I spent the weekend trying to implement multipart document+attachment uploads 
in my client code. In doing so I ran into what I think is a bug in CouchDB — 
after I’d gotten the client side working, every upload produced an Erlang 
exception on the server. I tried changing around the client-side code so it 
precomputed the body length instead of sending the body in ‘chunked’ encoding, 
and that made CouchDB happier.

The exception looks like:

[error] [emulator] Error in process <0.15079.3> with exit value: 
{badarith,[{couch_httpd_db,'-receive_request_data/2-fun-0-',3},{couch_httpd,read_until,3},{couch_httpd,parse_part_body,1},{couch_httpd,parse_multipart_request,3},{couch_doc,'-doc_from_multi_part_stream/2-fun-1-'...
 

Is this a known bug, or should I file something?

—Jens

* Well, Couchbase Single Server 2.0.0dev4, which I think is basically CouchDB 
1.1.1.

Reply via email to