diff options
author | Loïc Hoguin <[email protected]> | 2019-04-22 13:40:07 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-04-22 13:40:07 +0200 |
commit | 5e3a5337a34dcb09418d4f412b11ede4510e3ddc (patch) | |
tree | 294fde46b7b0775ce62c854892ddcf1c4a73ead2 /src/gun.erl | |
parent | b2aed85a2a8794f0cc23755d1a10c602ab289ff4 (diff) | |
download | gun-5e3a5337a34dcb09418d4f412b11ede4510e3ddc.tar.gz gun-5e3a5337a34dcb09418d4f412b11ede4510e3ddc.tar.bz2 gun-5e3a5337a34dcb09418d4f412b11ede4510e3ddc.zip |
Make gun_tls_proxy work for HTTP/2 connections
Diffstat (limited to 'src/gun.erl')
-rw-r--r-- | src/gun.erl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gun.erl b/src/gun.erl index 2f023e1..e86d73e 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -821,6 +821,12 @@ connected(cast, {connect, ReplyTo, StreamRef, Destination0, Headers}, end, ProtoState2 = Protocol:connect(ProtoState, StreamRef, ReplyTo, Destination, Headers), {keep_state, State#state{protocol_state=ProtoState2}}; +%% When using gun_tls_proxy we need a separate message to know whether +%% we need to switch to a different protocol. +connected(info, {connect_protocol, Protocol}, #state{protocol=Protocol}) -> + keep_state_and_data; +connected(info, {connect_protocol, Protocol}, State=#state{protocol_state=ProtoState}) -> + commands([{switch_protocol, Protocol, ProtoState}], State); connected(cast, {cancel, ReplyTo, StreamRef}, State=#state{protocol=Protocol, protocol_state=ProtoState}) -> ProtoState2 = Protocol:cancel(ProtoState, StreamRef, ReplyTo), |