mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Merge branch 'path-split-doc' of https://github.com/klaar/cowboy
This commit is contained in:
commit
6572d4d374
2 changed files with 10 additions and 2 deletions
|
@ -45,7 +45,11 @@ split_host(Host) ->
|
||||||
list_to_integer(binary_to_list(Port))}
|
list_to_integer(binary_to_list(Port))}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc Split a path into a list of tokens.
|
%% @doc Split a path into a list of path segments.
|
||||||
|
%%
|
||||||
|
%% Following RFC2396, this function may return path segments containing any
|
||||||
|
%% character, including <em>/</em> if, and only if, a <em>/</em> was escaped
|
||||||
|
%% and part of a path segment.
|
||||||
-spec split_path(binary()) -> {path_tokens(), binary(), binary()}.
|
-spec split_path(binary()) -> {path_tokens(), binary(), binary()}.
|
||||||
split_path(Path) ->
|
split_path(Path) ->
|
||||||
case binary:split(Path, <<"?">>) of
|
case binary:split(Path, <<"?">>) of
|
||||||
|
|
|
@ -88,7 +88,11 @@ raw_host(Req) ->
|
||||||
port(Req) ->
|
port(Req) ->
|
||||||
{Req#http_req.port, Req}.
|
{Req#http_req.port, Req}.
|
||||||
|
|
||||||
%% @doc Return the tokens for the path requested.
|
%% @doc Return the path segments for the path requested.
|
||||||
|
%%
|
||||||
|
%% Following RFC2396, this function may return path segments containing any
|
||||||
|
%% character, including <em>/</em> if, and only if, a <em>/</em> was escaped
|
||||||
|
%% and part of a path segment in the path requested.
|
||||||
-spec path(#http_req{}) -> {cowboy_dispatcher:path_tokens(), #http_req{}}.
|
-spec path(#http_req{}) -> {cowboy_dispatcher:path_tokens(), #http_req{}}.
|
||||||
path(Req) ->
|
path(Req) ->
|
||||||
{Req#http_req.path, Req}.
|
{Req#http_req.path, Req}.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue