aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-03-28 11:54:06 +0100
committerLoïc Hoguin <[email protected]>2020-03-28 11:54:06 +0100
commit310f01593f7efcafdbb416748028f164e19ad1e0 (patch)
tree730f0bbf2211730d1e78064e5d90d61ca8077c4b /src/gun.erl
parente3ca88e6111d2837f21741f410ce58381079e78a (diff)
downloadgun-310f01593f7efcafdbb416748028f164e19ad1e0.tar.gz
gun-310f01593f7efcafdbb416748028f164e19ad1e0.tar.bz2
gun-310f01593f7efcafdbb416748028f164e19ad1e0.zip
Make intermediaries return tls not tls_proxy
Also add a test for CONNECT to TLS via 2 TLS proxies.
Diffstat (limited to 'src/gun.erl')
-rw-r--r--src/gun.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gun.erl b/src/gun.erl
index 3255c67..998ce6b 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -434,8 +434,7 @@ info(ServerPid) ->
origin_scheme => OriginScheme,
origin_host => OriginHost,
origin_port => OriginPort,
- %% Intermediaries are listed in the order data goes through them.
- intermediaries => lists:reverse(Intermediaries),
+ intermediaries => intermediaries_info(Intermediaries, []),
cookie_store => CookieStore
},
Info = case Socket of
@@ -457,6 +456,19 @@ info(ServerPid) ->
_ -> Info#{protocol => Protocol:name()}
end.
+%% We change tls_proxy into tls for intermediaries.
+%%
+%% Intermediaries are listed in the order data goes through them,
+%% that's why we reverse the order here.
+intermediaries_info([], Acc) ->
+ Acc;
+intermediaries_info([Intermediary=#{transport := Transport0}|Tail], Acc) ->
+ Transport = case Transport0 of
+ tls_proxy -> tls;
+ _ -> Transport0
+ end,
+ intermediaries_info(Tail, [Intermediary#{transport => Transport}|Acc]).
+
-spec close(pid()) -> ok.
close(ServerPid) ->
supervisor:terminate_child(gun_sup, ServerPid).