mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Remove outdated comments, all edoc, plus a few minor tweaks
This commit is contained in:
parent
9110ee83fe
commit
17af50812c
20 changed files with 29 additions and 498 deletions
|
@ -42,7 +42,7 @@
|
|||
init(_, _, _) ->
|
||||
{upgrade, protocol, cowboy_rest}.
|
||||
|
||||
%% @doc Resolve the file that will be sent and get its file information.
|
||||
%% Resolve the file that will be sent and get its file information.
|
||||
%% If the handler is configured to manage a directory, check that the
|
||||
%% requested file is inside the configured directory.
|
||||
|
||||
|
@ -197,7 +197,7 @@ bad_path_win32_check_test_() ->
|
|||
end} || P <- Tests].
|
||||
-endif.
|
||||
|
||||
%% @doc Reject requests that tried to access a file outside
|
||||
%% Reject requests that tried to access a file outside
|
||||
%% the target directory.
|
||||
|
||||
-spec malformed_request(Req, State)
|
||||
|
@ -205,7 +205,7 @@ bad_path_win32_check_test_() ->
|
|||
malformed_request(Req, State) ->
|
||||
{State =:= error, Req, State}.
|
||||
|
||||
%% @doc Directories, files that can't be accessed at all and
|
||||
%% Directories, files that can't be accessed at all and
|
||||
%% files with no read flag are forbidden.
|
||||
|
||||
-spec forbidden(Req, State)
|
||||
|
@ -221,7 +221,7 @@ forbidden(Req, State={_, {ok, #file_info{access=Access}}, _})
|
|||
forbidden(Req, State) ->
|
||||
{false, Req, State}.
|
||||
|
||||
%% @doc Detect the mimetype of the file.
|
||||
%% Detect the mimetype of the file.
|
||||
|
||||
-spec content_types_provided(Req, State)
|
||||
-> {[{binary(), get_file}], Req, State}
|
||||
|
@ -236,7 +236,7 @@ content_types_provided(Req, State={Path, _, Extra}) ->
|
|||
{[{Type, get_file}], Req, State}
|
||||
end.
|
||||
|
||||
%% @doc Assume the resource doesn't exist if it's not a regular file.
|
||||
%% Assume the resource doesn't exist if it's not a regular file.
|
||||
|
||||
-spec resource_exists(Req, State)
|
||||
-> {boolean(), Req, State}
|
||||
|
@ -246,7 +246,7 @@ resource_exists(Req, State={_, {ok, #file_info{type=regular}}, _}) ->
|
|||
resource_exists(Req, State) ->
|
||||
{false, Req, State}.
|
||||
|
||||
%% @doc Generate an etag for the file.
|
||||
%% Generate an etag for the file.
|
||||
|
||||
-spec generate_etag(Req, State)
|
||||
-> {{strong | weak, binary()}, Req, State}
|
||||
|
@ -266,7 +266,7 @@ generate_default_etag(Size, Mtime) ->
|
|||
{strong, list_to_binary(integer_to_list(
|
||||
erlang:phash2({Size, Mtime}, 16#ffffffff)))}.
|
||||
|
||||
%% @doc Return the time of last modification of the file.
|
||||
%% Return the time of last modification of the file.
|
||||
|
||||
-spec last_modified(Req, State)
|
||||
-> {calendar:datetime(), Req, State}
|
||||
|
@ -274,7 +274,7 @@ generate_default_etag(Size, Mtime) ->
|
|||
last_modified(Req, State={_, {ok, #file_info{mtime=Modified}}, _}) ->
|
||||
{Modified, Req, State}.
|
||||
|
||||
%% @doc Stream the file.
|
||||
%% Stream the file.
|
||||
%% @todo Export cowboy_req:resp_body_fun()?
|
||||
|
||||
-spec get_file(Req, State)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue