aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_http2.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-11-06 14:22:23 +0100
committerLoïc Hoguin <[email protected]>2020-11-06 14:22:23 +0100
commitffba6390941f40d28d15535c95076dbf0f3c4137 (patch)
tree61965e4957ec010c4925b1de371aca44fb353655 /src/gun_http2.erl
parent3440591e4c252c9fe918c3e349ea64f68a72e2f0 (diff)
downloadgun-ffba6390941f40d28d15535c95076dbf0f3c4137.tar.gz
gun-ffba6390941f40d28d15535c95076dbf0f3c4137.tar.bz2
gun-ffba6390941f40d28d15535c95076dbf0f3c4137.zip
Make CONNECT responses produce a response_end event
While the stream has not ended, the response has.
Diffstat (limited to 'src/gun_http2.erl')
-rw-r--r--src/gun_http2.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gun_http2.erl b/src/gun_http2.erl
index 8f0632b..04d4de5 100644
--- a/src/gun_http2.erl
+++ b/src/gun_http2.erl
@@ -517,7 +517,11 @@ headers_frame_connect(State=#http2_state{transport=Transport, opts=Opts, tunnel_
status => Status,
headers => Headers
}, EvHandlerState0),
- EvHandlerState2 = EvHandler:origin_changed(#{
+ EvHandlerState2 = EvHandler:response_end(#{
+ stream_ref => RealStreamRef,
+ reply_to => ReplyTo
+ }, EvHandlerState1),
+ EvHandlerState3 = EvHandler:origin_changed(#{
stream_ref => RealStreamRef,
type => connect,
origin_scheme => case Destination of
@@ -526,7 +530,7 @@ headers_frame_connect(State=#http2_state{transport=Transport, opts=Opts, tunnel_
end,
origin_host => DestHost,
origin_port => DestPort
- }, EvHandlerState1),
+ }, EvHandlerState2),
ContinueStreamRef = continue_stream_ref(State, StreamRef),
OriginSocket = #{
gun_pid => self(),
@@ -576,7 +580,7 @@ headers_frame_connect(State=#http2_state{transport=Transport, opts=Opts, tunnel_
}
end,
{tunnel, ProtoState, EvHandlerState} = Proto:init(
- ReplyTo, OriginSocket, gun_tcp_proxy, ProtoOpts, EvHandler, EvHandlerState2),
+ ReplyTo, OriginSocket, gun_tcp_proxy, ProtoOpts, EvHandler, EvHandlerState3),
{store_stream(State, Stream#stream{tunnel=Tunnel#tunnel{state=established,
info=TunnelInfo, protocol=Proto, protocol_state=ProtoState}}),
EvHandlerState}.