From aca7a1c5f5353fd3fbf90877a78761590fc08510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 15 Nov 2017 14:57:10 +0100 Subject: Fix a potential issue finding end of headers in HTTP/1.1 This is a bit less efficient but necessary in case we start getting the beginning of \r\n\r\n and it cuts just there. --- src/gun_http.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gun_http.erl') diff --git a/src/gun_http.erl b/src/gun_http.erl index 26761a8..ef8d720 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -94,7 +94,7 @@ handle(_, #http_state{streams=[]}) -> %% Wait for the full response headers before trying to parse them. handle(Data, State=#http_state{in=head, buffer=Buffer}) -> Data2 = << Buffer/binary, Data/binary >>, - case binary:match(Data, <<"\r\n\r\n">>) of + case binary:match(Data2, <<"\r\n\r\n">>) of nomatch -> State#http_state{buffer=Data2}; {_, _} -> handle_head(Data2, State#http_state{buffer= <<>>}) end; -- cgit v1.2.3