From e4124de2c71564d37b3732ede0fe1542de1d6f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 27 Aug 2012 11:50:35 +0200 Subject: Switch to Ranch for connection handling This is the first of many API incompatible changes. You have been warned. --- src/cowboy_http_static.erl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/cowboy_http_static.erl') diff --git a/src/cowboy_http_static.erl b/src/cowboy_http_static.erl index 65e2595..1eb375b 100644 --- a/src/cowboy_http_static.erl +++ b/src/cowboy_http_static.erl @@ -326,13 +326,14 @@ file_contents(Req, #state{filepath=Filepath, -spec content_function(module(), inet:socket(), binary()) -> fun(() -> {sent, non_neg_integer()}). content_function(Transport, Socket, Filepath) -> - %% `file:sendfile/2' will only work with the `cowboy_tcp_transport' + %% `file:sendfile/2' will only work with the `ranch_tcp' %% transport module. SSL or future SPDY transports that require the - %% content to be encrypted or framed as the content is sent. + %% content to be encrypted or framed as the content is sent + %% will use the fallback mechanism. case erlang:function_exported(file, sendfile, 2) of false -> fun() -> sfallback(Transport, Socket, Filepath) end; - _ when Transport =/= cowboy_tcp_transport -> + _ when Transport =/= ranch_tcp -> fun() -> sfallback(Transport, Socket, Filepath) end; true -> fun() -> sendfile(Socket, Filepath) end -- cgit v1.2.3