0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Match early in connection_to_atom for a small performance improvement.

This commit is contained in:
Loïc Hoguin 2011-03-27 01:11:33 +01:00
parent 71e940a6eb
commit 5726aa3d85

View file

@ -215,6 +215,10 @@ version_to_connection({1, 1}) -> keepalive;
version_to_connection(_Any) -> close. version_to_connection(_Any) -> close.
-spec connection_to_atom(Connection::string()) -> keepalive | close. -spec connection_to_atom(Connection::string()) -> keepalive | close.
connection_to_atom("keep-alive") ->
keepalive;
connection_to_atom("close") ->
close;
connection_to_atom(Connection) -> connection_to_atom(Connection) ->
case string:to_lower(Connection) of case string:to_lower(Connection) of
"close" -> close; "close" -> close;