extend/cowboy — pull request #439 by fishcakez (2013-02-18 22:00:34+00:00)
Title: Add chunked response body fun

Extends cowboy:set_resp_body_fun/3 to allow chunked responses in streaming response funs. This is a backwards compatible change. Useful when the body length is unknown and you want to keep the connection alive.

```erlang
StreamFun = fun(SendChunk) -> lists:foreach(SendChunk, ["ChunkA\r\n", "ChunkB\r\n"]) end,
Req2 = cowboy_req:set_resp_body_fun(chunked, StreamFun, Req),
cowboy_req:reply(Status, Req2),
```

The code attached is (currently) a proof of concept with a (passing) testcase.