diff options
author | Loïc Hoguin <[email protected]> | 2018-09-26 13:51:13 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-09-26 13:51:13 +0200 |
commit | d8e91eefa6ea9973f60657db05c85ec594aa7d0b (patch) | |
tree | 28e047ef6e925b96508f2d29859ca2c3be113b47 /src/gun_http.erl | |
parent | f328916937c67b3c9679e4f11d4594c39d36f85d (diff) | |
download | gun-d8e91eefa6ea9973f60657db05c85ec594aa7d0b.tar.gz gun-d8e91eefa6ea9973f60657db05c85ec594aa7d0b.tar.bz2 gun-d8e91eefa6ea9973f60657db05c85ec594aa7d0b.zip |
Don't send keep-alive while waiting for CONNECT responses
Otherwise this can mess up the underlying protocol we will
switch to, like TLS or HTTP/2.
Diffstat (limited to 'src/gun_http.erl')
-rw-r--r-- | src/gun_http.erl | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl index c4291bc..e2b37d1 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -319,6 +319,9 @@ close_streams([#stream{ref=StreamRef, reply_to=ReplyTo}|Tail]) -> "The connection was lost."}}, close_streams(Tail). +%% We don't send a keep-alive when a CONNECT request was initiated. +keepalive(State=#http_state{streams=[#stream{ref={connect, _, _}}]}) -> + State; %% We can only keep-alive by sending an empty line in-between streams. keepalive(State=#http_state{socket=Socket, transport=Transport, out=head}) -> Transport:send(Socket, <<"\r\n">>), |