aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-03-27 01:11:33 +0100
committerLoïc Hoguin <[email protected]>2011-03-27 01:11:33 +0100
commit5726aa3d85c0b8642b90d698b15fee8e5a0281fb (patch)
tree22b5677aa7ff718c3aa593da88957c3aa68d9e98 /src
parent71e940a6ebef3540e0a2964ce4e0746c3d553566 (diff)
downloadcowboy-5726aa3d85c0b8642b90d698b15fee8e5a0281fb.tar.gz
cowboy-5726aa3d85c0b8642b90d698b15fee8e5a0281fb.tar.bz2
cowboy-5726aa3d85c0b8642b90d698b15fee8e5a0281fb.zip
Match early in connection_to_atom for a small performance improvement.
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_http_protocol.erl4
1 files changed, 4 insertions, 0 deletions
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;