aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-09 17:42:37 +0100
committerLoïc Hoguin <[email protected]>2018-11-09 17:42:37 +0100
commitd7b7580b3913c17b404319cc4c153748d5e59194 (patch)
tree3026f38e4bcfdcb26d067a4e5aec6d401700c3cc /doc/src
parent29043aa7b4d11e377bc76d453f592ea5a6df1f43 (diff)
downloadcowboy-d7b7580b3913c17b404319cc4c153748d5e59194.tar.gz
cowboy-d7b7580b3913c17b404319cc4c153748d5e59194.tar.bz2
cowboy-d7b7580b3913c17b404319cc4c153748d5e59194.zip
Add sendfile support to cowboy_req:stream_body
It is now possible to stream one or more sendfile tuples. A simple example of what can now be done would be for example to build a tar file on the fly using the sendfile syscall for sending the files, or to support Range requests with more than one range with the sendfile syscall. When using cowboy_compress_h unfortunately we have to read the file in order to send it. More options will be added at a later time to make sure users don't read too much into memory. This is a new feature however so existing code is not affected. Also rework cowboy_http's data sending to be flatter.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/manual/cowboy_req.stream_body.asciidoc3
-rw-r--r--doc/src/manual/cowboy_stream.asciidoc3
2 files changed, 4 insertions, 2 deletions
diff --git a/doc/src/manual/cowboy_req.stream_body.asciidoc b/doc/src/manual/cowboy_req.stream_body.asciidoc
index 24f5d97..03e6e70 100644
--- a/doc/src/manual/cowboy_req.stream_body.asciidoc
+++ b/doc/src/manual/cowboy_req.stream_body.asciidoc
@@ -10,7 +10,7 @@ cowboy_req:stream_body - Stream the response body
----
stream_body(Data, IsFin, Req :: cowboy_req:req()) -> ok
-Data :: iodata()
+Data :: cowboy_req:resp_body()
IsFin :: fin | nofin
----
@@ -58,6 +58,7 @@ The atom `ok` is always returned. It can be safely ignored.
== Changelog
+* *2.6*: The `Data` argument can now be a sendfile tuple.
* *2.0*: Function introduced. Replaces `chunk/2`.
== Examples
diff --git a/doc/src/manual/cowboy_stream.asciidoc b/doc/src/manual/cowboy_stream.asciidoc
index 24204bc..2ea40f8 100644
--- a/doc/src/manual/cowboy_stream.asciidoc
+++ b/doc/src/manual/cowboy_stream.asciidoc
@@ -133,7 +133,7 @@ Send data to the client.
[source,erlang]
----
-{data, fin(), iodata()}
+{data, fin(), cowboy_req:resp_body()}
----
[[trailers_command]]
@@ -420,6 +420,7 @@ tuple.
== Changelog
+* *2.6*: The data command can now contain a sendfile tuple.
* *2.6*: The `{stop, {exit, any()}, HumanReadable}` terminate reason was added.
* *2.2*: The trailers command was introduced.
* *2.0*: Module introduced.