aboutsummaryrefslogtreecommitdiffstats
path: root/test/rfc6265bis_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/rfc6265bis_SUITE.erl')
-rw-r--r--test/rfc6265bis_SUITE.erl33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/rfc6265bis_SUITE.erl b/test/rfc6265bis_SUITE.erl
index ecaf45f..8beee58 100644
--- a/test/rfc6265bis_SUITE.erl
+++ b/test/rfc6265bis_SUITE.erl
@@ -176,6 +176,39 @@ do_informational_set_cookie(Config, Boolean) ->
gun:close(ConnPid),
Res.
+set_cookie_connect(Config) ->
+ doc("Cookies may also be set in responses going through CONNECT tunnels."),
+ Transport = config(transport, Config),
+ Protocol = config(protocol, Config),
+ {ok, ProxyPid, ProxyPort} = event_SUITE:do_proxy_start(Protocol, Transport),
+ {ok, ConnPid} = gun:open("localhost", ProxyPort, #{
+ transport => Transport,
+ protocols => [Protocol],
+ cookie_store => gun_cookies_list:init()
+ }),
+ {ok, Protocol} = gun:await_up(ConnPid),
+ tunnel_SUITE:do_handshake_completed(Protocol, ProxyPid),
+ StreamRef1 = gun:connect(ConnPid, #{
+ host => "localhost",
+ port => config(port, Config),
+ transport => Transport,
+ protocols => [Protocol]
+ }),
+ %% @todo _IsFin is 'fin' for HTTP and 'nofin' for HTTP/2...
+ {response, _IsFin, 200, _} = gun:await(ConnPid, StreamRef1),
+ {up, Protocol} = gun:await(ConnPid, StreamRef1),
+ StreamRef2 = gun:get(ConnPid, "/cookie-set?prefix", #{
+ <<"please-set-cookie">> => <<"a=b">>
+ }, #{tunnel => StreamRef1}),
+ {response, fin, 204, Headers2} = gun:await(ConnPid, StreamRef2),
+ ct:log("Headers2:~n~p", [Headers2]),
+ StreamRef3 = gun:get(ConnPid, "/cookie-echo", [], #{tunnel => StreamRef1}),
+ {response, nofin, 200, _} = gun:await(ConnPid, StreamRef3),
+ {ok, Body3} = gun:await_body(ConnPid, StreamRef3),
+ ct:log("Body3:~n~p", [Body3]),
+ [{<<"a">>, <<"b">>}] = cow_cookie:parse_cookie(Body3),
+ gun:close(ConnPid).
+
-define(HOST, "web-platform.test").
%% WPT: domain/domain-attribute-host-with-and-without-leading-period