aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun.erl
diff options
context:
space:
mode:
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).