aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_http.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-11-15 14:57:10 +0100
committerLoïc Hoguin <[email protected]>2017-11-15 14:57:10 +0100
commitaca7a1c5f5353fd3fbf90877a78761590fc08510 (patch)
tree9bbeb5e0635e6cb5cafe4ef3f921c8fe316f9853 /src/gun_http.erl
parentcbbb4d5523f8738b237593f9516c3a237d0cc2f4 (diff)
downloadgun-aca7a1c5f5353fd3fbf90877a78761590fc08510.tar.gz
gun-aca7a1c5f5353fd3fbf90877a78761590fc08510.tar.bz2
gun-aca7a1c5f5353fd3fbf90877a78761590fc08510.zip
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.
Diffstat (limited to 'src/gun_http.erl')
-rw-r--r--src/gun_http.erl2
1 files changed, 1 insertions, 1 deletions
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;