summaryrefslogtreecommitdiff
path: root/src/ejabberd_http.erl
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2017-03-27 23:52:49 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2017-03-27 23:52:49 +0200
commit191fc1b4e87665df769ddac22335ac246b8d6f63 (patch)
treeaa704a8dbfbeb68ea968c712a2ea92e23c4824bb /src/ejabberd_http.erl
parentejabberd_http: Add "custom_headers" option (diff)
ejabberd_http: Expand @VERSION@ in custom headers
Let ejabberd_http expand the @VERSION@ keyword to the ejabberd version if specified in the "custom_headers" listener option. Closes #1414.
Diffstat (limited to 'src/ejabberd_http.erl')
-rw-r--r--src/ejabberd_http.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ejabberd_http.erl b/src/ejabberd_http.erl
index 4c5dd8eb..c3f962fb 100644
--- a/src/ejabberd_http.erl
+++ b/src/ejabberd_http.erl
@@ -169,7 +169,7 @@ init({SockMod, Socket}, Opts) ->
{ok, RE} = re:compile(<<"^(?:\\[(.*?)\\]|(.*?))(?::(\\d+))?$">>),
CustomHeaders = gen_mod:get_opt(custom_headers, Opts,
- fun(L) when is_list(L) -> L end,
+ fun expand_custom_headers/1,
[]),
?INFO_MSG("started: ~p", [{SockMod1, Socket1}]),
@@ -733,6 +733,11 @@ rest_dir(0, Path, <<H, T/binary>>) ->
rest_dir(0, <<H, Path/binary>>, T);
rest_dir(N, Path, <<_H, T/binary>>) -> rest_dir(N, Path, T).
+expand_custom_headers(Headers) ->
+ lists:map(fun({K, V}) ->
+ {K, jlib:expand_keyword(<<"@VERSION@">>, V, ?VERSION)}
+ end, Headers).
+
%% hex_to_integer
hex_to_integer(Hex) ->