diff options
author | Loïc Hoguin <[email protected]> | 2017-09-04 20:48:07 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-09-04 20:48:07 +0200 |
commit | 4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4 (patch) | |
tree | b644857e9b4134f2db67b936b29fa2456af48dfb /doc/src/manual/cowboy_req.asciidoc | |
parent | 0995fc99e039ea0b6b2979801c2ab1e0eb05a910 (diff) | |
download | cowboy-4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4.tar.gz cowboy-4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4.tar.bz2 cowboy-4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4.zip |
Accept sendfile tuple with 0 length in cowboy_req
This will result in no data being sent. It's simply easier to
do this than to have to handle 0 size cases in user code.
Diffstat (limited to 'doc/src/manual/cowboy_req.asciidoc')
-rw-r--r-- | doc/src/manual/cowboy_req.asciidoc | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/doc/src/manual/cowboy_req.asciidoc b/doc/src/manual/cowboy_req.asciidoc index 2cac8d5..7f026c3 100644 --- a/doc/src/manual/cowboy_req.asciidoc +++ b/doc/src/manual/cowboy_req.asciidoc @@ -156,7 +156,7 @@ resp_body() :: iodata() | {sendfile, Offset, Length, Filename} Offset :: non_neg_integer() -Length :: pos_integer() +Length :: non_neg_integer() Filename :: file:name_all() ---- @@ -180,16 +180,9 @@ order they should be sent: Hello world! ---- -When using the sendfile tuple, the `Length` value is mandatory -and must be higher than 0. It is sent with the response in the -content-length header. - -// @todo Make sure we have a test with an empty file... -// @todo cowboy_static should probably NOT return a sendfile tuple if size is 0. - -//%% While sendfile allows a Len of 0 that means "everything past Offset", -//%% Cowboy expects the real length as it is used as metadata. -//%% @todo We should probably explicitly reject it. +Note that the length must be greater than zero for any data +to be sent. Cowboy will send an empty body when the length +is zero. == See also |