aboutsummaryrefslogtreecommitdiff
path: root/src/mod_http_fileserver.erl
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2020-02-21 12:19:02 +0100
committerPaweł Chmielowski <pchmielowski@process-one.net>2020-02-21 12:19:37 +0100
commit357e7e117dc32b1de7a30cd8aa411d7220d230fd (patch)
tree1f210b6d3973c1f78cb79ea5008dbe5e7980f2c8 /src/mod_http_fileserver.erl
parentMerge pull request #3127 from area-42/allow_emojis_with_mssql (diff)
Make http heades passed in custom_headers override builtin headers
Previously we just appended them, so sometimes we just had duplicates This fixes issue #3056
Diffstat (limited to 'src/mod_http_fileserver.erl')
-rw-r--r--src/mod_http_fileserver.erl16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mod_http_fileserver.erl b/src/mod_http_fileserver.erl
index 9a8bc3f8f..287fce624 100644
--- a/src/mod_http_fileserver.erl
+++ b/src/mod_http_fileserver.erl
@@ -345,9 +345,10 @@ serve_index(FileName, [Index | T], CH, DefaultContentType, ContentTypes) ->
serve_not_modified(FileInfo, FileName, CustomHeaders) ->
?DEBUG("Delivering not modified: ~ts", [FileName]),
{0, 304,
- [{<<"Server">>, <<"ejabberd">>},
- {<<"Last-Modified">>, last_modified(FileInfo)}
- | CustomHeaders], <<>>}.
+ ejabberd_http:apply_custom_headers(
+ [{<<"Server">>, <<"ejabberd">>},
+ {<<"Last-Modified">>, last_modified(FileInfo)}],
+ CustomHeaders), <<>>}.
%% Assume the file exists if we got this far and attempt to read it in
%% and serve it up.
@@ -356,10 +357,11 @@ serve_file(FileInfo, FileName, CustomHeaders, DefaultContentType, ContentTypes)
ContentType = content_type(FileName, DefaultContentType,
ContentTypes),
{FileInfo#file_info.size, 200,
- [{<<"Server">>, <<"ejabberd">>},
- {<<"Last-Modified">>, last_modified(FileInfo)},
- {<<"Content-Type">>, ContentType}
- | CustomHeaders],
+ ejabberd_http:apply_custom_headers(
+ [{<<"Server">>, <<"ejabberd">>},
+ {<<"Last-Modified">>, last_modified(FileInfo)},
+ {<<"Content-Type">>, ContentType}],
+ CustomHeaders),
{file, FileName}}.
%%----------------------------------------------------------------------