diff options
author | Loïc Hoguin <[email protected]> | 2019-09-16 18:38:41 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-09-22 16:46:34 +0200 |
commit | 93552edd8afb598a3ef6d358fb6918fb9ff60856 (patch) | |
tree | f71bbe40540cc18359c623ef94518a4ee426fea0 /src/gun_http2.erl | |
parent | 74ab050f546ed94860da6f809617a6986a962ef5 (diff) | |
download | gun-93552edd8afb598a3ef6d358fb6918fb9ff60856.tar.gz gun-93552edd8afb598a3ef6d358fb6918fb9ff60856.tar.bz2 gun-93552edd8afb598a3ef6d358fb6918fb9ff60856.zip |
Move and merge all TLS handshakes to the main Gun code
There's now an initial_tls_handshake state for the initial
connection with handshake, and tls_handshake state for any
subsequent TLS handshakes.
The Socks5 code will be able to reuse this tls_handshake
state to perform its own transport switches.
Diffstat (limited to 'src/gun_http2.erl')
-rw-r--r-- | src/gun_http2.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gun_http2.erl b/src/gun_http2.erl index 47f670f..7dd369d 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -17,6 +17,7 @@ -export([check_options/1]). -export([name/0]). -export([init/4]). +-export([switch_transport/3]). -export([handle/4]). -export([update_flow/4]). -export([closing/4]). @@ -113,6 +114,9 @@ init(Owner, Socket, Transport, Opts0) -> Transport:send(Socket, Preface), State. +switch_transport(Transport, Socket, State) -> + State#http2_state{socket=Socket, transport=Transport}. + handle(Data, State=#http2_state{buffer=Buffer}, EvHandler, EvHandlerState) -> parse(<< Buffer/binary, Data/binary >>, State#http2_state{buffer= <<>>}, EvHandler, EvHandlerState). |