From ea2de24f18741fc89d7a1dd6a3a0a43f3ccb1fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 14 Jul 2014 12:56:05 +0200 Subject: Fix bug with HTTP and keepalive A linebreak was sometimes introduced in the middle of the request body. --- src/gun_http.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gun_http.erl b/src/gun_http.erl index ff1f01c..bd6565c 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -180,8 +180,10 @@ close_streams(Owner, [{StreamRef, _}|Tail]) -> close_streams(Owner, Tail). %% We can only keep-alive by sending an empty line in-between streams. -keepalive(State=#http_state{socket=Socket, transport=Transport}) -> +keepalive(State=#http_state{socket=Socket, transport=Transport, out=head}) -> Transport:send(Socket, <<"\r\n">>), + State; +keepalive(State) -> State. request(State=#http_state{socket=Socket, transport=Transport, version=Version, -- cgit v1.2.3