diff options
author | Loïc Hoguin <[email protected]> | 2018-11-09 17:42:37 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-09 17:42:37 +0100 |
commit | d7b7580b3913c17b404319cc4c153748d5e59194 (patch) | |
tree | 3026f38e4bcfdcb26d067a4e5aec6d401700c3cc /src/cowboy_http2.erl | |
parent | 29043aa7b4d11e377bc76d453f592ea5a6df1f43 (diff) | |
download | cowboy-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 'src/cowboy_http2.erl')
-rw-r--r-- | src/cowboy_http2.erl | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl index d461595..fc1a3a0 100644 --- a/src/cowboy_http2.erl +++ b/src/cowboy_http2.erl @@ -510,12 +510,6 @@ commands(State0, StreamID, [{data, IsFin, Data}|Tail]) -> commands(State0, StreamID, [{trailers, Trailers}|Tail]) -> State = maybe_send_data(State0, StreamID, fin, {trailers, maps:to_list(Trailers)}), commands(State, StreamID, Tail); -%% Send a file. -%% @todo Add the sendfile command. -%commands(State0, Stream0=#stream{local=nofin}, -% [{sendfile, IsFin, Offset, Bytes, Path}|Tail]) -> -% {State, Stream} = maybe_send_data(State0, Stream0, IsFin, {sendfile, Offset, Bytes, Path}), -% commands(State, Stream, Tail); %% Send a push promise. %% %% @todo Responses sent as a result of a push_promise request |