aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-05-16 12:56:01 +0200
committerLoïc Hoguin <[email protected]>2013-05-16 12:56:01 +0200
commit28186a68d0c023987fe7334b0326fb6c87f9447c (patch)
tree732b0da9873c061cdda690973150e7ccbce3b99b /src/cowboy_http.erl
parente0b5526f1e6c0794fc76c77f0fc6a4a95696d23f (diff)
downloadcowboy-28186a68d0c023987fe7334b0326fb6c87f9447c.tar.gz
cowboy-28186a68d0c023987fe7334b0326fb6c87f9447c.tar.bz2
cowboy-28186a68d0c023987fe7334b0326fb6c87f9447c.zip
Make the HTTP version type more practical
Now instead of {1, 1} we have 'HTTP/1.1', and instead of {1, 0} we have 'HTTP/1.0'. This is more efficient, easier to read in crash logs, and clearer in the code.
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r--src/cowboy_http.erl8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index fc08716..2da211d 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -46,14 +46,13 @@
%% 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 version() :: 'HTTP/1.1' | 'HTTP/1.0'.
-type headers() :: [{binary(), iodata()}].
-type status() :: non_neg_integer() | binary().
@@ -1001,11 +1000,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().