aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_static.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-01-05 20:19:43 +0100
committerLoïc Hoguin <[email protected]>2013-01-05 20:19:43 +0100
commit58e89e218991a8d04108616620de9bb99dbeb7c0 (patch)
tree53e952bf5b17a351f8efee9533dd0616f0bde9f6 /src/cowboy_static.erl
parentd8be610d4c68aa126afa952de4f134d68cc80636 (diff)
downloadcowboy-58e89e218991a8d04108616620de9bb99dbeb7c0.tar.gz
cowboy-58e89e218991a8d04108616620de9bb99dbeb7c0.tar.bz2
cowboy-58e89e218991a8d04108616620de9bb99dbeb7c0.zip
Change the response body streaming fun interface
Before we were required to get the socket and transport ourselves, now they're passed to the function.
Diffstat (limited to 'src/cowboy_static.erl')
-rw-r--r--src/cowboy_static.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cowboy_static.erl b/src/cowboy_static.erl
index 55d01c7..530c0f9 100644
--- a/src/cowboy_static.erl
+++ b/src/cowboy_static.erl
@@ -321,8 +321,10 @@ content_types_provided(Req, #state{filepath=Filepath,
-spec file_contents(cowboy_req:req(), #state{}) -> tuple().
file_contents(Req, #state{filepath=Filepath,
fileinfo={ok, #file_info{size=Filesize}}}=State) ->
- {ok, Transport, Socket} = cowboy_req:transport(Req),
- Writefile = fun() -> Transport:sendfile(Socket, Filepath) end,
+ Writefile = fun(Socket, Transport) ->
+ {ok, _} = Transport:sendfile(Socket, Filepath),
+ ok
+ end,
{{stream, Filesize, Writefile}, Req, State}.