mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Enable range requests support in cowboy_static
This commit is contained in:
parent
7840f6db7b
commit
fe1ee080de
2 changed files with 18 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue