From 28186a68d0c023987fe7334b0326fb6c87f9447c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 16 May 2013 12:56:01 +0200 Subject: 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. --- src/cowboy_http.erl | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/cowboy_http.erl') 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(). -- cgit v1.2.3