0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00
cowboy/guide
Loïc Hoguin 0c37925642 Add request body reading options
The options were added to allow developers to fix timeout
issues when reading large bodies. It is also a cleaner and
easier to extend interface.

This commit deprecates the functions init_stream, stream_body
and skip_body which are no longer needed. They will be removed
in 1.0.

The body function can now take an additional argument that is a
list of options. The body_qs, part and part_body functions can
too and simply pass this argument down to the body call.

There are options for disabling the automatic continue reply,
setting a maximum length to be returned (soft limit), setting
the read length and read timeout, and setting the transfer and
content decode functions.

The return value of the body and body_qs have changed slightly.
The body function now works similarly to the part_body function,
in that it returns either an ok or a more tuple depending on
whether there is additional data to be read. The body_qs function
can return a badlength tuple if the body is too big. The default
size has been increased from 16KB to 64KB.

The default read length and timeout have been tweaked and vary
depending on the function called.

The body function will now adequately process chunked bodies,
which means that the body_qs function will too. But this means
that the behavior has changed slightly and your code should be
tested properly when updating your code.

The body and body_qs still accept a length as first argument
for compatibility purpose with older code. Note that this form
is deprecated and will be removed in 1.0. The part and part_body
function, being new and never having been in a release yet, have
this form completely removed in this commit.

Again, while most code should work as-is, you should make sure
that it actually does before pushing this to production.
2014-06-02 23:09:43 +02:00
..
cookies.md Greatly expand on the Req object 2013-09-23 15:44:10 +02:00
erlang_beginners.md Greatly improve the guide introduction 2013-06-27 00:02:12 +02:00
erlang_web.md Minor corrections of the guide 2013-06-27 22:34:56 +02:00
getting_started.md Merge branch 'patch-1' of git://github.com/alco/cowboy 2013-11-15 22:08:26 +01:00
handlers.md Add sub protocol behaviour 2013-02-16 16:19:53 +00:00
hooks.md Add an example of onresponse hooks 2013-03-01 19:54:30 -06:00
http_handlers.md Greatly improve the HTTP handlers chapter 2013-09-18 20:29:48 +02:00
http_req_life.md Added a chapter about life of HTTP requests 2013-09-18 12:02:37 +02:00
http_req_resp.png Added a chapter about life of HTTP requests 2013-09-18 12:02:37 +02:00
http_req_resp.svg Added a chapter about life of HTTP requests 2013-09-18 12:02:37 +02:00
internals.md Finish up the Internals chapter 2013-01-18 20:22:49 +01:00
introduction.md Remove unnecessary titles 2013-09-18 20:30:11 +02:00
loop_handlers.md Replace terminate/2 with terminate/3, adding a Reason 2013-01-22 02:34:18 +01:00
middlewares.md Update Ranch to 0.8.0 2013-04-03 13:47:12 +02:00
modern_web.md Fix SPDY push explanations 2013-09-10 12:08:18 +02:00
multipart_req.md Add request body reading options 2014-06-02 23:09:43 +02:00
req.md Add request body reading options 2014-06-02 23:09:43 +02:00
req_body.md Add request body reading options 2014-06-02 23:09:43 +02:00
resources.md Add a reference to an eventsource helper utility. 2013-04-06 20:05:21 -07:00
resp.md Greatly expand on the Req object 2013-09-23 15:44:10 +02:00
rest_handlers.md Fix some explanations around response bodies 2013-08-27 18:32:53 +02:00
routing.md Remove unnecessary titles 2013-09-18 20:30:11 +02:00
static_handlers.md Review, improve and document the static files handler 2013-11-02 14:41:46 +01:00
toc.md Update and improve Websocket chapters in the guide 2014-03-03 16:59:02 +01:00
ws_handlers.md Update and improve Websocket chapters in the guide 2014-03-03 16:59:02 +01:00
ws_protocol.md Update and improve Websocket chapters in the guide 2014-03-03 16:59:02 +01:00