From bee5ca852b1a8e1506872aeea57f6c745c8add77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 3 Oct 2014 18:25:29 +0300 Subject: Replace some /binary to /bits in binary pattern matching We don't need the extra check for multiple of 8 bits. --- src/cowboy_protocol.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cowboy_protocol.erl') diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl index 00f8ba8..2da3a15 100644 --- a/src/cowboy_protocol.erl +++ b/src/cowboy_protocol.erl @@ -134,7 +134,7 @@ wait_request(Buffer, State=#state{socket=Socket, transport=Transport, -spec parse_request(binary(), #state{}, non_neg_integer()) -> ok. %% Empty lines must be using \r\n. -parse_request(<< $\n, _/binary >>, State, _) -> +parse_request(<< $\n, _/bits >>, State, _) -> error_terminate(400, State); parse_request(<< $\s, _/bits >>, State, _) -> error_terminate(400, State); @@ -150,7 +150,7 @@ parse_request(Buffer, State=#state{max_request_line_length=MaxLength, 1 when ReqEmpty =:= MaxEmpty -> error_terminate(400, State); 1 -> - << _:16, Rest/binary >> = Buffer, + << _:16, Rest/bits >> = Buffer, parse_request(Rest, State, ReqEmpty + 1); _ -> parse_method(Buffer, State, <<>>) -- cgit v1.2.3