Hi, I'm new to both Erlang and Yaws so please be gentle on me if I'm about to ask a stupid question.

I wrote an appmod in Yaws that accepts large CSV files, creates a document in CouchDB, and then adds the CSV as a standalone attachment.  The size of the CSV I'm using to test is 163M (3.4M+ rows).  Here is the CURL command I run:

curl -v -XPUT -H 'Content-Type: text/csv' '<url here>' --data-binary @data/data.csv

This will fail immediately, and with trace on I see an enomem error.  However, if I change to chunked transfer encoding via -H 'Transfer-Encoding: chunked' then it works just fine.  Looking through the source code it looks like body_method/3 is responsible for pulling the data from the socket.  If chunked it eventually does the following:

    yaws:setopts(CliSock, [binary, {packet, line}],SSL),
    N = yaws:get_chunk_num(CliSock,SSL),
    yaws:setopts(CliSock, [binary, {packet, raw}],SSL),

My guess is this has something to do with it working.  Although, I don't get why it sets packet to line, and then to raw.  Why not just raw?

My question, then, is there a way this can work without requiring the transfer encoding to be set to chunked?

-Ryan