diff options
author | Paweł Chmielowski <pchmielowski@process-one.net> | 2020-02-21 12:19:02 +0100 |
---|---|---|
committer | Paweł Chmielowski <pchmielowski@process-one.net> | 2020-02-21 12:19:37 +0100 |
commit | 357e7e117dc32b1de7a30cd8aa411d7220d230fd (patch) | |
tree | 1f210b6d3973c1f78cb79ea5008dbe5e7980f2c8 /src/mod_http_upload.erl | |
parent | Merge 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_upload.erl')
-rw-r--r-- | src/mod_http_upload.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl index 689ef4ec2..51d7761ab 100644 --- a/src/mod_http_upload.erl +++ b/src/mod_http_upload.erl @@ -545,7 +545,7 @@ process(_LocalPath, #request{method = 'PUT', host = Host, ip = IP, ok -> http_response(201, CustomHeaders); {ok, Headers, OutData} -> - http_response(201, Headers ++ CustomHeaders, OutData); + http_response(201, ejabberd_http:apply_custom_headers(Headers, CustomHeaders), OutData); {error, closed} -> ?DEBUG("Cannot store file ~ts from ~ts for ~ts: connection closed", [Path, encode_addr(IP), Host]), @@ -595,7 +595,7 @@ process(_LocalPath, #request{method = Method, host = Host, ip = IP} = Request) $", FileName/binary, $">>}] end, Headers2 = [{<<"Content-Type">>, ContentType} | Headers1], - Headers3 = Headers2 ++ CustomHeaders, + Headers3 = ejabberd_http:apply_custom_headers(Headers2, CustomHeaders), http_response(200, Headers3, {file, Path}); {error, eacces} -> ?WARNING_MSG("Cannot serve ~ts to ~ts: Permission denied", @@ -633,7 +633,7 @@ process(_LocalPath, #request{method = 'OPTIONS', host = Host, try gen_server:call(Proc, get_conf, ?CALL_TIMEOUT) of {ok, _DocRoot, CustomHeaders} -> AllowHeader = {<<"Allow">>, <<"OPTIONS, HEAD, GET, PUT">>}, - http_response(200, [AllowHeader | CustomHeaders]) + http_response(200, ejabberd_http:apply_custom_headers([AllowHeader], CustomHeaders)) catch exit:{noproc, _} -> ?WARNING_MSG("Cannot handle OPTIONS request from ~ts for ~ts: " |