aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_server/httpd_response.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2015-09-30 10:24:35 +0200
committerIngela Anderton Andin <[email protected]>2015-09-30 17:02:51 +0200
commitfe48161dbc7511220b0b91b06c26d2beba7a6586 (patch)
tree3aa823fd53036c4b5508fd268c744b1e223c0b6b /lib/inets/src/http_server/httpd_response.erl
parentec1284c810cdc176b93d7316e78dc9c6aa84a504 (diff)
downloadotp-fe48161dbc7511220b0b91b06c26d2beba7a6586.tar.gz
otp-fe48161dbc7511220b0b91b06c26d2beba7a6586.tar.bz2
otp-fe48161dbc7511220b0b91b06c26d2beba7a6586.zip
inets: Add new customize function response_default_headers
This enables the user to provide default HTTP header values for headers that should always be sent. Note that these values may override built in defaults.
Diffstat (limited to 'lib/inets/src/http_server/httpd_response.erl')
-rw-r--r--lib/inets/src/http_server/httpd_response.erl21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/inets/src/http_server/httpd_response.erl b/lib/inets/src/http_server/httpd_response.erl
index 7e73da7060..71243f525a 100644
--- a/lib/inets/src/http_server/httpd_response.erl
+++ b/lib/inets/src/http_server/httpd_response.erl
@@ -287,14 +287,21 @@ create_header(ConfigDb, KeyValueTupleHeaders) ->
Date = httpd_util:rfc1123_date(),
ContentType = "text/html",
Server = server(ConfigDb),
- Headers0 = add_default_headers([{"date", Date},
- {"content-type", ContentType}
- | if Server=="" -> [];
- true -> [{"server", Server}]
- end
- ],
- KeyValueTupleHeaders),
CustomizeCB = httpd_util:lookup(ConfigDb, customize, httpd_custom),
+
+ CustomDefaults = httpd_custom:response_default_headers(CustomizeCB),
+ SystemDefaultes = ([{"date", Date},
+ {"content-type", ContentType}
+ | if Server=="" -> [];
+ true -> [{"server", Server}]
+ end
+ ]),
+
+ %% System defaults not present in custom defaults will be added
+ %% to defaults
+ Defaults = add_default_headers(SystemDefaultes, CustomDefaults),
+
+ Headers0 = add_default_headers(Defaults, KeyValueTupleHeaders),
lists:filtermap(fun(H) ->
httpd_custom:customize_headers(CustomizeCB, response_header, H)
end,