diff options
author | Loïc Hoguin <[email protected]> | 2020-09-18 17:01:25 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2020-09-21 15:52:26 +0200 |
commit | 8033850ab81ca0639489636bb8760d93900d4a80 (patch) | |
tree | 94c2df630a4c6fce97f6192a63a663a25f43266c /src/gun_protocols.erl | |
parent | e740356b5881c39a95715d6081689802edf469a0 (diff) | |
download | gun-8033850ab81ca0639489636bb8760d93900d4a80.tar.gz gun-8033850ab81ca0639489636bb8760d93900d4a80.tar.bz2 gun-8033850ab81ca0639489636bb8760d93900d4a80.zip |
Initial success for h2 CONNECT -> https CONNECT -> https
Diffstat (limited to 'src/gun_protocols.erl')
-rw-r--r-- | src/gun_protocols.erl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gun_protocols.erl b/src/gun_protocols.erl index 4209641..65d5211 100644 --- a/src/gun_protocols.erl +++ b/src/gun_protocols.erl @@ -18,6 +18,7 @@ -export([handler/1]). -export([handler_and_opts/2]). -export([negotiated/2]). +-export([stream_ref/1]). -spec add_stream_ref(Protocol, undefined | gun:stream_ref()) -> Protocol when Protocol :: gun:protocol(). @@ -53,3 +54,7 @@ negotiated({ok, <<"h2">>}, _) -> http2; negotiated({ok, <<"http/1.1">>}, _) -> http; negotiated({error, protocol_not_negotiated}, [Protocol]) -> Protocol; negotiated({error, protocol_not_negotiated}, _) -> http. + +-spec stream_ref(gun:protocol()) -> undefined | gun:stream_ref(). +stream_ref({_, ProtocolOpts}) -> maps:get(stream_ref, ProtocolOpts, undefined); +stream_ref(_) -> undefined. |