aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-10-03 20:34:50 +0200
committerLoïc Hoguin <[email protected]>2020-10-03 21:03:28 +0200
commit563560e157aa767e655896ff7c2858587a436629 (patch)
tree85814460e46fb46cde93879296e7d79fde0f1ddc
parent37bf8c409ae341fdebdc062a33cd7fce7ac1f5b5 (diff)
downloadgun-563560e157aa767e655896ff7c2858587a436629.tar.gz
gun-563560e157aa767e655896ff7c2858587a436629.tar.bz2
gun-563560e157aa767e655896ff7c2858587a436629.zip
Fix Dialyzer warnings
-rw-r--r--src/gun.erl20
-rw-r--r--src/gun_http2.erl5
2 files changed, 18 insertions, 7 deletions
diff --git a/src/gun.erl b/src/gun.erl
index 839f665..047aa18 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -191,7 +191,10 @@
}.
-export_type([tunnel_info/0]).
--type raw_opts() :: #{}.
+-type raw_opts() :: #{
+ %% Internal.
+ tunnel_transport => tcp | tls
+}.
-export_type([raw_opts/0]).
%% @todo When/if HTTP/2 CONNECT gets implemented, we will want an option here
@@ -210,7 +213,10 @@
flow => pos_integer(),
keepalive => timeout(),
transform_header_name => fun((binary()) -> binary()),
- version => 'HTTP/1.1' | 'HTTP/1.0'
+ version => 'HTTP/1.1' | 'HTTP/1.0',
+
+ %% Internal.
+ tunnel_transport => tcp | tls
}.
-export_type([http_opts/0]).
@@ -237,7 +243,10 @@
preface_timeout => timeout(),
settings_timeout => timeout(),
stream_window_margin_size => 0..16#7fffffff,
- stream_window_update_threshold => 0..16#7fffffff
+ stream_window_update_threshold => 0..16#7fffffff,
+
+ %% Internal.
+ tunnel_transport => tcp | tls
}.
-export_type([http2_opts/0]).
@@ -249,7 +258,10 @@
protocols => protocols(),
transport => tcp | tls,
tls_opts => [ssl:tls_client_option()],
- tls_handshake_timeout => timeout()
+ tls_handshake_timeout => timeout(),
+
+ %% Internal.
+ tunnel_transport => tcp | tls
}.
-export_type([socks_opts/0]).
diff --git a/src/gun_http2.erl b/src/gun_http2.erl
index f8b507d..9dfc67c 100644
--- a/src/gun_http2.erl
+++ b/src/gun_http2.erl
@@ -357,7 +357,7 @@ tunnel_commands([SetCookie={set_cookie, _, _, _, _}|Tail], Stream, State=#http2_
continue_stream_ref(#http2_state{socket=#{handle_continue_stream_ref := ContinueStreamRef}}, StreamRef) ->
case ContinueStreamRef of
[_|_] -> ContinueStreamRef ++ [StreamRef];
- _ -> [ContinueStreamRef|StreamRef]
+ _ -> [ContinueStreamRef, StreamRef]
end;
continue_stream_ref(State, StreamRef) ->
stream_ref(State, StreamRef).
@@ -399,7 +399,7 @@ data_frame(State0, StreamID, IsFin, Data, EvHandler, EvHandlerState0,
{maybe_delete_stream(State, StreamID, remote, IsFin), EvHandlerState}.
%% @todo Make separate functions for inform/connect/normal.
-headers_frame(State0=#http2_state{socket=Socket, transport=Transport, opts=Opts,
+headers_frame(State0=#http2_state{transport=Transport, opts=Opts,
tunnel_transport=TunnelTransport, content_handlers=Handlers0, commands_queue=Commands},
StreamID, IsFin, Headers, #{status := Status}, _BodyLen,
EvHandler, EvHandlerState0) ->
@@ -444,7 +444,6 @@ headers_frame(State0=#http2_state{socket=Socket, transport=Transport, opts=Opts,
gun_pid => self(),
reply_to => ReplyTo,
stream_ref => RealStreamRef,
- %% @todo That's wrong when we are already in a tunnel?
handle_continue_stream_ref => ContinueStreamRef
},
Proto = gun_tunnel,