From 8033850ab81ca0639489636bb8760d93900d4a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 18 Sep 2020 17:01:25 +0200 Subject: Initial success for h2 CONNECT -> https CONNECT -> https --- src/gun_protocols.erl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gun_protocols.erl') 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. -- cgit v1.2.3