aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r--src/cowboy_http.erl22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index f889b52..af60dd9 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -46,21 +46,12 @@
%% Interpretation.
-export([cookie_to_iodata/3]).
--export([version_to_binary/1]).
-export([urldecode/1]).
-export([urldecode/2]).
-export([urlencode/1]).
-export([urlencode/2]).
-export([x_www_form_urlencoded/1]).
--type version() :: {Major::non_neg_integer(), Minor::non_neg_integer()}.
--type headers() :: [{binary(), iodata()}].
--type status() :: non_neg_integer() | binary().
-
--export_type([version/0]).
--export_type([headers/0]).
--export_type([status/0]).
-
%% Parsing.
%% @doc Parse a non-empty list of the given type.
@@ -802,7 +793,7 @@ qvalue(Data, Fun, Q, _M) ->
%% Only Basic authorization is supported so far.
-spec authorization(binary(), binary()) -> {binary(), any()} | {error, badarg}.
authorization(UserPass, Type = <<"basic">>) ->
- cowboy_http:whitespace(UserPass,
+ whitespace(UserPass,
fun(D) ->
authorization_basic_userid(base64:mime_decode(D),
fun(Rest, Userid) ->
@@ -813,7 +804,7 @@ authorization(UserPass, Type = <<"basic">>) ->
end)
end);
authorization(String, Type) ->
- cowboy_http:whitespace(String, fun(Rest) -> {Type, Rest} end).
+ whitespace(String, fun(Rest) -> {Type, Rest} end).
%% @doc Parse user credentials.
-spec authorization_basic_userid(binary(), fun()) -> any().
@@ -849,12 +840,12 @@ authorization_basic_password(<<C, Rest/binary>>, Fun, Acc) ->
Unit :: binary(),
Range :: {non_neg_integer(), non_neg_integer() | infinity} | neg_integer().
range(Data) ->
- cowboy_http:token_ci(Data, fun range/2).
+ token_ci(Data, fun range/2).
range(Data, Token) ->
whitespace(Data,
fun(<<"=", Rest/binary>>) ->
- case cowboy_http:list(Rest, fun range_beginning/2) of
+ case list(Rest, fun range_beginning/2) of
{error, badarg} ->
{error, badarg};
Ranges ->
@@ -1001,11 +992,6 @@ cookie_to_iodata(Name, Value, Opts) ->
[Name, <<"=">>, Value, <<"; Version=1">>,
MaxAgeBin, DomainBin, PathBin, SecureBin, HttpOnlyBin].
-%% @doc Convert an HTTP version tuple to its binary form.
--spec version_to_binary(version()) -> binary().
-version_to_binary({1, 1}) -> <<"HTTP/1.1">>;
-version_to_binary({1, 0}) -> <<"HTTP/1.0">>.
-
%% @doc Decode a URL encoded binary.
%% @equiv urldecode(Bin, crash)
-spec urldecode(binary()) -> binary().