diff options
author | Loïc Hoguin <[email protected]> | 2012-09-27 01:31:19 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-09-27 01:31:19 +0200 |
commit | cd7f37d34645dd2f54175d60632f9684cf064c6c (patch) | |
tree | 481e905867589b990c42779ec222603c3fe34e22 /src/cowboy_http.erl | |
parent | 681a216a246896366ffc30ef39aca816cbee2ac0 (diff) | |
download | cowboy-cd7f37d34645dd2f54175d60632f9684cf064c6c.tar.gz cowboy-cd7f37d34645dd2f54175d60632f9684cf064c6c.tar.bz2 cowboy-cd7f37d34645dd2f54175d60632f9684cf064c6c.zip |
Optimize Connection header parsing
Still optimizing the critical path.
Removes cowboy_http:connection_to_atom/1.
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r-- | src/cowboy_http.erl | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index c3bef2f..6ba4834 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -42,7 +42,6 @@ -export([ce_identity/1]). %% Interpretation. --export([connection_to_atom/1]). -export([version_to_binary/1]). -export([urldecode/1]). -export([urldecode/2]). @@ -773,20 +772,6 @@ ce_identity(Data) -> %% Interpretation. -%% @doc Walk through a tokens list and return whether -%% the connection is keepalive or closed. -%% -%% The connection token is expected to be lower-case. --spec connection_to_atom([binary()]) -> keepalive | close. -connection_to_atom([]) -> - keepalive; -connection_to_atom([<<"keep-alive">>|_Tail]) -> - keepalive; -connection_to_atom([<<"close">>|_Tail]) -> - close; -connection_to_atom([_Any|Tail]) -> - connection_to_atom(Tail). - %% @doc Convert an HTTP version tuple to its binary form. -spec version_to_binary(version()) -> binary(). version_to_binary({1, 1}) -> <<"HTTP/1.1">>; @@ -1030,16 +1015,6 @@ asctime_date_test_() -> ], [{V, fun() -> R = asctime_date(V) end} || {V, R} <- Tests]. -connection_to_atom_test_() -> - %% {Tokens, Result} - Tests = [ - {[<<"close">>], close}, - {[<<"keep-alive">>], keepalive}, - {[<<"keep-alive">>, <<"upgrade">>], keepalive} - ], - [{lists:flatten(io_lib:format("~p", [T])), - fun() -> R = connection_to_atom(T) end} || {T, R} <- Tests]. - content_type_test_() -> %% {ContentType, Result} Tests = [ |