aboutsummaryrefslogtreecommitdiffstats
path: root/test/gun_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-01-06 11:16:13 +0100
committerLoïc Hoguin <[email protected]>2019-01-06 11:21:55 +0100
commit8336270331c8ffdc04e79f069df5b051adc62e68 (patch)
tree32b22677ab145900136d7dd9c76f9012ea7ac56a /test/gun_SUITE.erl
parent531bcb080b24d4edc061405f11747d7631ccab39 (diff)
downloadgun-8336270331c8ffdc04e79f069df5b051adc62e68.tar.gz
gun-8336270331c8ffdc04e79f069df5b051adc62e68.tar.bz2
gun-8336270331c8ffdc04e79f069df5b051adc62e68.zip
Fix KilledStreams value for HTTP for connection: close responses
Diffstat (limited to 'test/gun_SUITE.erl')
-rw-r--r--test/gun_SUITE.erl26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index 93a09cc..6da5ca6 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -180,6 +180,32 @@ keepalive_infinity(_) ->
error(timeout)
end.
+killed_streams_http(_) ->
+ doc("Ensure completed responses with a connection: close are not considered killed streams."),
+ {ok, _, OriginPort} = init_origin(tcp, http,
+ fun (_, ClientSocket, ClientTransport) ->
+ {ok, _} = ClientTransport:recv(ClientSocket, 0, 1000),
+ ClientTransport:send(ClientSocket,
+ "HTTP/1.1 200 OK\r\n"
+ "connection: close\r\n"
+ "content-length: 12\r\n"
+ "\r\n"
+ "hello world!"
+ )
+ end),
+ {ok, ConnPid} = gun:open("localhost", OriginPort),
+ {ok, http} = gun:await_up(ConnPid),
+ StreamRef = gun:get(ConnPid, "/"),
+ {response, nofin, 200, _} = gun:await(ConnPid, StreamRef),
+ {ok, <<"hello world!">>} = gun:await_body(ConnPid, StreamRef),
+ receive
+ {gun_down, ConnPid, http, normal, KilledStreams, _} ->
+ [] = KilledStreams,
+ gun:close(ConnPid)
+ after 1000 ->
+ error(timeout)
+ end.
+
reply_to(_) ->
doc("The reply_to option allows using a separate process for requests."),
do_reply_to(http),