aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-07-14 12:56:05 +0200
committerLoïc Hoguin <[email protected]>2014-07-14 12:56:05 +0200
commitea2de24f18741fc89d7a1dd6a3a0a43f3ccb1fd4 (patch)
treeb7fe58ab1a3ea5728a950fb510c4a998d5836e77 /src
parent39813dc223e74e1dc8044ba56a7a29e870431495 (diff)
downloadgun-ea2de24f18741fc89d7a1dd6a3a0a43f3ccb1fd4.tar.gz
gun-ea2de24f18741fc89d7a1dd6a3a0a43f3ccb1fd4.tar.bz2
gun-ea2de24f18741fc89d7a1dd6a3a0a43f3ccb1fd4.zip
Fix bug with HTTP and keepalive
A linebreak was sometimes introduced in the middle of the request body.
Diffstat (limited to 'src')
-rw-r--r--src/gun_http.erl4
1 files changed, 3 insertions, 1 deletions
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,