mod_http_upload: Don't add "Server" header line

Administrators can add the "Server" header line using the new listener
option "custom_headers", if desired.
This commit is contained in:
Holger Weiss 2017-03-28 00:03:17 +02:00
parent 191fc1b4e8
commit 510fde58d8
1 changed files with 2 additions and 4 deletions

View File

@ -833,7 +833,6 @@ http_response(Host, Code, ExtraHeaders) ->
-> {pos_integer(), [{binary(), binary()}], binary()}.
http_response(Host, Code, ExtraHeaders, Body) ->
ServerHeader = {<<"Server">>, <<"ejabberd ", (?VERSION)/binary>>},
CustomHeaders =
gen_mod:get_module_opt(Host, ?MODULE, custom_headers,
fun(Headers) ->
@ -845,10 +844,9 @@ http_response(Host, Code, ExtraHeaders, Body) ->
[]),
Headers = case proplists:is_defined(<<"Content-Type">>, ExtraHeaders) of
true ->
[ServerHeader | ExtraHeaders];
ExtraHeaders;
false ->
[ServerHeader, {<<"Content-Type">>, <<"text/plain">>} |
ExtraHeaders]
[{<<"Content-Type">>, <<"text/plain">>} | ExtraHeaders]
end ++ CustomHeaders,
{Code, Headers, Body}.