From 510d49d8ef0a46e90374c3230f28b5354115293f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 17 Jul 2020 12:25:11 +0200 Subject: Make gun:stream_info/2 return intermediaries for HTTP/2 CONNECT --- src/gun.erl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/gun.erl') diff --git a/src/gun.erl b/src/gun.erl index 0a0560d..8556b92 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -166,8 +166,8 @@ type := connect | socks5, host := inet:hostname() | inet:ip_address(), port := inet:port_number(), - transport := tcp | tls | tls_proxy, - protocol := http | http2 | raw | socks + transport := tcp | tls, + protocol := http | socks }. -type raw_opts() :: #{}. @@ -1212,9 +1212,12 @@ connected(cast, {request, ReplyTo, StreamRef, Method, Path, Headers0, Body, Init InitialFlow, EvHandler, EvHandlerState0), {keep_state, State#state{protocol_state=ProtoState2, event_handler_state=EvHandlerState}}; connected(cast, {connect, ReplyTo, StreamRef, Destination, Headers, InitialFlow}, - State=#state{protocol=Protocol, protocol_state=ProtoState}) -> + State=#state{origin_host=Host, origin_port=Port, + protocol=Protocol, protocol_state=ProtoState}) -> %% @todo Not events are currently handled for the request? - ProtoState2 = Protocol:connect(ProtoState, StreamRef, ReplyTo, Destination, Headers, InitialFlow), + ProtoState2 = Protocol:connect(ProtoState, StreamRef, ReplyTo, + Destination, #{host => Host, port => Port}, + Headers, InitialFlow), {keep_state, State#state{protocol_state=ProtoState2}}; %% Public Websocket interface. %% @todo Maybe make an interface in the protocol module instead of checking on protocol name. -- cgit v1.2.3