aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/spdy_SUITE.erl23
-rw-r--r--test/spdy_server.erl3
2 files changed, 25 insertions, 1 deletions
diff --git a/test/spdy_SUITE.erl b/test/spdy_SUITE.erl
index 44fbbbe..b5a5666 100644
--- a/test/spdy_SUITE.erl
+++ b/test/spdy_SUITE.erl
@@ -29,12 +29,19 @@ wait() ->
receive after 500 -> ok end.
down() ->
- receive {gun_down, ConnPid, _, _, _, _} ->
+ receive {gun_down, _, _, _, _, _} ->
ok
after 5000 ->
exit(timeout)
end.
+not_down() ->
+ receive {gun_down, _, _, _, _, _} ->
+ exit(down)
+ after 0 ->
+ ok
+ end.
+
do_req_resp(ConnPid, ServerPid, ServerStreamID) ->
StreamRef = gun:get(ConnPid, "/"),
spdy_server:send(ServerPid, [
@@ -280,3 +287,17 @@ goaway_last_good_streamid(_) ->
wait(),
[{goaway, 6, protocol_error}] = spdy_server:stop(ServerPid),
down().
+
+dont_send_rst_stream_on_rst_stream(_) ->
+ doc("An endpoint must not send an RST_STREAM in response to an RST_STREAM. (spdy-protocol-draft3-1 2.4.2)"),
+ {ok, ServerPid, Port} = spdy_server:start_link(),
+ {ok, ConnPid} = gun:open("localhost", Port, #{transport=>ssl}),
+ {ok, spdy} = gun:await_up(ConnPid),
+ _ = gun:get(ConnPid, "/"),
+ spdy_server:send(ServerPid, [
+ {rst_stream, 1, refused_stream}
+ ]),
+ wait(),
+ %% No RST_STREAM was received; only SYN_STREAM.
+ [_] = spdy_server:stop(ServerPid),
+ not_down().
diff --git a/test/spdy_server.erl b/test/spdy_server.erl
index 2847d33..4690270 100644
--- a/test/spdy_server.erl
+++ b/test/spdy_server.erl
@@ -113,6 +113,9 @@ do_send([{syn_stream, StreamID, AssocToStreamID, IsFin, IsUnidirectional, Priori
do_send([{syn_reply, StreamID, IsFin, Status, Version, Headers}|Tail], Socket, Zdef) ->
ssl:send(Socket, cow_spdy:syn_reply(Zdef, StreamID, IsFin, Status, Version, Headers)),
do_send(Tail, Socket, Zdef);
+do_send([{rst_stream, StreamID, Status}|Tail], Socket, Zdef) ->
+ ssl:send(Socket, cow_spdy:rst_stream(StreamID, Status)),
+ do_send(Tail, Socket, Zdef);
do_send([{window_update, StreamID, DeltaWindowSize}|Tail], Socket, Zdef) ->
%% @todo ssl:send(Socket, cow_spdy:window_update(StreamID, DeltaWindowSize)),
do_send(Tail, Socket, Zdef);