diff options
author | Loïc Hoguin <[email protected]> | 2018-11-11 16:25:45 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-11 16:25:45 +0100 |
commit | fe1ee080de40ee6fd41e17bd71507fefe83f5f3c (patch) | |
tree | 1845f5ea498821222d4a1e25f04ddd9bf50709d1 /src | |
parent | 7840f6db7b340d4d0630019507eaffa725abbaad (diff) | |
download | cowboy-fe1ee080de40ee6fd41e17bd71507fefe83f5f3c.tar.gz cowboy-fe1ee080de40ee6fd41e17bd71507fefe83f5f3c.tar.bz2 cowboy-fe1ee080de40ee6fd41e17bd71507fefe83f5f3c.zip |
Enable range requests support in cowboy_static
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_static.erl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cowboy_static.erl b/src/cowboy_static.erl index 335c6ae..29ac809 100644 --- a/src/cowboy_static.erl +++ b/src/cowboy_static.erl @@ -20,6 +20,7 @@ -export([forbidden/2]). -export([content_types_provided/2]). -export([charsets_provided/2]). +-export([ranges_provided/2]). -export([resource_exists/2]). -export([last_modified/2]). -export([generate_etag/2]). @@ -340,6 +341,14 @@ charsets_provided(Req, State={Path, _, Extra}) -> {[Charset], Req, State} end. +%% Enable support for range requests. + +-spec ranges_provided(Req, State) + -> {[{binary(), auto}], Req, State} + when State::state(). +ranges_provided(Req, State) -> + {[{<<"bytes">>, auto}], Req, State}. + %% Assume the resource doesn't exist if it's not a regular file. -spec resource_exists(Req, State) |