From 4fd6e2f7cdca1c1adf1ba0bd76a0702328c380f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= <essen@ninenines.eu>
Date: Mon, 4 Sep 2017 20:48:07 +0200
Subject: 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.
---
 doc/src/manual/cowboy_req.asciidoc | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

(limited to 'doc/src/manual/cowboy_req.asciidoc')

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
 
-- 
cgit v1.2.3

