aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_protocol.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-10-03 18:25:29 +0300
committerLoïc Hoguin <[email protected]>2014-10-03 18:25:29 +0300
commitbee5ca852b1a8e1506872aeea57f6c745c8add77 (patch)
tree00f65257b5ba7e4688dceb46ecce99f2f5f898a6 /src/cowboy_protocol.erl
parent8e17d492b377cbf2eaf0d191b1e8636ea06c806a (diff)
downloadcowboy-bee5ca852b1a8e1506872aeea57f6c745c8add77.tar.gz
cowboy-bee5ca852b1a8e1506872aeea57f6c745c8add77.tar.bz2
cowboy-bee5ca852b1a8e1506872aeea57f6c745c8add77.zip
Replace some /binary to /bits in binary pattern matching
We don't need the extra check for multiple of 8 bits.
Diffstat (limited to 'src/cowboy_protocol.erl')
-rw-r--r--src/cowboy_protocol.erl4
1 files changed, 2 insertions, 2 deletions
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, <<>>)