From 5726aa3d85c0b8642b90d698b15fee8e5a0281fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 27 Mar 2011 01:11:33 +0100 Subject: Match early in connection_to_atom for a small performance improvement. --- src/cowboy_http_protocol.erl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/cowboy_http_protocol.erl') diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl index d9fa04b..55ecd34 100644 --- a/src/cowboy_http_protocol.erl +++ b/src/cowboy_http_protocol.erl @@ -215,6 +215,10 @@ version_to_connection({1, 1}) -> keepalive; version_to_connection(_Any) -> close. -spec connection_to_atom(Connection::string()) -> keepalive | close. +connection_to_atom("keep-alive") -> + keepalive; +connection_to_atom("close") -> + close; connection_to_atom(Connection) -> case string:to_lower(Connection) of "close" -> close; -- cgit v1.2.3