Skip to content

Commit 736710c

Browse files
committed
Add support for ciphers and protocol_options in ejabberd_http
1 parent 8f46ca4 commit 736710c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/ejabberd_http.erl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,24 @@ start_link(SockData, Opts) ->
9494
init({SockMod, Socket}, Opts) ->
9595
TLSEnabled = proplists:get_bool(tls, Opts),
9696
TLSOpts1 = lists:filter(fun ({certfile, _}) -> true;
97+
({ciphers, _}) -> true;
9798
(_) -> false
9899
end,
99100
Opts),
100-
TLSOpts2 = case proplists:get_bool(tls_compression, Opts) of
101-
false -> [compression_none | TLSOpts1];
102-
true -> TLSOpts1
101+
TLSOpts2 = case lists:keysearch(protocol_options, 1, Opts) of
102+
{value, {_, O}} ->
103+
[_|ProtocolOptions] = lists:foldl(
104+
fun(X, Acc) -> X ++ Acc end, [],
105+
[["|" | binary_to_list(Opt)] || Opt <- O, is_binary(Opt)]
106+
),
107+
[{protocol_options, iolist_to_binary(ProtocolOptions)} | TLSOpts1];
108+
_ -> TLSOpts1
103109
end,
104-
TLSOpts = [verify_none | TLSOpts2],
110+
TLSOpts3 = case proplists:get_bool(tls_compression, Opts) of
111+
false -> [compression_none | TLSOpts2];
112+
true -> TLSOpts2
113+
end,
114+
TLSOpts = [verify_none | TLSOpts3],
105115
{SockMod1, Socket1} = if TLSEnabled ->
106116
inet:setopts(Socket, [{recbuf, 8192}]),
107117
{ok, TLSSocket} = p1_tls:tcp_to_tls(Socket,

0 commit comments

Comments
 (0)