diff options
author | Alexey Shchepin <alexey@process-one.net> | 2015-03-24 18:13:55 +0300 |
---|---|---|
committer | Alexey Shchepin <alexey@process-one.net> | 2015-03-24 18:14:47 +0300 |
commit | 736710cc9c536fc5ae4602e8c5b8398afe8e3cd1 (patch) | |
tree | aa3af815b08f26902997f75ce42f8bdfe43826bd /src | |
parent | export CONTRIB_MODULES_PATH (thanks to sezuan)(#489) (diff) |
Add support for ciphers and protocol_options in ejabberd_http
Diffstat (limited to 'src')
-rw-r--r-- | src/ejabberd_http.erl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/ejabberd_http.erl b/src/ejabberd_http.erl index c1ab5c6cd..a06d3f99b 100644 --- a/src/ejabberd_http.erl +++ b/src/ejabberd_http.erl @@ -94,14 +94,24 @@ start_link(SockData, Opts) -> init({SockMod, Socket}, Opts) -> TLSEnabled = proplists:get_bool(tls, Opts), TLSOpts1 = lists:filter(fun ({certfile, _}) -> true; + ({ciphers, _}) -> true; (_) -> false end, Opts), - TLSOpts2 = case proplists:get_bool(tls_compression, Opts) of - false -> [compression_none | TLSOpts1]; - true -> TLSOpts1 + TLSOpts2 = case lists:keysearch(protocol_options, 1, Opts) of + {value, {_, O}} -> + [_|ProtocolOptions] = lists:foldl( + fun(X, Acc) -> X ++ Acc end, [], + [["|" | binary_to_list(Opt)] || Opt <- O, is_binary(Opt)] + ), + [{protocol_options, iolist_to_binary(ProtocolOptions)} | TLSOpts1]; + _ -> TLSOpts1 end, - TLSOpts = [verify_none | TLSOpts2], + TLSOpts3 = case proplists:get_bool(tls_compression, Opts) of + false -> [compression_none | TLSOpts2]; + true -> TLSOpts2 + end, + TLSOpts = [verify_none | TLSOpts3], {SockMod1, Socket1} = if TLSEnabled -> inet:setopts(Socket, [{recbuf, 8192}]), {ok, TLSSocket} = p1_tls:tcp_to_tls(Socket, |