From 323bd167fd33f322ab8747e398e54a8a36f5b753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 23 Jul 2020 17:22:21 +0200 Subject: Add the base_stream_ref to gun_http/gun_http2 --- src/gun.erl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/gun.erl') diff --git a/src/gun.erl b/src/gun.erl index 8556b92..00e2d82 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -115,6 +115,19 @@ | #{binary() | string() | atom() => iodata()}. -export_type([req_headers/0]). +-type tunnel_info() :: #{ + stream_ref := reference() | [reference()], + + %% Tunnel. + host := inet:hostname() | inet:ip_address(), + port := inet:port_number(), + + %% Origin. + origin_host => inet:hostname() | inet:ip_address(), + origin_port => inet:port_number() +}. +-export_type([tunnel_info/0]). + -type ws_close_code() :: 1000..4999. -type ws_frame() :: close | ping | pong @@ -1214,9 +1227,9 @@ connected(cast, {request, ReplyTo, StreamRef, Method, Path, Headers0, Body, Init connected(cast, {connect, ReplyTo, StreamRef, Destination, Headers, InitialFlow}, State=#state{origin_host=Host, origin_port=Port, protocol=Protocol, protocol_state=ProtoState}) -> - %% @todo Not events are currently handled for the request? + %% @todo No events are currently handled for the CONNECT request? ProtoState2 = Protocol:connect(ProtoState, StreamRef, ReplyTo, - Destination, #{host => Host, port => Port}, + Destination, #{stream_ref => StreamRef, host => Host, port => Port}, Headers, InitialFlow), {keep_state, State#state{protocol_state=ProtoState2}}; %% Public Websocket interface. -- cgit v1.2.3