Browse Source

Match early in connection_to_atom for a small performance improvement.

Loïc Hoguin 14 years ago
parent
commit
5726aa3d85
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/cowboy_http_protocol.erl

+ 4 - 0
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;