aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-10-02 10:03:09 +0200
committerLoïc Hoguin <[email protected]>2018-10-02 10:03:09 +0200
commitd394eb72568d2503bffc3e264cf194da16d0466d (patch)
treeb9b5b36278e3e6bf485bc9458e94721a40b78d6f /src
parenta428b10abfa158c97b01635f567b68cea4a22107 (diff)
downloadcowboy-d394eb72568d2503bffc3e264cf194da16d0466d.tar.gz
cowboy-d394eb72568d2503bffc3e264cf194da16d0466d.tar.bz2
cowboy-d394eb72568d2503bffc3e264cf194da16d0466d.zip
Fix ranch:start_tls when transport options are a map
Diffstat (limited to 'src')
-rw-r--r--src/cowboy.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cowboy.erl b/src/cowboy.erl
index ffea69a..7a09606 100644
--- a/src/cowboy.erl
+++ b/src/cowboy.erl
@@ -52,11 +52,15 @@ start_clear(Ref, TransOpts0, ProtoOpts0) ->
-spec start_tls(ranch:ref(), ranch:opts(), opts())
-> {ok, pid()} | {error, any()}.
start_tls(Ref, TransOpts0, ProtoOpts0) ->
- TransOpts1 = [
+ TransOpts1 = ranch:normalize_opts(TransOpts0),
+ SocketOpts = case TransOpts1 of
+ #{socket_opts := SocketOpts0} -> SocketOpts0;
+ _ -> []
+ end,
+ TransOpts2 = TransOpts1#{socket_opts => [
{next_protocols_advertised, [<<"h2">>, <<"http/1.1">>]},
{alpn_preferred_protocols, [<<"h2">>, <<"http/1.1">>]}
- |TransOpts0],
- TransOpts2 = ranch:normalize_opts(TransOpts1),
+ |SocketOpts]},
{TransOpts, ConnectionType} = ensure_connection_type(TransOpts2),
ProtoOpts = ProtoOpts0#{connection_type => ConnectionType},
ranch:start_listener(Ref, ranch_ssl, TransOpts, cowboy_tls, ProtoOpts).