From 3c10d5488396aaeeae7666aa25361c227db039f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 24 Sep 2012 02:58:33 +0200 Subject: Removal of binary:split from cowboy_dispatcher and small optimizations The internal host_tokens value now has host tokens in reverse order compared to before. This allows us to remove one lists:reverse call. --- test/dispatcher_prop.erl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'test/dispatcher_prop.erl') diff --git a/test/dispatcher_prop.erl b/test/dispatcher_prop.erl index 163fcd8..26c4f87 100644 --- a/test/dispatcher_prop.erl +++ b/test/dispatcher_prop.erl @@ -49,12 +49,14 @@ prop_split_host_symmetric() -> ?FORALL(Server, server(), begin case cowboy_dispatcher:split_host(Server) of {Tokens, RawHost, undefined} -> - (Server == RawHost) and (Server == binary_join(Tokens, ".")); + (Server == RawHost) + and (Server == binary_join(lists:reverse(Tokens), ".")); {Tokens, RawHost, Port} -> PortBin = (list_to_binary(":" ++ integer_to_list(Port))), (Server == << RawHost/binary, PortBin/binary >>) - and (Server == << (binary_join(Tokens, "."))/binary, - PortBin/binary >>) + and (Server == + << (binary_join(lists:reverse(Tokens), "."))/binary, + PortBin/binary >>) end end). %% Internal. -- cgit v1.2.3